summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-10-18 11:59:52 +0200
committerJoas Schilling <coding@schilljs.com>2023-10-23 15:48:03 +0200
commitb67fc7b69ffeea130987271efa945501547c7236 (patch)
tree978e9a7cbe2d9329ae0474a0025b5035a6c22e4d
parent29fe68c2f3d6338e8b45e27381b1da11a60bd6d5 (diff)
fix(sip-dialout): Rely on the $options array when receiving a rejection note
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--docs/participant.md8
-rw-r--r--lib/Controller/RoomController.php11
2 files changed, 12 insertions, 7 deletions
diff --git a/docs/participant.md b/docs/participant.md
index 14624e648..cf4c34842 100644
--- a/docs/participant.md
+++ b/docs/participant.md
@@ -334,10 +334,10 @@ Note: This is only allowed as validate SIP bridge requests
* Endpoint: `/room/{token}/rejected-dialout`
* Data:
-| field | type | Description |
-|--------------|--------|---------------------------------------------|
-| `attendeeId` | int | The attendee ID of the dial-out participant |
-| `callId` | string | The call ID that was rejected |
+| field | type | Description |
+|-----------|--------|------------------------------------------------|
+| `callId` | string | The call ID that was rejected |
+| `options` | string | The options as received in the dialout request |
* Response:
- Status code:
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index 2b2b1e74c..d42ec712c 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -1639,10 +1639,11 @@ class RoomController extends AEnvironmentAwareController {
/**
* Reset call ID of a dial-out participant when the SIP gateway rejected it
*
+ * @param array{actorId?: string, actorType?: string, attendeeId?: int} $options Additional details to verify the validity of the request
* @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST|Http::STATUS_UNAUTHORIZED|Http::STATUS_NOT_FOUND|Http::STATUS_NOT_IMPLEMENTED, array<empty>, array{}>
*
* 200: Call ID reset
- * 400: Call ID mismatch
+ * 400: Call ID mismatch or attendeeId not found in $options
* 401: SIP request invalid
* 404: Participant was not found
* 501: SIP dial-out is not configured
@@ -1651,7 +1652,7 @@ class RoomController extends AEnvironmentAwareController {
#[PublicPage]
#[BruteForceProtection(action: 'talkSipBridgeSecret')]
#[RequireRoom]
- public function rejectedDialOutRequest(int $attendeeId, string $callId): DataResponse {
+ public function rejectedDialOutRequest(string $callId, array $options = []): DataResponse {
try {
if (!$this->validateSIPBridgeRequest($this->room->getToken())) {
$response = new DataResponse([], Http::STATUS_UNAUTHORIZED);
@@ -1664,12 +1665,16 @@ class RoomController extends AEnvironmentAwareController {
return $response;
}
+ if (empty($options['attendeeId'])) {
+ return new DataResponse([], Http::STATUS_BAD_REQUEST);
+ }
+
if (!$this->talkConfig->isSIPConfigured() || !$this->talkConfig->isSIPDialOutEnabled()) {
return new DataResponse([], Http::STATUS_NOT_IMPLEMENTED);
}
try {
- $this->participantService->resetDialOutRequest($this->room, $attendeeId, $callId);
+ $this->participantService->resetDialOutRequest($this->room, $options['attendeeId'], $callId);
} catch (ParticipantNotFoundException) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (\InvalidArgumentException) {