Initiates an outbound voice call to a specified phone number.
The phone number to call.
Optional configuration parameters for customizing the outbound call process.
A promise that resolves to a VoiceCall object, representing the outbound call.
VoiceCall
FlexSdkError with the following error code(s):
import { createClient, Reservation } from "@twilio/flex-sdk";import { StartOutboundCall, StartOutboundCallOptions } from "@twilio/flex-sdk/actions/Voice";async function startOutboundCall() { const client = await createClient("SDK_TOKEN"); const reservationCanceledHandler = (reservation: Reservation) => { console.log( `Reservation canceled with reason https://www.twilio.com/docs/api/errors/${reservation.canceledReasonCode}` ); reservation.off("canceled", reservationCanceledHandler); }; const startOutboundCallOptions: StartOutboundCallOptions = { reservationEventListeners: { canceled: reservationCanceledHandler } }; const startOutboundCallAction = new StartOutboundCall("+15555555555", startOutboundCallOptions); const call = await client.execute(startOutboundCallAction);} Copy
import { createClient, Reservation } from "@twilio/flex-sdk";import { StartOutboundCall, StartOutboundCallOptions } from "@twilio/flex-sdk/actions/Voice";async function startOutboundCall() { const client = await createClient("SDK_TOKEN"); const reservationCanceledHandler = (reservation: Reservation) => { console.log( `Reservation canceled with reason https://www.twilio.com/docs/api/errors/${reservation.canceledReasonCode}` ); reservation.off("canceled", reservationCanceledHandler); }; const startOutboundCallOptions: StartOutboundCallOptions = { reservationEventListeners: { canceled: reservationCanceledHandler } }; const startOutboundCallAction = new StartOutboundCall("+15555555555", startOutboundCallOptions); const call = await client.execute(startOutboundCallAction);}
Optional
Initiates an outbound voice call to a specified phone number.
Param: toNumber
The phone number to call.
Param: options
Optional configuration parameters for customizing the outbound call process.
Returns
A promise that resolves to a
VoiceCallobject, representing the outbound call.Throws
FlexSdkError with the following error code(s):
Example