Why Do Call Endings Matter in Voice AI?
Learn How to Solve Timing Issues and Create Professional VAPI Call Endings
Creating a professional voice agent that can end calls smoothly is crucial for maintaining positive customer experiences. This article documents a real-world journey developing a VAPI (Voice AI Platform) agent that can gracefully conclude conversations, the challenges encountered, and the solutions discovered along the way.
Who is this Article for? | Article Use Case
This article is for developers, product managers, and technical teams working with VAPI or similar voice AI platforms who need to create professional call ending experiences. It's particularly valuable for those experiencing timing issues, inconsistent call endings, or looking to improve their voice agent's user experience.

What You'll Learn in This Article
- What Makes a Good Call Ending in VAPI?
- How Did We Solve the Call Ending Problem?
- How Do You Orchestrate endCallPhrases and endCall() for Different Conversation Paths?
- Which VAPI Settings Are Most Important for Call Endings?
- How Do You Test Call Ending Functionality?
- What Are the Key Lessons for VAPI Developers?
- How Can You Apply These Solutions?
What Makes a Good Call Ending in VAPI?
The core challenge is to end a call professionally so the caller leaves with a positive experience, feeling valued and informed. This requires careful orchestration of timing, messaging, and technical implementation.
What Are the Key Elements of a Professional Call Ending?
A successful call ending should embody these key principles:
- Polite and professional - Maintain courteous tone throughout.
- Acknowledgement of the caller's request - Confirm their needs have been understood.
- Clear action indication - Specify what will happen next.
- Smooth transition to ending - Avoid abrupt termination.
- Clear call conclusion - Use phrases that indicate the call has ended.

What Does a Successful Call Ending Look Like?
Scenario 1: Message Taking
Agent: "Thank you for contacting Patrick Michael. We have noted your request and will get back to you shortly. Goodbye."
Result: Caller feels acknowledged and informed
Scenario 2: Caller Will Call Back
Agent: "No problem. Thank you for contacting Patrick Michael. Have a great day. Goodbye."
Result: Caller understands the call is ending naturally
What Are the Common Problems with Call Endings?
Problem 1: Abrupt Ending
Agent: "Goodbye." (Call terminates immediately)
Issue: No acknowledgement, caller feels dismissed
Problem 2: Incomplete Ending
Agent: "Thank you for contacting Patrick Michael."
Issue: Call terminates without clear conclusion, caller unsure if call ended
Problem 3: Hanging Call
Agent: "Thank you for contacting Patrick Michael. We have noted your request and will get back to you shortly."
Issue: Call doesn't terminate, agent goes idle, caller left hanging
Problem 4: Premature Termination
Agent: "We will get back to you shortly. Is that correct?" (Call terminates mid-conversation)
Issue: endCallPhrase triggers call termination before confirmation is complete
How Did We Solve the Call Ending Problem?
What Was Our First Approach to Call Endings?
Base VAPI Configuration:
- Voice: Eleven Labs
- Model: gpt-4o
- Temperature: 0.15
Initial Approach: The first solution involved instructing the agent in the prompt to thank the caller and then end the call, combined with VAPI's endCall( ) function and endCallMessage configuration.
Stage 1 Prompt Example:
[Caller Call Back Procedure]
1. You say: "No problem. Thank you for contacting Patrick Michael. Have a great day."
2. Then, proceed to the End Call Procedure section.
[End Call Procedure]
Trigger the endCall Function.
Stage 1 VAPI Configuration:
//in model object
{
"tools": [
{
"type": "endCall"
}
]
}
//end call message
{
"endCallMessage": "Goodbye"
}
Initial Success:
This solution worked initially and was deployed to production in February 2025. The agent would deliver an acknowledgment message and then trigger the endCall( ) function, which would add "Goodbye" as the final message.
The Breakdown:
By July 2025, the solution began failing. The agent would either:
- Not end the call (no endCall( ) function triggered).
- End the call abruptly without proper acknowledgment.
- On odd occasions, we discovered dialogue that existed in the transcript was excluded in the audio, as such the caller did not hear the full message.
Langfuse Trace
The Langfuse trace indicated the acknowledgement message did exist in the transcript. The LLM is responding correctly and following the prompt instructions. However, this message is not heard by the caller. WHY?

