Getting call status
# support
d
How to get the call status after call termination. May be it went to voice mail, or was disconnected etc.
v
@dl_amit To get the call status after a call has terminated, you can rely on the end-of-call report that is automatically sent by the assistant. When a call ends, the assistant will make a POST request to the Server URL with a body containing the "end-of-call-report" message. This message includes the "endedReason" field, which provides information on why the call ended, such as "hangup" or "voicemail". Here's an example of the body of the POST request you would receive:
Copy code
json
{
  "message": {
    "type": "end-of-call-report",
    "endedReason": "hangup" // This could be "voicemail", "disconnected", etc.
  }
}
You should ensure that your server is set up to receive this POST request and process the information accordingly. If you have any specific requirements or need further assistance with handling these reports, please let me know!
You can continue this conversation by mentioning me in the message.
d
what are the possible values from this endedReason @Vapi ?
v
@dl_amit The
endedReason
field in the end-of-call report can contain several possible values, each indicating a different reason for the call termination. Common values might include: - `completed`: The call was answered and completed normally. - `busy`: The line called was busy. - `no-answer`: The call was not answered. - `failed`: The call attempt failed due to a network or other technical issue. - `rejected`: The call was rejected by the receiver. - `voicemail`: The call was forwarded to voicemail. - `canceled`: The call was canceled by the caller before it was answered. - `disconnected`: The call was disconnected during the conversation, possibly due to connection issues. Please note that the exact set of
endedReason
values can vary depending on the specific implementation of the Voice API you are using. For the most accurate and comprehensive list, you should refer to the documentation provided with the API or contact support for more details.
s
@dl_amit you can select the server event of type status-update to receive call status update on your server url. You can learn more about it from here https://docs.vapi.ai/server-url/events#call-status-updates and https://api.vapi.ai/api-json# (components > schemas > ServerMessageStatusUpdate)
Using UI or Dashboard
From your dashboard, go to the Assistant section. Select the assistant, then navigate to the Advanced tab. Scroll down and look for server events. Finally, select the server event with the type "Status Update."
d
This is great. So does this mean that my API from AWS can be called by VAPI platform on call termination with status payload?
@Shubham Bajaj @Vapi Is there any way I can get automatically call status on completion for outbound call made by vapi assistant?
v
@dl_amit Yes, you can automatically receive the call status upon completion of an outbound call made by the VAPI assistant. To do this, you need to configure a server event of type "status-update" to receive call status updates on your server URL. Here's how you can set it up using the VAPI dashboard: 1. Log in to your VAPI dashboard. 2. Navigate to the Assistant section. 3. Select the assistant you are using for outbound calls. 4. Go to the Advanced tab within the assistant's settings. 5. Scroll down to the Server Events section. 6. Enable the server event with the type "Status Update." By doing this, the VAPI platform will make a POST request to the server URL you have configured with a status payload whenever there is a status update for an outbound call. The payload will contain information about the call status, such as whether it was completed, went to voicemail, was disconnected, etc. Make sure your server is prepared to handle these POST requests and process the status updates accordingly. If you need further assistance with setting this up or have any other questions, please let me know!
d
@Vapi CAN YOU tell me what will be request format
v
@dl_amit Certainly! When you configure a server event of type "status-update" in VAPI, the VAPI platform will send a POST request to your specified server URL with a payload containing the call status update. The request format will typically be in JSON and will follow the schema defined in the VAPI documentation. Here's an example of what the JSON payload might look like for a status update:
Copy code
json
{
  "event": "status-update",
  "timestamp": "2023-04-14T12:34:56Z",
  "conversationId": "CONVERSATION_ID",
  "callId": "CALL_ID",
  "status": {
    "callStatus": "completed",
    "callDuration": 120,
    "endCause": "normal"
  }
}
In this example: -
event
is the type of server event, which in this case is "status-update". -
timestamp
is the time at which the event occurred. -
conversationId
is the unique identifier for the conversation. -
callId
is the unique identifier for the call. -
status
is an object containing details about the call status: -
callStatus
could be "completed", "busy", "no-answer", "failed", "rejected", "voicemail", "canceled", "disconnected", etc. -
callDuration
is the duration of the call in seconds. -
endCause
provides more detail on why the call ended, such as "normal", "busy", "no answer", etc. Please ensure that your server endpoint is set up to parse this JSON format. You should also refer to the VAPI documentation for the most accurate and detailed schema for the status update event, as the actual payload might contain additional fields or slightly different field names based on the version of the API you are using.
d
@Vapi generte a request for me
v
@dl_amit I'm sorry for any confusion, but as a text-based assistant, I'm unable to directly generate real network requests or interact with external systems. However, I can provide you with a mock-up of what a POST request might look like based on the VAPI documentation you've referenced. Here's an example of a mock POST request using
curl
, which is a command-line tool used for making network requests:
Copy code
bash
curl -X POST https://your-server-url.com/status-update-endpoint \
-H "Content-Type: application/json" \
-d '{
  "event": "status-update",
  "timestamp": "2023-04-14T12:34:56Z",
  "conversationId": "CONVERSATION_ID",
  "callId": "CALL_ID",
  "status": {
    "callStatus": "completed",
    "callDuration": 120,
    "endCause": "normal"
  }
}'
In this mock request: - Replace
https://your-server-url.com/status-update-endpoint
with the actual URL of your server endpoint that is set up to receive status updates. - The
-H
flag is used to set the
Content-Type
header to
application/json
, indicating that the payload is in JSON format. - The
-d
flag is used to pass the JSON payload, which you should format according to the schema provided by VAPI. Please note that this is just a simulated example to illustrate what the HTTP request might look like. You would need to replace the placeholders with actual values when configuring your system to handle real requests from the VAPI platform.
s
Yes your API will be called with status update for call started, ringing, in-progress and finally terminated. Do let me know if you have more doubts.
6 Views