This guide will walk you through setting up SIP inbound calls using Vapi AI and Twilio Elastic SIP Trunking. Follow the steps below to configure your system.

Step 1: Create a SIP URI via Vapi AI API

To create a SIP URI using Vapi AI, execute the following curl request. Replace your-private-api-key and your-assistant-id with the appropriate values.

CURL Request

curl --location '<https://api.vapi.ai/phone-number>' \\
--header 'Authorization: Bearer your-private-api-key' \\
--header 'Content-Type: application/json' \\
--data-raw '{
	"provider": "vapi",
	"sipUri": "<sip:[email protected]>",
	"assistantId": "your-assistant-id"
}'

Explanation:

Upon successful request, you will receive the newly created SIP URI. This URI will be used in Twilio to forward calls via SIP.

For more advanced options, visit the Vapi AI SIP documentation here.


Step 2: Create a Twilio Elastic SIP Trunk

  1. Log in to your Twilio Console.
  2. Navigate to Elastic SIP Trunks.
  3. Click on Create New Trunk and fill in the required details.
  4. Once the trunk is created, navigate to the Origination tab.

image.png

Adding the SIP URI: