Skip to main content
DTMF (Dual-Tone Multi-Frequency) events occur when a caller presses keys (0–9, *, #) during a call. Agents can listen for these events to capture input and respond immediately.
This page covers handling DTMF from your agent code. For the SIP gateway setup and the raw DTMF_EVENT payload, see DTMF Events in the Telephony platform docs.

Features

  • Detect key presses during a call session.
  • Deliver events in real time to the agent.
  • Handle events with a user-defined callback.
  • Trigger actions or IVR flows based on the input.

Activation

DTMF detection is enabled on the Inbound SIP gateway, in one of two ways.
When creating an Inbound SIP gateway in the Zero Runtime dashboard, enable the DTMF option.
DTMF events
Once the gateway has DTMF enabled, implement the handler as shown below.

Setup

Put a DTMFHandler on the Pipeline so keypad tones are delivered rather than dropped, then define an on_dtmf method on the agent. Once the session is started with zeroruntime.invoke(), the runtime calls it for each keypress.
A DTMFHandler on the pipeline subscribes the agent to the room’s DTMF events—no manual subscription is required. on_dtmf is looked up on your agent by name and may take either (key) or (key, payload); DTMFHandler(callback) routes to a plain function instead. The runtime delivers one key per call, so multi-digit input such as a PIN is accumulated in your own agent state.

What’s Next

Call Transfer

Move a live call to another number.

Voice Mail Detection

Handle voicemail on outbound calls.