添加 SIP 中继
添加并配置 SIP 中继。
请求 URL
POST {base_url}/{api_path}/trunk/create?access_token={access_token}
请求参数
根据不同类型的 SIP 中继发送请求参数。
- 添加注册中继
-
表 1. 参数 是否必填 类型 说明 name 是 String 中继名称。 enable 否 Integer 是否启用中继。 取值范围:
-
0
:禁用 -
1
:启用
country 是 String SIP 运营商所在的国家。 注: 可使用 查询 SIP 中继运营商 接口查询中继信息。itsp 否 String SIP 运营商的名称。 注: 可使用 查询 SIP 中继运营商 接口查询中继信息。type 是 String 中继类型。 取值范围:
register
transport 是 String 传输协议。 取值范围:udp
tcp
tls
dnsnaptr
hostname 是 String SIP 运营商的域名/ IP 地址。 port 是 Integer SIP 中继注册端口。 domain 是 String SIP 运营商的域名/ IP 地址。 username 是 String SIP 运营商提供的 SIP 账号的用户名。 password 是 String SIP 运营商提供的 SIP 账号的密码。 auth_name 是 String SIP 运营商提供的认证名称。 enb_outbound_proxy 否 Integer 是否启用呼出代理服务器。 取值范围:
-
0
:禁用 -
1
:启用
outbound_proxy_server 否 String 呼出代理服务器的域名 / IP 地址。 outbound_proxy_port 否 Integer 呼出代理服务器的端口。 codec_sel 是 String 中继的语音编码设置。 取值范围:ulaw
alaw
g729
gsm
h264
h263
h263p
ilbc
g722
g726
speex
adpcm
mpeg4
vp8
def_outbound_cid 否 String 默认的去电显示号码。 def_outbound_cid_name 否 String 默认的去电显示名称。 outbound_cid_list 否 Array <OutCaller_Info> 为分机自定义的去电显示信息。 did_list 否 Array <DID_List> 中继的 DID 信息。 -
- 添加点对点中继
-
表 5. 参数 是否必填 类型 说明 name 是 String 中继名称。 enable 否 Integer 是否启用中继。 取值范围:
-
0
:禁用 -
1
:启用
country 是 String SIP 运营商所在的国家。 注: 可使用 查询 SIP 中继运营商 接口查询中继信息。itsp 否 String SIP 运营商的名称。 注: 可使用 查询 SIP 中继运营商 接口查询 SIP 运营商信息。type 是 String 中继类型。 取值范围:
peer
transport 是 String 传输协议。 取值范围:udp
tcp
tls
dnsnaptr
hostname 是 String SIP 运营商的域名/ IP 地址。 port 是 Integer SIP 中继注册端口。 domain 是 String SIP 运营商的域名/ IP 地址。 codec_sel 是 String 中继的语音编码设置。 取值范围:ulaw
alaw
g729
gsm
h264
h263
h263p
ilbc
g722
g726
speex
adpcm
vp8
def_outbound_cid 否 String 中继去电显示号码。 def_outbound_cid_name 否 String 中继去电显示名称。 outbound_cid_list 否 Array <OutCaller_Info> 为分机自定义的去电显示信息。 did_list 否 Array <DID_List> 中继的 DID 信息。 -
- 添加账号中继
-
表 9. 参数 是否必填 类型 说明 name 是 String 中继名称。 enable 否 Integer 是否启用中继。 取值范围:
-
0
:禁用 -
1
:启用
country 是 String SIP 运营商所在的国家。 注: 可使用 查询 SIP 中继运营商 接口查询中继信息。itsp 否 String SIP 运营商的名称。 注: 可使用 查询 SIP 中继运营商 接口查询 SIP 运营商信息。type 是 String 中继类型。 取值范围:
account
transport 是 String 传输协议。 取值范围:udp
tcp
tls
username 是 String SIP 账号中继的用户名。 password 是 String 与用户名匹配的密码。 auth_name 是 String 要注册的第三方设备使用的认证名称。 codec_sel 是 String 中继的语音编码设置。 取值范围:ulaw
alaw
g729
gsm
h264
h263
h263p
ilbc
g722
g726
speex
adpcm
mpeg4
vp8
def_outbound_cid 否 String 默认的去电显示号码。 def_outbound_cid_name 否 String 默认的去电显示名称。 outbound_cid_list 否 Array <OutCaller_Info> 为分机自定义的去电显示信息。 -
响应参数
参数 | 类型 | 说明 |
---|---|---|
errcode | Integer | 返回错误码。
注: 更多错误码和错误信息说明,请参见 错误码 & 错误信息。
|
errmsg | String | 返回信息。
|
id | Integer | 中继的唯一 ID。 |
示例
请求示例
添加一个注册中继。
POST /openapi/v1.0/trunk/create?access_token=LLTQiARUCJPsBrhTR22RBVCvBJ5xAiFI HTTP/1.1
Host: 192.168.5.150:8088
Content-Type: application/json
{
"name": "test_Calls",
"country": "general",
"type": "register",
"transport": "dnsnaptr",
"hostname": "abc.provider.com",
"port": 5060,
"domain": "abc.provider.com",
"username": "6701",
"password": "aAc1653249",
"auth_name": "mubJwYEWs9",
"codec_sel": "ulaw,alaw,g729",
"def_outbound_cid": "5503300",
"def_outbound_cid_name": "Demo",
"outbound_cid_list": [
{
"outbound_cid_option": "shared",
"outbound_cid": "5503301",
"outbound_cid_name": "Sales",
"ext_list": [
{
"ext_number": "Sales",
"ext_name": "Sales",
"type": "ext_group"
}
],
"outbound_cid_label":"Yeastar Sales"
}
],
"did_list": [
{
"did": "5503308",
"did_name": "Sales"
}
]
}
}
响应示例
HTTP/1.1 200 OK
{
"errcode": 0,
"errmsg": "SUCCESS",
"id": 32
}