Browse Source
Handle dial-out exceptions
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/10733/head
Joas Schilling
2 years ago
No known key found for this signature in database
GPG Key ID: 74434EFE0D2E2205
7 changed files with
80 additions and
8 deletions
-
lib/Controller/CallController.php
-
lib/Exceptions/DialOutFailedException.php
-
lib/Signaling/BackendNotifier.php
-
openapi.json
-
psalm.xml
-
tests/stubs/GuzzleHttp_Exception_ServerException.php
-
tests/stubs/oc_http_client_response.php
|
|
|
@ -208,7 +208,7 @@ class CallController extends AEnvironmentAwareController { |
|
|
|
* Call a SIP dial-out attendee |
|
|
|
* |
|
|
|
* @param int $attendeeId ID of the attendee to call |
|
|
|
* @return DataResponse<Http::STATUS_CREATED|Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_NOT_IMPLEMENTED, array<empty>, array{}> |
|
|
|
* @return DataResponse<Http::STATUS_CREATED|Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_NOT_IMPLEMENTED, array{error?: string, message?: string}, array{}> |
|
|
|
* |
|
|
|
* 201: Dial-out initiated successfully |
|
|
|
* 400: SIP dial-out not possible |
|
|
|
|
|
|
|
@ -26,8 +26,6 @@ declare(strict_types=1); |
|
|
|
|
|
|
|
namespace OCA\Talk\Exceptions; |
|
|
|
|
|
|
|
use parallel\Events; |
|
|
|
|
|
|
|
class DialOutFailedException extends \RuntimeException { |
|
|
|
public function __construct( |
|
|
|
string $errorCode, |
|
|
|
|
|
|
|
@ -93,7 +93,10 @@ class BackendNotifier { |
|
|
|
} |
|
|
|
|
|
|
|
$this->logger->error('Failed to send message to signaling server, giving up!', ['exception' => $e]); |
|
|
|
return new Response($e->getResponse()); |
|
|
|
if ($e->hasResponse()) { |
|
|
|
return new Response($e->getResponse()); |
|
|
|
} |
|
|
|
throw $e; |
|
|
|
} catch (\Exception $e) { |
|
|
|
$this->logger->error('Failed to send message to signaling server', ['exception' => $e]); |
|
|
|
throw $e; |
|
|
|
|
|
|
|
@ -4616,7 +4616,17 @@ |
|
|
|
"meta": { |
|
|
|
"$ref": "#/components/schemas/OCSMeta" |
|
|
|
}, |
|
|
|
"data": {} |
|
|
|
"data": { |
|
|
|
"type": "object", |
|
|
|
"properties": { |
|
|
|
"error": { |
|
|
|
"type": "string" |
|
|
|
}, |
|
|
|
"message": { |
|
|
|
"type": "string" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -4644,7 +4654,17 @@ |
|
|
|
"meta": { |
|
|
|
"$ref": "#/components/schemas/OCSMeta" |
|
|
|
}, |
|
|
|
"data": {} |
|
|
|
"data": { |
|
|
|
"type": "object", |
|
|
|
"properties": { |
|
|
|
"error": { |
|
|
|
"type": "string" |
|
|
|
}, |
|
|
|
"message": { |
|
|
|
"type": "string" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -4672,7 +4692,17 @@ |
|
|
|
"meta": { |
|
|
|
"$ref": "#/components/schemas/OCSMeta" |
|
|
|
}, |
|
|
|
"data": {} |
|
|
|
"data": { |
|
|
|
"type": "object", |
|
|
|
"properties": { |
|
|
|
"error": { |
|
|
|
"type": "string" |
|
|
|
}, |
|
|
|
"message": { |
|
|
|
"type": "string" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -4700,7 +4730,17 @@ |
|
|
|
"meta": { |
|
|
|
"$ref": "#/components/schemas/OCSMeta" |
|
|
|
}, |
|
|
|
"data": {} |
|
|
|
"data": { |
|
|
|
"type": "object", |
|
|
|
"properties": { |
|
|
|
"error": { |
|
|
|
"type": "string" |
|
|
|
}, |
|
|
|
"message": { |
|
|
|
"type": "string" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -89,6 +89,7 @@ |
|
|
|
<file name="tests/stubs/oc_comments_manager.php" /> |
|
|
|
<file name="tests/stubs/oc_core_command_base.php" /> |
|
|
|
<file name="tests/stubs/oc_hooks_emitter.php" /> |
|
|
|
<file name="tests/stubs/oc_http_client_response.php" /> |
|
|
|
<file name="tests/stubs/oca_circles.php" /> |
|
|
|
<file name="tests/stubs/oca_files_events.php" /> |
|
|
|
<file name="tests/stubs/GuzzleHttp_Exception_ClientException.php" /> |
|
|
|
|
|
|
|
@ -2,5 +2,12 @@ |
|
|
|
|
|
|
|
namespace GuzzleHttp\Exception; |
|
|
|
|
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
|
|
|
|
|
|
class ServerException extends \RuntimeException { |
|
|
|
|
|
|
|
public function getResponse(): ResponseInterface { |
|
|
|
} |
|
|
|
public function hasResponse(): bool { |
|
|
|
} |
|
|
|
} |
|
|
|
@ -0,0 +1,23 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace OC\Http\Client; |
|
|
|
|
|
|
|
use OCP\Http\Client\IResponse; |
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
|
|
|
|
|
|
class Response implements IResponse { |
|
|
|
public function __construct(ResponseInterface $response, $stream = false) { |
|
|
|
} |
|
|
|
|
|
|
|
public function getBody() { |
|
|
|
} |
|
|
|
|
|
|
|
public function getStatusCode(): int { |
|
|
|
} |
|
|
|
|
|
|
|
public function getHeader(string $key): string { |
|
|
|
} |
|
|
|
|
|
|
|
public function getHeaders(): array { |
|
|
|
} |
|
|
|
} |