添加 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 账号的密码。
注:
  • 必须包含数字、大写字母和小写字母。
  • 最小字符长度要求 10。
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 信息。
OutCaller_Info
2.
参数 是否必填 类型 说明
outbound_cid_option String 去电显示号码类型。
取值范围
  • range:分机范围对应去电显示号码范围。
  • shared:一到多个分机使用一个去电显示号码。
outbound_cid String 去电显示号码。
outbound_cid_name String 去电显示号码名称。
outbound_cid_to_ext_range String 去电显示号码范围对应的分机范围。
注: 仅当 outbound_cid_option 设置为 range 时,才需填写此参数。
ext_list Array <Extension_Info> 分机信息。
注: 仅当 outbound_cid_option 设置为 shared 时,才需填写此参数。
Extension_Info
3.
参数 是否必填 类型 说明
type String 分机或分机组。

取值范围

  • extension:分机
  • ext_group:分机组
ext_number String 分机号码或分机组名称。
ext_name String 分机名称或分机组名称。
id Integer 分机 ID 或分机组 ID。
DID_List
4.
参数 是否必填 类型 说明
did String 中继绑定的 DID 号码。
did_name String 中继绑定的 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 信息。
OutCaller_Info
6.
参数 是否必填 类型 说明
outbound_cid_option String 去电显示号码类型。
取值范围
  • range:分机范围对应去电显示号码范围。
  • shared:一到多个分机使用一个去电显示号码。
outbound_cid String 去电显示号码。
outbound_cid_name String 去电显示号码名称。
outbound_cid_to_ext_range String 去电显示号码范围对应的分机范围。
注: 仅当 outbound_cid_option 设置为 range 时,才需填写此参数。
ext_list Array <Extension_Info> 分机信息。
注: 仅当 outbound_cid_option 设置为 shared 时,才需填写此参数。
Extension_Info
7.
参数 是否必填 类型 说明
type String 分机或分机组。

取值范围

  • extension:分机
  • ext_group:分机组
ext_number String 分机号码或分机组名称。
ext_name String 分机名称或分机组名称。
id Integer 分机 ID 或分机组 ID。
DID_List
8.
参数 是否必填 类型 说明
did String 中继绑定的 DID 号码。
did_name String 中继绑定的 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> 为分机自定义的去电显示信息。
OutCaller_Info
10.
参数 是否必填 类型 说明
outbound_cid_option String 去电显示号码类型。
取值范围
  • range:分机范围对应去电显示号码范围。
  • shared:一到多个分机使用一个去电显示号码。
outbound_cid String 去电显示号码。
outbound_cid_name String 去电显示号码名称。
outbound_cid_to_ext_range String 去电显示号码范围对应的分机范围。
注: 仅当 outbound_cid_option 设置为 range 时,才需填写此参数。
ext_list Array <Extension_Info> 分机信息。
注: 仅当 outbound_cid_option 设置为 shared 时,才需填写此参数。
Extension_Info
11.
参数 是否必填 类型 说明
type String 分机或分机组。

取值范围

  • extension:分机
  • ext_group:分机组
ext_number String 分机号码或分机组名称。
ext_name String 分机名称或分机组名称。
id Integer 分机 ID 或分机组 ID。

响应参数

12.
参数 类型 说明
errcode Integer 返回错误码。
  • 0:请求成功。
  • 非零值:请求失败。
注: 更多错误码和错误信息说明,请参见 错误码 & 错误信息
errmsg String 返回信息。
  • SUCCESS:请求成功。
  • FAILURE:请求失败。
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"
                    }
                ]
            }
        ],
        "did_list": [
            {
                "did": "5503308",
                "did_name": "Sales"
            }
        ]
    }
}

响应示例

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "id": 32
}