tall-autumn-57974
10/09/2025, 2:40 PMentrypoint depending on whether my client wants the bot enabled or not on certain days (for instance holidays). However, the SIP Transfer request fails with the following error (I'm using Twilio for SIP Trunking):
livekit.api.twirp_client.TwirpError: TwirpError(code=failed_precondition, message=twirp error unknown: can't transfer non established call, status=412) {"pid": 78355, "job_id": "AJ_pqcPLmKkUENm"}
From what I understand, it means that the participants are not fully connected to the room. But I didn't find any ways to actually wait for participant to be connected in `entrypoint()`:
• ctx.room.on("participant_connected") doesn't seem to be triggered for SIP Participants
• ctx.wait_for_participant() doesn't return any attribute related to the participant connection status. Possibly sip.callStatus, however this attribute is not awaitable. I would have to call the function until call is complete, which is less than ideal.
The only way I found for this to work is to do the transfer request within Agent classes, possibly on Agent.on_enter() but I would really prefer to do it upper in the stack.
Did I miss anything?tall-airline-16756
10/09/2025, 2:40 PMtall-airline-16756
10/09/2025, 2:40 PMsip.callStatus attribute. It should show as "active" before you go ahead with the transfer.
2. Next, use the ctx.transfer_sip_participant() method or the livekit_api.sip.transfer_sip_participant() API call to start the transfer. Just double-check that the target destination is a valid SIP URI or a telephone number with the tel: prefix.
3. Keep an eye on the transfer operation’s completion. There’s a default 30-second timeout for the transfer request to handle the asynchronous nature of SIP REFER operations, so it might take a moment.
If you want to manage this in the entrypoint, you might consider adding a way to poll or wait until the sip.callStatus becomes "active" before initiating the transfer. Or, like you mentioned, handling the transfer in the Agent.on_enter() method could be a smoother approach since it gives you better control over the participant’s state.
Please feel free to reach out if you’d like me to walk you through any of these steps or if you have any other questions—I’m here to help!
Sources: sipclient.go | SIP troubleshooting guide | LiveKit Docs | test/integration/sip_test.go | examples/voice_agents/error_callback.py | README.mdtall-autumn-57974
10/09/2025, 2:53 PMsession.start(), but whatever I do, nothing works...
Is there any event to listen to so I can transfer the call before the agent starts talking. But without adding this check within an Agent class methodtall-airline-16756
10/09/2025, 2:54 PMAgent class for this check? Are you hoping to handle everything directly within the entrypoint using a specific event or mechanism? Knowing more about your needs will really help me offer the most helpful and personalized guidance.tall-autumn-57974
10/09/2025, 3:02 PMentrypoint. For now the mitigation I found is to do a sleep(3) but that might not always worktall-airline-16756
10/09/2025, 3:02 PM