Skip to content

Commit aa17506

Browse files
author
root
committed
feat: Enhance DTMF forwarding with improved logging and error handling
1 parent da622f7 commit aa17506

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

pkg/sip/inbound.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,17 +1350,27 @@ func (c *inboundCall) playAudio(ctx context.Context, frames []msdk.PCM16Sample)
13501350
}
13511351

13521352
func (c *inboundCall) handleDTMF(tone dtmf.Event) {
1353+
log := c.log()
1354+
log.Infow("DTMF received from phone", "digit", string(tone.Digit), "code", tone.Code, "forwardDTMF", c.forwardDTMF.Load())
1355+
13531356
if c.forwardDTMF.Load() {
1354-
_ = c.lkRoom.SendData(&livekit.SipDTMF{
1357+
err := c.lkRoom.SendData(&livekit.SipDTMF{
13551358
Code: uint32(tone.Code),
13561359
Digit: string([]byte{tone.Digit}),
13571360
}, lksdk.WithDataPublishReliable(true))
1361+
if err != nil {
1362+
log.Warnw("Failed to forward DTMF to room", err, "digit", string(tone.Digit))
1363+
} else {
1364+
log.Infow("DTMF forwarded to room successfully", "digit", string(tone.Digit))
1365+
}
13581366
return
13591367
}
1368+
log.Debugw("DTMF not forwarded (forwardDTMF=false), buffering for PIN", "digit", string(tone.Digit))
13601369
// We should have enough buffer here.
13611370
select {
13621371
case c.dtmf <- tone:
13631372
default:
1373+
log.Warnw("DTMF buffer full, dropping tone", nil, "digit", string(tone.Digit))
13641374
}
13651375
}
13661376

0 commit comments

Comments
 (0)