Menu

Expand
Rate this page:

Twilio Client JS SDK: Twilio in the browser

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 set up your device and establish a connection to Twilio. Audio from your device’s microphone is sent to Twilio, and Twilio sends back audio which is played through your device’s speakers, like on a normal phone call. But with Twilio Client, your device need not be a phone.

Client Connection Overview

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.

TwiML Applications

Because Twilio Client connections aren’t made to a specific phone number, Twilio relies on a TwiML Application within your account to determine how to interact with your server. A TwiML 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 TwiML Applications perfect for handling connections from Twilio Client — which is 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 an Access Token. Twilio uses the TwiML response from its request to that Application’s VoiceUrl to direct what happens with the Client connection.

Supported Browsers

The following table indicates the browsers supported by the Twilio Client JS SDK. We support the most recent (N) and the two previous (N-2) versions of these browsers unless otherwise indicated.

Chrome Firefox Safari** Edge***
Android
iOS * *
Linux
macOS
Windows

* Chrome and Firefox for iOS don’t have access to WebRTC APIs, unlike Safari for iOS.

** WebRTC support in Safari started with Safari version 11.

*** We support Chromium-based Edge only. Legacy Edge isn’t supported. See this advisory for more details.

Mobile browsers lack the ability to receive or maintain call connectivity whilst in the background and they do not allow GSM call interruption handling. These lead to poor user experience. To create the best user experience, Twilio recommends understanding these limitations when creating mobile Voice Applications. Twilio also recommends evaluating the iOS and Android SDKs for creating mobile Voice Applications.

Electron Support

Twilio Client JS is also supported on the latest Electron version

Security

Channel Type
Signaling TLS (Secure Web Socket)
Media DTLS-SRTP (AES_CM_128_HMAC_SHA1_80)

Current twilio.js releases

As of version 1.3, twilio.js has been strictly following semantic versioning: minor-level updates only contain feature updates and are completely backward compatible with 1.3.0 and newer. Read more about the current Twilio.js SDK API here.

Deprecated twilio.js releases

Support for twilio.js 1.1 and 1.2 ceased on February 14, 2018. If you are still using either of these versions, please use the Migration Guide to upgrade to the latest version.

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.

Thank you for your feedback!

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

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more