Second Call Transfer Attempt Fails with TwirpError: call already being transferred elsewhere

I’m encountering an issue when attempting to transfer a SIP call multiple times using LiveKit.

Scenario:

  • I initiate a call transfer to a target number.

  • If the transfer target does not pick up, the first attempt fails with a timeout error:

    TwirpError(code=deadline_exceeded, message=twirp error unknown: request timed out, status=408)

  • Within a few seconds, I attempt to transfer the same call to a different target.

  • This second attempt fails with the following error:

    TwirpError(code=invalid_argument, message=twirp error unknown: call already being transferred elsewhere, status=400)

Observation:

It seems like the call is still considered “in transfer” even after the first attempt times out.

Question:

  • Is there a required delay or cleanup step before retrying a transfer?

  • How can I safely retry a transfer after a failed or timed-out attempt?

Transfer Code:

response = await self._ctx.api.sip.transfer_sip_participant(
transfer=TransferSIPParticipantRequest(
participant_identity=par_identity,
room_name=room_name,
transfer_to=“tel:” + phone_number,
)
)

That sounds sensible, can you track the participant state like this, python-agents-examples/docs/examples/sip_lifecycle at main · livekit-examples/python-agents-examples · GitHub, and wait until the transfer has ended.