endCall Tool doesn't work
# support
a
Hello, i'm having an error when calling the endCall tool, does any one could give me an example of how to call correctly the tool inside the prompt. I also created a tool of type endCall and also doesn't works correctly, i was using the function like the next example: ## Initial Detection and Handling - Identifies improper calls using predefined criteria or specific rules. - In these cases, provides the appropriate response and then MUST USE THE β€œendCall” TOOL TO END THE CALL. ## Initial Detection and Handling - Identifies improper calls using predefined criteria or specific rules. - In these cases, it provides the appropriate response and TERMINATES THE CALL. ## Initial Detection and Handling - Identifies improper calls using predefined criteria or specific rules. - In these cases, provides the appropriate response and then MUST USE the endCall TOOL TO END THE CALL. also i'm using for the provider open ai, and for the model gpt-4o-mini
v
Hi there! I'd be happy to help you with implementing the "endCall" tool correctly. πŸ‘‹ Based on your examples, it looks like you're trying to instruct the model to use the endCall tool in your prompt, but you might be missing some configuration elements. Let me walk you through the correct implementation: ### 1. First, ensure the tool is properly configured in your assistant:
Copy code
json
{
  "model": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "tools": [
      {
        "type": "endCall"
      }
    ]
  }
}
### 2. For your prompt instructions, be explicit and use function calling syntax: Instead of just mentioning the tool in your instructions, try using more explicit language that triggers the model to use function calling:
Copy code
When the conversation should end, you MUST call the endCall function directly without explaining that you're doing so. Do not say "I'll end the call now" or similar phrases - just call the function.
### 3. Common issues to check: - Make sure
endCallFunctionEnabled
is set to true in your dashboard - The model might log the function call but not actually end the call if parameters aren't passed correctly - Check for conflicts with other tool calls that might be preventing execution ### 4. Example implementation: When implementing the endCall function, you might need to structure it with parameters like:
Copy code
json
{
  "callId": "your_call_id",
  "reason": "User finished interaction",
  "timestamp": "2023-04-14T12:34:56Z"
}
If you're still having issues, you might need to check your implementation code. Here's a sample code snippet for invoking the endCall tool: ```bash # Assuming you have a defined CALL_ID for the current conversation CALL_ID="your_call_id" CONTROL_URL="https://aws-us-west-2-production1-phone-call-websocket.vapi.ai/$CALL_ID/control" # First send any final message curl -X POST "$CONTROL_URL" \ -H 'content-type: application/json' \ --data-raw '{ "type": "add-message", "message": {
"role": "assistant", "content": "Thank you for your time. I will end this call now. Goodbye!" }, "triggerResponseEnabled": true }' # Wait for the message to be spoken sleep 2 # Then, end the call curl -X POST "$CONTROL_URL" \ -H 'content-type: application/json' \ --data-raw '{ "type": "end-call" }' ``` Let me know if you need any clarification or have additional questions! 😊 Sources: - [Vapi Documentation](https://docs.vapi.ai/tools/default-tools) - [Discord Thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336004944150401166) - [Discord Thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1305929557144240159)
a
do you have the instructions for the ui example?
c
@Alexve FWIW, I also had trouble with endCall. I didn't dig deep because I found 'endCallPhrases' to work fairly well. My agent had a few stock goodbye phrases, so I stuffed them into 'endCallPhrases' and it now works most of the time.
a
@cw Honestly, I'll see what I can do. One issue is that my agent is in both English and Spanish, and it used to work fine, but I've been having problems lately.
@Vapi Support Bot where can i set the endCallPhrases?
v
Hi there! I can help you find where to set the endCallPhrases in the Vapi platform πŸ‘ You can configure the endCallPhrases in the assistant configuration section of your Vapi dashboard. Here's how: 1. Log into your Vapi account 2. Navigate to the assistant configuration section (typically under "Assistants" or "Voice Configuration") 3. Look for the
assistantOverrides
section 4. Within this section, you'll find the
endCallPhrases
parameter where you can specify the phrases Here's an example of how the configuration should look:
Copy code
json
{
  "assistantOverrides": {
    "endCallPhrases": [
      "you've reached",
      "press 0 for",
      "to speak to a representative"
    ]
  }
}
These phrases are designed to help your assistant automatically end calls when it detects specific phrases (like those from auto-attendants), which can save you minutes when dealing with automated systems. After adding or modifying the phrases, make sure to save your configuration and test it to ensure it works as expected! Note that the exact UI navigation might vary slightly depending on platform updates, but the configuration parameter remains the same. Source: - [Vapi Discord](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334188247676358656)
s
Hey! To help track down this issue, could you share: - The call ID - When exactly this happened (the timestamp)
f
Copy code
{
  "model": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "tools": [
      {
        "type": "endCall"
      }
    ]
  }
}
This does not work. When I create an agent using this as the payload the created agent still has the endCall toggle switched off and when I talk to it it cannot end the call https://cdn.discordapp.com/attachments/1349827929571590234/1350495431502856277/image.png?ex=67d6f261&is=67d5a0e1&hm=02fbe9a65ed3228dd22f405fa07d2285367a40c4c57f8b8e692761c0f26b9a25&
Actually nvm, looks like a frontend bug
after I made the prompt more explicit the agent can end the call
But there is clearly a frontend bug then where after creating an agent from the API with endCall enabled it shows as disabled
s
Thanks for bringing this to our attention Frikster, I'm glad you were able to resolve your issue by making the prompt more explicit. If anything else comes up feel free to reach back out.