dOpensource

dsiprouter

1
0
# Install this skill:
npx skills add dOpensource/dsiprouter-skill

Or install specific skill: npx add-skill https://github.com/dOpensource/dsiprouter-skill

# Description

Call the dSIPRouter REST API using the Postman collection (curl + jq).

# 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

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:listGET /api/v1/endpointgroups
  • endpointgroups:getGET /api/v1/endpointgroups/9 — Get a single endpointgroup
  • endpointgroups:createPOST /api/v1/endpointgroups — Create an endpointgroup
  • endpointgroups:create_1POST /api/v1/endpointgroups — Create an endpointgroup
  • endpointgroups:create_2POST /api/v1/endpointgroups — Create an endpointgroup
  • endpointgroups:create_3POST /api/v1/endpointgroups — Create an endpointgroup
  • endpointgroups:deleteDELETE /api/v1/endpointgroups/53 — Delete endpointgroup
  • endpointgroups:updatePUT /api/v1/endpointgroups/34 — Update an endpointgroup

kamailio

  • kamailio:reloadPOST /api/v1/reload/kamailio — Trigger a reload of Kamailio. This is needed after changes are made
  • kamailio:listGET /api/v1/kamailio/stats — Obtain call statistics

inboundmapping

  • inboundmapping:listGET /api/v1/inboundmapping — Get a list of inboundmappings
  • inboundmapping:createPOST /api/v1/inboundmapping — Create new inboundmapping
  • inboundmapping:updatePUT /api/v1/inboundmapping?did=13132222223 — Create new inboundmapping
  • inboundmapping:deleteDELETE /api/v1/inboundmapping?did=13132222223 — Create new inboundmapping

leases

  • leases:listGET /api/v1/lease/[email protected]&ttl=5m — Get a single endpointgroup
  • leases:list_1GET /api/v1/lease/[email protected]&ttl=1m&type=ip&auth_ip=172.145.24.2 — Get a single endpointgroup
  • leases:revokeDELETE /api/v1/lease/endpoint/34/revoke — Get a single endpointgroup

carriergroups

  • carriergroups:listGET /api/v1/carriergroups
  • carriergroups:createPOST /api/v1/carriergroups

auth

  • auth:createPOST /api/v1/auth/user
  • auth:updatePUT /api/v1/auth/user/2
  • auth:deleteDELETE /api/v1/auth/user/2
  • auth:listGET /api/v1/auth/user
  • auth:loginPOST /api/v1/auth/login

cdr

  • cdr:getGET /api/v1/cdrs/endpointgroups/17?type=csv&dtfilter=2022-09-14&email=True
  • cdr:get_1GET /api/v1/cdrs/endpoint/54

Included files

  • bin/dsiprouter.sh

# README.md

dSIPRouter Skill

A powerful Bash-based skill for interacting with the dSIPRouter REST API. Generated from the included Postman collection, this skill provides a convenient CLI and a safe curl-based calling convention.

Are you looking for our MCP Server? It's located here

Installation

Prerequisites

Before installing this skill, ensure you have the following tools available on your system:

  • curl — For making HTTP requests
  • jq — For JSON processing and formatting
  • Bash — Version 4.0 or later

You can verify these are installed:

command -v curl && command -v jq && bash --version

On macOS, install missing tools using Homebrew:

brew install curl jq

On Linux (Ubuntu/Debian):

sudo apt-get install curl jq

Installation Steps

  1. Clone or copy the repository:
git clone https://github.com/dOpensource/dsiprouter-skill
cd dsiprouter-skill
  1. Make the CLI executable:
chmod +x bin/dsiprouter.sh
  1. Add to your PATH (optional but recommended):
# Copy to a directory in your PATH
sudo cp bin/dsiprouter.sh /usr/local/bin/

# Or add the current directory to PATH in your shell profile
export PATH="$PWD/bin:$PATH"
  1. Configure environment variables:

Set the required environment variables for your dSIPRouter instance:

export DSIP_ADDR="your-dsiprouter-host"    # e.g., "192.168.1.100" or "dsip.example.com"
export DSIP_TOKEN="your-api-bearer-token"  # Your API token from dSIPRouter

For self-signed certificates, you can also set:

