API

KAMAILIO API
PUT Update existing information at endpoint N/A
GET Get Information from Endpoint
  • /api/v1/kamailio/stats/
  • /api/v1/kamailio/reload/
POST Create new information at endpoint N/A
DELETE Delete information at endpoint N/A
ENDPOINT API
PUT Update existing information at endpoint
  • /api/v1/endpoint/lease/<int:leaseid>/revoke
GET Get Information from Endpoint
  • /api/v1/endpoint/lease/
POST Create new information at endpoint
  • /api/v1/endpoint/<int:id>
DELETE Delete information at endpoint N/A
INBOUND MAPPING API
PUT Update existing information at endpoint
  • /api/v1/inboundmapping
GET Get Information from Endpoint
  • /api/v1/inboundmapping
POST Create new information at endpoint
  • /api/v1/inboundmapping
DELETE Delete information at endpoint
  • /api/v1/inboundmapping

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.

Getting Your Token

DSIP_TOKEN=$(cat /opt/dsiprouter/gui/settings.py | grep API_TOKEN | cut -d "'" -f 2)

Executing Kamailio stats API

curl -H "Authorization: Bearer $DSIP_TOKEN"
-X GET http://demo.dsiprouter.org:5000/api/v1/kamailio/stats

One Line Version:

curl -H "Authorization: Bearer $DSIP_TOKEN" -X GET http://<addressOfYourInstance>:5000/api/v1/kamailio/stats

Executing Lease Point API

Getting the endlease

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"

One Line Version:

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

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:

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

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

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

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

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"