Browse Source

Stop recording after end call

Signed-off-by: Vitor Mattos <vitor@php.rio>
pull/8602/head
Vitor Mattos 3 years ago
parent
commit
3a8a6024a1
No known key found for this signature in database GPG Key ID: B7AB4B76A7CA7318
  1. 7
      lib/Activity/Listener.php
  2. 3
      tests/integration/features/bootstrap/FeatureContext.php
  3. 34
      tests/integration/features/callapi/recording.feature

7
lib/Activity/Listener.php

@ -33,6 +33,7 @@ use OCA\Talk\Model\Attendee;
use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCA\Talk\Service\ParticipantService;
use OCA\Talk\Service\RecordingService;
use OCA\Talk\Service\RoomService;
use OCP\Activity\IManager;
use OCP\AppFramework\Utility\ITimeFactory;
@ -51,6 +52,7 @@ class Listener {
protected ParticipantService $participantService;
protected RoomService $roomService;
protected RecordingService $recordingService;
protected LoggerInterface $logger;
@ -61,6 +63,7 @@ class Listener {
ChatManager $chatManager,
ParticipantService $participantService,
RoomService $roomService,
RecordingService $recordingService,
LoggerInterface $logger,
ITimeFactory $timeFactory) {
$this->activityManager = $activityManager;
@ -68,6 +71,7 @@ class Listener {
$this->chatManager = $chatManager;
$this->participantService = $participantService;
$this->roomService = $roomService;
$this->recordingService = $recordingService;
$this->logger = $logger;
$this->timeFactory = $timeFactory;
}
@ -146,6 +150,9 @@ class Listener {
return false;
}
if ($room->getCallRecording() !== Room::RECORDING_NONE) {
$this->recordingService->stop($room);
}
if ($actor instanceof Participant) {
$actorId = $actor->getAttendee()->getActorId();
$actorType = $actor->getAttendee()->getActorType();

3
tests/integration/features/bootstrap/FeatureContext.php

@ -421,6 +421,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if (isset($expectedRoom['messageExpiration'])) {
$data['messageExpiration'] = (int) $room['messageExpiration'];
}
if (isset($expectedRoom['callRecording'])) {
$data['callRecording'] = (int) $room['callRecording'];
}
if (isset($expectedRoom['participants'])) {
throw new \Exception('participants key needs to be checked via participants endpoint');
}

34
tests/integration/features/callapi/recording.feature

@ -124,3 +124,37 @@ Feature: callapi/recording
And user "participant1" has the following notifications
| app | object_type | object_id | subject |
| spreed | chat | room1 | Recording for the call in room1 was uploaded. |
Scenario: Stop recording automatically when end the call
When the following "spreed" app config is set
| signaling_dev | yes |
And user "participant1" creates room "room1" (v4)
| roomType | 2 |
| roomName | room1 |
And user "participant1" joins room "room1" with 200 (v4)
And user "participant1" joins call "room1" with 200 (v4)
And user "participant1" starts "audio" recording in room "room1" with 200 (v1)
And user "participant1" is participant of the following unordered rooms (v4)
| type | name | callRecording |
| 2 | room1 | 2 |
Then user "participant1" ends call "room1" with 200 (v4)
And user "participant1" is participant of the following unordered rooms (v4)
| type | name | callRecording |
| 2 | room1 | 0 |
Scenario: Stop recording automatically when the last participant go out
When the following "spreed" app config is set
| signaling_dev | yes |
And user "participant1" creates room "room1" (v4)
| roomType | 2 |
| roomName | room1 |
And user "participant1" joins room "room1" with 200 (v4)
And user "participant1" joins call "room1" with 200 (v4)
And user "participant1" starts "audio" recording in room "room1" with 200 (v1)
And user "participant1" is participant of the following unordered rooms (v4)
| type | name | callRecording |
| 2 | room1 | 2 |
Then user "participant1" leaves room "room1" with 200 (v4)
And user "participant1" is participant of the following unordered rooms (v4)
| type | name | callRecording |
| 2 | room1 | 0 |
Loading…
Cancel
Save