Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Voice JavaScript SDK: Edge Locations


(information)

Info

The Twilio Client JavaScript SDK has been renamed to Twilio Voice JavaScript SDK.

Twilio Voice JavaScript SDK lets you select the specific Twilio data center edge locations used when your Twilio Device connects to Twilio. Network communication to and from Twilio will originate/terminate from the fixed, static IP address ranges listed for each edge location. Refer to these ranges if you need to configure your local network to allow communication or apply Quality of Service routing rules to communication with Twilio.

(warning)

Edge Location information for Twilio Voice JavaScript SDK

edge-location-information-for-twilio-voice-javascript-sdk page anchor

By default, the Twilio Voice JavaScript SDK will use Twilio's Global Low Latency (the roaming edge location) routing capability to determine which data center is closest to your user, establishing a connection through Twilio's nearest point of presence.

Global Low Latency uses latency-based DNS lookups to determine the nearest data center. You may want to override this in some cases, especially when your users are working from a fixed location and using a DNS server in another edge location.

(information)

Info

GLL (roaming edge location) requires the upstream DNS to support RFC 7871. See GLL requirements for more information.

If you are operating a restricted network that requires allowing of media IPs, our recommendation is to specify the edge location in your application. Twilio will continue to expand our Global Low Latency (the roaming edge location) footprint in the future by adding more edges with different IP ranges and leaving the edge selection up to Global Low Latency could result in connections being established to edges that are not allowed by your infrastructure which may result in one-way audio or call set up failures.

Use any one of the available edge locations as the edge parameter. Leaving the value undefined will cause Twilio to default to its Global Low Latency routing, which cause the Device to establish its connection to the Twilio edge closest to the user.


(information)

Info

For connectivty and bandwidth requirements including IP address list and ports see Voice Platform SDKs' Network Connectivity Requirements

Example Usage

example-usage page anchor

The examples below show two methods for setting an edge location.

Option 1 instantiates a new Twilio.Device with token and options arguments.

Option 2 instantiates a new Twilio.Device without the options argument. With this method, you can update the device options with device.updateOptions(options).

Force connections through Twilio Ireland

force-connections-through-twilio-ireland page anchor

Option 1:


_10
const device = new Twilio.Device(token, { edge: "dublin" });

Option 2:


_10
const device = new Twilio.Device(token);
_10
device.updateOptions({ edge: "dublin" });

Force connections through Twilio US East Coast edge over your private Interconnect connection to that edge

force-connections-through-twilio-us-east-coast-edge-over-your-private-interconnect-connection-to-that-edge page anchor

Option 1:


_10
const device = new Twilio.Device(token, { edge: "ashburn-ix" });

Option 2:


_10
const device = new Twilio.Device(token);
_10
device.updateOptions({ edge: "ashburn-ix"});

Let Twilio choose the nearest edge

let-twilio-choose-the-nearest-edge page anchor

_10
const device = new Twilio.Device(token);


By default, the SDK automatically reconnects the WebSocket connection to the same edge location when it is unreachable, or when the SDK encounters a network error that results in a WebSocket disconnect. But if Twilio.Device.Options.edge parameter is supplied as an array of edge names, the SDK will enable automatic Edge fallback functionality. The diagram below illustrates the logic that is executed to perform the fallback.

Edge fallback diagram. See paragraph below for full details.Rate this page:

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.