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.- Via Dashboard
- Via API
When creating an Inbound SIP gateway in the Zero Runtime dashboard, enable the 
DTMF option.
Setup
Create aDTMFHandler 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
- Python
SDK Reference
DTMF Handler
DTMF Handler in the Python API reference.