REST API文档

高级配置-SIP

SIP

信息说明:

参数说明
nameSIP Profile 名称
description描述
sip_ipsip 地址
sip_portsip 端口
rtp_iprtp 地址
ext_sip_ip外部 SIP IP
ext_rtp_ip外部 RTP IP
context呼叫源
icodec入方向编码
ocodec出方向编码
disabled是否启用,0-启用 1-不启用
aliases别名

查看 profile

  • 请求 URL/api/sip_profiles

  • 请求方式GET

  • Body 信息:无

  • 返回值:参考信息说明

  • curl 示例

curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/sip_profiles
  • 返回值
[
  {
    "disabled": 0,
    "icodec": "$${inbound_codec_prefs}",
    "deleted_at": "",
    "context": "context-2",
    "description": "",
    "updated_at": "2023-03-23 06:25:23",
    "created_at": "2023-03-23 06:25:23",
    "aliases": "",
    "sip_ip": "$${local_ip_v4}",
    "id": 1,
    "ext_sip_ip": "$${ext_sip_ip}",
    "rtp_ip": "$${local_ip_v4}",
    "ext_rtp_ip": "$${ext_rtp_ip}",
    "sip_port": "$${sip_port}",
    "name": "default",
    "ocodec": "$${outbound_codec_prefs}"
  },
  {
    "disabled": 0,
    "icodec": "$${inbound_codec_prefs}",
    "deleted_at": "",
    "context": "context-2",
    "description": "",
    "updated_at": "2023-03-23 06:25:23",
    "created_at": "2023-03-23 06:25:23",
    "aliases": "",
    "sip_ip": "$${local_ip_v4}",
    "id": 2,
    "ext_sip_ip": "$${ext_sip_ip}",
    "rtp_ip": "$${local_ip_v4}",
    "ext_rtp_ip": "$${ext_rtp_ip}",
    "sip_port": "$${sip_public_port}",
    "name": "public",
    "ocodec": "$${outbound_codec_prefs}"
  }
]

查看指定 profile 的配置参数

  • 请求 URL/api/sip_profiles/$id

  • 请求方式GET

  • Body 信息:无

  • curl 示例

curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/sip_profiles/1
  • 返回值
{
	"context": "context-2",
	"icodec": "$${inbound_codec_prefs}",
	"sip_port": "$${sip_port}",
	"ocodec": "$${outbound_codec_prefs}",
	"updated_at": "2023-03-23 06:25:23",
	"name": "default",
	"sip_port_expanded": "5060",
	"disabled": 0,
	"rtp_ip": "$${local_ip_v4}",
	"sip_ip_expanded": "172.18.0.3",
	"rtp_ip_expanded": "172.18.0.3",
	"created_at": "2023-03-23 06:25:23",
	"sip_ip": "$${local_ip_v4}",
	"description": "",
	"params": [
		{
			"k": "NDLB-broken-auth-hash",
			"deleted_at": "",
			"ref_id": 1,
			"created_at": "2023-03-23 06:25:23",
			"realm": "SIP_PROFILE",
			"updated_at": "2023-03-23 06:25:23",
			"id": 1362,
			"v": "true",
			"disabled": 1
		},
		...
		{
			"k": "wss-binding",
			"deleted_at": "",
			"ref_id": 1,
			"created_at": "2023-03-23 06:25:23",
			"realm": "SIP_PROFILE",
			"updated_at": "2023-03-23 06:25:23",
			"id": 1498,
			"v": ":7443",
			"disabled": 1
		}
	],
	"ext_rtp_ip": "$${ext_rtp_ip}",
	"icodec_expanded": "OPUS,G722,PCMA,PCMU",
	"deleted_at": "",
	"ocodec_expanded": "OPUS,G722,PCMA,PCMU",
	"id": 1,
	"aliases": "",
	"ext_sip_ip": "$${ext_sip_ip}"
}

查看 profile 配置参数中文说明

参数说明
lang支持说明语言,目前仅中文
k参数名
v参数对应说明
  • 请求 URL/api/sip_profiles/lparams

  • 请求方式GET

  • Body 信息:无

  • curl 示例

curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/sip_profiles/lparams
  • 返回值
[
	{
		"deleted_at": "",
		"k": "rtp-digit-delay",
		"lang": "zh",
		"updated_at": "2023-03-23 06:25:20",
		"created_at": "2023-03-23 06:25:20",
		"v": "RTP数字间隔时间(ms)",
		"id": 2,
		"realm": "SIP_PROFILE"
	},
	...
	{
		"deleted_at": "",
		"k": "apply-candidate-acl:3",
		"lang": "zh",
		"updated_at": "2023-03-23 06:25:20",
		"created_at": "2023-03-23 06:25:20",
		"v": "WebRTC的ice框架下可选媒体地址acl规则",
		"id": 132,
		"realm": "SIP_PROFILE"
	}
]

