Menu

Expand
Rate this page:

Making SIP Calls

Use Twilio's REST API to connect to your SIP-enabled endpoints. With this feature, you can set up a VoIP session using SIP. If you are unfamiliar with SIP, or want more information on how Twilio works with your SIP endpoint, please see the SIP overview.

HTTP POST to Calls

Initiate SIP sessions via the REST API by POSTing to the same calls resource used to initiate traditional phone calls (see making calls for more information). Once the call is connected, Twilio will then fetch the TwiML you specify for the call. For example, make a SIP call by POSTing to your account's calls list resource URI:

 /2010-04-01/Accounts/{AccountSid}/Calls 

POST Parameters

All outgoing call features and parameters are supported -- the only difference is that you pass different values in the "To" and "From" parameters. In the “To” parameter, put the SIP URI you are trying to connect to. In the “From” parameter, specify the user you want to show up in the From header in the SIP request.

Required Parameters

You must POST the following parameters:

Parameter Description
To The SIP URI to which you want to connect

The 'To' parameter specifies a SIP address for Twilio to connect to. The body of the URI element should be a valid SIP URI under 255 characters. For example:

sip:michael@example.com

Headers

Pass headers in the To parameter by appending them to the end of the SIP URI. For certain sdks, & will need encoding as %26. The total characters passed in a header must be under 1024. For example:

sip:michael@example.com?mycustomheader=foo&myotherheader=bar 

Transport

Set a parameter on your SIP URI to specify what transport protocol you want to use. Currently, this is limited to TCPand UDP. By default, Twilio sends your SIP INVITE over UDP. Change this by using the transport parameter:

sip:jack@example.com;transport=tcp

Optional Parameters

You may POST the following parameters:

Parameter Description
From This value is used to populate the username portion of the From header that is passed to the SIP endpoint. This may be any alphanumeric character, as well as the plus, minus, underscore, and period characters (+-_.). No spaces or other characters are allowed.
SipAuthUsername Your authentication username.
SipAuthPassword The password for the user.

Create a SIP Dial

Basic SIP dial using the REST API.

Loading Code Sample...
        
        

        Create Basic SIP Dial

        Create SIP Dial with Authentication

        Pass user and password to your SIP call for authentication.

        Loading Code Sample...
              
              

              Create SIP Dial with Authentication

              Pass Headers in your SIP URI

              Pass headers to your SIP Dial as part of the SIP URI.

              Loading Code Sample...
                    
                    

                    Create SIP Dial using Pass Headers in the SIP URI

                    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