Skip to content

Commit

Permalink
Add SIP publish DTMF feature (#1277)
Browse files Browse the repository at this point in the history
* Add SIP publish DTMF feature

* Create wild-lions-fly.md

---------

Co-authored-by: lukasIO <[email protected]>
  • Loading branch information
s-hamdananwar and lukasIO authored Oct 8, 2024
1 parent 03f2a6f commit 4936bad
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-lions-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Add SIP publish DTMF feature
22 changes: 22 additions & 0 deletions src/room/participant/LocalParticipant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
RequestResponse,
RequestResponse_Reason,
SimulcastCodec,
SipDTMF,
SubscribedQualityUpdate,
TrackInfo,
TrackUnpublishedResponse,
Expand Down Expand Up @@ -1349,6 +1350,27 @@ export default class LocalParticipant extends Participant {
await this.engine.sendDataPacket(packet, kind);
}

/**
* Publish SIP DTMF message to the room.
*
* @param code DTMF code
* @param digit DTMF digit
*/
async publishDtmf(code: number, digit: string): Promise<void> {
const packet = new DataPacket({
kind: DataPacket_Kind.RELIABLE,
value: {
case: 'sipDtmf',
value: new SipDTMF({
code: code,
digit: digit,
}),
},
});

await this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
}

async sendChatMessage(text: string): Promise<ChatMessage> {
const msg = {
id: crypto.randomUUID(),
Expand Down

0 comments on commit 4936bad

Please sign in to comment.