-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #494 from dOpensource/v0.72
V0.72
- Loading branch information
Showing
97 changed files
with
5,977 additions
and
1,929 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,164 +1,45 @@ | ||
API | ||
=== | ||
|
||
+----------+----------------+---------------------------------------------------+ | ||
| KAMAILIO API | | ||
+==========+================+===================================================+ | ||
| PUT | Update existing| N/A | | ||
| | information at | | | ||
| | endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
| GET | Get Information| - /api/v1/kamailio/stats/ | | ||
| | from Endpoint | - /api/v1/kamailio/reload/ | | ||
+----------+----------------+---------------------------------------------------+ | ||
| POST | Create new | N/A | | ||
| | information at | | | ||
| | endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
| DELETE | Delete | N/A | | ||
| | information at | | | ||
| | endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
|
||
+----------+----------------+---------------------------------------------------+ | ||
| ENDPOINT API | | ||
+==========+================+===================================================+ | ||
| PUT | Update existing| - /api/v1/endpoint/lease/<int:leaseid>/revoke | | ||
| | information at | | | ||
| | endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
| GET | Get Information| - /api/v1/endpoint/lease/ | | ||
| | from Endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
| POST | Create new | - /api/v1/endpoint/<int:id> | | ||
| | information at | | | ||
| | endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
| DELETE | Delete | N/A | | ||
| | information at | | | ||
| | endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
|
||
+----------+----------------+---------------------------------------------------+ | ||
| INBOUND MAPPING API | | ||
+==========+================+===================================================+ | ||
| PUT | Update existing| - /api/v1/inboundmapping | | ||
| | information at | | | ||
| | endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
| GET | Get Information| - /api/v1/inboundmapping | | ||
| | from Endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
| POST | Create new | - /api/v1/inboundmapping | | ||
| | information at | | | ||
| | endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
| DELETE | Delete | - /api/v1/inboundmapping | | ||
| | information at | | | ||
| | endpoint | | | ||
+----------+----------------+---------------------------------------------------+ | ||
|
||
The steps to obtain the API Token key and using the different curl commands are listen below. | ||
|
||
Note: Make sure to to login to your instance via ssh. | ||
The complete API is defined as a public Postman Workspace, which can be found `here <https://www.postman.com/dopensource/workspace/dsiprouter/collection/4319695-9c09dea3-0b4b-4a20-a615-fb8fc16811af?action=share&creator=4319695>`_ | ||
|
||
The steps to obtain the API Token key and examples of using the API via curl are below, but we highly recommend using Postman for testing the API. | ||
|
||
Getting Your Token | ||
^^^^^^^^^^^^^^^^^^ | ||
|
||
Your token was provided to you after you installed dSIPRouter. You can reset your token if you didn't write it down, by executing the following command | ||
|
||
.. code-block:: bash | ||
DSIP_TOKEN=$(grep 'API_TOKEN' /etc/dsiprouter/gui/settings.py | cut -d "'" -f 2) | ||
DSIP_HOSTNAME=<your ip or hostname> | ||
DSIP_TOKEN=<your token> | ||
dsiprouter setcredentials -ac $DSIP_TOKEN | ||
Executing Kamailio stats API | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
|
||
.. code-block:: bash | ||
curl -H "Authorization: Bearer $DSIP_TOKEN" | ||
-X GET http://demo.dsiprouter.org:5000/api/v1/kamailio/stats | ||
One Line Version: | ||
|
||
.. code-block:: bash | ||
curl -H "Authorization: Bearer $DSIP_TOKEN" -X GET http://<addressOfYourInstance>:5000/api/v1/kamailio/stats | ||
curl -k -H "Authorization: Bearer $DSIP_TOKEN" -X GET https://$DSIP_HOSTNAME:5000/api/v1/kamailio/stats | ||
Executing Lease Point API | ||
^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Getting the endlease | ||
Create a new endpoint lease | ||
|
||
|
||
.. code-block:: bash | ||
curl -H "Authorization: Bearer $DSIP_TOKEN" -H "Content-Type: application/json" | ||
-X GET "http://demo.dsiprouter.org:5000/api/v1/endpoint/lease?ttl=15&email=mack@dsiprouter.org" | ||
curl -k -H "Authorization: Bearer $DSIP_TOKEN" -H "Content-Type: application/json" -X GET "https://$DSIP_HOSTNAME:5000/api/v1/endpoint/lease?ttl=15&email=mack@dsiprouter.org" | ||
One Line Version: | ||
|
||
.. code-block:: bash | ||
curl -H "Authorization: Bearer $DSIP_TOKEN" -H "Content-Type: application/json" -X GET "http://demo.dsiprouter.org:5000/api/v1/endpoint/lease?ttl=15&email=mack@dsiprouter.org" | ||
Revoking and replacing with your own lease ID | ||
|
||
.. code-block:: bash | ||
curl -H "Authorization: Bearer $DSIP_TOKEN" -H "Content-Type: application/json" | ||
-X PUT "http://demo.dsiprouter.org:5000/api/v1/endpoint/lease/1/revoke" | ||
One Line Version: | ||
|
||
.. code-block:: bash | ||
curl -H "Authorization: Bearer $DSIP_TOKEN" -H "Content-Type: application/json" -X PUT "http://demo.dsiprouter.org:5000/api/v1/endpoint/lease/1/revoke" | ||
Inbound Mapping Valid commands | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
-------------------------- | ||
GET /api/v1/inboundmapping | ||
-------------------------- | ||
|
||
.. code-block:: bash | ||
curl -X GET -H "Authorization: Bearer ${token}" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping" | ||
curl -X GET -H "Authorization: Bearer ${token}" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping?ruleid=3" | ||
curl -X GET -H "Authorization: Bearer ${token}" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping?did=1313" | ||
--------------------------- | ||
POST /api/v1/inboundmapping | ||
--------------------------- | ||
|
||
.. code-block:: bash | ||
curl -X POST -H "Authorization: Bearer ${token}" --connect-timeout 3 -H "Content-Type: application/json" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping" -d '{"did": "1313", "servers": ["66","67"], "notes": "1313 DID Mapping"}' | ||
curl -X POST -H "Authorization: Bearer ${token}" --connect-timeout 3 -H "Content-Type: application/json" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping" -d '{"did": "1313","servers": ["66","67"]}' | ||
curl -X POST -H "Authorization: Bearer ${token}" --connect-timeout 3 -H "Content-Type: application/json" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping" -d '{"did": "", "servers": ["66"], "notes": "Default DID Mapping"}' | ||
--------------------------- | ||
PUT /api/v1/inboundmapping | ||
--------------------------- | ||
|
||
.. code-block:: bash | ||
curl -X PUT -H "Authorization: Bearer ${token}" --connect-timeout 3 -H "Content-Type: application/json" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping?ruleid=3" -d '{"did": "01234", "notes": "01234 DID Mapping"}' | ||
curl -X PUT -H "Authorization: Bearer ${token}" --connect-timeout 3 -H "Content-Type: application/json" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping?did=1313" -d '{"servers": ["67"]}' | ||
curl -X PUT -H "Authorization: Bearer ${token}" --connect-timeout 3 -H "Content-Type: application/json" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping?did=1313" -d '{"did": "01234", "notes": "01234 DID Mapping"}' | ||
------------------------------- | ||
DELETE /api/v1/inboundmapping | ||
------------------------------- | ||
|
||
.. code-block:: bash | ||
curl -k -H "Authorization: Bearer $DSIP_TOKEN" -H "Content-Type: application/json" -X PUT "https://$DSIP_HOSTNAME:5000/api/v1/endpoint/lease/1/revoke" | ||
curl -X DELETE -H "Authorization: Bearer ${token}" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping?ruleid=3" | ||
curl -X DELETE -H "Authorization: Bearer ${token}" "http://demo.dsiprouter.org:5000/api/v1/inboundmapping?did=1313" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.