Skip to content

Publish DTMF Helper for Local Participant - #1001

Open
ayukumar261 wants to merge 5 commits into
livekit:mainfrom
ayukumar261:publish-dtmf
Open

ayukumar261 wants to merge 5 commits into
livekit:mainfrom
ayukumar261:publish-dtmf

Conversation

@ayukumar261

@ayukumar261 ayukumar261 commented Sep 10, 2026

Copy link
Copy Markdown

Problem

The JavaScript, Rust, Python, and Node SDKs have DTMF publishing helpers that always use the reliable data channel. The Go SDK has no equivalent, so developers have to build the packet themselves and remember to pass WithDataPublishReliable(true).

That matters because PublishDataPacket has defaulted to the lossy channel since #421 (v2.1.0), and the lossy channel has been unordered since #659 (v2.8.0). Digits sent with the default can be dropped or arrive out of order.

Changes

  • Added PublishDTMF(code, digit) to LocalParticipant. It wraps PublishDataPacket with WithDataPublishReliable(true), so a SipDTMF packet always goes over the reliable channel. The helper accepts no publishing options.
  • Updated a stale comment above the default in PublishDataPacket. It said the Go default matches the protobuf default. That was true when Accept and send DTMF via data channel #415 wrote it, since both defaulted to reliable. Revert default behavior change with data publishing #421 flipped the Go default to lossy but left the comment, and the protobuf zero value is still RELIABLE.

Testing

TestPublishDTMF publishes 1 2 3 # and asserts that the subscriber receives four *livekit.SipDTMF packets with the expected codes and digits in order. It also checks the publisher’s WebRTC GetStats for four messages on the _reliable data channel and none on _lossy.

  • The updated integration test passed against a local LiveKit server with CGO_ENABLED=0.
  • mage test, which includes -race, passed locally before this API simplification. The latest full-suite attempt was blocked by a missing local soxr dependency.

Notes

  • The helper sends DTMF digits to all participants in the room.
  • Reliable delivery matches the other SDKs.

@CLAassistant

CLAassistant commented Sep 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ayukumar261
ayukumar261 marked this pull request as ready for review September 10, 2026 06:13
@ayukumar261
ayukumar261 requested a review from a team as a code owner September 10, 2026 06:13
devin-ai-integration[bot]

This comment was marked as resolved.

@ayukumar261 ayukumar261 changed the title Publish DTMF Helper for LiveKit Go SDK Publish DTMF Helper for Local Participant Sep 11, 2026
Comment thread localparticipant.go Outdated
//
// DTMF always uses the RELIABLE channel so digits arrive in order, overriding any
// WithDataPublishReliable(false). See WithDataPublishDestination to target participants.
func (p *LocalParticipant) PublishDTMF(code uint32, digit string, opts ...DataPublishOption) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no options for publishing dtmf in other sdks, so go-sdk doesn't need options too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing! I removed the opts argument from the helper.

However, I was looking at the Rust SDK publish_dtmf helper, and it includes destination_identities for destination support. If you think I should add a destinationIdentities... argument for the Go SDK PublishDTMF helper, please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants