Drift
06/13/2026, 4:21 AMAI Evy
06/13/2026, 4:22 AMAI Evy
06/13/2026, 4:22 AM{{user_number}} dynamic variable [(1) ]() . This system variable is available without requiring the caller to verbally provide their number during the conversation .
Implementation Options:
1. **Use in Agent Prompts**: Reference {{user_number}} directly in your agent's global prompt or conversation nodes . For example, you can add it to your prompt context:
#context
User phone number: {{user_number}}
2. **Access via Webhooks**: The caller's phone number is available in the call metadata as from_number [(2) ]() [(3) ]() [(4) ]() . When using webhooks (like call_started or call_completed) , you can extract this field and pass it to your systems [(4) ]() .
3. **Retrieve from Call Object**: After a call, the phone number is stored in the call object's from_number field [(2) ]() [(5) ]() [(3) ]() . You can access this through the API or webhook payloads [(4) ]() .
Example Webhook Response:
When setting up an inbound webhook, you can respond with dynamic variables including the caller's number:
json
{
"retell_llm_dynamic_variables": {
"customer_name": "John Doe"
}
}AI Evy
06/13/2026, 4:22 AMAI Evy
06/13/2026, 4:22 AMDrift
06/13/2026, 4:34 AMAI Evy
06/13/2026, 4:34 AMAI Evy
06/13/2026, 4:35 AM{{user_number}} system variable can be used in custom function configurations .
Implementation Approaches:
1. **In Custom Function URL**: Include the dynamic variable directly in your webhook URL [(1) ]() :
<https://your-api.com/endpoint?phone=%7B%7Buser_number%7D%7D>
2. **In Function Description or Property Description**: Reference {{user_number}} in your tool descriptions so the LLM can pass it as a parameter [(1) ]() [(2) ]() .
3. **In Code Tool**: Access the phone number via the dv object [(3) ]() :
javascript
const phoneNumber = dv.user_number;
For Phone Calls Specifically:
The {{user_number}} variable represents the user's phone number and is automatically available [(1) ]() . For inbound calls, this is the `from_number`; for outbound calls, this is the to_number [(1) ]() [(4) ]() .
Best Practice:
Add {{user_number}} to your custom function's property descriptions or use it directly in the webhook URL so it's automatically passed to your backend without the caller needing to speak it [(1) ]() [(2) ]() .AI Evy
06/13/2026, 4:35 AMAI Evy
06/13/2026, 4:35 AMDrift
06/13/2026, 4:38 AMAI Evy
06/13/2026, 4:38 AMAI Evy
06/13/2026, 4:39 AMconst value option instead of the description option when defining parameters in your custom function [(1) ]() [(2) ]() .
The key difference:
- **Description**: The LLM will try to extract this value from the conversation (causing the agent to ask for it)
- **Const value**: The value is applied directly to the function without LLM extraction
Correct implementation for custom functions:
When defining your parameter schema, use "const" to set the value directly :
json
{
"type": "object",
"properties": {
"phone_number": {
"type": "string",
"const": "{{user_number}}"
}
}
}AI Evy
06/13/2026, 4:39 AMAI Evy
06/13/2026, 4:39 AM{{user_number}} is passed directly to your function without the agent asking the caller for it [(1) ]() [(2) ]() .
Alternative approaches:
1. **Query parameters**: Set query parameters with the const value switch enabled and use {{user_number}}
2. **Request headers**: Add custom headers with {{user_number}} as a static or dynamic value
3. **Endpoint URL**: Include it directly in your webhook URL [(3) ]() [(1) ]()
All of these methods will pass the phone number to your custom function without triggering the agent to ask for it [(3) ]() [(1) ]() [(2) ]() .AI Evy
06/13/2026, 4:39 AMDrift
06/13/2026, 10:25 PMAI Evy
06/13/2026, 10:25 PMAI Evy
06/13/2026, 10:25 PMAI Evy
06/13/2026, 10:25 PMAI Evy
06/13/2026, 10:25 PM