Get Started

REST API: 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. 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 TCP and 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.

Examples

Example 1

Basic SIP dial using the REST API.

Example 2

Pass user and password for authentication.

Example 3

Pass headers as part of the SIP URI.