Skip to main content
Connect Plivo SIP trunking to LiveKit to enable your voice AI applications to make and receive phone calls through Plivo’s global voice network. You can configure Plivo using the API or the Console; each step in this guide includes both options.

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:
Optimize for latency: Select the LiveKit region closest to your call traffic. This minimizes audio delay and improves conversation flow.
India regional requirement: If your calls are made from a Plivo India phone number, or you’re dialing numbers in India, you must enable region pinning for your LiveKit project. This is a regulatory requirement; calls will fail to connect otherwise. See Calling in India.

Part 1: Receive incoming calls

Route calls from your Plivo phone number to LiveKit.
1

Create an inbound trunk in Plivo

Create an inbound trunk in Plivo, setting your LiveKit SIP endpoint as the primary URI.
First, create an origination URI that points to your LiveKit SIP endpoint. Include ;transport=tcp in the URI:
Copy the uri_uuid from the response for the next step:
Next, create an inbound trunk using the origination URI as the primary URI:
Copy the 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.
2

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.
Assign the inbound trunk to your phone number using the update a number endpoint. Set the 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:
A successful response returns HTTP 202:
To list your purchased numbers, run the following command:
3

Configure LiveKit to accept calls

Set up an inbound trunk and dispatch rule in LiveKit to accept calls to your Plivo phone number.
4

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.
1

Create an outbound trunk in Plivo

Set up an outbound trunk with username and password authentication in Plivo.
First, create a credential with a username and strong password for outbound call authentication:
  • 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.
Copy the credential_uuid from the response for the next step:
Next, create an outbound trunk using the credential:
Copy the trunk_id from the response:
Finally, retrieve the trunk to get your Termination SIP Domain. It’s returned in the trunk_domain field. For example, 21784177241578.zt.plivo.com:
Copy the Termination SIP Domain (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.
2

Configure LiveKit to make outbound calls

Create an outbound trunk in LiveKit using the Termination SIP Domain, username, and password from the previous step.
3

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.
For error codes, see Plivo hangup codes.

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.