Browse Source

fix(sip-dialout): Rely on the $options array when receiving a rejection note

Signed-off-by: Joas Schilling <coding@schilljs.com>
feat/10410/sip-dial-out
Joas Schilling 2 years ago
parent
commit
b67fc7b69f
No known key found for this signature in database GPG Key ID: 74434EFE0D2E2205
  1. 8
      docs/participant.md
  2. 11
      lib/Controller/RoomController.php

8
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:

11
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) {

Loading…
Cancel
Save