Connect a Vapi BYOC SIP trunk to a DIDHub phone number
Vapi supports Bring-Your-Own-Carrier (BYOC) so you can use any SIP trunk — including DIDHub — instead of paying Vapi's bundled telecom markup. This tutorial walks through provisioning, registering, and binding a DID end-to-end.
Step 1: Create a SIP trunk in DIDHub
# Dashboard → SIP Trunks → New trunk Name : vapi-prod Mode : SIP digest auth Username : vapi_a8f3 Password : "<auto-generated>" Region : us-east, eu-west (multi-region) Codecs : PCMU, OPUS STIR/SHAKEN : A-attestation Inbound caller-id format : E.164
Step 2: Register the trunk in Vapi
Vapi dashboard → Phone Numbers → Import → SIP Trunk (BYOC):
curl -X POST https://api.vapi.ai/credential \ -H "Authorization: Bearer $VAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "provider": "byo-sip-trunk", "name": "didhub-prod", "gateways": [ { "ip": "sip.didhub.io" } ], "outboundAuthenticationPlan": { "authUsername": "vapi_a8f3", "authPassword": "<PASSWORD>" }, "outboundLeadingPlusEnabled": true, "techPrefix": null }'
Step 3: Import the DID
curl -X POST https://api.vapi.ai/phone-number \ -H "Authorization: Bearer $VAPI_API_KEY" \ -d '{ "provider": "byo-phone-number", "name": "didhub-+15551234567", "number": "+15551234567", "credentialId": "<credential-id-from-step-2>", "assistantId": "<your-vapi-assistant-id>" }'
Step 4: Bind the DID in DIDHub to the trunk
Numbers → +1 555 123 4567 → Routing → SIP Trunk: vapi-prod. Save.
Step 5: Test inbound + outbound
Inbound
Call the DID from any phone. Vapi assistant should answer within 1 ring.
Outbound
Use the Vapi outbound API /call with phoneNumberId set to the imported BYOC number.
Logs
DIDHub dashboard → SIP Trunks → Logs shows live INVITE / 200 / BYE flow with timing.
Recording
Vapi recordings work as normal — recording is captured at the Vapi assistant layer, independent of trunk.
Troubleshooting
- 403 on Vapi credential creation: verify
$VAPI_API_KEYhas thecredentials:writescope. - Inbound rings but assistant does not answer: assistantId on the phone-number record is required (or set
squadId). - Outbound 503: DIDHub trunk auth is wrong — double-check username/password from the trunk detail page.
Ready to get a number?
Pick a DID in 130+ countries from $1.99/month. Activates instantly on most numbers.