SIP REFER transfer via Telnyx inbound trunk — 603 Decline on all attempts

Cold transfer the caller to a human agent (PSTN number) via SIP REFER when the user requests it. We call transfer_sip_participant from inside a @function_tool:

job_ctx = get_job_context()
room = job_ctx.room

sip_participant = next(
    (p for p in room.remote_participants.values()
     if p.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP),
    None
)

await job_ctx.api.sip.transfer_sip_participant(
    livekit_api.TransferSIPParticipantRequest(
        room_name=room.name,
        participant_identity=sip_participant.identity,
        transfer_to="sip:+16282606639@sip.telnyx.com",
        play_dialtone=True,
        headers={
            "Diversion": "<sip:+16187338098@sip.telnyx.com>",
            "X-Detected-Topic": "...",
        },
    )
)

What happens:

The agent confirms the transfer verbally, the tool is called, the call disconnects immediately — the caller hears silence and the room closes. No actual transfer to the target number occurs.

On the Telnyx portal → Outbound Call Reports we see 7 outbound call attempts, all failing with SIP 603 Decline.

Questions:

  1. Does the Telnyx FQDN connection that receives the SIP REFER need an outbound voice profile to route the transfer leg to PSTN? Or does Telnyx route it differently from a regular outbound call?

  2. Should transfer_to use tel:+16282606639 format instead of sip:+16282606639@sip.telnyx.com?

  3. Is there anything specific that needs to be enabled on the LiveKit SIP trunk side (not just Telnyx) to allow REFER to pass through? We only have one trunk and one dispatch rule.

  4. Has anyone successfully done a cold transfer to a PSTN number via Telnyx? What was the exact Telnyx configuration required?

Any help appreciated — we’ve been going in circles on this one.

Refer has to be enabled by Telnyx.