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 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
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 after generating the acknowledgment message, causing the voice system to prioritize the "Goodbye" message over the acknowledgment. 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:
[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.
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 C: Information Only
- Caller asks specific question.
- Agent provides answer.
- Caller satisfied with response.
- Agent ends call professionally.
What Are the Key Lessons for VAPI Developers?
1. Timing is Critical
The most important lesson is that timing matters significantly in voice interactions. The sequence of:
- Generate acknowledgment.
- Deliver acknowledgment.
- Wait for processing.
- Trigger endCallPhrases and endCall( ) as a fall-back.
Must be followed precisely to avoid message conflicts.
2. 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.
3. Prompt Engineering Requires Iteration
The initial prompt worked until it didn't. Regular testing and prompt refinement are essential for maintaining reliable behaviour.
4. 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.
5. 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.
How Can You Apply These Solutions?
Ending calls smoothly in VAPI requires careful attention to timing, sequencing, and user experience. The journey from the initial implementation to the current solution demonstrates the importance of:
- 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 timing conflicts can override intended messages has broader implications for voice AI development and should be considered in any voice interaction design.
TL;DR
Creating smooth call endings in VAPI requires proper timing between acknowledgment messages (endCallPhrases) and the endCall( ) function. The key solution is to deliver the acknowledgment message first, wait for processing, then trigger endCall( ). Use Langfuse for debugging and test regularly to maintain reliable behaviour.
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.
Contact Me
I can help you with your:
- Voice AI Assistants;
- Voice AI Automation;
I am available for remote freelance work. Please contact me.
References
This article is made possible due to the following excellent resources:
Recent Articles
The following articles are of interest:
Add new comment