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 unique ID of the Account that owns this Trunk.

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 always end with pstn.twilio.com. See Termination Settings for more information.

disasterRecoveryMethod
http_method Not PII

The HTTP method Twilio will use when requesting the DisasterRecoveryUrl. Either GET or POST.

disasterRecoveryUrl
url Not PII

The HTTP URL that Twilio will request if an error occurs while sending SIP traffic towards your configured Origination URL. Twilio will retrieve TwiML from this URL and execute those instructions like any other normal TwiML call. See Disaster Recovery for more information.

friendlyName
string Not PII

A human-readable name for the Trunk.

secure
boolean Not PII

The Secure Trunking settings for this trunk. If turned on, all calls going through this trunk will be secure using SRTP for media and TLS for signalling. If turned off, then RTP will be used for media. TwiML from this URL and execute those instructions like any other normal TwiML call. See Secure Trunking for more information.

recording
object Not PII

The recording settings for this trunk. If turned on, all calls going through this trunk will be recorded and the recording can either start when the call is ringing or when the call is answered. TwiML from this URL and execute those instructions like any other normal TwiML call. See Recording for more information.

cnamLookupEnabled
boolean Not PII

The Caller ID Name (CNAM) lookup setting for this trunk. If turned on, all inbound calls to this SIP Trunk from the United States and Canada will 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 you have mapped to your domain. The possible values are IP_ACL and CREDENTIAL_LIST. If you have both setup for your domain, both will be returned comma delimited. If you do not have one setup for your domain, it will not be able to receive any traffic.

authTypeSet
string[] Not PII

dateCreated
date_time<iso8601> Not PII

The date this Activity was created.

dateUpdated
date_time<iso8601> Not PII

The date this Activity was updated.

sid
sid<TR> Not PII

A 34 character string that uniquely identifies the SIP Trunk in Twilio.

url
url Not PII

The URL for this resource, relative to https://trunking.twilio.com

links
uri_map Not PII


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 human-readable name for the Trunk.

              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 always end with pstn.twilio.com. See Termination Settings for more information.

              disasterRecoveryUrl
              Optional
              post url Not PII

              The HTTP URL that Twilio will request if an error occurs while sending SIP traffic towards your configured Origination URL. Twilio will retrieve TwiML from this URL and execute those instructions like any other normal TwiML call. See Disaster Recovery for more information.

              disasterRecoveryMethod
              Optional
              post http_method Not PII

              The HTTP method Twilio will use when requesting the DisasterRecoveryUrl. Either GET or POST.

              recording
              Optional
              post ienum:recording_setting Not PII

              The recording settings for this trunk. If turned on, all calls going through this trunk will be recorded and the recording can either start when the call is ringing or when the call is answered. See Recording for more information.

              secure
              Optional
              post boolean Not PII

              The Secure Trunking settings for this trunk. If turned on, all calls going through this trunk will be secure using SRTP for media and TLS for signalling. If turned off, then RTP will be used for media. See Secure Trunking for more information.

              cnamLookupEnabled
              Optional
              post boolean Not PII

              The Caller ID Name (CNAM) lookup setting for this trunk. If turned on, all inbound calls to this SIP Trunk from the United States and Canada will 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

                          A 34 character string that uniquely identifies the SIP Trunk in Twilio.

                          friendlyName
                          Optional
                          post string Not PII

                          A human-readable name for the Trunk.

                          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 always end with pstn.twilio.com. See Termination Settings for more information.

                          disasterRecoveryUrl
                          Optional
                          post url Not PII

                          The HTTP URL that Twilio will request if an error occurs while sending SIP traffic towards your configured Origination URL. Twilio will retrieve TwiML from this URL and execute those instructions like any other normal TwiML call. See Disaster Recovery for more information.

                          disasterRecoveryMethod
                          Optional
                          post http_method Not PII

                          The HTTP method Twilio will use when requesting the DisasterRecoveryUrl. Either GET or POST.

                          recording
                          Optional
                          post ienum:recording_setting Not PII

                          The recording settings for this trunk. If turned on, all calls going through this trunk will be recorded and the recording can either start when the call is ringing or when the call is answered. See Recording for more information.

                          secure
                          Optional
                          post boolean Not PII

                          The Secure Trunking settings for this trunk. If turned on, all calls going through this trunk will be secure using SRTP for media and TLS for signalling. If turned off, then RTP will be used for media. See Secure Trunking for more information.

                          cnamLookupEnabled
                          Optional
                          post boolean Not PII

                          The Caller ID Name (CNAM) lookup setting for this trunk. If turned on, all inbound calls to this SIP Trunk from the United States and Canada will 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.