I'm building an app using livekit-client (Angular)...
# ask-ai
b
I'm building an app using livekit-client (Angular) and the livekit-server-sdk (Azure Functions, TypeScript). Calling a SIP number and answering the call works correctly. However, I’m experiencing unexpected behavior in this scenario: 1. A SIP call starts. 2. Very quicly after the SIP participant joins, we remove the SIP participant using the server SDK (as part of a programmatic call transfer). 3. When we remove the SIP participant very quickly after the call begins, the call on the physical phone gets placed on hold instead of ending cleanly. Our flow is: • End Call A by removing the SIP participant and the answering participant. • Start Call B with the same answering participant and a different (non-SIP) participant. • Essentially transferring the call from Room A to Room B, where “Callee A” participates in both calls. Is this hold behavior expected when removing a SIP participant immediately after the call starts? Should we wait a certain amount of time before removing the SIP participant to avoid the call being placed on hold?
t
Thanks for reaching out, Mike. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're seeing expected behavior. When you remove a SIP participant immediately after the call starts, the underlying SIP session (media/negotiation with the carrier) may not be fully established, which can leave the carrier-side session in an inconsistent state and result in the physical phone being placed on hold instead of terminating. What you can do: • Best option: Use TransferSIPParticipant to perform the transfer (issues a SIP REFER and lets the carrier handle a clean transfer). • If you must remove the participant: wait briefly (for example 1–2 seconds) after the SIP participant's
sip.callStatus
becomes
active
before calling RemoveParticipant. Listening for the
sip.callStatus
transition (
ringing
→
active
) and then delaying removal avoids the early-teardown hold behavior. • If you intend to end the entire session, deleting the room (
DeleteRoom
) will cleanly terminate all participants and SIP sessions. Would you like the exact code snippet for detecting
sip.callStatus
in your Angular client or an example call to
TransferSIPParticipant
from your TypeScript Azure Function? Sources: Call forwarding | LiveKit docs | SIP overview | LiveKit docs | Agents telephony integration | LiveKit Docs | SIP participant | LiveKit docs | Connecting to LiveKit | LiveKit docs
b
What specifc source says to wait 1-2 seconds ?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
b
Can i ask you something else about this topic ?