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

Create a DTMFHandler and register per-digit (and optional per-sequence) handlers using on_digit() and on_sequence(). Attach the handler to your agent’s Pipeline. Once the session is started with zrt.invoke(), the runtime automatically delivers DTMF events to the registered handlers.
A DTMFHandler attached to the Pipeline automatically subscribes to the room’s DTMF events—no manual subscription is required. Register per-digit and per-sequence handlers with on_digit() and on_sequence() to build interactive IVR flows and respond to caller input.

What’s Next

Call Transfer

Move a live call to another number.

Voice Mail Detection

Handle voicemail on outbound calls.

References

SDK Reference

DTMF Handler

DTMF Handler in the Python API reference.