> ## Documentation Index
> Fetch the complete documentation index at: https://plivo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Building AI Voice Agents with SIP Trunking

> Connect Plivo SIP trunking with AI voice agent platforms to build intelligent voice applications

Connect AI voice agent platforms to the telephone network using Plivo's SIP trunking (Zentrunk). Enable your AI agents to make and receive phone calls through Plivo's global voice infrastructure.

***

## Prerequisites

Before connecting your AI platform to Plivo SIP trunking, you'll need:

| Requirement             | Description                                                                                    |
| ----------------------- | ---------------------------------------------------------------------------------------------- |
| **Plivo Account**       | [Sign up](https://cx.plivo.com/signup) and get your Auth ID and Auth Token                     |
| **Phone Number**        | [Purchase a voice-enabled number](/numbers/guides/buy-a-number/) for receiving calls           |
|                         | - **India:** Requires KYC verification. See [Rent India Numbers](/numbers/rent-india-numbers). |
| **AI Platform Account** | Account with your chosen AI voice platform (ElevenLabs, LiveKit, or Vapi)                      |

***

## What is SIP Trunking?

SIP trunking provides a direct connection between your infrastructure and Plivo's voice network. For AI voice agents, this means:

* **Inbound calls**: Route calls from Plivo phone numbers to your AI platform via SIP
* **Outbound calls**: Your AI agents can place calls through Plivo to any phone number worldwide
* **Global reach**: Access phone numbers and terminate calls globally. See [coverage](https://www.plivo.com/virtual-phone-numbers/coverage/)

For complete SIP trunking documentation including technical specifications, APIs, and advanced configuration, see [SIP Trunking](/sip-trunking).

### Inbound vs Outbound Trunks

| Trunk Type   | Purpose                                                          | Can Attach to Phone Numbers? |
| ------------ | ---------------------------------------------------------------- | ---------------------------- |
| **Inbound**  | Receive calls on your Plivo number and route to your AI platform | ✅ Yes                        |
| **Outbound** | Your AI platform places calls through Plivo                      | ❌ No                         |

<Warning>
  **Only inbound trunks can be attached to phone numbers.** To receive calls on a Plivo number, you must create an inbound trunk. Outbound trunks are for placing calls only and won't appear in phone number configuration.
</Warning>

***

## How It Works

```text theme={null}
       ┌─────────────────┐
       │     Caller      │
       │    (Phone)      │
       └────────┬────────┘
                │
                ▼
       ┌─────────────────┐
       │  Plivo Zentrunk │
       │  (SIP Trunking) │
       └────────┬────────┘
                │
                │ SIP Protocol
                ▼
       ┌─────────────────┐
       │  AI Platform    │
       │ (ElevenLabs,    │
       │  LiveKit, Vapi) │
       └─────────────────┘
```

1. **For inbound calls**: Calls to your Plivo phone number are routed via SIP to your AI agent platform
2. **For outbound calls**: Your AI agent initiates calls through Plivo's SIP trunk to reach phone numbers

***

## Supported Platforms

| Platform       | Best For                                                                  | Setup                                                             |
| -------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| **ElevenLabs** | Natural-sounding conversational AI with industry-leading voice synthesis  | [Guide](/voice-agents/sip-trunking/integration-guides/elevenlabs) |
| **LiveKit**    | Custom real-time voice applications with full control over audio pipeline | [Guide](/voice-agents/sip-trunking/integration-guides/livekit)    |
| **Vapi**       | Rapid AI assistant deployment with pre-built templates and workflows      | [Guide](/voice-agents/sip-trunking/integration-guides/vapi)       |

***

## Quick Start

<CardGroup cols={3}>
  <Card title="ElevenLabs" icon="microphone" href="/voice-agents/sip-trunking/integration-guides/elevenlabs">
    Connect Plivo with ElevenLabs for natural-sounding AI voice agents
  </Card>

  <Card title="LiveKit" icon="tower-broadcast" href="/voice-agents/sip-trunking/integration-guides/livekit">
    Build custom real-time voice applications with LiveKit and Plivo
  </Card>

  <Card title="Vapi" icon="robot" href="/voice-agents/sip-trunking/integration-guides/vapi">
    Deploy voice AI assistants quickly using Vapi and Plivo
  </Card>
</CardGroup>

***

## Transferring to a Human Agent

When your AI agent needs to hand off a live call to a human — for escalations, complex queries, or compliance — use SIP REFER. Your endpoint sends a REFER request mid-call with the transfer target's number in the `Refer-To` header. Plivo bridges the caller to the human agent and disconnects your AI endpoint. The caller never re-dials and experiences a seamless handoff.

**How it works:**

1. Your AI agent is on a live call with a customer (inbound or outbound)
2. Agent decides to transfer — sends `REFER` with the target number
3. Plivo responds `202 Accepted` and starts calling the transfer target
4. Transfer target answers — Plivo bridges the caller and sends your agent a `BYE`
5. Caller and human agent continue the conversation

**Key details:**

* The `Refer-To` URI must use your SIP trunk domain (ending in `.zt.plivo.com`)
* Your endpoint must handle `NOTIFY` messages from Plivo to track transfer progress
* Do not send `BYE` before receiving `NOTIFY 200 OK` — this would drop the caller
* If the transfer fails, the caller stays on your AI agent's line — you can retry or continue

<CardGroup cols={2}>
  <Card title="Outbound call transfer" icon="phone-arrow-up-right" href="/sip-trunking/concepts/sip-refer-outbound">
    Your AI agent placed the call and wants to hand off.
  </Card>

  <Card title="Inbound call transfer" icon="phone-arrow-down-left" href="/sip-trunking/concepts/sip-refer-inbound">
    A caller dialled your Plivo number and your AI agent wants to hand off.
  </Card>
</CardGroup>

***

## Regional Considerations

If you're handling calls to or from India, ensure your AI platform has servers deployed in India to comply with regulatory requirements. See the individual integration guides for platform-specific instructions.

***

## Related

* [SIP Trunking Overview](/sip-trunking) - Complete SIP trunking documentation
* [SIP Trunking API Reference](/sip-trunking/api/overview) - Programmatically manage trunks
* [Technical Specifications](/sip-trunking/concepts/technical-specifications) - Codecs, protocols, and supported features
