Prerequisites
If you’re using the API, you also need your Plivo Auth ID and Auth Token, available on the Plivo Console home page. The Plivo API uses HTTP Basic authentication. Export your credentials as environment variables to use with the code samples in this guide:
Part 1: Receive incoming calls
Route calls from your Plivo phone number to LiveKit.Create an inbound trunk in Plivo
Create an inbound trunk in Plivo, setting your LiveKit SIP endpoint as the primary URI.
- API
- Console
First, create an origination URI that points to your LiveKit SIP endpoint. Include Copy the Next, create an inbound trunk using the origination URI as the primary URI:Copy the
;transport=tcp in the URI:uri_uuid from the response for the next step:trunk_id from the response. You use it to connect your phone number in the next step:Secure trunking: If you’re setting up secure trunking, use
;transport=tls instead of ;transport=tcp.Region-based endpoints: To restrict calls to a specific region, replace your global LiveKit SIP endpoint with a region-based endpoint.
Connect your phone number
Connect your Plivo phone number to the inbound trunk. You can skip this step if you connected your phone number when you created the inbound trunk.
- API
- Console
Assign the inbound trunk to your phone number using the update a number endpoint. Set the A successful response returns HTTP To list your purchased numbers, run the following command:
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:Configure LiveKit to accept calls
Set up an inbound trunk and dispatch rule in LiveKit to accept calls to your Plivo phone number.
Test incoming calls
Start your LiveKit agent and call your Plivo phone number. Your agent should answer the call. If you don’t have an agent, see the Voice AI quickstart to create one.
Part 2: Make outgoing calls
Enable LiveKit to make outbound calls through Plivo.Create an outbound trunk in Plivo
Set up an outbound trunk with username and password authentication in Plivo.
- API
- Console
First, create a credential with a username and strong password for outbound call authentication:Copy the Next, create an outbound trunk using the credential:Copy the Finally, retrieve the trunk to get your Termination SIP Domain. It’s returned in the Copy the Termination SIP Domain (
- Username: 5 to 20 characters, alphanumeric only.
- Password: 5 to 20 characters, using only alphanumeric characters and the special characters
~!@#$%^&*()_+, with at least one special character. - Use the same username and password when you configure your LiveKit outbound trunk.
credential_uuid from the response for the next step:trunk_id from the response:trunk_domain field. For example, 21784177241578.zt.plivo.com:trunk_domain) for the next step.Secure trunking: If you enable secure trunking in Plivo (
"secure": true), you must also enable secure trunking in LiveKit. To learn more, see Secure trunking.Configure LiveKit to make outbound calls
Create an outbound trunk in LiveKit using the Termination SIP Domain, username, and password from the previous step.
Place an outbound call
Test your configuration by placing an outbound call with LiveKit using the
CreateSIPParticipant API. To learn more, see Creating a SIP participant.Troubleshooting
If a call fails to connect, check the following common issues:
Debug logs:
- Inbound issues: First check the Plivo logs, then check the call logs in your LiveKit Cloud dashboard.
- Outbound issues: First check the call logs in your LiveKit Cloud dashboard, then check the Plivo logs.
Related
SIP Trunking API overview
Plivo SIP Trunking API reference.
SIP Trunking overview
Plivo SIP trunking documentation.
LiveKit SIP documentation
Complete LiveKit SIP configuration.
LiveKit Plivo guide
LiveKit’s official Plivo integration guide.