dSIPRouter API 管理:SIP 代理控制 - Openclaw Skills

作者:互联网

2026-04-14

AI教程

什么是 dSIPRouter API 管理?

此技能提供了一个与 dSIPRouter REST API 交互的全面界面,是管理 SIP 代理和 Kamailio 节点的必备工具。通过使用专门的辅助 CLI,它将复杂的原始 HTTP 请求抽象为易于管理的 VoIP 基础设施子命令。将其集成到 Openclaw Skills 生态系统中,开发人员可以自动配置端点组、运营商映射以及实时 SIP 统计数据的检索。

下载入口:https://github.com/openclaw/skills/tree/main/skills/mackhendricks/dsiprouter-skill

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install dsiprouter-skill

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 dsiprouter-skill。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

dSIPRouter API 管理 应用场景

  • 自动化 SIP 端点组的创建和删除。
  • 更新路由配置后触发 Kamailio 服务重载。
  • 获取并分析通话详细记录 (CDR) 以进行计费或故障排除。
  • 管理入站 DID 映射和运营商组分配。
  • 监控实时 SIP 代理性能和通话统计数据。
dSIPRouter API 管理 工作原理
  1. 技能通过从环境中读取 dSIPRouter 主机地址和 API 持票者令牌进行初始化。
  2. 它利用捆绑的 shell 脚本 dsiprouter.sh,该脚本充当本地化 curl 命令的包装器。
  3. 使用安全调用约定,确保所有 API 交互都包含正确的标头、超时和错误处理。
  4. 当发出命令时,该技能会将请求的操作映射到相应的 dSIPRouter REST 端点。
  5. 使用 jq 处理原始 JSON 响应,为用户或代理提供干净、可操作的数据。

dSIPRouter API 管理 配置指南

要在 Openclaw Skills 框架中使用此 dSIPRouter 集成,请配置环境变量并确保满足依赖项:

# 安装所需依赖项
# 确保系统中已安装 curl 和 jq

# 配置连接详细信息
export DSIP_ADDR="your.dsiprouter.ip"
export DSIP_TOKEN="your_api_bearer_token"

# 可选:允许自签名证书
export DSIP_INSECURE=1

# 测试辅助脚本
./bin/dsiprouter.sh help

dSIPRouter API 管理 数据架构与分类体系

该技能通过 dSIPRouter API 与多个主要数据模型进行交互。下表重点介绍了关键数据实体:

资源 属性 描述
端点组 ID, 名称, 服务器 SIP 端点集群的配置。
入站映射 DID, 服务器, 名称 呼入号码到特定服务器的映射。
Kamailio 统计 运行时间, 活动通话 代理的实时性能指标。
CDR 端点, 类型, 过滤器 用于流量分析的通话详细记录。
认证 用户, 密码, ID API 和系统用户凭据的管理。
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 r
    --connect-timeout 5 --max-time 30 r
    -H "Authorization: Bearer ${DSIP_TOKEN}" r
    -H "Content-Type: application/json" r
    -X "${method}" "https://${DSIP_ADDR}:5000${path}" r
    "$@"
}

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/endpoint?email=mack@goflyball.com&ttl=5m — Get a single endpointgroup
  • leases:list_1GET /api/v1/lease/endpoint?email=mack@goflyball.com&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