SIP trunking replaces traditional phone lines with a virtual connection over the internet, allowing your business to make and receive calls via a broadband connection. It connects your internal PBX or VoIP system to a SIP provider, which then routes calls to the Public Switched Telephone Network (PSTN). This setup simplifies your communications infrastructure and often reduces costs.
To allow SIP signaling and media between Vapi and your SIP provider, you must allowlist the following IP addresses:
These IPs are used exclusively for SIP traffic. For the complete list of ports, RTP ranges, and firewall configuration details, see the networking and firewall reference.
We generally don’t recommend IP-based authentication for SIP trunks as it can lead to routing issues. Since our servers are shared by many customers, if your telephony provider has multiple customers using IP-based authentication, calls may be routed incorrectly. IP-based authentication works reliably only when your SIP provider offers a unique termination URI or a dedicated SIP server for each customer, as is the case with Plivo and Twilio integrations.
Vapi supports multiple SIP trunk configurations, including:
Gather the SIP server address, authentication credentials (username/password or IP-based), and at least one phone number (DID) from your provider.
Use the Vapi API to create a new credential (type: byo-sip-trunk) with your provider’s details. This informs Vapi how to connect to your SIP network.
Example (using Zadarma):
Save the returned Credential ID for later use.
Link your external phone number (DID) to the SIP trunk credential in Vapi by creating a Phone Number resource.
Example:
Note the returned Phone Number ID for use in test calls.
Initiate a call through the Vapi dashboard or API to ensure outbound calls are properly routed.
API Example:
If inbound routing is configured, call your phone number from an external line. Ensure your provider forwards calls to the correct SIP URI (e.g., {phoneNumber}@<credential_id>.sip.vapi.ai for Zadarma).
Note: Please ensure that you provide all the signaling IP addresses when creating the SIP trunk. Failure to do so will prevent proper whitelisting, which may result in encountering unauthorized 401 errors for inbound calls.
If you need to transfer a call to another number, you will need to add a SIP Transfer based call forwarding where the transfer number will look like this: sip:transfer-number@your-telecom-provider-domain.com
Example: sip:15557654321@sip.zadarma.com
Note: Certain providers require phone numbers to be formatted in the proper E.164 standard. For example, the transfer URI should appear as: sip:+15557654321@sip.zadarma.com.
Example tool configuration required for SIP REFER: