Prerequisites
If you’re using the API, you also need your Plivo Auth ID and Auth Token, available on the Plivo Console home page. Export them as environment variables to use with the code samples in this guide:
- Its SIP endpoint: the host Plivo should send inbound calls to (often
sip.<platform>.com), and which transport it expects (UDP, TCP, or TLS) - Its outbound authentication method: SIP digest credentials (username and password), or a published list of static IP addresses
- Where to enter Plivo’s details: the screen where you register a phone number and configure a SIP trunk
Part 1: Receive Incoming Calls
Route calls from your Plivo phone number to your platform.Step 1: Create an Inbound Trunk in Plivo
- API
- Console
First, create an origination URI that points to your platform’s SIP endpoint, including the transport parameter it expects:Copy the Copy the
uri_uuid from the response. Next, create an inbound trunk using the origination URI as the primary URI:trunk_id from the response. You use it to connect your phone number in the next step.Step 2: Connect Your Phone Number
- API
- Console
Assign the inbound trunk to your phone number using the update a number endpoint. Set the A successful response returns HTTP
app_id field to the trunk ID of your inbound trunk. Use your phone number in E.164 format without the leading +. For example, 15105550100:202 with the message changed.Step 3: Configure Your Platform
On your platform, register the Plivo number and attach an agent to it. This step varies by platform; look for “SIP trunk”, “BYO carrier”, or “phone numbers” in its documentation. Call your Plivo number. Your agent should answer.Part 2: Make Outgoing Calls
Enable your platform to place calls through Plivo.Step 1: Create Authentication
Choose the method your platform supports: SIP digest credentials when your platform authenticates with a username and password or its IPs are dynamic, or an IP access control list when it publishes static IP addresses for its SIP traffic.- API
- Console
To create a credential, use a username of 5 to 20 alphanumeric characters and a password of 5 to 20 characters with at least one of the special characters Copy the Copy the
~!@#$%^&*()_+:credential_uuid from the response.Alternatively, create an IP access control list with your platform’s published IP addresses:ipacl_uuid from the response.Step 2: Create an Outbound Trunk in Plivo
- API
- Console
Create an outbound trunk using the credential or IP ACL from Step 1. Pass Copy the
credential_uuid, ipacl_uuid, or both. Set secure to true if your platform supports TLS and SRTP (recommended):trunk_id from the response, then retrieve the trunk to get your Termination SIP Domain from the trunk_domain field (e.g., 21784177241578.zt.plivo.com):Step 3: Configure Your Platform
In your platform’s outbound trunk settings, enter:Troubleshooting
Debug logs: for inbound issues, check Plivo logs first; for outbound issues, check your platform’s logs first. For error codes, see Hangup codes.
Related
- API Reference - Create trunks, credentials, URIs, and IP ACLs programmatically
- Technical Specifications - Codecs, ports, IP ranges, and supported SIP features
- Your First Agent Call - Quickstart with per-platform SIP URIs