Complete the API SIP message endpoint

- Complete the related README documentation
- Add a custom error message if the configured UNIX socket cannot be reached
- Update the dependencies
This commit is contained in:
Timothée Jaussoin 2022-03-21 11:12:19 +01:00
parent 88e2e049c4
commit 330073c167
4 changed files with 77 additions and 61 deletions

View file

@ -195,3 +195,15 @@ The functions already contains example codes to show you how the XML can be enha
You can also seed the tables with test accounts for the liblinphone test suite with the following command (check LiblinphoneTesterAccoutSeeder for the JSON syntax):
php artisan accounts:seed /path/to/accounts.json
## Sending SIP messages from the API
The `POST /api/messages` endpoint allows you to send messages on the SIP network. It call internally `linphone-daemon` to do so. To be able to use it you should follow the following steps:
1. Launch the `linphone-daemon` with a UNIX socket path, this will create a socket file in `/tmp` (the file will be `/tmp/lp` for the following line).
$ linphone-daemon --pipe ld
2. Configure the `.env` file to point to that UNIX socket
APP_LINPHONE_DAEMON_UNIX_PATH=/tmp/ld

View file

@ -39,6 +39,10 @@ class MessageController extends Controller
$loop->run();
if (!array_key_exists('Status', $returnedLines)) {
throw ValidationException::withMessages(["The linphone-daemon UNIX socket cannot be requested properly"]);
}
if ($returnedLines['Status'] == 'Error') {
throw ValidationException::withMessages([$returnedLines['Reason']]);
}

120
flexiapi/composer.lock generated
View file

