Interface ExtendedOptions

Options that may be passed to PreflightTest constructor for internal testing.




Optional audioContext

audioContext: AudioContext

The AudioContext instance to use

Optional codecPreferences

codecPreferences: Codec[]

An ordered array of codec names that will be used during the test call, from most to least preferred.



Optional deviceFactory

deviceFactory: typeof Device

Device class to use.

Optional edge

edge: undefined | string

Specifies which Twilio Data Center to use when initiating the test call. Please see this page for the list of available edges.



Optional fakeMicInput

fakeMicInput: undefined | false | true

If set to true, the test call will ignore microphone input and will use a default audio file. If set to false, the test call will capture the audio from the microphone. Setting this to true is only supported on Chrome and will throw a fatal error on other browsers



Optional fileInputStream

fileInputStream: MediaStream

File input stream to use instead of reading from mic

Optional getRTCIceCandidateStatsReport

getRTCIceCandidateStatsReport: Function

The getRTCIceCandidateStatsReport to use for testing.

Optional iceServers

iceServers: RTCIceServer[]

An array of custom ICE servers to use to connect media. If you provide both STUN and TURN server configurations, the test will detect whether a TURN server is required to establish a connection.

The following example demonstrates how to use Twilio's Network Traversal Service to generate STUN/TURN credentials and how to specify a specific edge location.

import Client from 'twilio';
import { Device } from 'twilio-client';

// Generate the STUN and TURN server credentials with a ttl of 120 seconds
const client = Client(twilioAccountSid, authToken);
const token = await client.tokens.create({ ttl: 120 });

let iceServers = token.iceServers;

// By default, global will be used as the default edge location.
// You can replace global with a specific edge name for each of the iceServer configuration.
iceServers = iceServers.map(config => {
  let { url, urls, ...rest } = config;
  url = url.replace('global', 'ashburn');
  urls = urls.replace('global', 'ashburn');

  return { url, urls, ...rest };

// Use the TURN credentials using the iceServers parameter
const preflightTest = Device.runPreflight(token, { iceServers });

// Read from the report object to determine whether TURN is required to connect to media
preflightTest.on('completed', (report) => {


Optional logLevel

logLevel: undefined | string

Log level to use in the Device.



Optional rtcConfiguration

rtcConfiguration: RTCConfiguration

An RTCConfiguration to pass to the RTCPeerConnection constructor.

Optional signalingTimeoutMs

signalingTimeoutMs: undefined | number

Amount of time to wait for setting up signaling connection.



Generated using TypeDoc