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.

Enable Debugging with the Twilio Voice JavaScript SDK

The Twilio Voice JavaScript SDK (formerly "Twilio Client") allows users to enable reporting of additional debug-level logging details in your browser console. These debug logs can be helpful for diagnosing issues with your application or connection. This guide will walk you through enabling and viewing the debug-level logging in your Twilio Voice JS SDK application.

Enable Debugging in the Twilio Voice JavaScript Quickstart

When using the Twilio Voice JavaScript SDK Quickstarts, debugging is enabled by default. To see this in the code, open the file Quickstart.js, and find debug: true, on Line 68, under the Twilio.Device function.

Your code should look something like this:

...
// Instantiate a new Twilio.Device
function intitializeDevice() {
  logDiv.classList.remove("hide");
  log("Initializing device");
  device = new Twilio.Device(token, {
    debug: true,
...

Enable Debugging with Twilio.js

For your custom Twilio Voice JavaScript SDK application, debugging works much the same way. 

Twilio.js 1.5+

In SDK 1.5.x and later, Twilio.Device allows for direct construction, letting users run multiple instances on the same page. When you pass a token to Twilio.Device, Device.setup() is automatically run. This means you won't need to call it out separately, and you can just add the debug: true, option here. This is the method used in the latest versions of the Quickstart applications. Take a look at the sample code above for an example.

Twilio.js 1.3.x - 1.4.x

In older WebRTC versions of the Twilio Voice JavaScript SDK, debugging needs to be called out as an option in Twilio.Device.setup().

Twilio.Device.setup(token, { debug: true });

For full documentation, see Twilio Voice JS SDK: Twilio.Device.

View Debug Logs

Once enabled, you'll be able to see additional logging information about your session in the browser console.

client_debug_400px.png

The browser console can be viewed via the following methods:

Browser OS Commands
Chrome Mac OS Command + Option + J
Chrome Windows Control + Shift + J
Firefox Mac OS Command + Shift + J
Firefox Windows Control + Shift + J
Edge Windows Press F12, then Control + 2
Safari Mac OS Command + Option + C
Note: The Develop menu must first be enabled.

The Console logs the Twilio Access Token used for your session, as well as any errors. If you need to reach out to our Support team, please include any details from your debugging logs, as these will be helpful for diagnosing your issues.

Have more questions? Submit a request
Powered by Zendesk