how to determine call failed or success
# support
y
from webhook received for calls from vapi how can i decide that call successfully completes or failed so that i can retry call
v
To determine if a call was successful or failed from a Vapi webhook, check the
endedReason
field in the
end-of-call-report
payload. For example, in Node.js:
Copy code
js
const endedReason = req.body.message.endedReason;
const failedReasons = [
  "customer-did-not-answer",
  "assistant-error",
  "twilio-failed-to-connect-call"
  // add more failure reasons as needed
];

if (failedReasons.includes(endedReason)) {
  // Retry the call
} else {
  // Consider the call successful
}
Tip: Refer to the [Vapi call ended reasons documentation](https://docs.vapi.ai/calls/call-ended-reason) for the full list of possible values and tailor your logic as needed. Sources: - [Vapi Server Events Documentation](https://docs.vapi.ai/server-url/events) - [Vapi Call Ended Reasons](https://docs.vapi.ai/calls/call-ended-reason)
y
there are large number of failed statuses how to handle this generic
k
Handle the status based on success types since there are less, or use regex for similar failed types like "\*not\*, \*error\*," etc