Open eric-brechemier opened 5 years ago
Phil Nash, a Twilio evangelist, confirmed on Stack Overflow that the region
parameter is not supported with SIP registration, only with SIP trunking:
The region parameter here is useful if you are sending SIP to your own infrastructure that is hosted nearer to one of these regions, or if you are using Twilio SIP trunking in a different region. — https://stackoverflow.com/a/47147200
The documentation no longer includes these limitations.
To specify the geographic region from which Twilio will send SIP-out traffic towards your communication infrastructure, you must include the
region
parameter in your SIP URI. For example, if theregion=ie1
parameter is included in your SIP URI, Twilio will send the SIP traffic from the Europe Ireland region:<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial> <Sip>sip:alice@example.com;region=ie1</Sip> </Dial> </Response>
Region Location us1
North America Virginia us2
North America Oregon ie1
Europe Ireland de1
Europe Frankfurt sg1
Asia Pacific Singapore jp1
Asia Pacific Tokyo br1
South America São Paulo au1
Asia Pacific Sydney If the
region
parameter is not specified, Twilio will send SIP-out traffic from the North America Virginia region. — https://www.twilio.com/docs/voice/twiml/sip#Sip-URI-region
and
Twilio’s SIP Registrar is deployed per Edge Location; the bindings stored in the SIP Registrar are shared between Edge Locations, so your locally-registered endpoints are globally reachable. You can register with any Edge Location, but 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.
When you configure your SIP device, you specify the SIP Domain URI, including the Twilio Edge Location with which you want to register.
{domain-name}.sip.{edge-location}.twilio.com
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 was named mydomain, and you wanted to register to our Sydney edge, you would configure your device as follows:
- Registration Domain: mydomain.sip.twilio.com
- Outbound Proxy: sip.sydney.twilio.com
If your SIP device doesn't use an Outbound Proxy in its configuration, then you should use the full mydomain.sip.sydney.twilio.com URI as the Registration Domain.
— https://www.twilio.com/docs/voice/api/sip-registration#register-your-sip-endpoint
Twilio is rolling out its global infrastructure to make it available in different regions. There are only two regions available at the moment, but one is in Europe:
US is the default and Ireland must be explicitly selected. A third region, in pilot, is not available yet in my account:
Using regional call routing in Ireland should eventually avoid calls from Europe to Europe transiting through servers in the US. There are two important limitations however, which are redhibitory at this point:
Note that during this initial phase of the rollout of Twilio Regions, Twilio does not guarantee that all data will remain within your selected Region.
and
Not all products and features are available in Regions outside of US1. For a full list of regional product and feature availability, refer to our Regional product and feature availability page.
Each product must be configured in the target region. It is not possible to simply copy or move a configuration from one region to another. What is more confusing is that as long as all your products are in the same region, the region is not displayed in the list of products on the left:
When a product is available in more than one region, there is now a drop-down list on the right of the pin icon. The pin only pins the default region, US1. It is necessary to select a different region in the drop-down on the right to pin each separate region individually:
I have chosen to pin all the products I use in both US and Ireland, when they are available. I will then migrate my settings from US to Ireland progressively:
A major hurdle is that TwiML Bins are only available in the US, and they cannot be configured as easily for incoming calls routed through Ireland. While the configuration in the US allows to select a TwiML Bin directly:
Only simple webhooks can be selected to handle incoming calls in Ireland, this option no longer includes TwiML Bin and Twilio Functions like in the US:
The lack of support for TwiML Bins makes the migration to the Ireland region too cumbersome for me at this point.
Regions identifiers have now been replaced with names of cities for edge locations:
Region ID Location Replaced by Edge Location au1 Australia sydney br1 Brazil sao-paulo ie1 Ireland dublin de1 Frankfurt frankfurt jp1 Japan tokyo sg1 Singapore singapore us1 US East Coast (Virginia) ashburn us2 US West Coast (Oregon) umatilla gll Use Twilio's Global Low Latency routing to select the data center with the lowest-latency connection to your user. roaming
us2
region is not available for Client
The documentation of the SIP region
parameter still references the shorter legacy identifiers, including us2
however:
Region Location us1 North America Virginia us2 North America Oregon ie1 Europe Ireland de1 Europe Frankfurt sg1 Asia Pacific Singapore jp1 Asia Pacific Tokyo br1 South America São Paulo au1 Asia Pacific Sydney If the
region
parameter is not specified, Twilio will send SIP-out traffic from the North America Virginia region.
I have not had much success with changing the region for the SIP registration: when the region is not included or differs from us1
in the domain configured with Linphone, the registration fails. There is a separate parameter called Route
in the configuration where a separate server address and parameters can be configured, but this is apparently only used to route calls, not for the initial SIP registration.
I have added the parameter ;region=roaming
in the configuration of the server domain in an attempt to reduce the latency of outgoing calls. Calls work as expected but I could not confirm at this point whether it has any effect on the latency of the calls.
I have not changed the configuration of incoming calls at this point.
According to the documentation of the
<Sip>
element:and