VAPI Logs
VAPI logs confirmed the missing dialogue.

Key Discovery:
Testing revealed two key discoveries:
- Testing revealed that the agent was waiting for the caller to explicitly indicate they wanted to end the call with phrases like "Goodbye" or "Thank you" before triggering the endCall( ) function. This created inconsistent behaviour and poor user experience.
- Dialogue from the LLM is missing in the audio. At this point, we were in the dark as to why key dialogue is excluded from the audio.
How Did We Discover and Fix the Timing Issue?
Two significant developments occurred that transformed the approach:
- endCallPhrases Feature Release - A new VAPI configuration option is discovered.
Phrases that, if spoken by the assistant, will trigger the call to be hung up. The End Call Reason given with this scenario is: assistant-said-end-call-phrase.- It is not clear when this feature was released.
Interrogating the change logs revealed:
"Based on my search, I can see that there was a feature added on January 14, 2025 that allows developers to programmatically end a call by sending an 'end-call' message type within ClientInboundMessage. This appears to be related to but different from endCallPhrases.
Let me search one more time specifically for endCallPhrases.
Based on my searches, while I can see references to call ending and end call functionality, I cannot find the specific date when endCallPhrases was added to the system. There are related features like the ability to programmatically end a call using the 'end-call' message type (added January 14, 2025) , and call end reasons including assistant-said-end-call-phrase, but I cannot find when the specific endCallPhrases feature was added.
I apologize, I can't find the specific changelog entry for when endCallPhrases was added in the available documents."
- It is not clear when this feature was released.
- Langfuse Integration - We integrated Langfuse, advanced logging and debugging capabilities, into our testing workflow.
What Did the Debugging Reveal?
The integration of Langfuse provided unprecedented visibility into the agent's decision-making process. Through detailed logging, we discovered a critical timing issue that was causing the acknowledgment message to be overridden.
Key Evidence from Debug Logs:
13:56:59:962: Model called tool: endCall()
13:56:59:966: Voice input: No problem. Thank you for contacting Patrick Michael. Have a great day.
13:56:59:975: Voice cached: Goodbye
What Was the Root Cause of the Problem?
The endCall( ) function was being triggered immediately before generating the acknowledgment message. My hypothesis is that the 'Goodbye' is cached, as such is said immediately, before the acknowledgement has time to be uttered. So, endCall( ), end call message and call termination happen before the acknowledgement message has had time to be said. The caller only heard "Goodbye" instead of the full acknowledgment.
How Did We Fix the Timing Issue?
The solution involved modifying the prompt and adjusting VAPI configuration settings to include endCallPhrases. For the endCallPrases to work, we engineered the prompt so that the agent would speak specific phrases at the end of different conversation flows.
If the conversation followed X path, end the call with Y phrase.
Our prompts are constructed with clearly defined unambiguous sections, and this technique enables tighter control of the conversation flow and agent behaviour.

