Hang up current call (if there is one).
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);
await voiceCall.disconnect();
Hold current call (if there is one).
Optionaloptions: HoldCallOptionsOptions to specify hold music URL and HTTP method
Task object, representing the held task.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);
await voiceCall.hold({ holdMusicUrl: "holdMusicUrl", holdMusicMethod: "GET" });
Is current call muted
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.
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 isOnHold: boolean = await voiceCall.isOnHold();
console.log(`Call ${isOnHold ? "is on hold" : "is not on hold"}`)
Mute current call
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"}`)
Pause recording current conference (if there is one).
OptionalpauseBehaviour: "silence" | "skip"The behaviour to use when pausing the recording. Can be either "silence" or "skip". Default is "silence".
FlexSdkError with the following error code(s):
Resume recording current conference. This method will only resume an existing recording, it won't start a new one.
FlexSdkError with the following error code(s):
Unhold current call (if there is one).
Task object, representing the unheld task.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);
// Call is not on hold by default so to unhold, it is needed to hold first
await call.hold("holdMusicUrl", "GET");
await call.unhold();
Unmute current call
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"}`)
Interface for controlling voice calls with mute, hold, disconnect, and recording capabilities.