Dipak Sisodiya
Committed by GitHub

Add publishDTMF method for Sending DTMF signals to SIP Participant (#576)

* Update LocalParticipant.kt

Add publishDTMF command.

* Update LocalParticipant.kt

* spotless apply and setKind

* Create hungry-peas-bow.md

---------

Co-authored-by: David Zhao <dz@livekit.io>
---
"client-sdk-android": patch
---
Add publishDTMF method for Sending DTMF signals to SIP Participant
... ...
... ... @@ -736,6 +736,34 @@ internal constructor(
}
/**
* This suspend function allows you to publish DTMF (Dual-Tone Multi-Frequency)
* signals within a LiveKit room. The `publishDtmf` function constructs a
* SipDTMF message using the provided code and digit, then encapsulates it
* in a DataPacket before sending it via the engine.
*
* Parameters:
* - code: an integer representing the DTMF signal code
* - digit: the string representing the DTMF digit (e.g., "1", "#", "*")
*/
@Suppress("unused")
suspend fun publishDtmf(
code: Int,
digit: String,
) {
val sipDTMF = LivekitModels.SipDTMF.newBuilder().setCode(code)
.setDigit(digit)
.build()
val dataPacket = LivekitModels.DataPacket.newBuilder()
.setSipDtmf(sipDTMF)
.setKind(LivekitModels.DataPacket.Kind.RELIABLE)
.build()
engine.sendData(dataPacket)
}
/**
* @suppress
*/
@VisibleForTesting
... ...