@twilio/voice-sdk
    Preparing search index...

    Interface Options

    Options passed to PreflightTest constructor.

    interface Options {
        codecPreferences?: Codec[];
        edge?: string;
        fakeMicInput?: boolean;
        iceServers?: RTCIceServer[];
        logLevel?: string;
        signalingTimeoutMs?: number;
    }
    Index

    Properties

    codecPreferences?: Codec[]

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

    ['pcmu','opus']
    
    edge?: string

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

    roaming
    
    fakeMicInput?: boolean

    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

    false
    
    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/voice-sdk';

    // 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) => {
    console.log(report.isTurnRequired);
    });
    null
    
    logLevel?: string

    Log level to use in the Device.

    'error'
    
    signalingTimeoutMs?: number

    Amount of time to wait for setting up signaling connection.

    10000