Edit a SIP Trunk

Change the settings of a SIP trunk.

Request URL

POST {base_url}/{api_path}/trunk/update?access_token={access_token}

Request parameters

Send different request parameters according to different types of SIP trunk.
Edit a Register trunk
Table 1.
Parameter Required Type Description
id Yes Integer The unique ID of a trunk.
Note: You can query trunk's ID using Search Specific Trunks.
name No String Trunk name.
enable No Integer Whether to enable or disable the trunk.

Valid value:

  • 0: Disabled

  • 1: Enabled

transport No String Transport protocol.

Valid value:

  • udp
  • tcp
  • tls
  • dnsnaptr
hostname No String The domain or IP address of the ITSP.
port No Integer The registration port of the SIP trunk.
domain No String The domain or IP address of the ITSP.
username No String The username of the SIP account that is provided by the ITSP.
password No String The password of the SIP account.
auth_name No String The authentication name that is provided by the ITSP.
enb_outbound_proxy No Integer Whether to enable an outbound proxy.

Valid value:

  • 0: Disable

  • 1: Enable

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 No String Codec settings of the trunk.

Valid value:

  • ulaw
  • alaw
  • g729
  • gsm
  • h264
  • h263
  • h263p
  • ilbc
  • g722
  • g726
  • speex
  • adpcm
  • mpeg4
  • vp8
  • opus
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:

  • 0: Disable

  • 1: Enable

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:

  • default

  • custom

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.
force_dod_from No Integer Whether to ignore the trunk's From User Part setting and forcibly use the extension’s selected DOD number in the From header when the extension selects a specific DOD to make an outbound call.

Valid value

  • 0: Disable.

  • 1: Enable.

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:
  • 0: Disable.
  • 1: Enable.
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:
  • 0: Disable.
  • 1: Enable.
OutCaller_Info
Table 2.
Parameter Required Type Description
outbound_cid_option Yes String The type of outbound caller ID.
Valid value:
  • range
  • shared
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:
  • Only digits, uppercase and lowercase letters, and the characters -, +, *, # are allowed. The maximum length is 31 characters.
  • When outbound_cid_option is set to range, the format must be +XXX-+XXX or XXX-XXX. E.g. 5503301-5503305, and the start and end numbers must have the same length.
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
Table 3.
Parameter Required Type Description
type No String Whether this is an extension or an extension group.

Valid value:

  • extension
  • ext_group
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
Table 4.
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.
Edit a Peer trunk
Table 5.
Parameter Required Type Description
id Yes Integer The unique ID of a trunk.
Note: You can query trunk's ID using Search Specific Trunks.
name No String Trunk name.
enable No Integer Whether to enable or disable the trunk.

Valid value:

  • 0: Disable

  • 1: Enable

transport No String Transport protocol.
Valid value:
  • udp
  • tcp
  • tls
  • dnsnaptr
hostname No String The domain or IP address of the ITSP.
port No Integer The registration port of the SIP trunk.
domain No String The domain or IP address of the ITSP.
codec_sel No String Codec settings of the trunk.
Valid value:
  • ulaw
  • alaw
  • g729
  • gsm
  • h264
  • h263
  • h263p
  • ilbc
  • g722
  • g726
  • speex
  • adpcm
  • mpeg4
  • vp8
  • opus
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:

  • 0: Disable

  • 1: Enable

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:

  • default

  • custom

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.
force_dod_from No Integer Whether to ignore the trunk's From User Part setting and forcibly use the extension’s selected DOD number in the From header when the extension selects a specific DOD to make an outbound call.

Valid value

  • 0: Disable.

  • 1: Enable.

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:
  • 0: Disable.
  • 1: Enable.
OutCaller_Info
Table 6.
Parameter Required Type Description
outbound_cid_option Yes String The type of outbound caller ID.
Valid value:
  • range
  • shared
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:
  • Only digits, uppercase and lowercase letters, and the characters -, +, *, # are allowed. The maximum length is 31 characters.
  • When outbound_cid_option is set to range, the format must be +XXX-+XXX or XXX-XXX. E.g. 5503301-5503305, and the start and end numbers must have the same length.
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
Table 7.
Parameter Required Type Description
type No String Whether this is an extension or an extension group.

Valid value:

  • extension
  • ext_group
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
Table 8.
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.
Edit an Account trunk
Table 9.
Parameter Required Type Description
id Yes Integer The unique ID of a trunk.
Note: You can query trunk's ID using Search Specific Trunks.
name No String Trunk name.
enable No Integer Whether to enable or disable the trunk.

Valid value:

  • 0: Disable

  • 1: Enable

transport No String Transport protocol.
Valid value:
  • udp
  • tcp
  • tls
username No String The user name of the SIP account trunk.
password No String The password associated with the username.
auth_name No String The authentication name for a third-party device to register with.
codec_sel No String Codec settings of the trunk.
Valid value:
  • ulaw
  • alaw
  • g729
  • gsm
  • h264
  • h263
  • h263p
  • ilbc
  • g722
  • g726
  • speex
  • adpcm
  • mpeg4
  • vp8
  • opus
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:

  • 0: Disable

  • 1: Enable

force_dod_from No Integer Whether to ignore the trunk's From User Part setting and forcibly use the extension’s selected DOD number in the From header when the extension selects a specific DOD to make an outbound call.

Valid value

  • 0: Disable.

  • 1: Enable.

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:
  • 0: Disable.
  • 1: Enable.
OutCaller_Info
Table 10.
Parameter Required Type Description
outbound_cid_option Yes String The type of outbound caller ID.
Valid value:
  • range
  • shared
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:
  • Only digits, uppercase and lowercase letters, and the characters -, +, *, # are allowed. The maximum length is 31 characters.
  • When outbound_cid_option is set to range, the format must be +XXX-+XXX or XXX-XXX. E.g. 5503301-5503305, and the start and end numbers must have the same length.
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
Table 11.
Parameter Required Type Description
type No String Whether this is an extension or an extension group.

Valid value:

  • extension
  • ext_group
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

Table 12.
Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.

Examples

Request example

Change the name of an account trunk (ID: 28) to "test-account-trunking".

POST /openapi/v1.0/trunk/update?access_token=7Vr1qX3sY6UjtocCs9WNLxikkap63Wsy HTTP/1.1 
Host: 192.168.5.150:8088
Content-Type: application/json
{
     "id": 28,
     "name": "test-account-trunking"
}

Response example

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