Add a SIP Trunk
Add and configure a SIP trunk.
Request URL
POST {base_url}/{api_path}/trunk/create?access_token={access_token}
Request parameters
Send different request parameters according to different types of SIP trunk.
- Add a Register trunk
- Add a Peer trunk
- Add an Account trunk
Add a Register trunk
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | Yes | String | Trunk name. |
| enable | No | Integer | Whether to enable the trunk. Valid value:
|
| country | Yes | String | The country of the ITSP.Note:You can query the desired ITSP using Query ITSP of SIP Trunks. |
| itsp | No | String | The name of the ITSP.Note:You can query the desired ITSP using Query ITSP of SIP Trunks. |
| type | Yes | String | Trunk type. Valid value: register |
| transport | Yes | String | Transport protocol.Valid value:
|
| hostname | Yes | String | The domain or IP address of the ITSP. |
| port | Yes | Integer | The registration port of the SIP trunk. |
| domain | Yes | String | The domain or IP address of the ITSP. |
| username | Yes | String | The username of the SIP account that is provided by the ITSP. |
| password | Yes | String | The password of the SIP account. |
| auth_name | Yes | String | The authentication name that is provided by the ITSP. |
| enb_outbound_proxy | No | Integer | Whether to enable an outbound proxy. Valid value:
|
| outbound_proxy_server | No | String | The domain name or IP address of the outbound proxy server. |
| outbound_proxy_port | No | Integer | The port of the outbound proxy server. |
| codec_sel | Yes | String | Codec settings of the trunk.Valid value:
|
| def_outbound_cid | No | String | Default outbound caller ID. |
| def_outbound_cid_name | No | String | Default outbound caller ID name. |
| outbound_cid_list | No | Array <OutCaller_Info> | The information of customized outbound caller ID for specific extensions. |
| did_list | No | Array <DID_List> | DID information associated with the trunk. |
| transparent_trans_180_msg | No | Integer | Whether to forward the 180 message following the peer's SDP presence. Valid value:
|
| setting_of_sip_and_sdp_ip | No | String | Whether to use the default or a custom IP address in 'Contact'(SIP) and 'Connection'(SIP) fields. Valid value:
|
| sip_and_sdp_ip_addr | No | String | The custom IP address to be used in 'Contact'(SIP) and 'Connection(SIP)' fields. Note:This parameter is required when setting_of_sip_and_sdp_ip is set to custom. |
| ignore_100_response | No | Integer | Whether to ignore the 100 Trying response. Valid value:
|
| force_sip_uri_scheme | No | Integer | Whether to forcibly use sip: URI scheme instead of sips: in registration requests to change SIP transport from encrypted to unencrypted. Note: This parameter is only available for register trunk when transport is set to tls or dnsnaptr.Valid value:
|
| enb_send_302_on_cf_external | No | Integer | Whether to return a "302 Moved Temporarily" response to the caller when forwarding an inbound call to an external number.Valid value:
|
| refer_to_support | No | Integer | Whether the PBX can process the SIP REFER requests received via the trunk.Valid value:
|
| refer_to_mode_list | No | Array<String> | The allowed destination types for blind transfers triggered by REFER requests. Valid value:
|
| refer_to_prefix | No | String | The prefix of the outbound route for blind transfers triggered by REFER requests. The PBX will prepend the prefix to the target number in the REFER request when transferring the call. Note:
|
| outbound_failover_sip_code | No | String | Specify which SIP response codes trigger automatic failover to the next trunk within the same outbound route and re-initiation of the call. Valid value:
|
| sip_codes | No | String | Custom SIP response codes that trigger automatic failover to the next trunk within the same outbound route and re-initiation of the call. Note:
|
OutCaller_Info
| Parameter | Required | Type | Description |
|---|---|---|---|
| outbound_cid_option | Yes | String | The type of outbound caller ID.Valid value:
|
| outbound_cid_short_code | No | String | The short code of the outbound caller ID.This code can be used together with the DOD prefix feature code to perform specific operations, such as setting a specific DOD to default, or selecting a DOD to call out without changing the default DOD. Note: This parameter is only available when outbound_cid_option is set to shared, and the code MUST be unique within the system. |
| outbound_cid | Yes | String | The outbound caller ID.Note:
|
| outbound_cid_name | No | String | The outbound caller ID name. |
| outbound_cid_to_ext_range | No | String | The extension range corresponding to the outbound caller ID range. The format should be XXX-XXX. E.g. 5000-5005. Note: This parameter is required when outbound_cid_option is set to range. |
| ext_list | No | Array <Extension_Info> | The information of the associated extensions. Note: This parameter is required when outbound_cid_option is set to shared. |
| outbound_cid_label | No | String | The default label of the outbound caller ID. |
Extension_Info
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | No | String | Whether this is an extension or an extension group. Valid value:
|
| ext_number | No | String | The number of an extension or the name of an extension group. |
| ext_name | No | String | The name of an extension or an extension group. |
| id | Yes | Integer | The unique ID of an extension or an extension group. |
DID_List
| Parameter | Required | Type | Description |
|---|---|---|---|
| did | Yes | String | The DID number associated with the trunk. |
| did_name | No | String | The DID name associated with the trunk. |
Add a Peer trunk
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | Yes | String | Trunk name. |
| enable | No | Integer | Whether to enable the trunk. Valid value:
|
| country | Yes | String | The country of the ITSP.Note:You can query the desired ITSP using Query ITSP of SIP Trunks. |
| itsp | No | String | The name of the ITSP.Note:You can query the desired ITSP using Query ITSP of SIP Trunks. |
| type | Yes | String | Trunk type.Valid value:
|
| transport | Yes | String | Transport protocol.Valid value:
|
| hostname | Yes | String | The domain or IP address of the ITSP. |
| port | Yes | Integer | The registration port of the SIP trunk. |
| domain | Yes | String | The domain or IP address of the ITSP. |
| codec_sel | Yes | String | Codec settings of the trunk.Valid value:
|
| def_outbound_cid | No | String | Default outbound caller ID. |
| def_outbound_cid_name | No | String | Default outbound caller ID name. |
| outbound_cid_list | No | Array <OutCaller_Info> | The information of customized outbound caller ID for specific extensions. |
| did_list | No | Array <DID_List> | DID information associated with the trunk. |
| transparent_trans_180_msg | No | Integer | Whether to forward the 180 message following the peer's SDP presence. Valid value:
|
| setting_of_sip_and_sdp_ip | No | String | Whether to use the default or a custom IP address in 'Contact'(SIP) and 'Connection'(SIP) fields. Valid value:
|
| sip_and_sdp_ip_addr | No | String | The custom IP address to be used in 'Contact'(SIP) and 'Connection(SIP)' fields. Note: This parameter is required when setting_of_sip_and_sdp_ip is set to custom. |
| enb_send_302_on_cf_external | No | Integer | Whether to return a "302 Moved Temporarily" response to the caller when forwarding an inbound call to an external number. Valid value:
|
| refer_to_support | No | Integer | Whether the PBX can process the SIP REFER requests received via the trunk.Valid value:
|
| refer_to_mode_list | No | Array<String> | The allowed destination types for blind transfers triggered by REFER requests. Valid value:
|
| refer_to_prefix | No | String | The prefix of the outbound route for blind transfers triggered by REFER requests. The PBX will prepend the prefix to the target number in the REFER request when transferring the call. Note:
|
| outbound_failover_sip_code | No | String | Specify which SIP response codes trigger automatic failover to the next trunk within the same outbound route and re-initiation of the call. Valid value:
|
| sip_codes | No | String | Custom SIP response codes that trigger automatic failover to the next trunk within the same outbound route and re-initiation of the call. Note:
|
OutCaller_Info
| Parameter | Required | Type | Description |
|---|---|---|---|
| outbound_cid_option | Yes | String | The type of outbound Caller ID. Valid value:
|
| outbound_cid_short_code | No | String | The short code of the outbound caller ID. This code can be used together with the DOD prefix feature code to perform specific operations, such as setting a specific DOD to default, or selecting a DOD to call out without changing the default DOD. Note: This parameter is only available when outbound_cid_option is set to shared, and the code MUST be unique within the system. |
| outbound_cid | Yes | String | The outbound caller ID. Note:
|
| outbound_cid_name | No | String | The outbound Caller ID name. |
| outbound_cid_to_ext_range | No | String | The extension range corresponding to the outbound caller ID range. The format should be XXX-XXX. E.g. 5000-5005. Note: This parameter is required when outbound_cid_option is set to range. |
| ext_list | No | Array <Extension_Info> | The information of the associated extensions. Note: This parameter is required when outbound_cid_option is set to shared. |
| outbound_cid_label | No | String | The default label of the outbound caller ID. |
Extension_Info
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | No | String | Whether this is an extension or an extension group. Valid value:
|
| ext_number | No | String | The number of an extension or the name of an extension group. |
| ext_name | No | String | The name of an extension or an extension group. |
| id | Yes | Integer | The unique ID of an extension or an extension group. |
DID_List
| Parameter | Required | Type | Description |
|---|---|---|---|
| did | Yes | String | The DID number associated with the trunk. |
| did_name | No | String | The DID name associated with the trunk. |
Add an Account trunk
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | Yes | String | Trunk name. |
| enable | No | Integer | Whether to enable the trunk. Valid value:
|
| country | Yes | String | The country of the ITSP. Note: You can query the desired ITSP using Query ITSP of SIP Trunks. |
| itsp | No | String | The name of the ITSP.Note:You can query the desired ITSP using Query ITSP of SIP Trunks. |
| type | Yes | String | Trunk type. Valid value: account |
| transport | Yes | String | Transport protocol.Valid value:
|
| username | Yes | String | The user name of the SIP account trunk. |
| password | Yes | String | The password associated with the user name. |
| auth_name | Yes | String | The authentication name for a third-party device to register with. |
| codec_sel | Yes | String | Codec settings of the trunk. Valid value:
|
| def_outbound_cid | No | String | Default outbound caller ID. |
| def_outbound_cid_name | No | String | Default outbound caller ID name. |
| outbound_cid_list | No | Array <OutCaller_Info> | The information of customized outbound caller ID for specific extensions. |
| transparent_trans_180_msg | No | Integer | Whether to forward the 180 message following the peer's SDP presence. Valid value:
|
| ignore_100_response | No | Integer | Whether to ignore the 100 Trying response. Valid value:
|
| enb_send_302_on_cf_external | No | Integer | Whether to return a "302 Moved Temporarily" response to the caller when forwarding an inbound call to an external number. Valid value:
|
| refer_to_support | No | Integer | Whether the PBX can process the SIP REFER requests received via the trunk. Valid value:
|
| refer_to_mode_list | No | Array<String> | The allowed destination types for blind transfers triggered by REFER requests. Valid value:
|
| refer_to_prefix | No | String | The prefix of the outbound route for blind transfers triggered by REFER requests. The PBX will prepend the prefix to the target number in the REFER request when transferring the call. Note:
|
| outbound_failover_sip_code | No | String | Specify which SIP response codes trigger automatic failover to the next trunk within the same outbound route and re-initiation of the call. Valid value:
|
| sip_codes | No | String | Custom SIP response codes that trigger automatic failover to the next trunk within the same outbound route and re-initiation of the call. Note:
|
OutCaller_Info
| Parameter | Required | Type | Description |
|---|---|---|---|
| outbound_cid_option | Yes | String | The type of outbound caller ID. Valid value:
|
| outbound_cid_short_code | No | String | The short code of the outbound caller ID. This code can be used together with the DOD prefix feature code to perform specific operations, such as setting a specific DOD to default, or selecting a DOD to call out without changing the default DOD. Note: This parameter is only available when outbound_cid_option is set to shared, and the code MUST be unique within the system. |
| outbound_cid | Yes | String | The outbound caller ID. Note:
|
| outbound_cid_name | No | String | The outbound caller ID name. |
| outbound_cid_to_ext_range | No | String | The extension range corresponding to the outbound caller ID range. The format should be XXX-XXX. E.g. 5000-5005. Note: This parameter is required when outbound_cid_option is set to range. |
| ext_list | No | Array <Extension_Info> | The information of the associated extensions. Note: This parameter is required when outbound_cid_option is set to shared. |
| outbound_cid_label | No | String | The default label of the outbound caller ID. |
Extension_Info
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | No | String | Whether this is an extension or an extension group. Valid value:
|
| ext_number | No | String | The number of an extension or the name of an extension group. |
| ext_name | No | String | The name of an extension or an extension group. |
| id | Yes | Integer | The unique ID of an extension or an extension group. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| errcode | Integer | Returned error code.
|
| errmsg | String | Returned message.
|
| id | Integer | The unique ID of the trunk. |
Examples
Request example
Add a register trunk.
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": "Cloud One",
"outbound_cid_list": [
{
"outbound_cid_option": "shared",
"outbound_cid_short_code": "123"
"outbound_cid": "5503301",
"outbound_cid_name": "Cloud One Sales",
"ext_list": [
{
"ext_number": "Cloud One Sales",
"ext_name": "Cloud One Sales",
"type": "ext_group"
}
],
"outbound_cid_label":"Cloud One Sales"
}
],
"did_list": [
{
"did": "5503308",
"did_name": "Cloud One"
}
],
"transparent_trans_180_msg": 0,
"setting_of_sip_and_sdp_ip": "default",
"sip_and_sdp_ip_addr": "",
"ignore_100_response": 1,
"force_sip_uri_scheme": 0,
"enb_send_302_on_cf_external": 0s,
"refer_to_support": 1,
"refer_to_mode_list": [
"external_number",
"internal_number"
],
"refer_to_prefix": "55",
"outbound_failover_sip_code": "custom",
"sip_codes": "408;480;500;502;503;513;555;580"
}Response example
HTTP/1.1 200 OK
{
"errcode": 0,
"errmsg": "SUCCESS",
"id": 19
}