diff options
author | Joas Schilling <coding@schilljs.com> | 2022-04-29 09:13:45 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-05-03 09:38:35 +0200 |
commit | ec82ac391ae823f00b24d2fc0f16fac85529a849 (patch) | |
tree | fd86f7953a2397fe49895946949e800118dcedc9 | |
parent | 5441b9c5459ee3425eded896dcfd2edf6e0d9d05 (diff) |
Add endpoint for the HPB to create guests
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | appinfo/routes/routesRoomController.php | 2 | ||||
-rw-r--r-- | lib/Controller/RoomController.php | 24 |
2 files changed, 26 insertions, 0 deletions
diff --git a/appinfo/routes/routesRoomController.php b/appinfo/routes/routesRoomController.php index e065a39bc..5867d6be5 100644 --- a/appinfo/routes/routesRoomController.php +++ b/appinfo/routes/routesRoomController.php @@ -92,6 +92,8 @@ return [ ['name' => 'Room#getParticipantByDialInPin', 'url' => '/api/{apiVersion}/room/{token}/pin/{pin}', 'verb' => 'GET', 'requirements' => array_merge($requirementsWithToken, [ 'pin' => '^\d{7,32}$', ])], + /** @see \OCA\Talk\Controller\RoomController::createGuestByDialIn() */ + ['name' => 'Room#createGuestByDialIn', 'url' => '/api/{apiVersion}/room/{token}/open-dial-in', 'verb' => 'POST', 'requirements' => $requirementsWithToken], /** @see \OCA\Talk\Controller\RoomController::setNotificationLevel() */ ['name' => 'Room#setNotificationLevel', 'url' => '/api/{apiVersion}/room/{token}/notify', 'verb' => 'POST', 'requirements' => $requirementsWithToken], /** @see \OCA\Talk\Controller\RoomController::setNotificationCalls() */ diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index ec1cb189c..fd11f8ad9 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -1422,6 +1422,30 @@ class RoomController extends AEnvironmentAwareController { /** * @PublicPage + * @RequireRoom + * + * @return DataResponse + */ + public function createGuestByDialIn(): DataResponse { + try { + if (!$this->validateSIPBridgeRequest($this->room->getToken())) { + return new DataResponse([], Http::STATUS_UNAUTHORIZED); + } + } catch (UnauthorizedException $e) { + return new DataResponse([], Http::STATUS_UNAUTHORIZED); + } + + if ($this->room->getSIPEnabled() !== Webinary::SIP_ENABLED_NO_PIN) { + return new DataResponse([], Http::STATUS_BAD_REQUEST); + } + + $participant = $this->participantService->joinRoomAsNewGuest($this->roomService, $this->room, '', true); + + return new DataResponse($this->formatRoom($this->room, $participant)); + } + + /** + * @PublicPage * @UseSession * * @param string $token |