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

    Interface VoiceCall

    Interface for controlling voice calls with mute, hold, disconnect, and recording capabilities.

    interface VoiceCall {
        disconnect(): Promise<void>;
        hold(options?: HoldCallOptions): Promise<Task>;
        isMuted(): undefined | boolean;
        isOnHold(): Promise<boolean>;
        mute(): void;
        pauseRecording(pauseBehaviour?: "silence" | "skip"): Promise<void>;
        resumeRecording(): Promise<void>;
        unhold(): Promise<Task>;
        unmute(): void;
    }
    Index

    Methods

    • Hang up current call (if there is one).

      Returns Promise<void>

      import { createClient, StartOutboundCall } from "@twilio/flex-sdk";

      const client = await createClient("SDK_TOKEN");
      const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});

      const voiceCall = await client.execute(startOutboundCall);

      await voiceCall.disconnect();
    • Is current call muted

      Returns undefined | boolean

      • A boolean indicating whether the call is muted

      FlexSdkError with the following error code(s):

      import { createClient, StartOutboundCall } from "@twilio/flex-sdk";

      const client = await createClient("SDK_TOKEN");
      const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});

      const voiceCall = await client.execute(startOutboundCall);

      const isMuted: boolean = voiceCall.isMuted();
      console.log(`Call ${isMuted ? "is muted" : "is not muted"}`)
    • Check if current call (if there is one) is on hold.

      Returns Promise<boolean>

      • A promise that resolves to a boolean indicating whether the call is on hold.
      import { createClient, StartOutboundCall } from "@twilio/flex-sdk";

      const client = await createClient("SDK_TOKEN");
      const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});

      const voiceCall = await client.execute(startOutboundCall);

      const isOnHold: boolean = await voiceCall.isOnHold();
      console.log(`Call ${isOnHold ? "is on hold" : "is not on hold"}`)
    • Mute current call

      Returns void

      FlexSdkError with the following error code(s):

      import { createClient, StartOutboundCall } from "@twilio/flex-sdk";

      const client = await createClient("SDK_TOKEN");
      const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});

      const voiceCall = await client.execute(startOutboundCall);
      voiceCall.mute();

      const isMuted: boolean = voiceCall.isMuted();
      console.log(`Call ${isMuted ? "is muted" : "is not muted"}`)
    • Unmute current call

      Returns void

      FlexSdkError with the following error code(s):

      import { createClient, StartOutboundCall } from "@twilio/flex-sdk";

      const client = await createClient("SDK_TOKEN");
      const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});

      const voiceCall = await client.execute(startOutboundCall);
      voiceCall.unmute();

      const isMuted: boolean = voiceCall.isMuted();
      console.log(`Call ${isMuted ? "is muted" : "is not muted"}`)