Source Code
dSIPRouter API skill
This skill is generated from the Postman collection and provides:
- a safe
curlcalling convention - a
bin/dsiprouter.shhelper CLI with subcommands for the collectionβs requests - example payloads (where present in Postman)
Required environment
DSIP_ADDRβ hostname/IP of your dSIPRouter node (no scheme)DSIP_TOKENβ API bearer token- Optional:
DSIP_INSECURE=1to allow self-signed TLS (adds-k)
Base URL:
https://$DSIP_ADDR:5000/api/v1
Auth header:
Authorization: Bearer $DSIP_TOKEN
Safe calling convention
dsip_api() {
local method="$1"; shift
local path="$1"; shift
local insecure=()
if [ "${DSIP_INSECURE:-}" = "1" ]; then insecure=(-k); fi
curl "${insecure[@]}" --silent --show-error --fail-with-body \
--connect-timeout 5 --max-time 30 \
-H "Authorization: Bearer ${DSIP_TOKEN}" \
-H "Content-Type: application/json" \
-X "${method}" "https://${DSIP_ADDR}:5000${path}" \
"$@"
}
Preferred usage: the bundled helper CLI
# list subcommands
dsiprouter.sh help
# list endpoint groups
dsiprouter.sh endpointgroups:list | jq .
# create inbound mapping with your own JSON payload
dsiprouter.sh inboundmapping:create '{"did":"13132222223","servers":["#22"],"name":"Taste Pizzabar"}' | jq .
# or send the Postman sample body
dsiprouter.sh inboundmapping:create --sample | jq .
Kamailio
dsiprouter.sh kamailio:stats | jq .
dsiprouter.sh kamailio:reload | jq .
Endpoint catalog (from Postman)
endpointgroups
endpointgroups:listβ GET/api/v1/endpointgroupsendpointgroups:getβ GET/api/v1/endpointgroups/9β Get a single endpointgroupendpointgroups:createβ POST/api/v1/endpointgroupsβ Create an endpointgroupendpointgroups:create_1β POST/api/v1/endpointgroupsβ Create an endpointgroupendpointgroups:create_2β POST/api/v1/endpointgroupsβ Create an endpointgroupendpointgroups:create_3β POST/api/v1/endpointgroupsβ Create an endpointgroupendpointgroups:deleteβ DELETE/api/v1/endpointgroups/53β Delete endpointgroupendpointgroups:updateβ PUT/api/v1/endpointgroups/34β Update an endpointgroup
kamailio
kamailio:reloadβ POST/api/v1/reload/kamailioβ Trigger a reload of Kamailio. This is needed after changes are madekamailio:listβ GET/api/v1/kamailio/statsβ Obtain call statistics
inboundmapping
inboundmapping:listβ GET/api/v1/inboundmappingβ Get a list of inboundmappingsinboundmapping:createβ POST/api/v1/inboundmappingβ Create new inboundmappinginboundmapping:updateβ PUT/api/v1/inboundmapping?did=13132222223β Create new inboundmappinginboundmapping:deleteβ DELETE/api/v1/inboundmapping?did=13132222223β Create new inboundmapping
leases
leases:listβ GET/api/v1/lease/[email protected]&ttl=5mβ Get a single endpointgroupleases:list_1β GET/api/v1/lease/[email protected]&ttl=1m&type=ip&auth_ip=172.145.24.2β Get a single endpointgroupleases:revokeβ DELETE/api/v1/lease/endpoint/34/revokeβ Get a single endpointgroup
carriergroups
carriergroups:listβ GET/api/v1/carriergroupscarriergroups:createβ POST/api/v1/carriergroups
auth
auth:createβ POST/api/v1/auth/userauth:updateβ PUT/api/v1/auth/user/2auth:deleteβ DELETE/api/v1/auth/user/2auth:listβ GET/api/v1/auth/userauth:loginβ POST/api/v1/auth/login
cdr
cdr:getβ GET/api/v1/cdrs/endpointgroups/17?type=csv&dtfilter=2022-09-14&email=Truecdr:get_1β GET/api/v1/cdrs/endpoint/54
Included files
bin/dsiprouter.sh