Custom endCall function - "system" content gets sp...
# support
d
Hi, I'm creating a custom endCall function after the new update. I decided to use the "system" content as the request-complete message to personalize each goodbye message to the user. But, instead of generating a personalized goodbye, the assistant reads the system content out loud exactly as it's written (I send configuration on a screenshot - bright background) In my 3 other functions, request-complete message using "role":"system" works fine and it creates personalized messages after completing each function, instead of reading out the prompt. But for some reason, it doesn't work with endCall type of function (config - dark backgroud) I tried switching "system" to "assistant", and shortening the prompt wiritten in the "content" field - no result https://cdn.discordapp.com/attachments/1349282832177954836/1349282832337342525/Zrzut_ekranu_2025-03-12_081916.png?ex=67d2890f&is=67d1378f&hm=0600cf4998ea62482d5548706b56f8fbf48c3c2a0b2791ca3e72e500ed0c1f65& https://cdn.discordapp.com/attachments/1349282832177954836/1349282832601845811/Zrzut_ekranu_2025-03-12_082731.png?ex=67d2890f&is=67d1378f&hm=2e08ee2bf10e3e1bd9edc2b47baba6456b1c35e70bd1bd574882bf83d3952f54&
v
Hi there! 👋 I understand you're having an issue with your custom endCall function where the system content is being read verbatim instead of generating a personalized goodbye message. This is a known behavior difference with the
endCall
function compared to other function types. According to the documentation, there are some specific considerations when handling "system" role messages for endCall functions: 1. **Check your configuration**: Ensure
endCallFunctionEnabled
is set to true in your setup [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1336432457943351358). 2. **Try using the
say
method**: Instead of relying on the system message content, you can use the
say
method with the
endCallAfterSpoken
parameter to ensure a graceful termination:
Copy code
javascript
   vapi.say("Your personalized goodbye message", true);
This approach ensures your message is delivered before ending the call [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1336004944150401166). 3. **Review message configuration**: The system messages can sometimes trigger unintended responses from the assistant despite being intended to be non-intrusive [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1338730919904673853). 4. **Consider conditional logic**: You might need to implement conditional logic to trigger the endCall function based on specific user inputs or conditions [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1313293840580612166). If these steps don't resolve the issue, you might need to review recent changes to your configuration or examine the function call implementation at the code level [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1305929557144240159). Hope this helps! Let me know if you need further assistance. 🙂 Sources:
d
Also, I created all of my functions using the "create Tool" API: https://docs.vapi.ai/api-reference/tools/create. Otherwise I wouldn't be able to use "role":"system", cause in functions dashboard "role" messages are not available
p
Hello Damian, we're taking a look into this and will get back to you ASAP.
d
Hi, is there any solution yet? Just curious
p
Hey @damian To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!
s
@Damian
d
Sure, here's the call ID: 25707cd3-6eda-4fb6-ab6b-71161f8367dc
@Shubham Bajaj
s
@Damian can you check the call ID again?
d
Yes, this is the right call ID. Isn't it opening for you, or is there any other issue? Just in case - I made a new call showing this issue, here's the call ID: 939eb1af-a3b6-4961-9b5d-1bb1b4653ff9
s
🔵 17:54:49:769 Converted Requested Tools Calls To Internal Format. [ { "type": "endCall", "function": { "name": "zakonczRozmowe", "description": "Jeśli użytkownik na pytanie \"Czy mogę jeszcze w czymś pomóc?\" odpowie przecząco (np. \"To wszystko, dziękuję\", \"Nie, to wszystko. Dziękuję\", \"Nie, to już wszystko\") lub użyje krótkiej odpowiedzi sugerującej zakończenie rozmowy (np. \"To wszystko\", \"To tyle\", bez dalszego kontekstu), natychmiast wywołaj tę funkcję. Jeśli użytkownik sam się pożegna, natychmiast wywołaj tę funkcję." }, "messages": [ { "type": "request-complete", "content": "Pożegnaj się z użytkownikiem używając zwrotu \"Do widzenia\" z uprzejmym dodatkiem", "contents": [], "conditions": [], "role": "system", "endCallAfterSpokenEnabled": true } ], "toolCall": { "id": "call_UxMBYDu2Q2zfOyZZQARZQTad", "type": "function", "function": {"name": "zakonczRozmowe", "arguments": {}} } } ] 🔵 17:54:49:772 Getting Speech For
cartesia:575a5d29-1fdc-4d4e-9afa-5a9a71759864:44100:40b1a60b9a98cfbc6c145b78e680806af51abf00cb9a01c832e6ec795cd98594
, "80" Text: "Pożegnaj się z użytkownikiem używając zwrotu "Do widzenia" z uprzejmym dodatkiem" 🔵 17:54:49:772 Voice Input Formatted: "Pożegnaj się z użytkownikiem używając zwrotu "Do widzenia" z uprzejmym dodatkiem", Original: "Pożegnaj się z użytkownikiem używając zwrotu "Do widzenia" z uprzejmym dodatkiem" 🔵 17:54:50:041 Say Request Saying 80... (say: Pożegnaj się z użytkownikiem używając zwrotu "Do widzenia" z uprzejmym dodatkiem) 🔵 17:54:54:272 Conversation Buffer Appending Bot Message. Emitting "conversation-update"... { "role": "bot", "message": "Albo żegnaj się z użytkownikiem używając zwrotu do widzenia", "time": 1742493287884, "endTime": 1742493291274, "secondsFromStart": 21.8, "duration": 3390, "source": "" } 🔵 17:54:49:771 No suitable source content found to translate to language "pl". @damian as you can see Your last rebirth complete message or was being voiced out. It's just that the transcriber has transcribed it differently, and you get to hear it like, "My message not being voiced out," but that's not true. Your message is actually being voiced out; the transcriber is converting it into some different words.
@Damian i'll suggest adding your request complete messages to the keywords. It will help the transcriber to pass them exactly how you are looking out for.