Send DTMF
Sends DTMF digits to an active call. This is commonly used for IVR navigation and keypad-driven call flows.
Signature
// Callback version
fun sendDTMF(
callId: String,
digits: String,
callback: (Exception?) -> Unit
)
// Suspend version
suspend fun sendDTMF(
callId: String,
digits: String
)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
callId | string | Yes | Identifier of the active call |
digits | string | Yes | DTMF digit sequence to send (for example "1234") |
Return Type
Returns void (or Promise<void> for Web).
Usage Example
// Callback
client.sendDTMF("callId", "1234") {
it?.let { err ->
// Handle Error in sending DTMF
println("Error in sending DTMF: $err")
}
}
// Coroutine
try {
client.sendDTMF("callId", "1234")
} catch (e: Error) {
// Handle Error in sending DTMF
}
Errors
| Error Type | Error Code | Description |
|---|---|---|
INTERNAL_ERROR | voice:error:no_call_found | No active call found for provided callId |
INTERNAL_ERROR | Media-layer errors | Failed to send DTMF over media connection |
UNKNOWN_ERROR | N/A | Unexpected failure |
For complete error reference and handling guidelines, see Error Reference.
Notes
- DTMF requires an active established call media session
- Digit validation/handling behavior depends on backend and remote endpoint
Related Events
onDTMF- Fired when DTMF digits are received on a call