Listening to DTMF Events in VideoSDK
DTMF (Dual-Tone Multi-Frequency) events are generated when a participant presses keys (0-9, *, #) on their phone or SIP device during a call. These events are useful for building IVR flows, collecting user input, or triggering actions in your application.
Enabling DTMF Events
DTMF event detection can be enabled in two ways:
- Via Dashboard:
- When creating or editing a SIP gateway in the VideoSDK dashboard, enable the
DTMF
option.
- When creating or editing a SIP gateway in the VideoSDK dashboard, enable the
- Via API:
- Set the
enableDtmf
parameter totrue
when creating or updating a SIP gateway using the API.
- Set the
Once enabled, DTMF events will be detected and published for all calls routed through that gateway.
Listening to DTMF Events
To listen DTMF events in a VideoSDK meeting, you can subscribe to the DTMF_EVENT
topic using the PubSub system. This allows your application to react to DTMF input in real time.
Sample Event Payload:
{
"message": "Dtmf event received",
"senderId": "otb9vc4s",
"timestamp": "2025-09-08T12:02:14.726Z",
"topic": "DTMF_EVENT",
"senderName": "Participant",
"id": "32gwnzkt5we",
"payload": {
"number": 1,
"timestamp": "1757332934706"
}
}
Payload Fields:
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_EVENT
for 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.
DTMF events are available for both inbound and outbound SIP calls, as long as the gateway is configured with DTMF enabled.
Got a Question? Ask us on discord