Transfer call using SIP REFER to different destinations based on detected intent/state

Hello,

We need help configuring call transfer using SIP REFER in Retell AI.

Current Topology

Call flow:

  1. Call enters our PBX.

  2. The PBX IVR answers the call.

  3. When the caller presses option 1, the call is transferred to Retell AI.

  4. Retell AI identifies the state/city (for example: State 1 or State 2).

  5. Based on the detected state, Retell must transfer the same active call back to our PBX, but to different destinations.

Example:

  • If State 1 is detected → transfer to sip:6000@our_cm_ip

  • If State 2 is detected → transfer to sip:7000@our_cm_ip

We want to use SIP REFER, because we need a transfer of the current active call, not a new outbound call from Retell.


Questions

  1. Does Retell fully support SIP REFER to arbitrary SIP URIs?

  2. How should the destination be configured in the Transfer node to ensure REFER is used instead of creating a new outbound call?

  3. Is there any specific configuration required in the trunk settings to enable REFER-based transfers?

  4. Can we dynamically set the SIP destination based on a variable (for example: sip:${destination}@our_cm_ip)?


Expected Behavior

Retell should:

  • Detect the state

  • Execute SIP REFER

  • Transfer the current dialog to:

    • sip:6000@our_cm_ip (State 1)

    • sip:7000@our_cm_ip (State 2)

Without creating a second outbound call.

Based on your topology where calls enter your PBX first and then dial into Retell AI, you’re using the “Dial to SIP URI” method(1). This integration method has a critical limitation for call transfers.

SIP REFER Support Status

The “Dial to SIP URI” method does not support Retell’s built-in transfer call feature(1). When using this method, Retell does not have access and control over the telephony provider and number, and cannot initiate transfers for you(2).

For cold transfers with a transferee number, Retell uses SIP REFER to transfer the call(3). However, this functionality requires using Elastic SIP Trunking, not the “Dial to SIP URI” method(1).

Your Options

Option 1: Switch to Elastic SIP Trunking (Recommended)

Elastic SIP Trunking is the recommended way to integrate with your telephony provider that supports elastic SIP trunking(1). With this method:

  • Call transfers, including SIP REFER for cold transfers, are supported(2)
  • Your SIP trunking provider must allow SIP REFER and PSTN transfers(4)
  • You would need to set up a SIP trunk and configure your number to point to it, then import that number to Retell(1)

Option 2: Implement Custom Transfer Logic

Since you’re using “Dial to SIP URI” method, you will need to handle the transfer call logic yourself(1). This means writing a custom function which internally interacts with your telephony provider (your PBX) to transfer the call(1).

Dynamic Destination Configuration

For dynamic SIP destinations based on detected state, you can use dynamic variables(5). The transfer number can be set to a dynamic variable that gets substituted at runtime(6)(7).

For example, you could set the transfer destination to {{transfer_destination}} and populate this variable with values like sip:6000@your_cm_ip or sip:7000@your_cm_ip based on the detected state(5).

Configuration Notes

  • Transfer numbers can be in E.164 format or a SIP URI in the format of sip:username@domain (e.g., sip:user@retellai.com)(6)(7)
  • If your transfer destination is not in E.164 format, you can choose to keep the input as is by choosing raw format (this only applies when using custom telephony and does not apply when using Retell Telephony)(7)

Bottom line: To use SIP REFER as you intend, you’ll need to either switch to Elastic SIP Trunking or implement custom transfer logic in your PBX that Retell triggers via a custom function call.

Hello,

Thank you for the clarification.

We will proceed with Option 2 and implement the transfer logic on our PBX side.

We understand that when using “Dial to SIP URI”, SIP REFER is not supported. Therefore, instead of transferring the active dialog, Retell will initiate a new outbound SIP call to our PBX based on the detected state.

We will configure dynamic transfer destinations using a variable such as:

{{transfer_destination}}

Which will resolve at runtime to:

  • sip:6000@our_cm_ip (State 1)

  • sip:7000@our_cm_ip (State 2)

Please confirm that using a dynamic SIP URI in the Transfer node is fully supported in this scenario.

Thank you.

Hello @suporte,

Yes, dynamic transfer destination is supported.

Please provide the official outbound SIP IP address range to be whitelisted on our firewall.