Skip to main content

Connect Plivo's  SIP trunking with LiveKit for inbound and outbound calls.

Prerequisites

The following are required to complete the steps in this guide:

Inbound calling

To accept inbound calls with Plivo and LiveKit, complete the steps in the following sections.

Create a SIP trunk

Create an inbound trunk in Plivo, setting your LiveKit SIP endpoint as the primary URI.

  1. Sign in to the Plivo Console .

  2. Navigate to SIP TrunkingInbound Trunks .

  3. Select Create Trunk and provide a descriptive name for your trunk.

  4. For Primary URI, select Add New URI and enter your LiveKit SIP endpoint. Include ;transport=tcp in the URI. For example, vjnxecm0tjk.sip.livekit.cloud;transport=tcp.

    Secure trunking

    If you're setting up secure trunking, use ;transport=tls instead of ;transport=tcp.

  5. For Link Numbers, select your phone number from the dropdown menu. Or connect your phone number in the next step.

  6. Select Create Trunk.

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.

  1. Navigate to Phone NumbersPurchased Numbers .
  2. Select the phone number to connect to the trunk.
  3. For Application Type, select SIP Trunk.
  4. For Trunk, select the trunk you created in the previous step.
  5. Select Save changes.

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.

Troubleshooting

For help troubleshooting inbound calls, check the following logs:

Outbound calling

To make outbound calls with Plivo and LiveKit, complete the steps in the following sections.

Create an outbound trunk in Plivo

Set up an outbound trunk with username and password authentication in Plivo.

  1. Sign in to the Plivo Console .

  2. Navigate to SIP TrunkingOutbound Trunks .

  3. Select Create Trunk and provide a descriptive name for your trunk.

  4. In the Trunk Authentication section → Credential, select Create new credential.

  5. Add a credential name, and a username and strong password for outbound call authentication. Make sure these values match the username and password you use for your LiveKit outbound trunk. Select Create credential.

  6. For Authentication, select the credential you created in the previous step.

  7. For Secure Trunking, select Enabled.

    Secure trunking

    If you enable secure trunking in Plivo, you must also enable secure trunking in LiveKit. To learn more, see Secure trunking.

  8. Select Create Trunk to complete your outbound trunk configuration.

    Copy the Termination SIP Domain for the next step.

Configure LiveKit to make outbound calls

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

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 the call fails to connect, check the following common issues:

  • Verify your SIP URI. It must include ;transport=tcp.
  • Verify your Plivo phone number is associated with the correct trunk.

For outbound calls, check the following logs:

For error codes, see the Plivo hangup codes  reference.

Regional restrictions

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 restricts calls to India to comply with local telephony regulations. Your calls will fail to connect if region pinning is not enabled.

For other countries, select the region closest to the location of your call traffic for optimal performance.

Next steps

The following guides provide next steps for building your LiveKit telephony app.