Black Friday / Cyber Monday Alert: Due to increased traffic demand on mobile communication networks, we are expecting potential congestion for US carrier networks during the Black Friday and Cyber Monday period. Customers may experience intermittent SMS and MMS delivery delays. Please refer to our Black Friday / Cyber Monday FAQ page and our Twilio Status page for more information.

Getting Started with the Twilio Voice JavaScript SDK

The Twilio Voice JavaScript SDK (formerly "Twilio Client") enables web browsers and mobile devices to send and receive voice calls through a two-way streaming audio pipe. Software developers can incorporate communications features like live collaboration, softphones, web conferencing, and click-to-talk into their applications. End users will enjoy more immersive in-app experiences in browsers, smartphones, and connected devices. Every web and mobile application is now a phone.

The Voice JavaScript SDK

Twilio Client has been renamed to the Twilio Voice JavaScript SDK as of version 2.0. The 2.x branch has a number of new quality of life improvements, and changes to promote best practices. For full details, see Migrating to Voice JavaScript SDK 2.0.

Voice SDK Browser Call Components

The Voice JS SDK requires an installed web browser that supports WebRTC, and an internet connection. Before placing and receiving browser calls using the SDK, the following will also need to be configured:

  • A UI page for placing and receiving calls in your browser.
  • An Access Token containing your Twilio account credentials, and the inbound and outbound calling capabilities granted.
    • Outbound: A TwiML App is required for placing outgoing calls. This is configured with a voice webhook url that responds with a TwiML <Dial> verb for calling.
    • Inbound: An identity is required for receiving incoming calls. This is used for forwarding incoming calls to the user instance with <Dial> and the <Client> noun.

Here’s how these components work together on an outgoing call:

  1. Upon loading the UI page, it should automatically request an Access token.
  2. Your application responds with the token, at which point the UI page is ready to be used.
  3. A valid E.164 phone number is submitted to dial in the UI page, which opens an active connection to Twilio, and sends the number to the TwiML App in your token.
  4. The TwiML App forwards this request to the voice webhook that responds with <Dial> TwiML.
  5. Twilio bridges your Client call to the new outbound call to the submitted phone number.

Setting Up a Twilio Voice JavaScript SDK app

A Voice SDK app can be built from the ground-up, or built in to your existing application. For full details, please see the the following Twilio Docs resources:

To get up and running quickly, or just test the Voice JS SDK out, we recommend using our quickstart guides found here: Getting Started - Voice JavaScript SDK

How Much Does a Voice SDK Call Cost?

Voice SDK connections to Twilio have a single low per-minute price from anywhere in the world you can connect to Twilio. When placing or receiving calls from other phone numbers or SIP addresses, the standard Twilio voice call pricing would apply for these call legs. For full details, see How Does Twilio Voice JavaScript and Mobile SDK Pricing Work.

Additional Resources

Have more questions? Submit a request
Powered by Zendesk