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

    Class AddVoiceEventListener<T>

    Adds a voice event listener to the client.

    The event name (e.g. "incoming" or VoiceClientEvent.Incoming).

    The event listener function.

    Optional parameters for adding the event listener, containing an optional custom voice device.

    A promise which resolves to an object containing the unsubscribe function to remove the listener.

    import { createClient } from "@twilio/flex-sdk";
    import { AddVoiceEventListener, VoiceClientEvent } from "@twilio/flex-sdk/actions/Voice";

    const client = await createClient("SDK_TOKEN");

    const addVoiceEventListener = new AddVoiceEventListener(VoiceClientEvent.Incoming, (call) => {
    // Handle incoming call
    });
    const { unsubscribe } = await client.execute(addVoiceEventListener);

    // call unsubscribe if defined to remove the listener when needed
    unsubscribe();

    Type Parameters

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Parameters

      • ctx: {}

      Returns Promise<{ unsubscribe: () => void }>