Stage 2 Prompt Modifications:
Note NB (Sept 2025): adding timing in the prompt as suggested below, does not work. See solution below - continue from What Did We Learn From Timing Directives, and How Do You Orchestrate endCallPhrases and endCall() for Different Conversation Paths?
[Caller Call Back Procedure]
1. You say: "No problem. Thank you for contacting Patrick Michael. Have a great day. Goodbye."
2. **IMPORTANT**: After delivering this acknowledgment message, wait for a brief moment to ensure the message is heard by the caller before proceeding.
3. Then, proceed to the End Call Procedure section.
[Message Delivery Timing]
**CRITICAL**: When ending calls, follow this sequence:
1. Deliver your acknowledgment message first (e.g., "Thank you for contacting Patrick Michael. Have a great day. Goodbye.")
2. Allow the message to be processed and delivered to the caller.
3. Only after the acknowledgment message has been delivered, then trigger the endCall Function.
Stage 2 VAPI Configuration
//in model object
{
"tools": [
{
"type": "endCall"
}
]
}
//end call message and end call phrases
{
"endCallMessage": "Goodbye",
"endCallPhrases": [
"we will get back to you shortly",
"have a great day"
]
}
What Were the Key Changes Made?
- Sequential Processing - Explicit requirement to deliver acknowledgment first, then wait, then call endCall( ).
- Specifying and implementing end call phrases - Prompting the agent to speak end call phrases.
- Timing Awareness - Multiple reminders about not calling endCall( ) simultaneously with acknowledgment.
- Clear Sequence - Step-by-step process to prevent timing conflicts.
What Did We Learn About Timing Directives?
The Timing Directive Reality Check
Despite implementing explicit timing directives in the prompt (waiting instructions, sequential processing requirements), our analysis revealed that these directives had minimal effect on actual agent behaviour. The LLM continued to exhibit timing inconsistencies regardless of explicit instructions to wait or follow specific sequences.
Why Timing Directives Don't Work
- LLM Processing Nature: Large Language Models process and generate responses in a single turn, making it difficult to enforce real-time waiting behaviours through prompt instructions alone. LLMs operate under resource constraints and must balance competing objectives such as accuracy, latency, compute efficiency, and cost, which limits their ability to follow explicit timing directives [[1]].
- Voice Processing Pipeline: The voice processing pipeline (text-to-speech, audio generation, delivery) operates independently of LLM timing instructions, creating inherent delays that can't be controlled through prompting. The endCall() function can be triggered before the acknowledgment message is fully delivered, leading to abrupt call terminations where the caller only hears a partial message. This issue has been reported in VAPI community discussions where users experienced endCall() not working as expected despite appearing in logs [[2]].
- Function Call Timing: When the LLM generates both a response and a function call in the same turn, the execution timing is determined by the platform, not the prompt instructions. This platform-controlled timing can override intended message sequences, resulting in timing conflicts that prompt instructions cannot prevent [[3]].
The Solution: Orchestrated endCallPhrases
Instead of relying on timing directives, we shifted to a conversation flow orchestration approach using endCallPhrases strategically placed at the natural conclusion points of different conversation paths. This approach aligns with best practices for LLM inference performance monitoring, which emphasise measuring model speed and response times to ensure efficiency, reliability, and consistency in real-world scenarios [[4]].
How Do You Orchestrate endCallPhrases and endCall() for Different Conversation Paths?
What Is Conversation Flow Orchestration?
Instead of relying on timing directives, successful VAPI call endings require strategic orchestration of endCallPhrases and endCall() based on the specific conversation path taken. This approach maps different conversation flows to appropriate ending strategies.
The idea is to ensure that the endCallPhrase and the endCallMessage work together and apart. There are times when the endCallPhrase AND the endCallMessage are heard, times when only the endCallPhrase is heard, and times when only the endCallMessage is heard.
SO:
Do not add 'Goodbye' into the endCallPhrase, and ensure the endCallPhrases work without a 'Goodbye'. For our messenger agent, we can use the following:
- endCallMessage: "Goodbye"
- endCallPhrases: "Have a great day" "We will get back to you shortly"
My experience and much testing reveals that whether the call ends smoothly, and in what manner, depends to a large degree on the conversation path.
What Are the Key Conversation Paths?
A conversation can take many paths, however for our messenger agent, I have identified two main flows. This is after listening to many calls over time.
- Full flow: Question → Answer → Take Message → Collect Details → Confirm Phone Number → Thank Caller → endCallPhrase → endCall().
- Edge flow: Any flow where the agent does not complete or is not given the opportunity to Take Message → Collect Details → Confirm Phone Number.
- The most common is, after the initial conversation, the caller indicates they will call back later.
Full Flow
Conversation Flow: Question → Answer → Take Message → Collect Details → Confirm Phone Number → Thank Caller → endCallPhrase → endCall().
Ending strategy: "Thank you (caller name), I have noted your request for more information on (caller request) and will pass it on to the team. Thank you for calling Patrick Michael, we will get back to you shortly." Now if the endCallMessage (Goodbye) is heard as well, the conversation makes sense.
Edge Flow
Conversation Flow: Question → Answer → Will call back → Thank Caller → endCallPhrase → endCall().
Ending strategy: "No problem (caller name). Thank you for calling Patrick Michael, have a great day." Now if the endCallMessage (Goodbye) is heard as well, the conversation makes sense.
Now with the above strategy, it is possible, and I have experienced it, that the agent will use an endCallPhrase early in the conversation, thereby terminating the conversation illogically. We can call this Premature Call Termination.
What Happened with Premature Termination?
Agent: "Thank you Priya, I have noted your request and will pass your message on to the team. We will get back to you shortly. To confirm, is your number zero 7 1 2 3...? Is that correct?" [Call terminates immediately due to "We will get back to you shortly" being an endCallPhrase]
We need to add guardrails in our prompt.
What Guardrails Prevent Premature Call Termination?
We added the following to strategic sections of our prompt.
Add the endCallPhrases to the prompt
[End Call Phrases]
- "We will get back to you shortly"
- "Have a great day"
Global prohibition
Never include any End Call Phrases in the same utterance as a question or while awaiting any confirmation
Timing
- WAIT for the Caller to confirm before proceeding, and avoid using End Call Phrases until the Caller has confirmed.
- Example:
- You: "Is that correct?"
- Caller: "Correct".
- Then proceed to the Thank Caller Procedure section.
What Are the Key Guardrail Principles?
- Separation of Concerns: Never mix questions with closing phrases;
- Explicit Confirmations: Always wait for explicit confirmation before proceeding;
- Sequential Processing: Complete all required steps before triggering endCallPhrases;
- Context Awareness: Only use endCallPhrases when the conversation is genuinely ready to end;
- Fallback Safety: Use endCall() as a backup, not the primary termination method.
Which VAPI Settings Are Most Important for Call Endings?
What Are the Essential VAPI Configuration Elements?
1. endCall( ) Tool (VAPI default tool)
- Purpose: Programmatically terminates the call.
- Trigger: Called by the agent when ready to end.
- Behaviour: Adds final message and terminates connection.
2. endCallMessage
- Purpose: Sets the final message before call termination.
- Default: "Goodbye".
- Customization: Can be modified for different scenarios.
3. endCallPhrases
- Purpose: Phrases that, if spoken by the assistant, will trigger the call to be hung up.
- Implementation: List of phrases that trigger call ending.
- Benefit: More control of the conversation flow.

