Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now

Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

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

Names in PHP format
accountSid
sid<AC> Not PII

The SID of the Account that created the Trunk resource.

domainName
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.

disasterRecoveryMethod
http_method Not PII

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

disasterRecoveryUrl

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.

friendlyName
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.

cnamLookupEnabled
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.

authType
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.

authTypeSet
string[] Not PII

Reserved.

dateCreated
date_time<iso8601> Not PII

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

dateUpdated
date_time<iso8601> Not PII

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

sid
sid<TR> 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
Names in None 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.

recording
Optional
post enum:recording_setting 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.

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.

Example
        
        
        
        

        Fetch a Trunk resource

        get
        https://trunking.twilio.com/v1/Trunks/{Sid}
        Parameters
        Names in None format
        sid
        Required
        get sid<TR> Not PII

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

        Example
              
              
              
              

              Read multiple Trunk resources

              get
              https://trunking.twilio.com/v1/Trunks
              Example
                    
                    
                    
                    

                    Update a Trunk resource

                    post
                    https://trunking.twilio.com/v1/Trunks/{Sid}
                    Parameters
                    Names in None format
                    sid
                    Required
                    post sid<TR> 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.

                    recording
                    Optional
                    post enum:recording_setting 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. See Recording 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.

                    Example
                          
                          
                          
                          

                          Delete a Trunk resource

                          delete
                          https://trunking.twilio.com/v1/Trunks/{Sid}
                          Parameters
                          Names in None format
                          sid
                          Required
                          delete sid<TR> Not PII

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

                          Example
                                
                                
                                
                                
                                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 browsing the Twilio tag on Stack Overflow.