diff options
author | Joas Schilling <coding@schilljs.com> | 2022-03-01 18:43:08 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-05-17 13:16:03 +0300 |
commit | 03b26ba740f0eaacbee54592db3cd3402b4e4b24 (patch) | |
tree | 58af2ebe0f10c2a77732660f47fb0ef2d762af6c /lib/Signaling/BackendNotifier.php | |
parent | f7229f458f3a8e5e2745a99bf13ce8d9d693beb2 (diff) |
Use "all: true" for end meeting for everyone case
This is needed to prevent issues with the request body size:
POST https:\/\/192.168.178.101:18443\/api\/v1\/room\/3097975620`
resulted in a `413 Request Entity Too Large` response:\nRequest entity
too large
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Signaling/BackendNotifier.php')
-rw-r--r-- | lib/Signaling/BackendNotifier.php | 82 |
1 files changed, 46 insertions, 36 deletions
diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php index 162d321da..a1c0547d1 100644 --- a/lib/Signaling/BackendNotifier.php +++ b/lib/Signaling/BackendNotifier.php @@ -361,60 +361,70 @@ class BackendNotifier { * @param Room $room * @param int $flags * @param string[] $sessionIds + * @param bool $changeAll * @throws \Exception */ - public function roomInCallChanged(Room $room, int $flags, array $sessionIds): void { - $changed = []; - $users = []; + public function roomInCallChanged(Room $room, int $flags, array $sessionIds, bool $changeAll = false): void { + if ($changeAll) { + $data = [ + 'incall' => $flags, + 'all' => true + ]; + } else { + $changed = []; + $users = []; - $participants = $this->participantService->getParticipantsForAllSessions($room); - foreach ($participants as $participant) { - $session = $participant->getSession(); - if (!$session instanceof Session) { - continue; - } + $participants = $this->participantService->getParticipantsForAllSessions($room); + foreach ($participants as $participant) { + $session = $participant->getSession(); + if (!$session instanceof Session) { + continue; + } - $attendee = $participant->getAttendee(); - if ($attendee->getActorType() !== Attendee::ACTOR_USERS - && $attendee->getActorType() !== Attendee::ACTOR_GUESTS) { - continue; - } + $attendee = $participant->getAttendee(); + if ($attendee->getActorType() !== Attendee::ACTOR_USERS + && $attendee->getActorType() !== Attendee::ACTOR_GUESTS) { + continue; + } - $data = [ - 'inCall' => $session->getInCall(), - 'lastPing' => $session->getLastPing(), - 'sessionId' => $session->getSessionId(), - 'nextcloudSessionId' => $session->getSessionId(), - 'participantType' => $attendee->getParticipantType(), - 'participantPermissions' => $participant->getPermissions(), - ]; - if ($attendee->getActorType() === Attendee::ACTOR_USERS) { - $data['userId'] = $attendee->getActorId(); - } + $data = [ + 'inCall' => $session->getInCall(), + 'lastPing' => $session->getLastPing(), + 'sessionId' => $session->getSessionId(), + 'nextcloudSessionId' => $session->getSessionId(), + 'participantType' => $attendee->getParticipantType(), + 'participantPermissions' => $participant->getPermissions(), + ]; + if ($attendee->getActorType() === Attendee::ACTOR_USERS) { + $data['userId'] = $attendee->getActorId(); + } - if ($session->getInCall() !== Participant::FLAG_DISCONNECTED) { - $users[] = $data; - } + if ($session->getInCall() !== Participant::FLAG_DISCONNECTED) { + $users[] = $data; + } - if (\in_array($session->getSessionId(), $sessionIds, true)) { - $changed[] = $data; + if (\in_array($session->getSessionId(), $sessionIds, true)) { + $changed[] = $data; + } } + + $data = [ + 'incall' => $flags, + 'changed' => $changed, + 'users' => $users, + ]; } $start = microtime(true); $this->backendRequest($room, [ 'type' => 'incall', - 'incall' => [ - 'incall' => $flags, - 'changed' => $changed, - 'users' => $users - ], + 'incall' => $data, ]); $duration = microtime(true) - $start; $this->logger->debug('Room in-call status changed: {token} {flags} {users} ({duration})', [ 'token' => $room->getToken(), 'flags' => $flags, - 'users' => print_r($sessionIds, true), + 'users' => $changeAll ? 'all' : print_r($sessionIds, true), 'duration' => sprintf('%.2f', $duration), 'app' => 'spreed-hpb', ]); |