corneliusschramm
02/28/2025, 6:42 PMend-of-call-report
changes slighlty between the a web call and a phone call.
On a normal phone call, there is the message.call.assistantId
which we use in our backend code to differentiate between agents and handle different agents with different logic. But when doing a web call, this key seems to be inexplicably missing which breaks our code.
Any idea what is happening here?
https://cdn.discordapp.com/attachments/1345103814318882959/1345103814612746240/Screenshot_2025-02-28_at_1.41.14_PM.png?ex=67c3550c&is=67c2038c&hm=2660b3dfd7b87c732a8fa0c929c6c385bae4d9d7ddf06f62183ca49eb353baff&Vapi Support Bot
02/28/2025, 6:43 PMend-of-call-report
payload in Vapi. The absence of the message.call.assistantId
key in web calls can indeed disrupt your backend logic. Here are a few potential reasons for this discrepancy:
1. **Call Flow and Handling Logic**: The assistantId
may not be recorded in the same way for web calls as it is for phone calls. If the assistant was not directly involved in the web call, the assistantId
might not be included in the payload. It's worth reviewing your call handling logic to ensure that the assistantId
is being captured correctly.
2. **Persistent vs. Transient Assistants**: If you're using transient assistants for web calls, the assistantId
might not be included. Make sure that your assistant is set up as persistent if you need the assistantId
to be present in every case.
3. **Incorrect Payload Configuration**: Sometimes, the payload structure can be affected by how the call is initiated. If you're using a transient assistant, it might take precedence over the expected assistantId
. Double-check your payload configuration to ensure it's set up correctly.
4. **Webhook and Server Handling**: If your webhook is configured to handle requests based on phone numbers, ensure that it responds with the necessary assistant information, including the assistantId
.
To handle the missing key in your code, consider implementing null-checks and defaults to prevent runtime errors. For example, you can use optional chaining to safely access the assistantId
and set a default value if it's missing.
If these suggestions don't resolve the issue, it might be helpful to consult Vapi's documentation or support for more specific guidance on the payload structure differences between web and phone calls.
Let me know if you need further assistance! 😊
Sources:
- [Vapi Community Discussion](https://discord.com/channels/1211482211119796234/1211483291191083018/1336915389040558160)Vapi Support Bot
02/28/2025, 6:43 PMcorneliusschramm
03/04/2025, 4:58 PMShubham Bajaj
03/07/2025, 10:01 PMShubham Bajaj
03/07/2025, 10:02 PMShubham Bajaj
03/07/2025, 10:02 PMts
await processEndOfCallReport({
...,
assistantId: call?.assistantId || DEFAULT_ASSISTANT_ID,
});