Back to Skills
    🦞

    dsiprouter-skill

    Call the dSIPRouter REST API using the Postman

    By @mackhendricks
    View on GitHub
    SKILL.md
    ---
    name: dsiprouter
    description: Call the dSIPRouter REST API using the Postman collection (curl + jq).
    metadata: {"openclaw":{"emoji":"πŸ“‘","requires":{"bins":["curl","jq"],"env":["DSIP_ADDR","DSIP_TOKEN"]}}}
    ---
    
    # dSIPRouter API skill
    
    This skill is generated from the Postman collection and provides:
    - a safe `curl` calling convention
    - a `bin/dsiprouter.sh` helper 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=1` to allow self-signed TLS (adds `-k`)
    
    Base URL:
    - `https://$DSIP_ADDR:5000/api/v1`
    
    Auth header:
    - `Authorization: Bearer $DSIP_TOKEN`
    
    ## Safe calling convention
    
    ```bash
    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
    
    ```bash
    # 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
    
    ```bash
    dsiprouter.sh kamailio:stats | jq .
    dsiprouter.sh kamailio:reload | jq .
    ```
    
    ## Endpoint catalog (from Postman)
    
    ### endpointgroups
    - `endpointgroups:list` β†’ **GET** `/api/v1/endpointgroups`
    - `endpointgroups:get` β†’ **GET** `/api/v1/endpointgroups/9` β€” Get a single endpointgroup
    - `endpointgroups:create` β†’ **POST** `/api/v1/endpointgroups` β€” Create an endpointgroup
    - `endpointgroups:create_1` β†’ **POST** `/api/v1/endpointgroups` β€” Create an endpointgroup
    - `endpointgroups:create_2` β†’ **POST** `/api/v1/endpointgroups` β€” Create an endpointgroup
    - `endpointgroups:create_3` β†’ **POST** `/api/v1/endpointgroups` β€” Create an endpointgroup
    - `endpointgroups:delete` β†’ **DELETE** `/api/v1/endpointgroups/53` β€” Delete endpointgroup
    - `endpointgroups: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 made
    - `kamailio:list` β†’ **GET** `/api/v1/kamailio/stats` β€” Obtain call statistics
    
    ### inboundmapping
    - `inboundmapping:list` β†’ **GET** `/api/v1/inboundmapping` β€” Get a list of inboundmappings
    - `inboundmapping:create` β†’ **POST** `/api/v1/inboundmapping` β€” Create new inboundmapping
    - `inboundmapping:update` β†’ **PUT** `/api/v1/inboundmapping?did=13132222223` β€” Create new inboundmapping
    - `inboundmapping:delete` β†’ **DELETE** `/api/v1/inboundmapping?did=13132222223` β€” Create new inboundmapping
    
    ### leases
    - `leases:list` β†’ **GET** `/api/v1/lease/endpoint?email=mack@goflyball.com&ttl=5m` β€” Get a single endpointgroup
    - `leases:list_1` β†’ **GET** `/api/v1/lease/endpoint?email=mack@goflyball.com&ttl=1m&type=ip&auth_ip=172.145.24.2` β€” Get a single endpointgroup
    - `leases:revoke` β†’ **DELETE** `/api/v1/lease/endpoint/34/revoke` β€” Get a single endpointgroup
    
    ### carriergroups
    - `carriergroups:list` β†’ **GET** `/api/v1/carriergroups`
    - `carriergroups:create` β†’ **POST** `/api/v1/carriergroups`
    
    ### auth
    - `auth:create` β†’ **POST** `/api/v1/auth/user`
    - `auth:update` β†’ **PUT** `/api/v1/auth/user/2`
    - `auth:delete` β†’ **DELETE** `/api/v1/auth/user/2`
    - `auth:list` β†’ **GET** `/api/v1/auth/user`
    - `auth:login` β†’ **POST** `/api/v1/auth/login`
    
    ### cdr
    - `cdr:get` β†’ **GET** `/api/v1/cdrs/endpointgroups/17?type=csv&dtfilter=2022-09-14&email=True`
    - `cdr:get_1` β†’ **GET** `/api/v1/cdrs/endpoint/54`
    
    ## Included files
    
    - `bin/dsiprouter.sh`