export DSIP_INSECURE=1  # Allows connections to servers with self-signed TLS certificates

To make these permanent, add them to your shell profile (~/.bashrc, ~/.zshrc, etc.).

Quick Start

List Available Commands

dsiprouter.sh help

Basic Usage Examples

List all endpoint groups:

dsiprouter.sh endpointgroups:list | jq .

Get a specific endpoint group:

dsiprouter.sh endpointgroups:get | jq .

Create an inbound mapping:

dsiprouter.sh inboundmapping:create '{"did":"13132222223","servers":["#22"],"name":"My Location"}' | jq .

Check Kamailio statistics:

dsiprouter.sh kamailio:list | jq .

Reload Kamailio after making changes:

dsiprouter.sh kamailio:reload | jq .

Available Skills

This skill provides command groups organized by resource type. Each command follows the pattern:

dsiprouter.sh <resource>:<action> [options]

Endpoint Groups

Manage endpoint groups and SIP endpoints:

  • endpointgroups:list — List all endpoint groups
  • endpointgroups:get — Get details of a specific endpoint group
  • endpointgroups:create — Create a new endpoint group
  • endpointgroups:update — Update an existing endpoint group
  • endpointgroups:delete — Delete an endpoint group

Kamailio Management

Monitor and manage the Kamailio SIP server:

  • kamailio:list — Get Kamailio call statistics
  • kamailio:reload — Trigger a Kamailio reload (required after configuration changes)

Inbound Mapping

Configure DID (Direct Inward Dialing) to endpoint mapping:

  • inboundmapping:list — List all inbound mappings
  • inboundmapping:create — Create a new inbound mapping
  • inboundmapping:update — Update an existing inbound mapping
  • inboundmapping:delete — Delete an inbound mapping

Leases

Manage endpoint leases:

  • leases:list — List active endpoint leases
  • leases:revoke — Revoke an endpoint lease

Carrier Groups

Manage carrier/trunk configurations:

  • carriergroups:list — List all carrier groups
  • carriergroups:create — Create a new carrier group

Authentication

User management:

  • auth:create — Create a new API user

Safe Calling Convention

This skill implements a safe curl wrapper with the following features:

  • Automatic authentication — Includes the Bearer token from DSIP_TOKEN
  • Error handling — Shows errors and exits on failure
  • Timeout protection — 5-second connection timeout, 30-second max time
  • TLS flexibility — Optional insecure mode for self-signed certificates
  • Content negotiation — Automatically sets JSON headers

The underlying function:

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}" \
    "$@"
}

Environment Variables

Variable Required Description
DSIP_ADDR Yes Hostname or IP address of your dSIPRouter instance (without scheme)
DSIP_TOKEN Yes Bearer token for API authentication
DSIP_INSECURE No Set to 1 to allow self-signed TLS certificates

API Base URL

All requests are sent to:

https://$DSIP_ADDR:5000/api/v1

Common Workflows

1. Verify Connection

dsiprouter.sh endpointgroups:list | jq '.count'

2. Create an Endpoint Group

dsiprouter.sh endpointgroups:create '{
  "name": "My Endpoints",
  "sip_profile_id": 1
}' | jq .

3. Create an Inbound Mapping

dsiprouter.sh inboundmapping:create '{
  "did": "13132222223",
  "servers": ["#22"],
  "name": "Main Office",
  "prefix": "",
  "strip": 0
}' | jq .

4. Reload Configuration

After making changes, reload Kamailio:

dsiprouter.sh kamailio:reload | jq .

Troubleshooting

Connection timeout:

error: Failed to connect to dSIPRouter
  • Verify DSIP_ADDR is correct and accessible
  • Check network connectivity: ping $DSIP_ADDR
  • Ensure port 5000 is open

Authentication error (401):

error: Unauthorized
  • Verify DSIP_TOKEN is correct
  • Check that your token hasn't expired

SSL/TLS certificate errors:

error: SSL certificate problem
  • For self-signed certificates, set DSIP_INSECURE=1
  • Or add your certificate to the system trust store

Command not found:

dsiprouter: command not found
  • Verify the script is executable: chmod +x bin/dsiprouter.sh
  • Ensure the directory is in your PATH or use the full path: ./bin/dsiprouter

Additional Resources

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.