SIP Registration allows you to connect your SIP-enabled devices or softphones directly to Twilio, and use the Programmable Voice API to build powerful call-handling logic without standing up complex hardware or physical connections to your network. You can use the Twilio applications you know and love to connect to SIP endpoints the same way you do to the PSTN or WebRTC/Mobile clients. Until now, however, while your registered SIP devices could make and receive calls globally, your endpoints could only register to Twilio via our US-East data center in Ashburn, VA, USA.
Earlier this year, we announced new Twilio Edge Locations to improve application performance. With this launch, we are building on top of what we delivered to improve the end-user experience.
Today, we are happy to announce that Twilio SIP Registration is now accessible via our public and private Edge Locations worldwide. Now you can register your SIP device to the Edge Locations closest to where you are located, and add increased performance and resiliency to your device connections.
Registration via Edge Locations improve the performance of your applications with the following benefits:
- Reduced latency and packet loss resulting in faster signaling and higher quality media streams.
- Increased flexibility and options for redundancy between Edge Locations.
- Improved security, quality of service and availability of private connections via Twilio Interconnect.
How does it work?
There isn’t any change in how you set the SIP Domain up on your Twilio account. You create your SIP Domain in your Twilio account under the Programmable Voice product, and you automatically get the Edge-specific domains to use when connecting your SIP infrastructure – but now SIP Registration is included too.
Register your SIP Endpoint
Now, when you register your SIP endpoint, you can use any of our worldwide Edge Locations. While you can register with any Edge Location, typically you would register with the Edge Location which is physically closest to your device location, as this will give you the best performance and quality, due to reduced latency, jitter, and packet loss. You can also switch between Edge Locations if you like, for failover, changing locations, or other reasons.
We have both Public and Private Edge locations throughout the globe:
The format for the Edge-specific domains is now as follows:
When you configure your SIP endpoint to
REGISTER to Twilio, you specify the SIP Domain URI, including the Twilio Edge Location you want to register with.
If you do not specify an Edge Location in either your registration URI, or your outbound proxy URI, the registration will default to Twilio’s Ashburn, VA, USA datacenter.
Your SIP device may include configuration options for both a Registration Domain and an Outbound Proxy. If that is the case, we suggest using the Twilio Edge Location URI for the Outbound Proxy, and your SIP Domain URI for the Registration Domain. For example, if your domain is named “mydomain”, and you wanted to register in our Sydney datacenter, you would use the following SIP URIs:
- Registration Domain:
- Outbound Proxy:
If your SIP device does not use an Outbound Proxy in its configuration, then use the full
mydomain.sip.sydney.twilio.com URI as the Registration Domain.
Receive calls on your Registered SIP Endpoint from Twilio
Calling a registered SIP endpoint works the same as calling any other SIP URI, only you will now be using the AOR of your registered SIP Endpoint. Keep in mind that calls need to be initiated by your application, just like any other Programmable Voice SIP call.
When calling your registered SIP Endpoint, you should use the general SIP Domain URI, omitting the Edge Location from the URI, i.e.:
When calling a Registered SIP AOR, Twilio will call all of the SIP Endpoints registered using that AOR in parallel across all edge locations, so the specific Edge Location does not need to be specified in the SIP URI you call. Also note that if you have multiple SIP Endpoints registered under the same AOR, then all registered devices will ring simultaneously. See Limits.
For backwards compatibility, the
us1-ix legacy regions are still allowed, but only when calling SIP Endpoints which are specifically registered to the Ashburn, VA, USA datacenter (over public Internet or Twilio Interconnect, respectively). Any other region or edge specified when calling a registered SIP endpoint will return an error. We strongly suggest you adjust any legacy code to no longer use the regional domain when calling a registered SIP endpoint.
Send Calls from your Registered SIP Endpoints to Twilio
SIP calls from your registered Endpoint to your Twilio SIP Domain are treated just like any inbound SIP call received on that domain. After the INVITE is authenticated, Twilio will invoke the Voice URL configured on your SIP domain. See the ‘Send SIP to Twilio’ section for details.
Normally, your SIP Endpoint would send its INVITEs to the edge-specific domain that it registered with, but they can be sent to any Twilio Edge Location:
When the calls reach the Edge-specific Twilio domain, they will invoke the application configured for that domain. If you are looking to make outbound calls to the PSTN, we have some example code on how to do that in our SIP Registration documentation.
Improve application performance and resiliency
Twilio is constantly working on improving the overall user experience as more businesses build global applications.
Ready to increase the performance and resilience of your devices' connections? See our list of public edge connections and private interconnects and find the one that is best for you.
Bill Harrison is a Product Manager of SIP and Voice Connectivity at Twilio. He spends way too much time reading PCAPs, discussing SIP, coaching youth hockey, and watching his beloved Boston sports teams. He can be reached at billharrison [at] twilio.com