@ -72,16 +72,16 @@
},
{
"name": "bacon/bacon-qr-code",
"version": "2.0.6",
"version": "2.0.7",
"source": {
"type": "git",
"url": "https://github.com/Bacon/BaconQrCode.git",
"reference": "0069435e2a01a57193b25790f105a5d3168653c1"
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/0069435e2a01a57193b25790f105a5d3168653c1",
"reference": "0069435e2a01a57193b25790f105a5d3168653c1",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
"shasum": ""
},
"require": {
@ -120,9 +120,9 @@
"homepage": "https://github.com/Bacon/BaconQrCode",
"support": {
"issues": "https://github.com/Bacon/BaconQrCode/issues",
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.6"
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.7"
},
"time": "2022-02-04T20:16:05+00:00"
"time": "2022-03-14T02:02:36+00:00"
},
{
"name": "brick/math",
@ -332,16 +332,16 @@
},
{
"name": "doctrine/dbal",
"version": "3.3.2",
"version": "3.3.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "35eae239ef515d55ebb24e9d4715cad09a4f58ed"
"reference": "82331b861727c15b1f457ef05a8729e508e7ead5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/35eae239ef515d55ebb24e9d4715cad09a4f58ed",
"reference": "35eae239ef515d55ebb24e9d4715cad09a4f58ed",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/82331b861727c15b1f457ef05a8729e508e7ead5",
"reference": "82331b861727c15b1f457ef05a8729e508e7ead5",
"shasum": ""
},
"require": {
@ -356,14 +356,14 @@
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2021.1",
"phpstan/phpstan": "1.4.0",
"phpstan/phpstan": "1.4.6",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "9.5.11",
"phpunit/phpunit": "9.5.16",
"psalm/plugin-phpunit": "0.16.1",
"squizlabs/php_codesniffer": "3.6.2",
"symfony/cache": "^5.2|^6.0",
"symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0",
"vimeo/psalm": "4.16.1"
"vimeo/psalm": "4.22.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
@ -423,7 +423,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.3.2"
"source": "https://github.com/doctrine/dbal/tree/3.3.3"
},
"funding": [
{
@ -439,7 +439,7 @@
"type": "tidelift"
}
],
"time": "2022-02-05T16:33:45+00:00"
"time": "2022-03-09T15:39:50+00:00"
},
{
"name": "doctrine/deprecations",
@ -1320,16 +1320,16 @@
},
{
"name": "guzzlehttp/psr7",
"version": "1.8.3",
"version": "1.8.5",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85"
"reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/1afdd860a2566ed3c2b0b4a3de6e23434a79ec85",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/337e3ad8e5716c15f9657bd214d16cc5e69df268",
"reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268",
"shasum": ""
},
"require": {
@ -1410,7 +1410,7 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/1.8.3"
"source": "https://github.com/guzzle/psr7/tree/1.8.5"
},
"funding": [
{
@ -1426,20 +1426,20 @@
"type": "tidelift"
}
],
"time": "2021-10-05T13:56:00+00:00"
"time": "2022-03-20T21:51:18+00:00"
},
{
"name": "laravel/framework",
"version": "v8.83.3",
"version": "v8.83.5",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "b4ed222a188cca74ca9062296e525d26ae54a0ce"
"reference": "33b1b981266e3a19fbc826b60c4a6847e311ac95"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/b4ed222a188cca74ca9062296e525d26ae54a0ce",
"reference": "b4ed222a188cca74ca9062296e525d26ae54a0ce",
"url": "https://api.github.com/repos/laravel/framework/zipball/33b1b981266e3a19fbc826b60c4a6847e311ac95",
"reference": "33b1b981266e3a19fbc826b60c4a6847e311ac95",
"shasum": ""
},
"require": {
@ -1599,7 +1599,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2022-03-03T15:14:29+00:00"
"time": "2022-03-15T13:37:44+00:00"
},
{
"name": "laravel/serializable-closure",
@ -1662,16 +1662,16 @@
},
{
"name": "laravel/tinker",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/tinker.git",
"reference": "5f2f9815b7631b9f586a3de7933c25f9327d4073"
"reference": "1e2d500585a4e546346fadd3adc6f9c1a97e15f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/tinker/zipball/5f2f9815b7631b9f586a3de7933c25f9327d4073",
"reference": "5f2f9815b7631b9f586a3de7933c25f9327d4073",
"url": "https://api.github.com/repos/laravel/tinker/zipball/1e2d500585a4e546346fadd3adc6f9c1a97e15f4",
"reference": "1e2d500585a4e546346fadd3adc6f9c1a97e15f4",
"shasum": ""
},
"require": {
@ -1724,9 +1724,9 @@
],
"support": {
"issues": "https://github.com/laravel/tinker/issues",
"source": "https://github.com/laravel/tinker/tree/v2.7.0"
"source": "https://github.com/laravel/tinker/tree/v2.7.1"
},
"time": "2022-01-10T08:52:49+00:00"
"time": "2022-03-15T15:25:01+00:00"
},
{
"name": "laravelcollective/html",
@ -2045,16 +2045,16 @@
},
{
"name": "monolog/monolog",
"version": "2.3.5",
"version": "2.4.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "fd4380d6fc37626e2f799f29d91195040137eba9"
"reference": "d7fd7450628561ba697b7097d86db72662f54aef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9",
"reference": "fd4380d6fc37626e2f799f29d91195040137eba9",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7fd7450628561ba697b7097d86db72662f54aef",
"reference": "d7fd7450628561ba697b7097d86db72662f54aef",
"shasum": ""
},
"require": {
@ -2076,7 +2076,7 @@
"phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5",
"predis/predis": "^1.1",
"rollbar/rollbar": "^1.3",
"rollbar/rollbar": "^1.3 || ^2 || ^3",
"ruflin/elastica": ">=0.90@dev",
"swiftmailer/swiftmailer": "^5.3|^6.0"
},
@ -2128,7 +2128,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.3.5"
"source": "https://github.com/Seldaek/monolog/tree/2.4.0"
},
"funding": [
{
@ -2140,7 +2140,7 @@
"type": "tidelift"
}
],
"time": "2021-10-01T21:08:31+00:00"
"time": "2022-03-14T12:44:37+00:00"
},
{
"name": "nesbot/carbon",
@ -3289,16 +3289,16 @@
},
{
"name": "react/event-loop",
"version": "v1.2.0",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/event-loop.git",
"reference": "be6dee480fc4692cec0504e65eb486e3be1aa6f2"
"reference": "187fb56f46d424afb6ec4ad089269c72eec2e137"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/event-loop/zipball/be6dee480fc4692cec0504e65eb486e3be1aa6f2",
"reference": "be6dee480fc4692cec0504e65eb486e3be1aa6f2",
"url": "https://api.github.com/repos/reactphp/event-loop/zipball/187fb56f46d424afb6ec4ad089269c72eec2e137",
"reference": "187fb56f46d424afb6ec4ad089269c72eec2e137",
"shasum": ""
},
"require": {
@ -3351,7 +3351,7 @@
],
"support": {
"issues": "https://github.com/reactphp/event-loop/issues",
"source": "https://github.com/reactphp/event-loop/tree/v1.2.0"
"source": "https://github.com/reactphp/event-loop/tree/v1.3.0"
},
"funding": [
{
@ -3363,7 +3363,7 @@
"type": "github"
}
],
"time": "2021-07-11T12:31:24+00:00"
"time": "2022-03-17T11:10:22+00:00"
},
{
"name": "react/promise",
@ -7827,16 +7827,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.17",
"version": "9.5.19",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "5c5abcfaa2cbd44b2203995d7a339ef910fe0c8f"
"reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5c5abcfaa2cbd44b2203995d7a339ef910fe0c8f",
"reference": "5c5abcfaa2cbd44b2203995d7a339ef910fe0c8f",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807",
"reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807",
"shasum": ""
},
"require": {
@ -7866,7 +7866,7 @@
"sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^2.3.4",
"sebastian/type": "^3.0",
"sebastian/version": "^3.0.2"
},
"require-dev": {
@ -7914,7 +7914,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.17"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19"
},
"funding": [
{
@ -7926,7 +7926,7 @@
"type": "github"
}
],
"time": "2022-03-05T16:54:31+00:00"
"time": "2022-03-15T09:57:31+00:00"
},
{
"name": "sebastian/cli-parser",
@ -8785,28 +8785,28 @@
},
{
"name": "sebastian/type",
"version": "2.3.4",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914"
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^9.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
@ -8829,7 +8829,7 @@
"homepage": "https://github.com/sebastianbergmann/type",
"support": {
"issues": "https://github.com/sebastianbergmann/type/issues",
"source": "https://github.com/sebastianbergmann/type/tree/2.3.4"
"source": "https://github.com/sebastianbergmann/type/tree/3.0.0"
},
"funding": [
{
@ -8837,7 +8837,7 @@
"type": "github"
}
],
"time": "2021-06-15T12:49:02+00:00"
"time": "2022-03-15T09:54:48+00:00"
},
{
"name": "sebastian/version",

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc
%define build_number 132
%define build_number 133
%define var_dir /var/opt/belledonne-communications
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager