livekit / sip

SIP to WebRTC bridge for LiveKit
70 stars 18 forks source link

Support for DTMF back to incoming SIP caller? #109

Open eli-kaplan opened 2 weeks ago

eli-kaplan commented 2 weeks ago

From what I can see in the codebase these two flows seem to be implemented:

However, the flow I'm hoping to implement for my use case requires the opposite direction:

Am I understanding correctly that this (somewhat niche) dataflow is not currently supported? If not, I assume the workaround for now would probably be just sending the DTMF tones in-band as normal audio.

dennwc commented 2 weeks ago

You are right, this flow is currently not supported.

It won't be particularly hard to implement, because SIP participant will only need to listen on its own WebRTC data channel and encode DTMF as outbound calls already do.

We were discussing it internally before, and the main concern is that if multiple SIP participants are present, DTMF from one will be passed to another. This might have unintended consequences if LK is set to bridge a call between some autonomous system that supports DTMF and untrusted SIP participants.

It might be solved by adding can_accept_dtmf flag to Dispatch Rule and CreateSIPParticipant. That way DTMF won't be forwarded by default to SIP, unless explicitly enabled.