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.
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:
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.
You must POST the following parameters:
|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:
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:
Set a parameter on your SIP URI to specify what transport protocol you want to use. You may use
TLS. By default, Twilio sends your SIP INVITE over
UDP. Change this by using the transport parameter:
Also, when using
transport=tls, this will only encrypt SIP signaling messages and not
RTP. To use
SRTP and to encrypt SIP signaling, please add a parameter
secure=true to your SIP URI:
You may POST the following parameters:
|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.|
Basic SIP dial using the REST API.
Pass user and password to your SIP call for authentication.
Pass headers to your SIP Dial as part of the SIP URI.