https://retellai.com/?utm_source=discord&utm_medium=seo logo
How can I collect the phone number that is calling...
# ❓・ai-evy-support
d
@AI Evy How can I collect the phone number that is calling me without asking for it during a call.
a
Thanks for tagging me @Drift. I'll look through relevant sources and get back to you shortly.
### Answer You can automatically capture the caller's phone number using the
{{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:
Copy code
#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:
Copy code
json
{
  "retell_llm_dynamic_variables": {
    "customer_name": "John Doe"
  }
}
[(2) ]() The
from_number
field in the call payload contains the caller's number (e.g.,
"+12137771234"
) [(2) ]() [(3) ]() , which you can map to your CRM, Google Sheets, or other systems without the caller ever stating it verbally [(4) ]() .
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Register Phone Call](https://docs.retellai.com/api-references/register-phone-call) [[3] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[4] Discord message from @olyn_38804 on 2026-01-05](https://discord.com/channels/1186424376300679209/1186462578310910112/1457733836107419762) [[5] Update Call](https://docs.retellai.com/api-references/update-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
Thanks for the follow-up, @Drift. I'll get back to you soon.
### Answer --- Yes, you can send the caller's phone number to a custom function using dynamic variables [(1) ]() [(2) ]() . The
{{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) ]() :
Copy code
<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) ]() :
Copy code
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) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
So adding it to the parameters is not the right way if I dont want it to ask for the number @AI Evy
a
Thanks for the follow-up, @Drift. I'll get back to you soon.
### Answer To prevent the agent from asking for the phone number, you should use the
const
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 :
Copy code
json
{
  "type": "object",
  "properties": {
    "phone_number": {
      "type": "string",
      "const": "{{user_number}}"
    }
  }
}
​ To learn more, see the sources I considered: [[1] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[2] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[3] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
[(1) ]() This approach ensures
{{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) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
@AI Evy what is an A2P application?
a
Thanks for the follow-up, @Drift. I'll get back to you soon.
### Answer A2P stands for "Application-to-Person" messaging [(1) ]() . It's a type of SMS communication where an application (like your Retell AI agent) sends text messages to individuals with 10-digit phone numbers [(2) ](

▾

) . Why A2P registration matters: To enable SMS capabilities with Retell AI, you need to complete an A2P application process that includes [(1) ]() : 1. Business Profile approval (free) 2. Brand registration ($4 for low-volume or $45 for standard) 3. SMS Campaign approval ($15 one-time fee) What it enables: Once approved, your Retell AI phone number can send SMS messages to customers . The application process typically takes 2-3 weeks, sometimes longer, as it involves manual review by the telephony provider . Volume tiers: - **Low-volume**: Send fewer than 6,000 message segments per day to the US - **Standard**: Send between 6,000 and 400,000 message segments per day to the US The A2P application ensures compliance with carrier regulations and prevents spam, which is why the approval process includes reviewing your use case and sample messages [(1) ]() [(2) ](

▾

) .
​ To learn more, see the sources I considered: [[1] Send & receive SMS](https://docs.retellai.com/deploy/enable-sms) [[2] A2P Setup ultra guide | Enable SMS for Your Retell Agent](

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

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