|
| 1 | +--- |
| 2 | +title: Plivo SIP Integration |
| 3 | +subtitle: How to integrate Plivo SIP with Vapi |
| 4 | +slug: advanced/sip/plivo |
| 5 | +--- |
| 6 | + |
| 7 | +This guide walks you through setting up both outbound and inbound SIP trunking between Plivo and Vapi. |
| 8 | + |
| 9 | +## Outbound Calls (Plivo to Vapi) |
| 10 | + |
| 11 | +### Plivo Configuration |
| 12 | + |
| 13 | +1. **Login to Plivo Console** |
| 14 | + |
| 15 | + Access the Plivo console at [https://console.plivo.com/accounts/login/](https://console.plivo.com/accounts/login/) |
| 16 | + |
| 17 | +2. **Create IP Access Control List** |
| 18 | + |
| 19 | + Navigate to: Zentrunk(SIP) → Outbound Trunks → IP Access Control List → Create New IP Group |
| 20 | + |
| 21 | + - Name: Choose a descriptive name |
| 22 | + - IP Address List: Whitelist Vapi's fixed IPs: |
| 23 | + - 44.229.228.186/32 |
| 24 | + - 44.238.177.138/32 |
| 25 | + - Click "Create ACL" |
| 26 | + |
| 27 | +  |
| 28 | + |
| 29 | +3. **Create Outbound Trunk** |
| 30 | + |
| 31 | + Navigate to: Zentrunk(SIP) → Outbound Trunks → Trunks → Create New Outbound Trunk |
| 32 | + |
| 33 | + - Trunk Name: Choose a descriptive name |
| 34 | + - IP Access Control List: Select the IP ACL created in the previous step |
| 35 | + - Click "Create Trunk" |
| 36 | + |
| 37 | +  |
| 38 | + |
| 39 | +4. **Note Your Termination SIP Domain** |
| 40 | + |
| 41 | + After creating the trunk, note the Termination SIP Domain (format: 12700668357XXXXXX.zt.plivo.com) |
| 42 | + |
| 43 | +  |
| 44 | + |
| 45 | +5. **Purchase a Phone Number** |
| 46 | + |
| 47 | + Navigate to: Numbers → Buy a new number |
| 48 | + |
| 49 | +  |
| 50 | + |
| 51 | +### Vapi Configuration |
| 52 | + |
| 53 | +1. **Get Your Vapi API Key** |
| 54 | + |
| 55 | + Sign in to the Vapi dashboard at [https://dashboard.vapi.ai/](https://dashboard.vapi.ai/) and retrieve your API key |
| 56 | + |
| 57 | +  |
| 58 | + |
| 59 | +2. **Create a SIP Trunk Credential** |
| 60 | + |
| 61 | + Use the following API call, replacing the gateway IP with your Plivo Termination SIP Domain: |
| 62 | + |
| 63 | + ```bash |
| 64 | + curl -X POST https://api.vapi.ai/credential \ |
| 65 | + -H "Content-Type: application/json" \ |
| 66 | + -H "Authorization: Bearer your-vapi-private-api-key" \ |
| 67 | + -d '{ |
| 68 | + "provider": "byo-sip-trunk", |
| 69 | + "name": "PLIVO Trunk", |
| 70 | + "gateways": [ |
| 71 | + { |
| 72 | + "ip": "1270066835XXXXXXXXX.zt.plivo.com" |
| 73 | + } |
| 74 | + ] |
| 75 | + }' |
| 76 | + ``` |
| 77 | + |
| 78 | +  |
| 79 | + |
| 80 | + Note the `id` (credentialId) from the response for the next step. |
| 81 | + |
| 82 | +3. **Register Your Phone Number** |
| 83 | + |
| 84 | + Associate your Plivo number with the SIP trunk: |
| 85 | + |
| 86 | + ```bash |
| 87 | + curl -X POST https://api.vapi.ai/phone-number \ |
| 88 | + -H "Content-Type: application/json" \ |
| 89 | + -H "Authorization: Bearer your-vapi-private-api-key" \ |
| 90 | + -d '{ |
| 91 | + "provider": "byo-phone-number", |
| 92 | + "name": "PLIVO SIP Number", |
| 93 | + "number": "1833684XXXX", |
| 94 | + "numberE164CheckEnabled": false, |
| 95 | + "credentialId": "a2c815b8-03f4-40f5-813c-xxxxxxxxxxxx" |
| 96 | + }' |
| 97 | + ``` |
| 98 | + |
| 99 | +  |
| 100 | + |
| 101 | + Note the phone number ID from the response for making calls. |
| 102 | + |
| 103 | +4. **Create a Vapi Assistant** |
| 104 | + |
| 105 | + Follow the steps at [https://docs.vapi.ai/quickstart/dashboard#create-an-assistant](https://docs.vapi.ai/quickstart/dashboard#create-an-assistant) |
| 106 | + |
| 107 | +  |
| 108 | + |
| 109 | + Note your Assistant ID for making calls. |
| 110 | + |
| 111 | +5. **Make Outbound Calls** |
| 112 | + |
| 113 | + **Using the API:** |
| 114 | + |
| 115 | + ```bash |
| 116 | + curl --location 'https://api.vapi.ai/call/phone' \ |
| 117 | + --header 'Authorization: Bearer your-vapi-private-api-key' \ |
| 118 | + --header 'Content-Type: application/json' \ |
| 119 | + --data '{ |
| 120 | + "assistantId": "29d47d31-ba3c-451c-86ce-xxxxxxxxx", |
| 121 | + "customer": { |
| 122 | + "number": "9199437XXXXX", |
| 123 | + "numberE164CheckEnabled": false |
| 124 | + }, |
| 125 | + "phoneNumberId": "eba2fb13-259f-4123-abfa-xxxxxxxxxxx" |
| 126 | + }' |
| 127 | + ``` |
| 128 | + |
| 129 | +  |
| 130 | + |
| 131 | + **Using the Vapi Dashboard:** |
| 132 | + |
| 133 | + Select your Assistant and enter the destination number you want to call. |
| 134 | + |
| 135 | +  |
| 136 | + |
| 137 | +## Inbound Calls (Vapi to Plivo) |
| 138 | + |
| 139 | +### Plivo Configuration |
| 140 | + |
| 141 | +1. **Login to Plivo Console** |
| 142 | + |
| 143 | + Access the Plivo console at [https://console.plivo.com/accounts/login/](https://console.plivo.com/accounts/login/) |
| 144 | + |
| 145 | +2. **Create Origination URI** |
| 146 | + |
| 147 | + Navigate to: Zentrunk(SIP) → Inbound Trunks → Origination URI → Create New IP URI |
| 148 | + |
| 149 | + - Name: Choose a descriptive name |
| 150 | + - URI: Enter Vapi's SIP URI: `sip.vapi.ai;transport=udp` |
| 151 | + - Click "Create URI" |
| 152 | + |
| 153 | +  |
| 154 | + |
| 155 | +3. **Create Inbound Trunk** |
| 156 | + |
| 157 | + Navigate to: Zentrunk(SIP) → Inbound Trunks → Trunks → Create New Inbound Trunk |
| 158 | + |
| 159 | + - Trunk Name: Choose a descriptive name |
| 160 | + - Primary URI: Select the URI created in the previous step |
| 161 | + - Click "Create Trunk" |
| 162 | + |
| 163 | +  |
| 164 | + |
| 165 | +4. **Attach Phone Number to Inbound Trunk** |
| 166 | + |
| 167 | + Navigate to: Phone Numbers → Select your purchased number |
| 168 | + |
| 169 | + - In the Application dropdown, select "Zentrunk" |
| 170 | + - In the Zentrunk dropdown, select your inbound trunk |
| 171 | + - Save the changes |
| 172 | + |
| 173 | +  |
| 174 | + |
| 175 | +### Vapi Configuration |
| 176 | + |
| 177 | +1. **Get Your Vapi API Key** |
| 178 | + |
| 179 | + Sign in to the Vapi dashboard at [https://dashboard.vapi.ai/](https://dashboard.vapi.ai/) and retrieve your API key |
| 180 | + |
| 181 | +2. **Create an Inbound SIP Trunk Credential** |
| 182 | + |
| 183 | + ```bash |
| 184 | + curl -X POST https://api.vapi.ai/credential \ |
| 185 | + -H "Content-Type: application/json" \ |
| 186 | + -H "Authorization: Bearer your-vapi-private-api-key" \ |
| 187 | + -d '{ |
| 188 | + "provider": "byo-sip-trunk", |
| 189 | + "name": "PLIVO Inbound Trunk", |
| 190 | + "type": "inbound" |
| 191 | + }' |
| 192 | + ``` |
| 193 | + |
| 194 | + Note the `id` (credentialId) from the response for the next step. |
| 195 | + |
| 196 | +3. **Register Your Phone Number** |
| 197 | + |
| 198 | + ```bash |
| 199 | + curl -X POST https://api.vapi.ai/phone-number \ |
| 200 | + -H "Content-Type: application/json" \ |
| 201 | + -H "Authorization: Bearer your-vapi-private-api-key" \ |
| 202 | + -d '{ |
| 203 | + "provider": "byo-phone-number", |
| 204 | + "name": "PLIVO SIP Inbound Number", |
| 205 | + "number": "1833684XXXX", |
| 206 | + "numberE164CheckEnabled": false, |
| 207 | + "credentialId": "a2c815b8-03f4-40f5-813c-xxxxxxxxxxxx" |
| 208 | + }' |
| 209 | + ``` |
| 210 | + |
| 211 | +4. **Create and Configure a Vapi Assistant** |
| 212 | + |
| 213 | + - Create an assistant following the steps at [https://docs.vapi.ai/quickstart/dashboard#create-an-assistant](https://docs.vapi.ai/quickstart/dashboard#create-an-assistant) |
| 214 | + - In the assistant settings, link it to the phone number you created |
| 215 | + |
| 216 | + Now when someone calls your Plivo number, the call will be routed to your Vapi assistant. |
0 commit comments