https://retellai.com/?utm_source=discord&utm_medium=seo logo
what dynamic variable do we need to use with the T...
# ❓・ai-evy-support
u
@AI Evy what dynamic variable do we need to use with the Transfer Call node?
a
Thanks for tagging me @_scaggs. I'll look through relevant sources and get back to you shortly.
### Answer For the Transfer Call node, you can use dynamic variables in the transfer destination field [(1) ]() . The documentation shows you can set the transfer target to be either a static number in e.164 format, a SIP URI, or a dynamic variable that gets substituted at runtime . For example, you can use dynamic variables like
{{customer_phone}}
or
{{escalation_number}}
as the transfer destination [(2) ]() [(1) ]() . However, there's an important limitation: dynamic variables are currently not supported in the Transfer To destination phone number field for some configurations [(3) ]() . The transfer destination number is typically expected to be hardcoded . You can also use dynamic variables in custom SIP headers for call transfers [(4) ]() . These headers must start with
X-
and can include dynamic variable values to pass information extracted from the call to the receiving party .
​ To learn more, see the sources I considered: [[1] Call Transfer Node](https://docs.retellai.com/build/conversation-flow/call-transfer-node) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[3] Currently dynamic variables are not supported in the #Transfer To (the destination phone number)](https://discord.com/channels/1186424376300679209/1287253684492828733) [[4] Set & parse custom SIP headers](https://docs.retellai.com/build/telephony/sip-headers) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
u
Can I use a multi-state agent instead to get around the limitation of dynamic variables.
@AI Evy Can I use a multi-state agent instead to get around the limitation of dynamic variables.
a
Thanks for the follow-up, @_scaggs. I'll get back to you soon.
### Answer Yes, you can use multi-state agents as a workaround for dynamic variable limitations in call transfers [(1) ]() . One Discord user found that using multi-state agents provided a solution to dynamically define the number to be used in the call transfer function . Additionally, you might want to consider Agent Transfer instead of Call Transfer for your use case [(2) ]() . Agent Transfer offers several advantages over traditional call transfers : - **Lower Latency**: The transition between agents is near-instant, much lower than transfer call - **Better Reliability**: No need to create a new phone call, avoiding potential telephony failures - **No Handoff Message Needed**: The destination agent has access to the full conversation history, eliminating the need for adding hand-off messages or repeated customer questions - **No Separate Numbers for Agents**: Agents receiving transfers don't need their own phone numbers — one number is all you need, no matter how many agents you transfer to With Agent Transfer, you can transfer from one AI agent to another based on task or other criteria, and you can configure the transfer agent ID and version dynamically .
​ To learn more, see the sources I considered: [[1] Currently dynamic variables are not supported in the #Transfer To (the destination phone number)](https://discord.com/channels/1186424376300679209/1287253684492828733) [[2] Agent Transfer](https://docs.retellai.com/build/single-multi-prompt/transfer-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
u
Show me how to build this with specifics @AI Evy
a
Thanks for the follow-up, @_scaggs. I'll get back to you soon.
### Answer Here's how to build a multi-state agent with dynamic call transfers using specific steps: ## Option 1: Agent Transfer (Recommended) Step 1: Add Agent Transfer Tool [(1) ]() Click Add in the tools section and select "Agent Transfer" from the dropdown menu . Step 2: Configure Transfer Details Configure the following settings: - **Transfer agent**: the ID and version of a specific agent to transfer to - **Speak during execution and messages**: if the agent should speak something while performing the transfer - **Post call analysis setting**: for post-call analysis, only extract dynamic variables for the transferred agent, or both agents Step 3: Update the Prompt Add clear instructions in the prompt such as:
Copy code
"If the user asks to book an appointment, use the agent_transfer tool to transfer to the Appointment Agent."
## Option 2: Multi-State Call Transfer with Dynamic Variables Step 1: Set Up Dynamic Variables [(2) ]() In your Create Phone Call API request, include dynamic variables in the
retell_llm_dynamic_variables
field [(3) ]() :
Copy code
json
{
 "retell_llm_dynamic_variables": {
   "transfer_number": "+12137771234",
   "customer_name": "John Smith"
 }
}
Step 2: Configure Transfer Call Tool [(4) ]() - Add Transfer Call Tool from the dropdown menu - For the transfer destination, choose the value of a dynamic variable - Choose between cold transfer or warm transfer Step 3: Use Dynamic Variables in Transfer [(2) ]() You can use dynamic variables in: - Tool call description - Transfer call function number - Warm transfer settings Step 4: Update Agent Prompt [(4) ]() Include specific instructions such as:
Copy code
"If the user is angry or frustrated, use the transfer_call tool to transfer the conversation to a human agent."
## Workaround for Dynamic Transfer Numbers As shown in the workshop example [(5) ](

▾

) , you can use dynamic variables to pass phone numbers from your CRM system and reference them in the transfer function using variables like
{{transfer_number}}
. The key advantage of Agent Transfer over Call Transfer is lower latency, better reliability, and no need for separate phone numbers for each agent [(1) ]() .
​ To learn more, see the sources I considered: [[1] Agent Transfer](https://docs.retellai.com/build/single-multi-prompt/transfer-agent) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[3] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[4] Transfer call](https://docs.retellai.com/build/single-multi-prompt/transfer-call) [[5] LIVE WORKSHOP: Build an Outbound AI Caller for Mortgage Leads!](

https://www.youtube.com/watch?v=ID1d1bkVuNU▾

) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.