Receive Call Duration
# support
z
Hi! Is there a way to receive the duration of the entire call?
m
I took the difference between ended_at and created_at
z
I tried this but theres like a 8-9 seconds increase from (ended_at-created_at) compared to the seconds shown from the call recording
I need this as I'm planning to sell minutes on ZeroBot.ai and this would allow me to track the minutes spent on the calls
here is a copy of a sample payload
Copy code
[2024-06-19 11:47:17] Received payload:
{"message":{"type":"end-of-call-report","endedReason":"customer-ended-call","transcript":"AI: Panda here. How's it going?\n","summary":"The call begins with Panda, an AI, greeting the other party and asking how they are doing.","messages":[{"role":"system","message":"You are an assistant.","time":1718812030271,"secondsFromStart":0},{"role":"bot","message":"Panda here. How's it going?","time":1718812032295,"endTime":1718812033835,"secondsFromStart":1.8399999,"source":""}],"analysis":{"summary":"The call begins with Panda, an AI, greeting the other party and asking how they are doing.","successEvaluation":"false"},"recordingUrl":"https://auth.vapi.ai/storage/v1/object/public/recordings/80912cb0-3cc5-424b-bc30-91bbfd54a600-1718812036083-ff1aff9d-9ab6-44e1-bfc7-57b14ebefce8-mono.wav","stereoRecordingUrl":"https://auth.vapi.ai/storage/v1/object/public/recordings/80912cb0-3cc5-424b-bc30-91bbfd54a600-1718812036083-5510cb60-6b6a-46be-8ddb-2628e917af7c-stereo.wav","call":{"id":"80912cb0-3cc5-424b-bc30-91bbfd54a600","orgId":"63a9a141-9cbd-4376-a09e-91b789b851ba","createdAt":"2024-06-19T15:47:07.029Z","updatedAt":"2024-06-19T15:47:07.029Z","type":"webCall","status":"queued","assistant":{"model":{"model":"gpt-3.5-turbo","systemPrompt":"","provider":"openai"},"voice":{"provider":"openai","voiceId":"alloy"},"firstMessage":"Panda here, how's it going?","metadata":{"user_id":"07e182e5045"}},"assistantOverrides":{},"webCallUrl":"https://vapi.daily.co/BoFnWlj8JGHp2njqKzzX"},"artifact":{"messages":[],"messagesOpenAIFormatted":[]},"timestamp":"2024-06-19T15:47:17.446Z"}}
c
It comes when you get the call ID. It will have start end end time.
z
ok I think i see now, looks like I would have to
GET call
to retrieve
startedAt
&
endedAt
c
Yes, there seems to be a lot of confusing on why you get the call. If you pull information from the ebhook the call is still active, so how are you going to get the proper time?
z
I figured it would be in the end-of-call-report
c
Which you fully get after the call is done. basically you do not get all of the information without getting info from the call.
z
I see, will start working on this, thank you!
c
You actually want this to have sleep before you get the call for about 15 seconds. If you pull right after you will not get everything. https://cdn.discordapp.com/attachments/1253025714609852437/1253046324425920607/Screenshot_2024-05-24_111450.png?ex=66746dd4&is=66731c54&hm=41a20603f3252c3e2121deafd6ae8fd4cdf9e0c907f2b632d6955b254f68547b&
s
Yeah, it is because we add a few seconds extra for call_ending and other processes.
z
Thank you very much!
3 Views