Menu

Expand
Rate this page:

Trunk Resource

The Trunk resource represents a SIP Trunk in your Twilio account. A Trunk can have associated Credential Lists, IP Access Control Lists, Origination URLs, and Phone Numbers.

To learn how to create and use SIP Trunks, check out our getting started guide.

Trunk properties

Resource Properties in REST API format
account_sid
sid<AC> Not PII

The SID of the Account that created the Trunk resource.

domain_name
string Not PII

The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and - and must end with pstn.twilio.com. See Termination Settings for more information.

disaster_recovery_method
http_method Not PII

The HTTP method we use to call the disaster_recovery_url. Can be: GET or POST.

disaster_recovery_url

The URL we call using the disaster_recovery_method if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See Disaster Recovery for more information.

friendly_name
string Not PII

The string that you assigned to describe the resource.

secure
boolean Not PII

Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See Secure Trunking for more information.

recording
object Not PII

The recording settings for the trunk. Can be: do-not-record, record-from-ringing, record-from-answer. If set to record-from-ringing or record-from-answer, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g./Trunks/[Trunk_SID]/Recording -XPOST -d'Mode=record-from-answer'. See Recording for more information.

transfer_mode
enum:transfer_setting Not PII

The call transfer settings for the trunk. Can be: enable-all, sip-only and disable-all. See Transfer for more information.

transfer_caller_id
enum:transfer_caller_id Not PII

Caller Id for transfer target. Can be: from-transferee (default) or from-transferor.

cnam_lookup_enabled
boolean Not PII

Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See CNAM Lookups for more information.

auth_type
string Not PII

The types of authentication mapped to the domain. Can be: IP_ACL and CREDENTIAL_LIST. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic.

auth_type_set
string[] Not PII

Reserved.

date_created
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in RFC 2822 format.

date_updated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in RFC 2822 format.

sid
sid<TK> Not PII

The unique string that we created to identify the Trunk resource.

url
url Not PII

The absolute URL of the resource.

links
uri_map Not PII

The URLs of related resources.

Create a Trunk resource

post
https://trunking.twilio.com/v1/Trunks
Parameters
Parameters in REST API format
friendly_name
Optional
post string Not PII

A descriptive string that you create to describe the resource. It can be up to 64 characters long.

domain_name
Optional
post string Not PII

The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and - and must end with pstn.twilio.com. See Termination Settings for more information.

disaster_recovery_url
Optional
post url PII MTL: 30 DAYS

The URL we should call using the disaster_recovery_method if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See Disaster Recovery for more information.

disaster_recovery_method
Optional
post http_method Not PII

The HTTP method we should use to call the disaster_recovery_url. Can be: GET or POST.

transfer_mode
Optional
post ienum:transfer_setting Not PII

The call transfer settings for the trunk. Can be: enable-all, sip-only and disable-all. See Transfer for more information.

secure
Optional
post boolean Not PII

Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See Secure Trunking for more information.

cnam_lookup_enabled
Optional
post boolean Not PII

Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See CNAM Lookups for more information.

transfer_caller_id
Optional
post ienum:transfer_caller_id Not PII

Caller Id for transfer target. Can be: from-transferee (default) or from-transferor.

Example 1
Loading Code Sample...
        
        
        

        Create Trunk

        Fetch a Trunk resource

        get
        https://trunking.twilio.com/v1/Trunks/{Sid}
        Parameters
        Parameters in REST API format
        sid
        Path
        get sid<TK> Not PII

        The unique string that we created to identify the Trunk resource to fetch.

        Example 1
        Loading Code Sample...
              
              
              

              Fetch Trunk

              Read multiple Trunk resources

              get
              https://trunking.twilio.com/v1/Trunks
              Example 1
              Loading Code Sample...
                    
                    
                    

                    Read Trunk

                    Update a Trunk resource

                    post
                    https://trunking.twilio.com/v1/Trunks/{Sid}
                    Parameters
                    Parameters in REST API format
                    sid
                    Path
                    post sid<TK> Not PII

                    The unique string that we created to identify the OriginationUrl resource to update.

                    friendly_name
                    Optional
                    post string Not PII

                    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

                    domain_name
                    Optional
                    post string Not PII

                    The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and - and must end with pstn.twilio.com. See Termination Settings for more information.

                    disaster_recovery_url
                    Optional
                    post url PII MTL: 30 DAYS

                    The URL we should call using the disaster_recovery_method if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See Disaster Recovery for more information.

                    disaster_recovery_method
                    Optional
                    post http_method Not PII

                    The HTTP method we should use to call the disaster_recovery_url. Can be: GET or POST.

                    transfer_mode
                    Optional
                    post ienum:transfer_setting Not PII

                    The call transfer settings for the trunk. Can be: enable-all, sip-only and disable-all. See Transfer for more information.

                    secure
                    Optional
                    post boolean Not PII

                    Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See Secure Trunking for more information.

                    cnam_lookup_enabled
                    Optional
                    post boolean Not PII

                    Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See CNAM Lookups for more information.

                    transfer_caller_id
                    Optional
                    post ienum:transfer_caller_id Not PII

                    Caller Id for transfer target. Can be: from-transferee (default) or from-transferor.

                    Example 1
                    Loading Code Sample...
                          
                          
                          

                          Update Trunk

                          Delete a Trunk resource

                          delete
                          https://trunking.twilio.com/v1/Trunks/{Sid}
                          Parameters
                          Parameters in REST API format
                          sid
                          Path
                          delete sid<TK> Not PII

                          The unique string that we created to identify the Trunk resource to delete.

                          Example 1
                          Loading Code Sample...
                                
                                
                                

                                Delete Trunk

                                Rate this page:

                                Need some help?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                Loading Code Sample...
                                      
                                      
                                      

                                      Thank you for your feedback!

                                      Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                      Sending your feedback...
                                      🎉 Thank you for your feedback!
                                      Something went wrong. Please try again.

                                      Thanks for your feedback!

                                      thanks-feedback-gif