What Advanced Settings Should You Consider?
Temperature Settings:
- Lower temperature (0.15) provides more consistent behaviour.
- Higher temperature may introduce variability in call ending patterns.
Model Selection:
- gpt-4o and gpt-4.1 provides reliable function calling.
- gpt-4o context window: 128 000 tokens (96 000 words).
- gpt-4.1 context window: 1 000 000 tokens (750 000 words).
- Consistent behaviour across different conversation scenarios.
How Do You Test Call Ending Functionality?
What Tools Do You Need for Effective Testing?
1. Langfuse Integration
- Purpose: Advanced logging and debugging.
- Benefits:
- Real-time conversation analysis.
- Timing analysis.
- Cost monitoring.
2. VAPI Logs
- Purpose: System-level debugging
- Key Metrics:
- Voice audio processing times.
- Function call timing.
- Message delivery sequence.
- End pointing behaviour.
3. Audio Transcripts
- Purpose: User experience validation.
- Analysis: What the caller actually hears vs. what was intended.
4. Test Scenarios
- Structured Testing: Predefined conversation flows.
- Edge Cases: Various caller responses and behaviours.
- Regression Testing: Ensuring fixes don't break existing functionality.
What Test Scenarios Should You Cover?
Scenario A: Standard Message Taking
- Caller asks about services.
- Agent provides information.
- Caller requests callback.
- Agent takes message and ends call.
Scenario B: Caller Will Call Back
- Caller asks about pricing.
- Agent explains quotation-based pricing.
- Caller indicates they'll call back.
- Agent acknowledges and ends call.
Scenario D: Guardrail Testing
- Caller provides phone number.
- Agent repeats number and asks for confirmation.
- Verify no premature termination.
- Caller confirms.
- Agent delivers appropriate closing.
What Are the Key Lessons for VAPI Developers?
1. Timing Directives Don't Work
Lesson: Explicit timing instructions in prompts have minimal effect on actual agent behaviour. Instead, focus on conversation flow orchestration and strategic endCallPhrase placement.
Action: Design conversation paths with natural conclusion points rather than relying on timing directives.
2. Orchestration is an Effective Strategy
Lesson: Successful call endings require mapping conversation paths to appropriate ending strategies, not trying to control timing through prompts.
Action: Create clear conversation flow maps and implement corresponding endCallPhrase strategies.
3. Guardrails Are Essential
Lesson: Without proper guardrails, endCallPhrases can trigger premature call termination, creating poor user experiences.
Action: Implement comprehensive guardrails that prevent endCallPhrases from being used in inappropriate contexts.
4. Debugging Tools are Essential
Langfuse and detailed logging provided the insights needed to identify the root cause. Without these tools, the timing issue would have remained hidden.
5. Prompt Engineering Requires Iteration
The initial prompt worked until it didn't. Regular testing and prompt refinement are essential for maintaining reliable behaviour.
6. User Experience Should Drive Technical Decisions
The technical solution must prioritize the caller's experience. A technically correct but poorly timed solution creates a poor user experience.
7. Configuration Changes Can Break Existing Solutions
The introduction of new VAPI features (like endCallPhrases) can affect existing implementations. Regular testing after platform updates is crucial.
8. Conversation Flow Analysis is Critical
Lesson: Understanding how conversations naturally flow and where they conclude is more important than trying to control timing.
Action: Analyze conversation patterns and design ending strategies around natural conclusion points.
How Can You Apply These Solutions?
Ending calls smoothly in VAPI requires careful attention to conversation flow orchestration, strategic endCallPhrase placement, and comprehensive guardrails. The journey from the initial implementation to the current solution demonstrates the importance of:
- Conversation flow mapping instead of timing control
- Strategic endCallPhrase orchestration based on conversation paths
- Comprehensive guardrails to prevent premature termination
- Comprehensive testing with proper debugging tools
- Iterative prompt engineering based on real-world behavior
- Understanding the technical constraints of voice processing
- Prioritizing user experience over technical convenience
The solution developed through this journey provides a robust framework for creating professional call endings that leave callers feeling valued and informed. The key insight that conversation flow orchestration is more effective than timing control has broader implications for voice AI development and should be considered in any voice interaction design.
TL;DR
Creating smooth call endings in VAPI conversation flow orchestration rather than timing control. Map different conversation paths to appropriate endCallPhrase strategies, implement comprehensive guardrails to prevent premature termination, and use Langfuse for debugging and test regularly to maintain reliable behaviour. Focus on natural conversation conclusion points rather than trying to force timing through prompts.
Article Resources
Links and downloads:
Subscribe
Explore the practical possibilities of AI for your business. Subscribe to our newsletter for insights and discussions on potential AI strategies and how they are adopted.
References
This article is made possible due to the following excellent resources:
[1] Bounded Rationality in Large Language Models. PMC. https://pmc.ncbi.nlm.nih.gov/articles/PMC12149859/
[2] endCall Not Working Even Though Written Out in the Logs. VAPI Support Forum. https://support.vapi.ai/t/23126488/endcall-not-working-even-though-written-out-in-the-logs
[3] VAPI Community Discussion on endCall Functionality. VAPI Community. https://vapi.ai/community/m/1371844980162691152
[4] endCall Without Arguments - VAPI Support. VAPI Support. https://support.vapi.ai/t/27119180/endcall-without-arguments
[5] VAPI Community Discussion on Call Ending Issues. VAPI Community. https://vapi.ai/community/m/1372945646209990676
[6] Best Practices for LLM Inference Performance Monitoring. Medium. https://medium.com/spheronfdn/best-practices-for-llm-inference-performance-monitoring-2a9e22cd8914
Recent Articles
The following articles are of interest:
Add new comment