This page covers handling DTMF from your agent code. For the routing rule 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 routing rule that handles the call, in one of two ways.- Via Dashboard
- Via API
In the Zero Runtime dashboard, go to Telephony > Routing Rules and click Create Routing Rule (or edit an existing rule). In the Feature section, turn on DTMF, then click Create Rule.

Setup
Put aDTMFHandler 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.