IS there a function built into vapi to sort throug...
# support
y
IS there a function built into vapi to sort through end call reasons? EX: sort by assistant transfered call
v
@YinYang Yes, VAPI does provide capabilities for call analysis, which can include sorting through end call reasons such as when an assistant transfers a call. However, to provide you with the exact function or method to achieve this, I would need more information about how your system is set up and what specific features you are using. If you are looking for a function within the VAPI documentation or SDKs that can help you sort or filter call reasons, you might want to look into the call analysis or reporting features provided by VAPI. These features often allow developers to analyze call data and categorize calls based on different criteria, including the reason for call termination. If you need further assistance with this or if you have specific parameters or setup details you can share, I'd be happy to help you further. Otherwise, if this is a feature you cannot find in the documentation, please reach out to our support team for more detailed assistance. Would you like me to help you with anything else?
You can continue this conversation by mentioning me in the message.
s
curl_request
Copy code
curl --location 'https://api.vapi.ai/analytics' \
--header 'Authorization: Bearer 5c44--token--051eb' \
--header 'Content-Type: application/json' \
--header 'Cookie: _cfuvid=CUSErOTQze7IfYksWMA7yAByAUDG7qgz41gjoqw2vwU-1737501475592-0.0.1.1-604800000' \
--data '{
  "queries": [
        {
            "name": "calls-grouped-by-call-end-reason",
            "table": "call",
            "timeRange": {
                "start": "2024-01-01T00:00:00Z",
                "end": "2024-12-31T23:59:59Z"
            },
            "operations": [
                {
                    "operation": "count",
                    "column": "id",
                    "alias": "callEndReason"
                }
            ],
            "groupBy": [
                "endedReason"
            ]
        }
  ]
}'
sample_response
Copy code
json
[
    {
        "name": "calls-grouped-by-call-end-reason",
        "timeRange": {
            "start": "2024-01-01T00:00:00.000Z",
            "end": "2024-12-31T23:59:59.000Z",
            "timezone": "UTC"
        },
        "result": [
            {
                "endedReason": "",
                "callEndReason": "1"
            },
            {
                "endedReason": "assistant-ended-call",
                "callEndReason": "26"
            },
            {
                "endedReason": "assistant-forwarded-call",
                "callEndReason": "186"
            },
            {
                "endedReason": "assistant-said-end-call-phrase",
                "callEndReason": "11"
            },
            {
                "endedReason": "customer-busy",
                "callEndReason": "5"
            },
            {
                "endedReason": "customer-did-not-answer",
                "callEndReason": "34"
            },
            {
                "endedReason": "customer-did-not-give-microphone-permission",
                "callEndReason": "26"
            },
            {
                "endedReason": "customer-ended-call",
                "callEndReason": "2378"
            },
            {
                "endedReason": "exceeded-max-duration",
                "callEndReason": "1"
            },
            {
                "endedReason": "phone-call-provider-closed-websocket",
                "callEndReason": "3"
            },
            {
                "endedReason": "pipeline-error-anthropic-400-bad-request-validation-failed",
                "callEndReason": "4"
            },
            {
                "endedReason": "pipeline-error-eleven-labs-voice-not-found",
                "callEndReason": "17"
            },
            {
                "endedReason": "pipeline-error-playht-request-timed-out",
                "callEndReason": "6"
            }

        ]
    }
]
@YinYang You can use the above curl request to get the count of all calls by their end reason for a complete year. It works for UTC time zone, but you can change the timezone according to your requirement. The same applies to the timeRange parameter. Please let me know if you need anything else.