Skip to main content

Trunk Object

This section goes over the parts of the Trunk object. Trunks hold settings that will determine how the system will communicate with an endpoint. Trunks belong to trunk groups.

tip

Refer to our How It Works: Trunk Groups and Trunks section to learn more about what trunks are, what they are used for, and how you can work with them.

Trunk Object Attributes

The fields listed in the table below will be returned in a JSON object when a successful request has been made.

AttributeData TypeDescription
aclsarray of objectsThe Access Control Lists associated with the trunk. Refer to the table below for more information.
allow_forwardstringDetermines how to handle 302 redirects from legB. Values accepted in this field are:
  • direct to treat as direct_uri if user@host is specified in contact URI, or to treat as reroute if only user is specified.
  • direct_uri to create call leg to the SIP URI specified in the contact header. If only user is specified without host, assume the host is unchanged and send to the same destination IP again. The new URI will be placed in REDIRECT_URI field of CDRs.
  • disabled to reject the call.
  • protected to allow forward only if the destination IP is associated with an endpoint address, which has its direction set to inbound and is related to the partner third_party endpoint.
  • reroute to use only the phone number portion of the contact URI. Look this up and place as if it were an outbound call, applying all CarrierX routing rules. This will create a 2nd CDR.
The default value is disabled.
allow_transferbooleanWhether or not to allow transfer.
asn_modestringWhether or not to allow PASSCALLERCSRC, PASSCALLEECSRC variables for ASN proxy. Values accepted in this field are:
  • disable to disable this feature.
  • read to allow reading of ASN proxy flags.
  • write to allow writing of ASN proxy flags.
  • read_write to allow both reading and writing of ASN proxy flags.
The default value is disable.
call_typestringThe call type. Values accepted in this field are:
  • redirect_302 for 302 redirect.
  • regular for with media.
  • sip_only for SIP only.
The default value is regular.
codecstringThe supported codec. Values accepted in this field are: alaw, g722, g723, g729, gsm, opus8, opus12, opus16, opus24, opus48, ulaw. The default value is null which means that the trunk will use one of the supported codecs from legA.
endpoint_sidstringThe secure ID of the endpoint associated with this trunk.
in_capacityintegerThe maximum number of simultaneous calls which the trunk can receive. Use the -1 value to disable receiving calls by the trunk. 0 means unlimited and is the default value.
in_identity_formatstringDetermines the format, in which the data will be sent to legB in the case the in_identity_mode/ out_identity_mode is set to pass the RPID/PAI headers. This setting is only applicable when there is data to be sent. Values accepted in this field are:
  • pai to send the information in the PAI format.
  • passthrough to send the information in the format determined by legA.
  • rpid to send the information in the RPID format.
The default value is passthrough.
in_identity_modestringControls when and how the information about Remote Party ID (RPID) and P-Asserted-Identity (PAI) headers is accepted when the trunk is receiving calls. Values accepted in this field are:
  • always
  • never
  • passthrough
  • rewrite_from
See the out_identity_mode parameter below for more information on this. The default value is passthrough.
in_rfc_4694_mode
read only
stringControls whether the number portability parameters for the "tel" URI are accepted for the incoming leg. Values accepted in this field are:
  • accept_all for accepting all the RFC-4694 parameters as they are.
  • cic_only for accepting CIC parameter information only.
  • cut_all for cutting all the RFC-4694 parameters information off the incoming leg.
  • rn_npdi for accepting the information for query to NPDB and routing number only.
