Skip to main content
After creating your SIP trunk on your provider (Plivo or Twilio), the next step is to register that trunk with Bolna. This tells Bolna how to connect to your provider’s gateway and which phone numbers belong to this trunk. You will do two things in this guide:
  1. Create the trunk on Bolna with your provider’s gateway details and authentication credentials
  2. Add your phone numbers (DIDs) so Bolna knows which numbers to route through this trunk
SIP Trunking is currently in Beta. Contact enterprise@bolna.ai or schedule a call for access.

Prerequisites

Before you begin, make sure you have:
  1. A SIP trunk already created on your provider (Plivo guide or Twilio guide)
  2. Your provider gateway address (e.g., XXXX.zt.plivo.com for Plivo or bolna-trunk.pstn.twilio.com for Twilio)
  3. Your authentication credentials: username/password for userpass auth, or provider IP ranges for ip-based auth
  4. Your Bolna API key from the Bolna Dashboard
  5. Your DID phone numbers that you purchased from your provider

Step 1: Create the Trunk on Bolna

Use the Create SIP Trunk API to register your trunk. The exact payload depends on your provider and authentication method. Choose the example that matches your setup:
With IP-based auth, your provider identifies Bolna by its source IP address. You provide your provider’s IP ranges so Bolna can verify that incoming SIP requests are legitimate.
curl -X POST https://api.bolna.ai/sip-trunks/trunks \
  -H "Authorization: Bearer <your-bolna-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Plivo Trunk - Production",
    "provider": "plivo",
    "description": "Plivo Zentrunk for Bolna Voice AI",
    "auth_type": "ip-based",
    "gateways": [
      {
        "gateway_address": "XXXXXXXXXXXXXXXXXXXX.zt.plivo.com",
        "port": 5060,
        "priority": 1
      }
    ],
    "ip_identifiers": [
      { "ip_address": "15.207.90.192/31" },
      { "ip_address": "204.89.151.128/27" },
      { "ip_address": "13.52.9.0/25" }
    ],
    "allow": "ulaw,alaw",
    "disallow": "all",
    "inbound_enabled": true,
    "outbound_leading_plus_enabled": true
  }'
Replace XXXXXXXXXXXXXXXXXXXX.zt.plivo.com with the Termination SIP Domain you copied from your provider’s console. The ip_identifiers above are Plivo’s IP ranges; check your provider’s documentation for their specific ranges.
Save the id field from the response. This is your Trunk ID and you will need it for every subsequent API call: adding phone numbers, mapping agents, and making calls.

Step 2: Add Phone Numbers

Register the DID phone numbers you have already purchased on your SIP provider (from Plivo or Twilio). Bolna does not provision numbers, it needs to know which of your provider numbers to route through this trunk for inbound matching and outbound caller ID. Use the Add Phone Number API for each number:
curl -X POST https://api.bolna.ai/sip-trunks/trunks/<trunk-id>/numbers \
  -H "Authorization: Bearer <your-bolna-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "919876543210",
    "name": "Main Support Line"
  }'
Save the id from the response. This is the Phone Number ID that you will use when mapping this number to an AI agent for inbound calls, and when specifying the from_number for outbound calls.

Adding Multiple Numbers

Repeat the API call for each DID number you want to add. Each number receives its own unique id:
# Example: adding a second number
curl -X POST https://api.bolna.ai/sip-trunks/trunks/<trunk-id>/numbers \
  -H "Authorization: Bearer <your-bolna-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+14158675309",
    "name": "US Sales Line"
  }'
Phone number format: Bolna stores the number exactly as you provide it and performs flexible matching (with and without the + prefix) for inbound calls. Use a consistent format across your configuration.

Step 3: Verify Your Trunk

After creating the trunk and adding numbers, verify that everything is configured correctly. Use the Get SIP Trunk API to check your trunk:
curl -X GET https://api.bolna.ai/sip-trunks/trunks/<trunk-id> \
  -H "Authorization: Bearer <your-bolna-api-key>"
Confirm the following fields in the response:
FieldExpected ValueWhat It Means
is_activetrueTrunk is active and ready for calls
inbound_enabledtrueTrunk can receive inbound calls
gatewaysYour gateway addressGateway is correctly configured
phone_numbersYour added numbersAll DIDs are registered
You can also list all phone numbers on the trunk:
curl -X GET https://api.bolna.ai/sip-trunks/trunks/<trunk-id>/numbers \
  -H "Authorization: Bearer <your-bolna-api-key>"

Field Reference

Here is a complete reference of all fields you can use when creating a trunk:
FieldTypeRequiredDefaultDescription
namestringYesHuman-readable label for the trunk. Must be unique.
providerstringYesSIP provider: "twilio", "plivo", "zadarma", "telnyx", "vonage", "custom"
descriptionstringNonullOptional description for your internal reference
auth_typestringYes"userpass" (username/password) or "ip-based"
auth_usernamestringIf userpassnullSIP username for authentication
auth_passwordstringIf userpassnullSIP password for authentication
gatewaysarrayYesAt least one gateway with gateway_address (required), port (default 5060), priority (default 1)
ip_identifiersarrayIf ip-based[]List of { "ip_address": "..." } objects in CIDR notation
allowstringNo"ulaw,alaw"Comma-separated codecs to allow. Always include ulaw.
disallowstringNo"all"Comma-separated codecs to block
inbound_enabledbooleanNofalseSet to true to receive inbound calls
outbound_leading_plus_enabledbooleanNotruePrepend + to outbound dialed numbers (required by Twilio)
rtp_symmetricbooleanNotrueSymmetric RTP for NAT traversal. Keep as true.
force_rportbooleanNotrueForce responses to source port. Keep as true.
qualify_frequencyintegerNo60SIP OPTIONS keepalive ping interval in seconds. Set to 0 to disable.

Next Steps

Your trunk is registered and phone numbers are added. Now configure how calls are handled:

Receive Inbound Calls

Map your phone numbers to AI agents so they answer incoming calls

Make Outbound Calls

Place outbound calls from your trunk numbers using AI agents