Integration with Vapi AI

Setup guides / Vapi AI

Vapi AI — it is a service for creating voice assistants using artificial intelligence. Voice assistants can independently receive and make calls or be part of an operator team. There is a wide range of voices for speech synthesis, flexible voice customization, selection of speech speed, background sounds, use of additional dialing, and much more.

1) In the Vapi AI personal account, go to your organization's settings, in the section API keys copy the Private Key

VAPI API keys

Adding a SIP login, password, and server address in Vapi AI

You need to compose and send a curl request with the following data:

  • badcf222-9542-4d39-a834-fef874b7aec1 - Your Private Key from Vapi AI your personal account.
  • Zadarma Trunk - The trunk name.
  • sip.zadarma.com - Server address for connection and outgoing calls.
  • 111111 - Your SIP number from your personal account.
  • SipPassword - Your SIP number password, you can generate it here.

curl -L 'https://api.vapi.ai/credential' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer badcf222-9542-4d39-a834-fef874b7aec1' \
-d '{
"provider": "byo-sip-trunk",
"name": "Zadarma Trunk",
"gateways": [
{ "ip": "sip.zadarma.com" }
],
"outboundLeadingPlusEnabled": true,
"outboundAuthenticationPlan": {
"authUsername": "111111",
"authPassword": "SipPassword"
}
}'

If the request is composed correctly, the response will contain the following data:


{"id":"7c97ecbe-7e1d-4fa1-8259-8ed32f8a9edd","orgId":"487ba655-4fb2-4a55-abfe-ddded2442631","provider":"byo-sip-trunk","createdAt":"2025-02-25T11:24:02.450Z","updatedAt":"2025-02-25T11:24:02.450Z","gateways":[{"ip":"sip.zadarma.com"}],"name":"Zadarma Trunk","outboundAuthenticationPlan":{"authUsername":"384540"},"outboundLeadingPlusEnabled":true}

2) Adding a virtual number in Vapi AI

For this, you need to compose and send a second curl request with the following data:

  • badcf222-9542-4d39-a834-fef874b7aec1 - Your Private Key from your Vapi AI personal account.
  • Zadarma Number - Number name.
  • 15551111111 - Your virtual number from your personal account.
  • Zadarma Trunk - Trunk name.
  • 7c97ecbe-7e1d-4fa1-8259-8ed32f8a9edd - id from the response to the first request.

curl -L 'https://api.vapi.ai/phone-number' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer badcf222-9542-4d39-a834-fef874b7aec1' \
-d '{
"provider": "byo-phone-number",
"name": "Zadarma Number",
"number": "15551111111",
"numberE164CheckEnabled": false,
"credentialId": "7c97ecbe-7e1d-4fa1-8259-8ed32f8a9edd"
}'

3) In the Vapi AI personal account, open the Build - Phone numbers section and go to your Zadarma Number, and in the Inbound Settings section, select your voice assistant in the Assistant parameter to handle incoming calls. Further down the page, in the Outbound Form section, select your voice assistant in the Assistant parameter to make outgoing calls.

VAPI - Inbound settings

4. Incoming call reception setup in Zadarma.

To receive incoming calls, set up call forwarding from your Zadarma virtual number to Vapi AI:

  1. Go to the Zadarma section "Settings" → "Virtual phone numbers".
  2. Next to your number, click on the ⚙ (gear) icon.
  3. Open the tab "External server".
  4. Enable the opyion "External server (SIP URI)".
  5. In the field that appears, enter the address: 15551111111@sip.vapi.ai, where 15551111111 – is your virtual number in international format.
  6. Click "Save".