Inbound SIP signaling — does VAPI ever return non-...
# support
a
Setup ----- We integrate VAPI via SIP. Inbound calls arrive on a Twilio number that SIP-dials sip.vapi.ai using ... in our TwiML, with a custom SIP header on the INVITE that identifies which assistant should run. The corresponding phone number in VAPI has a Server URL configured, and we return the assistant config dynamically per call via the assistant-request message. For resilience, we use Twilio's callback to be notified of every dial outcome. We classify based on DialCallStatus and DialSipResponseCode: anything that's not "completed" / 200 OK is treated as a failure, and we redirect the same call leg to a backup voice provider. We treat SIP 486 and 503 specifically as capacity rejections (RFC 3261 §21.4 / §21.5) so we can react differently to them than other failures. The problem ----------- We can't get VAPI's SIP edge to return any non-2xx response. Every failure mode we've tried still returns SIP 200 OK to the INVITE, followed by an immediate hangup at the media layer (~1s typical). From Twilio's wire view that's DialCallStatus=completed, DialSipResponseCode=200, DialCallDuration=1 — indistinguishable from a successful but very short call. Our classifier reads it as success, and the failover never fires.
m
You’re running into a SIP edge issue VAPI always returns 200 OK, then drops at media level, so Twilio sees it as “completed” even when it failed. Instead of SIP codes, detect failure using signals like very short call duration, no RTP/audio, or missing assistant handshake. You can also add a timeout if the assistant flow doesn’t start in time, trigger failover yourself. I can help you tighten this, are you checking for actual audio/RTP or just Twilio’s call status? @andret13pinto
c
Hi Matt, We understand your concern and want to make sure your setup is working correctly. If inbound routing is configured, please try calling your number from an external line. Also, ensure your provider is forwarding calls to the correct SIP URI,:
{phoneNumber}@<credential_id>.sip.vapi.ai
For reference, you can follow this guide: https://docs.vapi.ai/advanced/sip/sip-trunk Thank you