Skip to content

Commit da35944

Browse files
committed
Added SIP Trunking Guide
Signed-off-by: sahil suman <[email protected]>
1 parent 8c26db0 commit da35944

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

fern/advanced/sip/sip-trunk.mdx

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
title: SIP Trunking Guide for Vapi
3+
subtitle: How to integrate your SIP provider with Vapi
4+
slug: advanced/sip/sip-trunk
5+
---
6+
7+
SIP trunking replaces traditional phone lines with a virtual connection over the internet, allowing your business to make and receive calls via a broadband connection. It connects your internal PBX or VoIP system to a SIP provider, which then routes calls to the Public Switched Telephone Network (PSTN). This setup simplifies your communications infrastructure and often reduces costs.
8+
9+
## 1. Vapi SIP Trunking Options
10+
11+
Vapi supports multiple SIP trunk configurations, including:
12+
13+
- **Telnyx**: Uses SIP gateway domain (e.g., sip.telnyx.com) with IP-based authentication. May require a tech prefix for outbound calls.
14+
- **Zadarma**: Uses SIP credentials (username/password) with its SIP server (e.g., sip.zadarma.com).
15+
- **Custom "BYO" SIP Trunk**: Allows integration with any SIP provider. You simply provide the SIP gateway address and the necessary authentication details.
16+
17+
## 2. Setup Process Overview
18+
19+
To set up a SIP trunk in Vapi, follow these steps:
20+
21+
### Obtain Provider Details
22+
23+
Gather the SIP server address, authentication credentials (username/password or IP-based), and at least one phone number (DID) from your provider.
24+
25+
### Create a SIP Trunk Credential in Vapi
26+
27+
Use the Vapi API to create a new credential (type: byo-sip-trunk) with your provider's details. This informs Vapi how to connect to your SIP network.
28+
29+
**Example (using Zadarma):**
30+
31+
```bash
32+
curl -X POST "https://api.vapi.ai/credential" \
33+
-H "Content-Type: application/json" \
34+
-H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY" \
35+
-d '{
36+
"provider": "byo-sip-trunk",
37+
"name": "Zadarma Trunk",
38+
"gateways": [{
39+
"ip": "sip.zadarma.com"
40+
}],
41+
"outboundLeadingPlusEnabled": true,
42+
"outboundAuthenticationPlan": {
43+
"authUsername": "YOUR_SIP_NUMBER",
44+
"authPassword": "YOUR_SIP_PASSWORD"
45+
}
46+
}'
47+
```
48+
49+
Save the returned Credential ID for later use.
50+
51+
### Associate a Phone Number with the SIP Trunk
52+
53+
Link your external phone number (DID) to the SIP trunk credential in Vapi by creating a Phone Number resource.
54+
55+
**Example:**
56+
57+
```bash
58+
curl -X POST "https://api.vapi.ai/phone-number" \
59+
-H "Content-Type: application/json" \
60+
-H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY" \
61+
-d '{
62+
"provider": "byo-phone-number",
63+
"name": "Zadarma Number",
64+
"number": "15551234567",
65+
"numberE164CheckEnabled": false,
66+
"credentialId": "YOUR_CREDENTIAL_ID"
67+
}'
68+
```
69+
70+
Note the returned Phone Number ID for use in test calls.
71+
72+
### Test Your SIP Trunk
73+
74+
#### Outbound Call Test
75+
76+
Initiate a call through the Vapi dashboard or API to ensure outbound calls are properly routed.
77+
78+
**API Example:**
79+
80+
```json
81+
POST https://api.vapi.ai/call/phone
82+
{
83+
"assistantId": "YOUR_ASSISTANT_ID",
84+
"customer": {
85+
"number": "15557654321",
86+
"numberE164CheckEnabled": false
87+
},
88+
"phoneNumberId": "YOUR_PHONE_NUMBER_ID"
89+
}
90+
```
91+
92+
#### Inbound Call Test
93+
94+
If inbound routing is configured, call your phone number from an external line. Ensure your provider forwards calls to the correct SIP URI (e.g., `{phoneNumber}@sip.vapi.ai` for Zadarma).

fern/docs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ navigation:
237237
- section: SIP Telephony
238238
path: advanced/sip/sip.mdx
239239
contents:
240+
- page: SIP Trunking
241+
path: advanced/sip/sip-trunk.mdx
240242
- page: Telnyx Integration
241243
path: advanced/sip/sip-telnyx.mdx
242244
- page: Zadarma Integration

0 commit comments

Comments
 (0)