The default value is cut_all.
location_sidstringSecure ID of the location object that identifies the Trunk object as belonging to a specific location.
namestringThe trunk name.
out_capacityintegerThe maximum number of simultaneous calls which the trunk can send. Use the -1 value to disable sending calls by the trunk. 0 means unlimited and is the default value.
out_identity_modestringControls whether Remote Party ID (RPID) and P-Asserted-Identity (PAI) headers are passed when the trunk is sending calls. The behavior depends on the in_identity_mode value and RPID/PAI headers presence, and is described in respect to the accepted values below.
  • passthrough and RPID/PAI headers are present:
    • if in_identity_mode = passthrough or in_identity_mode = never, then 'From' remains unchanged, PAI header is set to RPID/PAI, privacy flags are preserved.
    • if in_identity_mode = always, then 'From' remains unchanged, PAI header is not sent.
    • if in_identity_mode = rewrite_from, then 'From' is set to RPID/PAI, PAI header is not sent.
  • never or RPID/PAI headers are missing:
    • if in_identity_mode = passthrough or in_identity_mode = always or in_identity_mode = rewrite_from, then 'From' remains unchanged, PAI header is not sent.
    • if in_identity_mode = never, then 'From' remains unchanged, PAI header is set to the 'From' value.
The default value is passthrough.
out_rfc_4694_mode
read only
stringControls whether the number portability parameters for the "tel" URI are passed to the outgoing leg. Values accepted in this field are:
  • accept_all for passing all the RFC-4694 parameters as they are.
  • cic_only for passing CIC parameter information only.
  • cut_all for cutting all the RFC-4694 parameters information off the outgoing leg.
  • rn_npdi for passing the information for query to NPDB and routing number only.
The default value is cut_all.
out_sip_ringing_max_ttlintegerTime in seconds during which an outbound call will continue ringing trying to reach the other party before the call is dropped off. The default value is 180.
priorityintegerAllows to change the routing order for trunks inside a trunk group with the routing_type set to failover. Lower values have higher priority. The default value is 0.
relay_sip_headersarrayThe list of the headers from the incoming leg that must be passed to the outgoing leg. This setting applies when the trunk is receiving calls. Regular expressions can be used instead of complete header names (e.g., the X-.* value will relay all the X-headers).
transformationsarray of objectsThe transformations to apply to the trunk. Refer to the transformations section for more information.
trunk_sid
read only
stringThe trunk secure ID.
weightintegerAllows to distribute the calls among the trunks inside a trunk group with the routing_type set to round_robin. Trunks with bigger values will receive more calls compared to trunks with smaller values.

Sample Trunk Object

{
"acls": []
"allow_forward": "disabled",
"allow_transfer": false,
"asn_mode": "disable",
"call_type": "regular",
"codec": null,
"endpoint_sid": null,
"in_capacity": 0,
"in_identity_format": "passthrough",
"in_identity_mode": "passthrough",
"in_rfc_4694_mode": "cut_all",
"location_sid": null,
"name": "trunk01",
"out_capacity": 0,
"out_identity_mode": "passthrough",
"out_rfc_4694_mode": "cut_all",
"priority": 0,
"relay_sip_headers": [],
"transformations": [],
"trunk_sid": "4c51c85c-5355-4a91-bf1e-f33d731bcfa9",
"weight": 0
}
note

Please note, that identity information (the in_identity_mode and out_identity_mode parameters) is supported using either RPID or PAI headers. However, when placing the outbound call leg, the PAI format will always be used for sending.

ACL Object

AttributeData TypeDescription
access_control_rulesarray

The list of access control rules secure IDs. Refer to the Access Control Rule object for more information about access control rules.

directionstring
The direction for the access control list. Values accepted in this field are:
  • any to apply the rules from the list to both sent and received calls and messages.
  • inbound to apply the rules from the list to received calls and messages.
  • outbound to apply the rules from the list to sent calls and messages.
  • undirected to apply the rules from the list to actions with no direction specified.
sms_action_false
read only
string

For the Trunk Object this field is always null and read-only because Trunks are used for voice only.

sms_action_true
read only
string

For the Trunk Object this field is always null and read-only because Trunks are used for voice only.

voice_action_falsestring
The action to be executed for calls if no access control rules are applied. Values accepted in this field are:
  • accept to accept the calls.
  • reject403 to reject the call with the 403 status code.
  • reject503 to reject the call with the 503 status code.
voice_action_truestring
The action to be executed for calls if any access control rules are applied. Values accepted in this field are:
  • accept to accept the calls.
  • reject403 to reject the call with the 403 status code.
  • reject503 to reject the call with the 503 status code.