Skip to content

Commit 4f4432b

Browse files
dipak140davidzhao
andauthored
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>
1 parent 1a21e5d commit 4f4432b

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.changeset/hungry-peas-bow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"client-sdk-android": patch
3+
---
4+
5+
Add publishDTMF method for Sending DTMF signals to SIP Participant

livekit-android-sdk/src/main/java/io/livekit/android/room/participant/LocalParticipant.kt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,34 @@ internal constructor(
735735
engine.sendData(dataPacket)
736736
}
737737

738+
/**
739+
* This suspend function allows you to publish DTMF (Dual-Tone Multi-Frequency)
740+
* signals within a LiveKit room. The `publishDtmf` function constructs a
741+
* SipDTMF message using the provided code and digit, then encapsulates it
742+
* in a DataPacket before sending it via the engine.
743+
*
744+
* Parameters:
745+
* - code: an integer representing the DTMF signal code
746+
* - digit: the string representing the DTMF digit (e.g., "1", "#", "*")
747+
*/
748+
749+
@Suppress("unused")
750+
suspend fun publishDtmf(
751+
code: Int,
752+
digit: String,
753+
) {
754+
val sipDTMF = LivekitModels.SipDTMF.newBuilder().setCode(code)
755+
.setDigit(digit)
756+
.build()
757+
758+
val dataPacket = LivekitModels.DataPacket.newBuilder()
759+
.setSipDtmf(sipDTMF)
760+
.setKind(LivekitModels.DataPacket.Kind.RELIABLE)
761+
.build()
762+
763+
engine.sendData(dataPacket)
764+
}
765+
738766
/**
739767
* @suppress
740768
*/

0 commit comments

Comments
 (0)