diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-02-21 02:13:25 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-02-22 13:09:26 +0100 |
commit | eca3161d246eac7e874a17ee3b747bb0129bee7b (patch) | |
tree | a3dd7785af66b729aa909f0c1930301dc22c396d /lib/Controller/RecordingController.php | |
parent | 808c9f0e36fadf4af0a6c8d0fc943361a7b421bf (diff) |
Add failed status to recordings
Although recordings should not fail in some cases they could (for
example, if the configuration is wrong, the disk is full...). A new
recording status, "failed", has been added to notify that situation to
the Nextcloud server from the recording server.
Typically call participants will not be able to do anything about the
failure, so the clients can just show a notification to the moderators
and hint about asking the system administrators.
In any case, even if the recording status is "failed" further recordings
can be started, which will behave as if the recording was started from
the "none" status.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib/Controller/RecordingController.php')
-rw-r--r-- | lib/Controller/RecordingController.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/Controller/RecordingController.php b/lib/Controller/RecordingController.php index ad4dbef36..1f55bee1d 100644 --- a/lib/Controller/RecordingController.php +++ b/lib/Controller/RecordingController.php @@ -156,6 +156,8 @@ class RecordingController extends AEnvironmentAwareController { return $this->backendStarted($message['started']); case 'stopped': return $this->backendStopped($message['stopped']); + case 'failed': + return $this->backendFailed($message['failed']); default: return new DataResponse([ 'type' => 'error', @@ -237,6 +239,30 @@ class RecordingController extends AEnvironmentAwareController { return new DataResponse(); } + private function backendFailed(array $failed): DataResponse { + $token = $failed['token']; + + try { + $room = $this->manager->getRoomByToken($token); + } catch (RoomNotFoundException $e) { + $this->logger->debug('Failed to get room {token}', [ + 'token' => $token, + 'app' => 'spreed-recording', + ]); + return new DataResponse([ + 'type' => 'error', + 'error' => [ + 'code' => 'no_such_room', + 'message' => 'Room not found.', + ], + ], Http::STATUS_NOT_FOUND); + } + + $this->roomService->setCallRecording($room, Room::RECORDING_FAILED); + + return new DataResponse(); + } + /** * @NoAdminRequired * @RequireLoggedInModeratorParticipant |