This page covers the SIP platform side: enabling DTMF on the gateway and the event payload. To handle DTMF from your agent code, see DTMF Handling.
Enabling DTMF Events
DTMF event detection can be enabled in two ways:- Via Dashboard:
- When creating or editing a SIP gateway in the Zero Runtime dashboard, enable the
DTMFoption.
- When creating or editing a SIP gateway in the Zero Runtime dashboard, enable the
- Via API:
- Set the
enableDtmfparameter totruewhen creating or updating a SIP gateway using the API.
- Set the
Listening to DTMF Events
To listen DTMF events in a Zero Runtime room, you can subscribe to theDTMF_EVENT topic using the PubSub system. This allows your application to react to DTMF input in real time.
Sample Event Payload:
message: Description of the event.senderId: The unique ID of the participant who sent the DTMF input.timestamp: When the event was received (ISO format).topic: AlwaysDTMF_EVENTfor these events.senderName: Name of the participant (if available).id: Unique event/message ID.payload.number: The DTMF digit pressed (0-9, *, #).payload.timestamp: Timestamp (in ms) when the digit was pressed.
Use Cases
- Build IVR menus and collect user input during calls.
- Trigger actions in your app based on keypresses (e.g., press 1 for support, 2 for sales).
- Log or analyze DTMF input for compliance or analytics.