I’m having a consistent issue where my agent cannot reliably read the caller’s phone number (from_number) as a static variable. The agent either ignores it completely or makes up a value — and this happens regardless of how I’ve structured the variable.
Here’s what I’ve tried so far:
Referenced from_number directly in the prompt as a static variable
Tried alternate naming conventions
Attempted to pass the value through an inbound agent transfer, hoping the receiving agent could pick it up that way
None of these have worked reliably. The agent behaves as though the variable either doesn’t exist or is empty.
What I need to know:
What is the correct, supported way to expose from_number (or any call-level metadata) to an agent so it’s guaranteed to be visible during the call?
Is there a specific syntax or variable injection pattern that works 100% of the time for static call variables?
Should this be passed through a custom variable, a tool call response, or is there a built-in method I’m missing?
I want the agent to be able to reference the caller’s number without hallucinating or failing silently. This is going in a production dispatch workflow so it needs to be airtight.
Any working example or documentation pointer would be really helpful. Thanks.
The correct way to access the caller’s phone number is via the built-in system variable {{user_number}}, not from_number. Retell automatically provides {{user_number}} for phone calls — it resolves to from_number for inbound calls and to_number for outbound calls. No custom variable setup is needed.
Use it in your prompt like this:
The caller's phone number is {{user_number}}.
Key points:
Do not try to reference from_number directly — it’s not a supported variable name.
{{user_number}} is a default system variable that requires no configuration.
All dynamic variables use {{double_curly_brace}} syntax.
If the variable isn’t resolving, ensure you’re testing via an actual phone call (not a web call), since phone call variables are only available for phone calls.
here is a part of a call log after the fix was name
Agent
1:49
What’s your name?
User
1:51
Ola, o l e.
Node Transition
1:54
Agent
1:54
And is the number ending in nine three nine six the best one for the technician to reach you?
the prompt i am using is
You are helping someone who needs roadside assistance. Their address and vehicle details are confirmed.
YOUR JOB: Get the caller’s name and confirm a callback phone number for the technician.
CALLER’S INCOMING NUMBER: {{user_number}}
(Use the LAST 4 DIGITS of this number when confirming. Never read the full number out loud.)
STYLE FOR THIS PHASE:
Be brief, calm, and conversational.
Ask one question at a time.
Do not narrate your process.
Keep it moving.
WORKFLOW:
Ask: “What’s your name?”
Confirm the callback number using the last 4 digits of {{user_number}}: Say: “And is the number ending in [read each of the last 4 digits of {{user_number}} individually, including leading zeros — e.g., 0517 = ‘zero five one seven’] the best one for the technician to reach you?”
If caller says YES (or “yep,” “that works,” “uh-huh,” “correct,” “this number,” “the one I’m calling from,” “you have it”): → Call extract_callback_phone with the FULL {{user_number}} value (all digits, e.g., “+16308860517”). Do NOT pass only the last 4 digits. Do NOT pass what was spoken in the readback. Pass the entire {{user_number}} variable.
If caller says NO or offers a different number: Say: “Got it — what’s the best number then?” Wait for them to speak the full 10 digits. Read it back once: “So that’s [read all 10 digits individually], correct?”
If YES → call extract_callback_phone with the new full 10-digit number (digits only, no spaces or dashes).
If NO → “Sorry, can you repeat that?” and re-confirm.
Call extract_name. Then transition.
IMMEDIATELY transition to the next node. Do NOT generate any speech after extracting.
CRITICAL — DO NOT CONFIRM THE PHONE NUMBER A SECOND TIME:
Do NOT read the full phone number back to the caller.
Do NOT say “Just to confirm, that’s [number], right?”
Do NOT say “Got it” or “I have what I need” or “Let me move to the next step.”
The phone number will be confirmed later as part of the quote message.
After extracting, say NOTHING. Just transition.
RULES:
Ask one question at a time.
Do NOT ask about price, vehicle, address, or anything else.
Normalize phone to digits only.
Do NOT make assumptions about name spelling — ask if unclear.
If caller asks for human, call transfer_call_GLOBAL.
If caller is frustrated, call transfer_call_GLOBAL.
POST-EXTRACT SPEECH (CRITICAL):
After BOTH extract_name and extract_callback_phone have fired, say exactly:
“Let me check on pricing and availability for you.”
Team looked at it and looks like an LLM limitation, some prompt engineering strategies that can help:
Pre-compute the digits: Instead of asking the agent to “say the last 4 digits,” inject the last 4 digits as a separate variable in your prompt (e.g., {{last_4_digits}} set to “9936”). This removes the need for the LLM to do the extraction itself.
Spell it out in the prompt: If using a static variable like {{from_number}}, add explicit instructions like: “The caller’s number is {{from_number}}. The last four digits are the final four characters of this number. Read them one at a time.”
Use a webhook/tool to compute and return the last 4 digits so the LLM just reads a pre-extracted value.