From fb50852a562c49f8a74a5231588ec1b0e8142237 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 28 Nov 2024 10:12:46 +0100 Subject: [PATCH] fix(openapi): Fix empty array for SIP integration Signed-off-by: Joas Schilling --- lib/Controller/RoomController.php | 48 +++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 4a94baf2e0a..ed4bed33038 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -1803,7 +1803,7 @@ public function joinFederatedRoom(string $token, ?string $sessionId): DataRespon * Verify a dial-in PIN (SIP bridge) * * @param numeric-string $pin PIN the participant used to dial-in - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse * * 200: Participant returned * 401: SIP request invalid @@ -1817,24 +1817,24 @@ public function joinFederatedRoom(string $token, ?string $sessionId): DataRespon public function verifyDialInPin(string $pin): DataResponse { try { if (!$this->validateSIPBridgeRequest($this->room->getToken())) { - $response = new DataResponse([], Http::STATUS_UNAUTHORIZED); + $response = new DataResponse(null, Http::STATUS_UNAUTHORIZED); $response->throttle(['action' => 'talkSipBridgeSecret']); return $response; } } catch (UnauthorizedException) { - $response = new DataResponse([], Http::STATUS_UNAUTHORIZED); + $response = new DataResponse(null, Http::STATUS_UNAUTHORIZED); $response->throttle(['action' => 'talkSipBridgeSecret']); return $response; } if (!$this->talkConfig->isSIPConfigured()) { - return new DataResponse([], Http::STATUS_NOT_IMPLEMENTED); + return new DataResponse(null, Http::STATUS_NOT_IMPLEMENTED); } try { $participant = $this->participantService->getParticipantByPin($this->room, $pin); } catch (ParticipantNotFoundException $e) { - return new DataResponse([], Http::STATUS_NOT_FOUND); + return new DataResponse(null, Http::STATUS_NOT_FOUND); } return new DataResponse($this->formatRoom($this->room, $participant)); @@ -1845,7 +1845,7 @@ public function verifyDialInPin(string $pin): DataResponse { * * @param string $number E164 formatted phone number * @param array{actorId?: string, actorType?: string, attendeeId?: int} $options Additional details to verify the validity of the request - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse * * 200: Participant created successfully * 400: Phone number and details could not be confirmed @@ -1860,32 +1860,32 @@ public function verifyDialInPin(string $pin): DataResponse { public function verifyDialOutNumber(string $number, array $options = []): DataResponse { try { if (!$this->validateSIPBridgeRequest($this->room->getToken())) { - $response = new DataResponse([], Http::STATUS_UNAUTHORIZED); + $response = new DataResponse(null, Http::STATUS_UNAUTHORIZED); $response->throttle(['action' => 'talkSipBridgeSecret']); return $response; } } catch (UnauthorizedException) { - $response = new DataResponse([], Http::STATUS_UNAUTHORIZED); + $response = new DataResponse(null, Http::STATUS_UNAUTHORIZED); $response->throttle(['action' => 'talkSipBridgeSecret']); return $response; } if (!$this->talkConfig->isSIPConfigured() || !$this->talkConfig->isSIPDialOutEnabled()) { - return new DataResponse([], Http::STATUS_NOT_IMPLEMENTED); + return new DataResponse(null, Http::STATUS_NOT_IMPLEMENTED); } if (!isset($options['actorId'], $options['actorType']) || $options['actorType'] !== Attendee::ACTOR_PHONES) { - return new DataResponse([], Http::STATUS_BAD_REQUEST); + return new DataResponse(null, Http::STATUS_BAD_REQUEST); } try { $participant = $this->participantService->getParticipantByActor($this->room, Attendee::ACTOR_PHONES, $options['actorId']); } catch (ParticipantNotFoundException) { - return new DataResponse([], Http::STATUS_NOT_FOUND); + return new DataResponse(null, Http::STATUS_NOT_FOUND); } if ($participant->getAttendee()->getPhoneNumber() !== $number) { - return new DataResponse([], Http::STATUS_BAD_REQUEST); + return new DataResponse(null, Http::STATUS_BAD_REQUEST); } return new DataResponse($this->formatRoom($this->room, $participant)); @@ -1894,7 +1894,7 @@ public function verifyDialOutNumber(string $number, array $options = []): DataRe /** * Create a guest by their dial-in * - * @return DataResponse|DataResponse, array{}> + * @return DataResponse|DataResponse * * 200: Participant created successfully * 400: SIP not enabled @@ -1907,18 +1907,18 @@ public function verifyDialOutNumber(string $number, array $options = []): DataRe public function createGuestByDialIn(): DataResponse { try { if (!$this->validateSIPBridgeRequest($this->room->getToken())) { - $response = new DataResponse([], Http::STATUS_UNAUTHORIZED); + $response = new DataResponse(null, Http::STATUS_UNAUTHORIZED); $response->throttle(['action' => 'talkSipBridgeSecret']); return $response; } } catch (UnauthorizedException $e) { - $response = new DataResponse([], Http::STATUS_UNAUTHORIZED); + $response = new DataResponse(null, Http::STATUS_UNAUTHORIZED); $response->throttle(['action' => 'talkSipBridgeSecret']); return $response; } if ($this->room->getSIPEnabled() !== Webinary::SIP_ENABLED_NO_PIN) { - return new DataResponse([], Http::STATUS_BAD_REQUEST); + return new DataResponse(null, Http::STATUS_BAD_REQUEST); } $participant = $this->participantService->joinRoomAsNewGuest($this->roomService, $this->room, '', true); @@ -1931,7 +1931,7 @@ public function createGuestByDialIn(): DataResponse { * * @param string $callId The call ID provided by the SIP bridge earlier to uniquely identify the call to terminate * @param array{actorId?: string, actorType?: string, attendeeId?: int} $options Additional details to verify the validity of the request - * @return DataResponse, array{}> + * @return DataResponse * * 200: Call ID reset * 400: Call ID mismatch or attendeeId not found in $options @@ -1946,33 +1946,33 @@ public function createGuestByDialIn(): DataResponse { public function rejectedDialOutRequest(string $callId, array $options = []): DataResponse { try { if (!$this->validateSIPBridgeRequest($this->room->getToken())) { - $response = new DataResponse([], Http::STATUS_UNAUTHORIZED); + $response = new DataResponse(null, Http::STATUS_UNAUTHORIZED); $response->throttle(['action' => 'talkSipBridgeSecret']); return $response; } } catch (UnauthorizedException $e) { - $response = new DataResponse([], Http::STATUS_UNAUTHORIZED); + $response = new DataResponse(null, Http::STATUS_UNAUTHORIZED); $response->throttle(['action' => 'talkSipBridgeSecret']); return $response; } if (empty($options['attendeeId'])) { - return new DataResponse([], Http::STATUS_BAD_REQUEST); + return new DataResponse(null, Http::STATUS_BAD_REQUEST); } if (!$this->talkConfig->isSIPConfigured() || !$this->talkConfig->isSIPDialOutEnabled()) { - return new DataResponse([], Http::STATUS_NOT_IMPLEMENTED); + return new DataResponse(null, Http::STATUS_NOT_IMPLEMENTED); } try { $this->participantService->resetDialOutRequest($this->room, $options['attendeeId'], $callId); } catch (ParticipantNotFoundException) { - return new DataResponse([], Http::STATUS_NOT_FOUND); + return new DataResponse(null, Http::STATUS_NOT_FOUND); } catch (\InvalidArgumentException) { - return new DataResponse([], Http::STATUS_BAD_REQUEST); + return new DataResponse(null, Http::STATUS_BAD_REQUEST); } - return new DataResponse([], Http::STATUS_OK); + return new DataResponse(null); } /**