You're viewing the documentation for the 2.X version of the Voice JavaScript SDK. View the Migration Guide to learn how to migrate from 1.X to 2.X or view the 1.x-specific documentation.
While the quickstarts enable you to quickly set up a functional application for making and receiving phone calls via a web browser in just a few minutes, the reference components offer flexible building blocks for your Twilio Voice applications. Designed around common Twilio Voice use cases, these components leverage Web Components to showcase integrated backend and frontend implementations. You can easily incorporate these components into your application or use them as a foundation for your development needs.
Before proceeding, take a moment to explore how the JavaScript SDK works and review the getting started page to familiarize yourself with key concepts.
The reference components demonstrate several common Twilio Voice use cases. For detailed implementation guidance, visit the Twilio Voice JavaScript Reference Components repository. These use cases include:
git clone https://github.com/twilio/twilio-voice-js-reference-components.git
.env
file and initialize the following environment variables under the twilio-voice-js-reference-components
folder. Go through the quickstarts for more information about these variables.1# Port number to run the server on2PORT=303034# Twilio account sid5ACCOUNT_SID=ACxxxxxxxxxxxxxx67# Twilio API key8API_KEY_SID=SKxxxxxxxxxxxxxx910# Twilio API secret11API_KEY_SECRET=xxxxxxxxxxxxxx1213# Twilio TwiML App sid where the Voice Request URL is set to14# https://yourdomain/twilio-voice-dialer/twiml15APP_SID=APxxxxxxxxxxxxxx1617# Twilio auth token18AUTH_TOKEN=xxxxxxxxxxxxxx1920# Caller ID21CALLER_ID=+112345678902223# Callback base URL24CALLBACK_BASE_URL=https://foo.ngrok.dev2526# Default identity to use27DEFAULT_IDENTITY=alice
npm install
twilio-voice-js-reference-components
folder.npm start