Tool not being called on Silence Time Out or Custo...
# support
f
Hi team, I've done a lot of testing and have hit a road block. Hoping to find a quick solution for this. This Assistant's purpose is to collect information regarding Function from the Customer and then send this by email to the Functions Manager. We are getting inconsistent emails being sent where the Assistant isnt calling the functionsEnquiry tool when: - Customer hangs up (incase something happens on their line, we still need the Assistant to call the functionsEnquiry tool to ensure the information collected is sent) - Customer goes silent (we've had cases in the past where customers line goes very quiet or silent during call and Assistant ends call. In this case, we want to ensure the functionsEnquiry tool is called so information collected is sent) Right now, here is our prompt: # CALL COMPLETION const CALL_COMPLETION = ` > Only trigger endCall after either: >> All information is collected and functionsEnquiry is called. >> Customer explicitly ends conversation. >> Error condition requires termination. > STRICTLY silently call the functionsEnquiry tool in the following cases: >> When you have finished collecting the Information Tracking. >> If at least some Information Tracking has been collected and the call is unexpectedly interrupted or ended (e.g., silenced timed out, customer hangs up, phone line drops, or any other disconnection). > DO NOT discard collected data due to call interruptions. `;
Following on from above post, here are our Call Examples Call 1 Call ID: 2db904d6-031f-477b-ba8f-359a175a6d0a Customer hung up & no call was made to functionsEnquiry tool. Although, Dashboard Analysis Notes say Call ended abruptly, The inquiry details were presumably sent to the Functions Manager for follow-up. It would be great to understand where the "presumably sent" note in Analysis came from. It's confirmed it was NOT sent. Call 2 Call ID: dd39b780-0301-4ae6-b897-8c3d5a358c5b Customer goes silent & no call was made to functionsEnquiry tool. Dashboard Analysis Notes: The enquiry was successfully taken and will be sent to the Functions Manager. It's confirmed - NO email was sent.
m
hey @firefly_0206 , without being able to look up the call logs yet I can definitely help you out as much as I can. Once the call ends, it won't send any further requests to your LLM provider. The best way to do what you'd like is to catch endedReason and if it's anything besides a success reason (such as assistant-ended-call) you can fire the function yourself. Here's a list of ended reasons: https://docs.vapi.ai/calls/call-ended-reason
f
Hi @Mason I appreciate your input, I will check this out!
m
No problem man let me know how it goes, incase you run into any problems I’ll keep an eye out for this ticket 🤝
k
Hey Beck, is this resolved for you? If so I'll close out the ticket.
f
Hi @Mason thanks for checking in, not yet. Still in progress
Hi @Mason , after looking over this - I have identified the endedReasons for each. Call 1 - *endedReason: Customer Ended Call * Call ID: 2db904d6-031f-477b-ba8f-359a175a6d0a Customer hung up & no call was made to functionsEnquiry tool. Although, Dashboard Analysis Notes say Call ended abruptly, The inquiry details were presumably sent to the Functions Manager for follow-up. It would be great to understand where the "presumably sent" note in Analysis came from. It's confirmed it was NOT sent. Call 2 - endedReason: Silence Time Out Call ID: dd39b780-0301-4ae6-b897-8c3d5a358c5b Customer goes silent & no call was made to functionsEnquiry tool. Dashboard Analysis Notes: The enquiry was successfully taken and will be sent to the Functions Manager. It's confirmed - NO email was sent. *My next question would be how can we ensure Assistant still fires the Function if part of the enquiry information is collected from the Customer. * The Assistant is only firing Function if all information is collected. Our intention here is to ensure information collected is still sent via email to the Manager if there was interruption or unexpected call ending - i.e customers line drops out (customer ends call), Assistant cannot hear customer (silence time out) etc. We are also seeing some inconsistency of Function being fired so this may ensure no enquiry is missed.
s
The key issue is that once a call ends, no further requests are sent to your LLM provider, as mentioned by Mason. This means your assistant can't execute any tools after the call has ended. Here's how to solve this: Option 1: Create a Webhook Server to Handle Call End Events 1. Set up a server to receive webhook notifications when calls end 2. In your webhook server, detect specific endedReason values (like "customer-ended-call" or "silence-timed-out") 3. When these events occur, check if data was collected but not sent, and trigger your function manually Here's how to implement this: 1. Create a webhook endpoint in your server code 2. Configure your Vapi assistant to use this webhook URL in the server.url field 3. In your webhook handler, process the status-update event type that includes the endedReason 4. If the endedReason is one you care about (customer-ended-call or silence-timed-out), and you have partial data, trigger your function Sample webhook handler code: // Sample webhook handler app.post('/webhook', (req, res) => { const data = req.body; const message = data.message || {}; if (message.type === 'status-update' && message.status === 'ended') { const endedReason = message.endedReason; // Check if this is a case we need to handle if (endedReason === 'customer-ended-call' || endedReason === 'silence-timed-out') { // Get the call ID and any data you've stored const callId = data.call?.id; // If you have partial data for this call stored somewhere // Call your function to send the email with whatever data was collected if (callId && hasPartialData(callId)) { const collectedData = getPartialData(callId); sendEmailWithData(collectedData); } } } res.json({ success: true }); }); Option 2: Store Partial Data During the Call Another approach is to continuously store the collected data during the call: 1. Modify your assistant logic to incrementally save collected information to your backend as soon as it's gathered 2. Set up a webhook to receive call end events 3. When you get a call end event, if data was collected but the function wasn't called, trigger it manually This would involve: 1. Creating endpoints to store partial data during the conversation 2. Having your assistant make API calls to store data as it's collected 3. Using your webhook to check if the function was already called when the call ends Implementation Steps 1. Set up a webhook server that can receive call status updates 2. Configure your Vapi assistant to send webhooks to your server 3. In your webhook handler, when you receive a call end event with endedReason "customer-ended-call" or "silence-timed-out", check if you have partial data for that call 4. If data exists but the functionsEnquiry wasn't called, manually trigger it This approach ensures that even if the call ends unexpectedly, you'll still process and send the data that was collected up to that point. Would you like me to elaborate on any of these solutions further?
2 Views