hamza-007
03/04/2026, 2:40 PMcall.type variable, but it doesn’t seem to distinguish properly between inbound and outbound calls. Here’s the snippet I’m using:
{% if call.type == "outboundPhoneCall" %}
- "Hi {{firstName}}, this is Lexi with NEXA Mortgage. We helped with your last FHA or VA home loan, and I'm reaching out as part of your quarterly mortgage review. I hope you're having a great day."
{% elsif call.type == "inboundPhoneCall" %}
- "Hi {{firstName}}, this is Lexi with NEXA Mortgage. Thanks for calling! You’ve been invited to learn more about our Quarterly Mortgage Review."
{% endif %}
How can I correctly distinguish between inbound and outbound calls in Vapi so the greeting script triggers appropriately?Chiranjeet Mishra
03/10/2026, 6:48 AM{{call.type}} is not available in Vapi’s template system, so it cannot be used directly in system prompts or first messages.
Recommended solution:
Pass a custom variable using assistantOverrides.variableValues, then reference it in your prompt.
For outbound calls (via API):
POST /call/phone
{
"assistantId": "your-assistant-id",
"assistantOverrides": {
"variableValues": {
"callDirection": "outbound",
"firstName": "John"
}
},
"phoneNumberId": "...",
"customer": { "number": "+1234567890" }
}
For inbound calls (via the assistant-request webhook):
{
"assistantId": "your-assistant-id",
"assistantOverrides": {
"variableValues": {
"callDirection": "inbound",
"firstName": "Jane"
}
}
}
You can then reference this variable in your prompt to control the first message logic.
Alternative:
Use separate assistants for inbound and outbound calls, each with its own first message.
Best regards,
Oshi Raghav
Customer Support
Vapihamza-007
03/16/2026, 7:43 AMChiranjeet Mishra
03/18/2026, 7:12 AM