sip icon indicating copy to clipboard operation
sip copied to clipboard

Tracking Exact Moment When User Answers Outbound Call

Open vlxdisluv opened this issue 1 year ago • 1 comments

We are facing an issue with tracking the exact moment when a user answers a call (picks up the phone) during outbound calling. We wanted to use the participant joined webhook for this, but we noticed that it triggers when the ringing starts, not when the user actually picks up.

Is there a way to more accurately track the moment when the user picks up the phone during an outbound call? Perhaps there is another webhook or method that we can use for this purpose?

Thank you for your assistance!

vlxdisluv avatar Aug 08 '24 16:08 vlxdisluv

this makes sense.. we need to align the lifecycle better to match user expectations. we'll work on improving this behavior

davidzhao avatar Aug 09 '24 03:08 davidzhao

Hi @davidzhao , could you kindly clarify which status I should listen for to identify that the user has picked up the phone during an outbound call? If I'm not mistaken, I should listen to the tracks?

vlxdisluv avatar Oct 04 '24 09:10 vlxdisluv

Hey @vlxdisluv! First, participant created by SIP will update it's sip.callStatus to active, which can be observed with participant attribute hook in the SDK. Second, outbound SIP participant will not subscribe to anyone's tracks until the call is dialed. So this could be another indicator.

dennwc avatar Oct 04 '24 14:10 dennwc

Hey @vlxdisluv! First, participant created by SIP will update it's sip.callStatus to active, which can be observed with participant attribute hook in the SDK. Second, outbound SIP participant will not subscribe to anyone's tracks until the call is dialed. So this could be another indicator.

Is there a way to reliably detect whether a SIP INVITE request was unsuccessful, particularly when the SIP trunk service is unavailable and a 500 error is returned? Can this be tracked through specific events or mechanisms? Additionally, is it possible to determine whether the call was answered by the intended recipient or an answering machine the call was forwarded to?

vlxdisluv avatar Oct 10 '24 13:10 vlxdisluv

Yes, SIP service will set DisconnectReason for a LK participant to a specific value in this case, see https://github.com/livekit/sip/issues/191. The actual change is https://github.com/livekit/protocol/pull/845.

Regarding answering machine detection - we do not support it directly yet. Should be done externally with an Agent for now. The issue is https://github.com/livekit/sip/issues/117. We now plan to emit specific events via the data channel when SIP service detects telephony tones. This may help the Agent detect it more reliably.

dennwc avatar Oct 10 '24 19:10 dennwc

@dennwc Tracking on this to see whether anything in progress to emit the events for SIP Service answering machine detection