Programmable Voice SIP

Before you Begin

Before you can use Programmable Voice SIP, you must sign up for a Twilio account (if you don't - already have one). To sign up for an account click here.

Overview

Connect your communications infrastructure to Twilio and start building programmable voice applications, such as call centers and IVRs, with Twilio’s powerful and flexible voice capabilities. You can connect to Twilio over the public internet or alternatively via a private connection using Twilio’s Interconnect. Programmable Voice SIP let’s you route your voice calls with global reach to any landline phone, mobile phone, browser, mobile app, or any other SIP endpoint.

The following diagram illustrates the position of the Twilio Cloud in the call flows.

Programmable Voice SIP Diagram

What’s SIP?

Session Initiation Protocol (SIP) is a standardized communications protocol that has been widely adopted for managing multimedia communication sessions for voice and video calls. SIP may be used to establish connectivity between your communications infrastructure such as an on-premise or virtual PBX and Twilio's communications platform.

Sending SIP to Twilio

Twilio’s Programmable Voice SIP product enables you to use your existing SIP communications infrastructure to initiate SIP sessions with the Twilio Cloud and use Twilio’s TwiML language and/or Twilio’s REST APIs to create advanced voice applications. Learn how to get started connecting your SIP communications infrastructure to the Twilio Cloud.

Receiving SIP from Twilio

Twilio’s Programmable Voice SIP product enables your advanced voice applications to initiate SIP sessions from the Twilio Cloud towards your existing SIP communications infrastructure using Twilio’s TwiML language and/or Twilio’s REST APIs. Learn how to get started connecting the Twilio Cloud to your SIP communications infrastructure.

SIP Connection - Technical Specifications

The following section summarizes the SIP capabilities offered by Twilio.

Media codec

Twilio uses G.711/μ-law CODEC for media. This is the most popular CODEC used by the carriers so transcoding is unnecessary.

DTMF

Twilio implements RFC-2833 for sending and receiving DTMF.

Securing SIP Traffic using TLS

Encryption ensures that the call media and associated signaling remains private during transmission. Transport Layer Security (TLS) provides encryption for SIP signaling.

Specifications:

  • Sending SIP to Twilio: Twilio will automatically respond to requests for TLS and supports the following Crypto suites: AES_CM_128_HMAC_SHA1_80 and AES_CM_128_HMAC_SHA1_32. Both may be included in your order of preference.
  • Receiving SIP from Twilio: Only a single crypto suite will be advertised: AES_CM_128_HMAC_SHA1_80
  • If you are using TwiML to send SIP from Twilio, to enable encryption you must use the transport=tls parameter in your SIP noun in your Dial verb.
    By default port 5061 will be used for TLS, however you may specify the port you wish to use in your URI.
  • Importing Twilio's Root CA Certificate TLS is used to encrypt SIP signaling between SIP endpoints. In order for this to function properly it is required that certain devices in the network import a CA certificate. Twilio uses certificates from a CA (Certificate Authority). It is important that you add the following root certificate to your communications infrastructure to establish its authenticity. Download Twilio's CA certificate.

    It is important to note that Twilio uses a wildcard certificate which can be used for multiple subdomains of a domain (*.sip.twilio.com). If your network element does not support wildcarded certificates please disable certificate validation.

IP address whitelist

Prepare your communications infrastructure to make sure that your SIP infrastructure has connectivity to the Twilio Cloud and vice versa. To ensure that your communications infrastructure doesn’t block communication, you must update your whitelist. We strongly encourage you to whitelist all of the following IP address ranges and ports on your firewall for SIP signaling and RTP media traffic.

This is important if you have Numbers in different regions as well as for availability purposes (e.g. if North America Virginia gateways are down, then North America Oregon gateways will be used).

North America Virginia Gateways:

Signalling IPs:

54.172.60.0
54.172.60.1
54.172.60.2
54.172.60.3
Ports: 5060 (UDP/TCP), 5061 (TLS)
Media IPs:
Any IP address
Port Range: 10,000 to 20,000 (UDP)

North America Oregon Gateways (reserved for future use):

Signalling IPs:

54.244.51.0
54.244.51.1
54.244.51.2
54.244.51.3
Ports: 5060 (UDP/TCP), 5061 (TLS)

Media IPs:

Any IP address
Port Range: 10,000 to 20,000 (UDP)

Europe Ireland Gateways (reserved for future use):

Signalling IPs:

54.171.127.192
54.171.127.193
54.171.127.194
54.171.127.195
Ports: 5060 (UDP/TCP), 5061 (TLS)

Media IPs:

Any IP address
Port Range: 10,000 to 20,000 (UDP)

Asia Pacific Tokyo Gateways (reserved for future use):

Signalling IPs:

54.65.63.192
54.65.63.193
54.65.63.194
54.65.63.195
Ports: 5060 (UDP/TCP), 5061 (TLS)

Media IPs:

Any IP address
Port Range: 10,000 to 20,000 (UDP)

Asia Pacific Singapore Gateways (reserved for future use):

Signalling IPs:

54.169.127.128
54.169.127.129
54.169.127.130
54.169.127.131
Ports: 5060 (UDP/TCP), 5061 (TLS)

Media IPs:

Any IP address
Port Range: 10,000 to 20,000 (UDP)

Asia Pacific Sydney Gateways (reserved for future use):

Signalling IPs:

54.252.254.64
54.252.254.65
54.252.254.66
54.252.254.67
Ports: 5060 (UDP/TCP), 5061 (TLS)

Media IPs:

Any IP address
Port Range: 10,000 to 20,000 (UDP)

South America Sao Paulo Gateways (reserved for future use):

Signalling IPs:

177.71.206.192
177.71.206.193
177.71.206.194
177.71.206.195
Ports: 5060 (UDP/TCP), 5061 (TLS)

Media IPs:

Any IP address
Port Range: 10,000 to 20,000 (UDP)

Glossary

communications infrastructure
A broad term to refer to IP-PBX, SBC, IP-phones, etc…
SIP Endpoint
IP-phone or a soft client with which a user initiates a VoIP call
SIP URI
Equivalent to a SIP phone number and takes the form, sip:username@SIPDomain
Twilio SIP Domain
It takes the form {example}.sip.{region}.twilio.com where {example} is specified by customer and {region} is the datacenter where the registrar is located. Initially us1 only.