SIP (Session Initiation Protocol) is a signalling protocol used to establish, manage, and terminate communication sessions over IP networks. It is widely used for real-time communication, including voice and video calls.
Call Origination:
Refers to receiving inbound calls. It involves setting up and managing phone numbers, enabling calls from traditional PSTN or IP-based networks to reach your system.
Example: If your SIP provider has assigned the number +14155552671
to your SIP trunk, inbound calls to this number will be routed to your configured Vapi system.
Call Termination:
Refers to outbound calls routed from your system to the recipient’s network. This requires configurations for routing and managing call quality.
Example: A user in your system places a call to +442071838750
. The call is routed from Vapi through your SIP provider to the intended recipient.
Create a SIP URI: Use the Vapi API to generate a SIP URI. Example:
curl --location '<https://api.vapi.ai/phone-number>' \\
--header 'Authorization: Bearer your-vapi-private-api-key' \\
--header 'Content-Type: application/json' \\
--data-raw '{
"provider": "vapi",
"sipUri": "<sip:[email protected]>",
"assistantId": "your-assistant-id"
}'
Replace placeholders with your details:
username
: Your SIP username.Example: Replace username
with johnsmith
, resulting in sip:[email protected]
.assistantId
: Identifier for routing calls.Example: Use an assistant ID like abc123
.Upon completion, a SIP URI like sip:[email protected]
will be generated. Inbound calls to this URI will trigger actions in Vapi.
Configure Webhooks (Optional): If you want call requests sent to a webhook instead of a specific assistant, update the SIP URI with your webhook:
curl --location --request PATCH '<https://api.vapi.ai/phone-number/id>' \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Bearer your-vapi-private-api-key' \\
--data '{
"assistantId": null,
"serverUrl": "https://your_server_url"
}'
serverUrl
: Your webhook endpoint.Example: https://myserver.com/call-handler
.When an inbound call is received, the webhook https://myserver.com/call-handler
will be triggered.
Set Up Outbound Call Credentials: Define the connection between Vapi and your SIP provider using a credential:
curl -X POST <https://api.vapi.ai/credential> \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer your-private-key" \\
-d '{
"provider": "byo-sip-trunk",
"name": "SIP Provider Name",
"gateways": [{"ip": "provider-gateway"}]
}'
Replace placeholders with:
provider-gateway
: The SIP provider’s gateway.Example: fts.telcom.net
or sip.telynx.com
.Link Phone Numbers to SIP Trunk: Associate phone numbers with the SIP trunk for inbound or outbound calls:
curl -X POST <https://api.vapi.ai/phone-number> \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer your-private-key" \\
-d '{
"provider": "byo-phone-number",
"name": "SIP Number",
"number": "your-sip-phone-number",
"credentialId": "your-credential-id-which-you-got-from-previous-step"
"numberE164CheckEnabled": false
}'
Replace placeholders with:
your-phone-number
: The assigned phone number.Example: +14155552671
.your-credential-id-which-you-got-from-previous-step
: The ID from the credentials setup.Example: abc-123-def-456
.Inbound Configuration:
{{TBD}}
Outbound Configuration:
Whitelist IPs from Vapi.
44.229.228.186
and 44.238.177.138
.Assign a Tech Prefix for routing calls, if required.
Example: Prefix 1234
for Vapi calls.
Number Assignment:
+441632960961
to your SIP trunk.SIP Domain and Invite Setup:
fts.telcom.net
) and modify SIP invites to match Vapi’s URI format.