falseVacuum
03/17/2025, 5:16 PMjson
{
"authentication": {
"password": "mypassword",
"username": "myusername"
},
"fallback_destination": {
"message": "Please call back later.",
"sip_uri": "sip:fallback@mysiphost.com",
"transfer_plan": {
"mode": "blind-transfer",
"sip_verb": "bye"
},
"type": "sip"
},
"name": "DEV",
"provider": "vapi",
"server": {
"secret": "webhooksecret",
"url": "https://mywebhook.com/"
},
"sip_uri": "sip:my-vapi-sip-uri@sip.vapi.ai",
"status": "active",
}
It seems like no mater how I configure it if the server doesn't respond with an HTTP 2xx response code VAPI plays an error message to caller that say something like "Your server rejected get assistant request webhook, error request failed with status code 500".
How can I prevent VAPI from saying this if my server is down? This seems like a bug with the fallback_destination setting on the phone number.Shubham Bajaj
03/18/2025, 12:04 PMjavascript
// Example webhook handler in Node.js/Express
app.post('/webhook', async (req, res) => {
try {
// Your normal webhook processing logic
// If an error occurs, throw it or handle it
// Your normal successful response
return res.status(200).json({
// Your normal assistant configuration
});
} catch (error) {
// When an error occurs, still return 200 but with fallback instructions
return res.status(200).json({
transferTo: {
type: "sip",
sip_uri: "sip:fallback@mysiphost.com",
message: "Please call back later."
}
});
}
});
## Why This Works Better Than Waiting for a Timeout
While VAPI would eventually use your fallback destination if you don't respond at all (after the timeoutSeconds elapses), this isn't ideal because:
1. The caller experiences a long wait before being transferred
2. It consumes resources on your VAPI account waiting for the timeout
3. It creates a poor user experience
By proactively returning a 200 response with fallback instructions, you:
- Provide an immediate resolution for the caller
- Maintain control over the call flow even during error conditions
- Deliver a better caller experience
## Additional Configuration Tips
Make sure your webhook is also configured to handle these other scenarios:
- Network failures (using try/catch)
- Authentication failures (still return 200 with fallback instructions)
- Rate limiting or overload conditions (200 with fallback instructions)
By implementing this solution, you'll ensure calls are properly routed to your fallback destination when your server encounters any issues, rather than having VAPI play error messages to your callers.