endCall not ending call for ~20s
# support
h
The built-in endCall tool is not working well in our agents. The tool call happens, but then the call stays open ~20s longer before the call actually is ended. Is this a known bug? Is there any configuration on our end we can use to work around this? The tool call is configured like so:
Copy code
{
    type: "endCall",
    messages: [
        {
            role: "system",
            type: "request-complete",
        },
    ],
}
The agent will often also repeat its last phrase in the final message too, after the tool call completes (endCall "Successful") but before the call is ended. e.g. "The call has been ended as you requested. If you need any assistance in the future, feel free to reach out. Have a great day. The call has been ended as you requested. If you need any assistance in the future, feel free to reach out. Have a great"
c
Hi hiyataylor, Thanks for reaching out. Could you please share a few call IDs along with the assistant ID so we can look into this further? Thanks!
i
Hi Shaunak, I'm working with hiyataylor on the same project. The call id is [019bc451-dbcd-7880-a66d-b227e549e9db](https://dashboard.vapi.ai/calls/019bc451-dbcd-7880-a66d-b227e549e9db)
c
Hi, From what I can see, this call flow looks normal: the endCall tool is invoked at +25.1s and completes shortly after, with the final goodbye spoken before the call ends. Could you clarify where you’re seeing the issue in this example? If you have another call ID where the issue is clearer, please share it so we can compare. Just want to make sure I’m not missing anything on my end. Thanks!
i
The tool invokes in correct time. But the agent leaves from the conversation, instead of hang up. And in ~20s the call ends (hang up).
This issue arises only when we’re using the Twilio provider.
c
Hi, I think we may be looking at the wrong example. For call 019bc451-dbcd-7880-a66d-b227e549e9db, the flow looks normal in the logs: • User says “No” at +24.5s • endCall is triggered at +25.1s • Bot says “Thank you. Goodbye.” at +27.1s • Call completes shortly after Nothing unusual stands out in this call. Could you please share another call ID where the agent stops responding immediately but the call stays open for ~20 seconds? That will help us pinpoint the issue. Thanks!
h
The issue is that the real experience for the customer is extra silence at the end of the call. Within the Vapi console, that silence does not appear. The call linked above by Ivan has a duration of 29s. But if we look at that same call in our Twilio console, it has a duration of 39s. We'd like to figure out why that mismatch exists. https://cdn.discordapp.com/attachments/1461533698133463223/1461793655982526514/Screenshot202026-01-1620at2010.43.41E280AFAM.png?ex=696bd8ee&is=696a876e&hm=cf95166c28bfdaf1a61bbef7a988d65b1f552f0a1ac053c17e8a95f5dd0fc5cc&
We found that when we enable background noise, the background noise stops around the time of the tool call. So it seems like the agent is disconnecting, but the call itself is not ended.
c
Hi, Thanks for the details. This is expected behavior with Twilio. The endCall tool fires at the correct time on our side, but Twilio may keep the call open briefly during call teardown/audio drain, which can result in a few seconds of silence at the end. No configuration change is needed on your end, this is by design. Thanks!