Interface TwilioConnectorWarmTransferTaskOptions

Options for createTwilioConnectorWarmTransferTask: the base task options minus the SIP fields, plus the Twilio credentials used to place the supervisor call.

interface TwilioConnectorWarmTransferTaskOptions {
    abortSignal?: AbortSignal;
    allowInterruptions?: boolean;
    callerHangupInstruction?: null | string;
    callerHangupSpeech?: WarmTransferSpeech;
    chatCtx?: ChatContext;
    greetingSpeech?: WarmTransferSpeech;
    holdAudio?: null | AudioSourceType | voice.AudioConfig | voice.AudioConfig[];
    instructions?: string | InstructionParts;
    llm?: null | llm.RealtimeModel | llm.LLM | LLMModels;
    originalCallerNumber?: string;
    phoneNumber: string;
    ringingTimeout?: null | number;
    roomName?: string;
    stt?: null | stt.STT | STTModelString;
    tools?: readonly ToolContextEntry[];
    tts?: null | tts.TTS | TTSModelString;
    turnDetection?: null | TurnDetectionMode;
    twilioAccountSid?: string;
    twilioAuthToken?: string;
    twilioCallToken?: string;
    twilioFromNumber: string;
    vad?: null | VAD;
}

Hierarchy

  • Omit<WarmTransferTaskOptions, "sipCallTo" | "sipTrunkId" | "sipConnection" | "sipNumber" | "sipHeaders" | "dtmf" | "ringingTimeout" | "humanAgentIdentity" | "originateHumanAgent">
    • TwilioConnectorWarmTransferTaskOptions

Properties

abortSignal?: AbortSignal

Signal for application cancellation, such as a consult deadline or application shutdown.

Do not abort this signal when the caller disconnects. The task handles caller disconnects so it can play callerHangupInstruction before it ends an answered consultation.

A successful participant move wins if it completes after the signal aborts. The task stops waiting for a pending SIP request but cannot cancel it.

allowInterruptions?: boolean
callerHangupInstruction?: null | string

Instructions used to generate the reply spoken to the human agent before their call is ended when the caller hangs up mid-transfer (after the human agent answered but before the merge). Falls back to a built-in instruction when not provided.

Deprecated

Use callerHangupSpeech. Return session.generateReply() from its callback to keep generated speech.

callerHangupSpeech?: WarmTransferSpeech

Speech played before ending the human agent's call when the caller hangs up after the human agent answers. A string is spoken with session.say() and requires a TTS model. For sessions without TTS, use a callback that returns session.say(text, { audio }) with prerecorded audio. The callback runs only after the caller hangs up, and the task awaits its returned handle. This option takes precedence over callerHangupInstruction.

chatCtx?: ChatContext
greetingSpeech?: WarmTransferSpeech

Speech started after the outbound SIP call is answered. A string is spoken with session.say(). A callback runs once after answer with the consultation session and must return a speech handle. Omit this option to let the destination speak first. The answer signal does not distinguish a person from voicemail or an IVR, so an enabled greeting can overlap automated audio.

Audio played to the caller while they are on hold during the transfer.

instructions?: string | InstructionParts

Instructions for the human agent briefing. Pass a full string to replace the built-in prompt entirely, or InstructionParts to override individual sections (e.g. persona) while keeping the built-in template and auto-formatted conversation history.

llm?: null | llm.RealtimeModel | llm.LLM | LLMModels
originalCallerNumber?: string

Incoming call’s From; used only with a nonempty twilioCallToken.

phoneNumber: string

Phone number of the human agent to dial, in E.164 format.

ringingTimeout?: null | number

How long to wait, in milliseconds, for the human agent to answer before giving up and cancelling the call. Defaults to 30 seconds: Twilio reports no-answer only via status webhooks, which this task does not consume, so the wait is capped instead. null disables the cap.

roomName?: string

Name of the room used to dial and brief the human agent. Defaults to ${callerRoom.name}-human-agent.

Set this to control the briefing room's configuration: pre-create a room under this name (e.g. with RoomServiceClient.createRoom and an egress request to record the transfer leg) before running the task, and the transfer agent joins the pre-configured room instead of implicitly creating one with project defaults.

The room is deleted when the transfer completes, fails, or is cancelled (the same lifecycle as the default room), which also ends any egress attached to it. Must differ from the caller room's name.

stt?: null | stt.STT | STTModelString
tools?: readonly ToolContextEntry[]
tts?: null | tts.TTS | TTSModelString
turnDetection?: null | TurnDetectionMode
twilioAccountSid?: string

Twilio account SID. Falls back to the TWILIO_ACCOUNT_SID environment variable.

twilioAuthToken?: string

Twilio auth token. Falls back to the TWILIO_AUTH_TOKEN environment variable.

twilioCallToken?: string

CallToken from the original incoming Twilio voice webhook, authorizing reuse of that call's caller ID. Requires the same call's From as originalCallerNumber. HTTP 400 / Twilio error 21210 or 21212 retries once from twilioFromNumber without a token. Other failures are not retried, to avoid duplicate calls. Retrieve the token from server-side state for that specific call; keep it out of prompts and participant attributes. When omitted or empty, use the business caller ID.

twilioFromNumber: string

Agent/business Twilio number or verified caller ID. Used without a token and for the caller-ID rejection fallback.

vad?: null | VAD