In this tutorial, we’ll guide you through connecting a custom telephony provider to Vapi
From your carrier, you need to have the gateways
you want to connect to. Example:
"gateways": [
{
"ip": "192.168.12.81",
"port": 5060,
"inboundEnabled": true,
"outboundEnabled": true
},
{
"ip": "192.168.12.80",
"port": 5060,
"inboundEnabled": true,
"outboundEnabled": true
}
],
To initiate outbound SIP calls, you first need to create a SIP trunk credential. This credential will serve as the foundation for establishing the connection between Vapi and your SIP provider.
curl -X POST <https://api.vapi.ai/credential> \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer your-private-key" \\
-d '{
"provider": "byo-sip-trunk",
"name": "My Custom Trunk",
"gateways": // gateways from previous step.
}'
This step sets up the SIP trunk credential, linking your telephony infrastructure with Vapi.
Once the SIP trunk credential is created, the next step is to create a phone number that will be associated with this SIP trunk. This phone number will be used to make outbound calls through the configured SIP trunk.
curl -X POST <https://api.vapi.ai/phone-number> \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer your-private-key" \\
-d '{
"provider": "byo-phone-number",
"name": "SIP Number on My Custom Trunk",
"number": "your-sip-phone-number",
"numberE164CheckEnabled": false,
"credentialId": "your-credential-id-from-previous-step"
}'
This step creates a phone number that is directly associated with your SIP trunk, enabling you to manage and utilize it for outbound calls.
The phone number will be appeared in your dashboard you can trigger the call directly or if you want to trigger the call via API you can use that phone-number-id and trigger it.