Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Twilio Client JS SDK: Twilio in the browser

Attention: Please upgrade to the latest version of twilio.js to avoid breaking changes. Google Chrome will introduce these changes by the end of 2019. Versions prior to 1.7.1 will be impacted. See this advisory for details.

Overview

The Twilio Client JS SDK (twilio.js) allows you to make voice calls to and from a web browser and a Twilio TwiML Voice Application. This means you can open inbound and outbound audio connections to Twilio for building softphones, walkie-talkies, conference calls, click-to-talk systems, and more, all from the browser.

Want to get started right away?

Jump right in with our Twilio Client Quickstart!

How It Works

You setup your device and establish a connection to Twilio. Audio from your device's microphone is sent to Twilio, and Twilio plays audio through your device's speakers, like on a normal phone call. But with Twilio Client, your device need not be a phone.

When you initiate a connection using Twilio Client, you're not connecting to another phone directly. Rather, you're connecting to Twilio and instructing Twilio to fetch TwiML from your server to handle the connection. This is analogous to the way Twilio handles incoming calls from a real phone. All the same TwiML verbs and nouns that are available for handling Twilio Voice calls are also available for handling Twilio Client connections. We've also added a new <Client> noun for dialing to a Client.

Twilio Applications

Because Twilio Client connections aren't made to a specific phone number, Twilio relies on a Twilio Application within your account to determine how to interact with your server. A Twilio Application is just a convenient way to store a set of URLs, like the VoiceUrl and SmsUrl on a phone number, but without locking them to a specific phone number. This makes Twilio Applications perfect for handling connections from Twilio Client (which is actually why we created them in the first place).

So when your device initiates a Twilio Client connection to Twilio, a request is made to the VoiceUrl property of an Application within your account. You specify the Application you're connecting to with a Capability Token. Twilio uses the TwiML response from its request to that Application's VoiceUrl to direct what happens with the Client connection.

Supported Browsers

Twilio Client JS requires recent versions of Chrome and Firefox, and Safari 11 or greater.

Chrome Firefox Safari Edge (ORTC) Edge (WebRTC)
Android - - -
iOS * * - -
Linux - - -
macOS - -
Windows - Coming soon

* Chrome and Firefox for iOS do not have access to WebRTC APIs, unlike Safari for iOS.

WebRTC Security

Channel Type
Signaling TLS
Media SRTP

Current Twilio.js Releases

As of 1.3, Twilio.js has been strictly following SemVer: minor-level updates only contain feature updates and are completely backward compatible with 1.3.0 and newer. Documentation for the current Twilio.js SDK API can be found here.

Deprecated Twilio.js Releases

Support for Twilio.js 1.1 and 1.2 ceased on February 14, 2018.

Please use the Migration Guide to upgrade to the newest version of Twilio.js.

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.