创建 profile

  • 请求 URL/api/sip_profiles
  • 请求方式POST
  • Body 信息
{
  "name": "test",
  "description": "test",
  "sip_port": "2345",
  "context": "context-2",
  "template": "default"
}
  • curl 示例
curl -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"name": "test","description": "test","template": "default","context": "context-2","sip_port":"2345"}' \
-H "Content-Type: application/json" "http://192.168.1.100:8081/api/sip_profiles"
  • 返回值
{
  "code": 200,
  "data": 3,
  "message": "success"
}

修改 profile

  • 请求 URL/api/sip_profiles/$id
  • 请求方式PUT
  • Body 信息
{
  "disabled": "0",
  "context": "context-1"
}
  • curl 示例
curl -XPUT -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" \
-H "Content-Type: application/json" \
-d '{"disabled": "0","description": "default"}' \
"192.168.1.100:8081/api/sip_profiles/3"
  • 返回值
{
  "code": 200,
  "data": "3",
  "message": "success"
}

在某个 profile 内的新增参数

  • 请求 URL/api/sip_profiles/$id/params
  • 请求方式POST
  • Body 信息
{
  "k": "test",
  "realm": "SIP_PROFILES",
  "v": "test"
}
  • curl 示例
curl -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"k": "test","realm": "SIP_PROFILES","v": "test"}' \
-H "Content-Type: application/json" "http://192.168.1.100:8081/api/sip_profiles/5/params"
  • 返回值
{
  "message": "success",
  "data": 1752,
  "code": 200
}

修改指定 profile 的参数配置

  • 请求 URL/api/sip_profiles/$id/params/$param_id
  • 请求方式PUT
  • Body 信息
{
  "k": "NDLB-broken-auth-hash-test",
  "v": "true",
  "disabled": 1
}
  • curl 示例
curl -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"k": "NDLB-broken-auth-hash-test","v": "true","disabled": 1}' \
-H "Content-Type: application/json" "http://192.168.1.100:8081/api/sip_profiles/5/params/2513"
  • 返回值
{
  "message": "success",
  "data": "2513",
  "code": 200
}

删除 profile 内的某个参数

  • 请求 URL/api/sip_profiles/$id/param/$params_id

  • 请求方式DELETE

  • Body 信息:无

  • 示例

curl -0 -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE 192.168.1.100:8081/api/sip_profiles/1/param/2513
  • 返回值
{
  "code": 200,
  "message": "success",
  "data": "2513"
}

删除 profile

  • 请求 URL/api/sip_profiles/$id

  • 请求方式DELETE

  • Body 信息:无

  • 示例

curl -0 -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE 192.168.1.100:8081/api/sip_profiles/5
  • 返回值
{
  "data": "5",
  "message": "success",
  "code": 200
}

创建 SIP Profile 全局参数

  • 请求 URL/api/params
  • 请求方式POST
  • 消息头Content-Type: application/json
  • Body 信息
{
  "disabled": 1,
  "k": "test",
  "realm": "SOFIAGLOBALS",
  "v": "100"
}
  • 返回值
{
  "data": 1597,
  "code": 200,
  "message": "success"
}
  • 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"disabled": "1","k": "test","realm": "SOFIAGLOBALS","v": "100"}' \
-H "Content-Type: application/json" http://192.168.1.100:8081/api/params

修改 SIP Profile 全局参数

  • 请求 URL/api/params/$id
  • 请求方式PUT
  • 消息头Content-Type: application/json
  • Body 信息
{
  "disabled": 0,
  "k": "test",
  "realm": "SOFIAGLOBALS",
  "v": "200"
}
  • 示例:
curl -XPUT -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"disabled": "0","k": "test","realm": "SOFIAGLOBALS","v": "200"}' \
-H "Content-Type: application/json" http://192.168.1.100:8081/api/params/1598
  • 返回值
{
  "data": "1598",
  "message": "success",
  "code": 200
}

删除 SIP Profile 全局参数

  • 请求 URL/api/params/$id

  • 请求方式DELETE

  • Body 信息:无

  • 示例:

curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE http://192.168.1.100:8081/api/params/1598
  • 返回值
{
  "code": 200,
  "data": "1598",
  "message": "success"
}
话单管理