|
| 1 | +--- |
| 2 | +title: Zadarma SIP Integration |
| 3 | +subtitle: How to integrate SIP Zadarma to Vapi |
| 4 | +slug: advanced/sip/zadarma |
| 5 | +--- |
| 6 | + |
| 7 | + |
| 8 | +Integrate your Zadarma SIP trunk with Vapi.ai to enable your AI voice assistants to handle calls efficiently. Follow the steps below to set up this integration: |
| 9 | + |
| 10 | +## 1. Retrieve Your Vapi.ai Private Key |
| 11 | + |
| 12 | +- Log in to your Vapi.ai account. |
| 13 | +- Navigate to **Organization Settings**. |
| 14 | +- In the **API Keys** section, copy your **Private Key**. |
| 15 | + |
| 16 | +## 2. Add Your Zadarma SIP Credentials to Vapi.ai |
| 17 | + |
| 18 | +You'll need to send a `curl` request to Vapi.ai's API to add your SIP credentials: |
| 19 | + |
| 20 | +- **Private Key**: Your Vapi.ai private key. |
| 21 | +- **Trunk Name**: A name for your SIP trunk (e.g., "Zadarma Trunk"). |
| 22 | +- **Server Address**: The server address provided by Zadarma (e.g., "sip.zadarma.com"). |
| 23 | +- **SIP Number**: Your Zadarma SIP number. |
| 24 | +- **SIP Password**: The password for your Zadarma SIP number. |
| 25 | + |
| 26 | +Here's the `curl` command to execute: |
| 27 | + |
| 28 | +```bash |
| 29 | +curl -L 'https://api.vapi.ai/credential' \\ |
| 30 | +-H 'Content-Type: application/json' \\ |
| 31 | +-H 'Authorization: Bearer YOUR_PRIVATE_KEY' \\ |
| 32 | +-d '{ |
| 33 | + "provider": "byo-sip-trunk", |
| 34 | + "name": "Zadarma Trunk", |
| 35 | + "gateways": [ |
| 36 | + { "ip": "sip.zadarma.com" } |
| 37 | + ], |
| 38 | + "outboundLeadingPlusEnabled": true, |
| 39 | + "outboundAuthenticationPlan": { |
| 40 | + "authUsername": "YOUR_SIP_NUMBER", |
| 41 | + "authPassword": "YOUR_SIP_PASSWORD" |
| 42 | + } |
| 43 | +}' |
| 44 | +``` |
| 45 | +Replace `YOUR_PRIVATE_KEY`, `YOUR_SIP_NUMBER`, and `YOUR_SIP_PASSWORD` with your actual credentials. |
| 46 | + |
| 47 | +If successful, the response will include an `id` for the created credential, which you'll use in the next step. |
| 48 | + |
| 49 | +## 3. Add Your Virtual Number to Vapi.ai |
| 50 | + |
| 51 | +Next, associate your virtual number with the SIP trunk in Vapi.ai: |
| 52 | + |
| 53 | +- **Private Key**: Your Vapi.ai private key. |
| 54 | +- **Number Name**: A name for your virtual number (e.g., "Zadarma Number"). |
| 55 | +- **Virtual Number**: Your Zadarma virtual number in international format (e.g., "15551111111"). |
| 56 | +- **Credential ID**: The `id` from the previous step. |
| 57 | + |
| 58 | +Use the following `curl` command: |
| 59 | + |
| 60 | +```bash |
| 61 | +curl -L 'https://api.vapi.ai/phone-number' \\ |
| 62 | +-H 'Content-Type: application/json' \\ |
| 63 | +-H 'Authorization: Bearer YOUR_PRIVATE_KEY' \\ |
| 64 | +-d '{ |
| 65 | + "provider": "byo-phone-number", |
| 66 | + "name": "Zadarma Number", |
| 67 | + "number": "YOUR_VIRTUAL_NUMBER", |
| 68 | + "numberE164CheckEnabled": false, |
| 69 | + "credentialId": "YOUR_CREDENTIAL_ID" |
| 70 | +}' |
| 71 | +``` |
| 72 | + |
| 73 | +Replace `YOUR_PRIVATE_KEY`, `YOUR_VIRTUAL_NUMBER`, and `YOUR_CREDENTIAL_ID` with your actual details. |
| 74 | + |
| 75 | +## 4. Assign Your Voice Assistant to Handle Calls |
| 76 | + |
| 77 | +- In your Vapi.ai dashboard, go to the **Build** section and select **Phone Numbers**. |
| 78 | +- Click on your **Zadarma Number**. |
| 79 | +- In the **Inbound Settings** section, assign your voice assistant to handle incoming calls. |
| 80 | +- In the **Outbound Form** section, assign your voice assistant to handle outgoing calls. |
| 81 | + |
| 82 | +## 5. Configure Incoming Call Reception in Zadarma |
| 83 | + |
| 84 | +To forward incoming calls from your Zadarma virtual number to Vapi.ai: |
| 85 | + |
| 86 | +- Log in to your Zadarma account. |
| 87 | +- Navigate to **Settings** → **Virtual phone numbers**. |
| 88 | +- Click the ⚙ (gear) icon next to your number. |
| 89 | +- Open the **External server** tab. |
| 90 | +- Enable **External server (SIP URI)**. |
| 91 | +- Enter the address: `[email protected]` (replace `YOUR_VIRTUAL_NUMBER` with your number in international format). |
| 92 | +- Click **Save**. |
| 93 | + |
| 94 | +By following these steps, your Zadarma SIP trunk will be integrated with Vapi.ai, allowing your AI voice assistants to manage calls effectively. |
0 commit comments