agents icon indicating copy to clipboard operation
agents copied to clipboard

WarmTransferTask: support dialing an extension / navigating an IVR via DTMF

Open a-gasior opened this issue 6 months ago • 2 comments

Feature Type: Would make my life easier

Feature Description

WarmTransferTask (the prebuilt warm-transfer task) dials the human agent via api.CreateSIPParticipantRequest inside _dial_human_agent, but never sets the request's dtmf field. That makes it impossible to warm-transfer to a destination that sits behind an extension or an IVR menu ("press 1 for support", "enter extension 1234#") — common for transfers to a desk phone on a PBX.

Proposal: add an optional dtmf: str | None constructor parameter to WarmTransferTask that is passed straight through to CreateSIPParticipantRequest(dtmf=...). The SIP service already supports DTMF on outbound calls (including w pause characters), so this is a thin passthrough.

result = await WarmTransferTask(
    sip_call_to=SUPERVISOR_PHONE_NUMBER,
    sip_trunk_id=SIP_TRUNK_ID,
    dtmf="wwww1234#",  # wait ~2s for the IVR greeting, then dial extension 1234#
    chat_ctx=self.chat_ctx,
)

Workarounds / Alternatives

Currently we subclass WarmTransferTask and copy-paste the entire _dial_human_agent method just to add dtmf= (and ringing_timeout=) to the SIP request — brittle, since it has to track upstream changes to that method.

Additional Context

Happy to open the PR — it's a ~3-line change in livekit-agents/livekit/agents/beta/workflows/warm_transfer.py plus a docstring and a changeset. Other CreateSIPParticipantRequest fields like ringing_timeout could get the same treatment, but I'd keep that out of scope unless you'd like it included.

a-gasior avatar May 12 '26 19:05 a-gasior

this makes sense. It'd be great if you can open a PR to expose this and other relevant CreateSIPParticipantRquest fields.

davidzhao avatar May 12 '26 19:05 davidzhao

@davidzhao Anything else besides ringing_timeout?

a-gasior avatar May 12 '26 19:05 a-gasior