Menu

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?

Trunks

The Trunks resource represents a SIP trunk in your Twilio account. A Trunk owns 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.

Actions

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


List All Trunks

Back To Top

GET /Trunks

Get a paged listing of all SIP Trunks for your account:

        
        
        
        


        Create a SIP Trunk

        Back To Top

        POST /Trunks
        

        Create a new SIP Trunk:

              
              
              
              
              Names in PHP format
              friendlyName
              Optional
              post string Not PII

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

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

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

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

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


              Retrieve a SIP Trunk

              Back To Top

              GET /Trunks/{Trunk SID}
              

              Get instance data for a particular SIP Trunk:

                    
                    
                    
                    


                    Update a SIP Trunk

                    Back To Top

                    POST /Trunks/{Trunk SID}
                    

                    Update the properties of a SIP Trunk:

                          
                          
                          
                          
                          Names in PHP format
                          sid
                          Required
                          post sid<TR> Not PII

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

                          friendlyName
                          Optional
                          post string Not PII

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

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

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

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

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


                          Delete a Trunk

                          Back To Top

                          DELETE /Trunks/{Trunk SID}
                          

                          Remove a SIP trunk instance from your account:

                                
                                
                                
                                

                                Example Response

                                A successful request returns an HTTP status code 204 and an empty body.

                                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.