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

# Test and connect a SIP voice-agent platform

> Get a Plivo number ready for LiveKit, ElevenLabs, Retell or Vapi over SIP trunking: check the platform's SIP host answers, plan every step, and fill in the platform's values.

Connect a voice-agent platform such as LiveKit, ElevenLabs, Retell or Vapi over Session Initiation Protocol (SIP) with [SIP trunking](https://plivo.com/docs/voice-agents/sip-trunking/overview.md): an inbound trunk sends calls to your number on to the platform, and an outbound trunk lets the platform place calls through Plivo. First, check a platform host (use yours if it isn't ElevenLabs). This needs no login and places no call:

```bash theme={null}
plivo sip test --uri "sip.rtc.elevenlabs.io:5061;transport=tls"
```

Then `plivo sip connect plan` checks your number and prints every command to run, in order, changing nothing. As you run the plan's steps, `--platform` on `sip uris create`, `sip ip-acl create` and `sip trunks create` fills in the platform's SIP host, port, transport and IP addresses from Plivo's integration guide.

## Check that the platform answers

Example output for the TLS test above, with illustrative addresses, timings and certificate dates:

```text theme={null}
CHECK  STATUS  DETAIL
dns    pass    sip.rtc.elevenlabs.io resolves to 136.112.48.140 (194 ms)
tcp    pass    connected to 136.112.48.140:5061 (271 ms)
tls    pass    TLS 1.3; certificate for sip.rtc.elevenlabs.io valid until 2026-12-07 (52 days) (297 ms)

result: reachable (TLS to sip.rtc.elevenlabs.io:5061)
A pass means the host answers, not that the platform will accept calls.
```

| Transport | What is checked |
| - | - |
| TCP | DNS lookup, then a TCP connection (port 5060 unless the URI gives one) |
| TLS (`;transport=tls`) | DNS, TCP, then the TLS handshake: the certificate is verified and its expiry shown (port 5061 unless the URI gives one) |
| UDP (also when no transport is given) | DNS, then one SIP OPTIONS request |

* Exit codes: `0` reachable; `1` the URI itself is invalid; `3` unreachable, or `unknown` (a UDP host that didn't answer the OPTIONS request).
* No INVITE is ever sent, so no call is placed. Quote a URI that contains `;`, or the shell cuts the command there.
* Hosted platforms often ignore SIP from addresses they don't know, so `unknown` on UDP doesn't mean calls will fail.
* A host given without a port that publishes a SIP service (SRV) DNS record gets a warning naming the record's target; the test still checks the host you gave.
* Each step waits up to 5 seconds, or `--timeout` when given. `-o json` returns `checks[]` (each with `name`, `status`, `detail` and `duration_ms`) and `result`.

## Plan the connection

```bash theme={null}
plivo sip connect plan --number +14155551234 --platform elevenlabs
```

You need to be [logged in](https://plivo.com/docs/cli/install.md#log-in-with-a-browser). Both flags are required: `--number <number>`, a voice-enabled number on your account, and `--platform <name>`: `livekit`, `elevenlabs`, `retell` or `vapi`. The plan checks that the number is on this account with voice enabled, then prints the steps:

```text theme={null}
CHECK    STATUS  DETAIL
number   pass    +14155551234 is on this account
voice    pass    voice is enabled
country  info    United States
routing  info    routed to application <app_id>; step 5 takes its calls away from application <app_id> and sends them to the new inbound trunk

Steps to connect +14155551234 to elevenlabs (nothing has been changed):
  1. plivo sip uris create --name elevenlabs-in --platform elevenlabs --dry-run
  2. printf '%s' "$SIP_PASSWORD" | plivo sip credentials create --name elevenlabs-out --username <username> --password-stdin --dry-run
  3. plivo sip trunks create --name elevenlabs-in --direction inbound --platform elevenlabs --uri <uri_uuid> --dry-run
  4. plivo sip trunks create --name elevenlabs-out --direction outbound --platform elevenlabs --credential <credential_uuid> --dry-run
  5. plivo numbers update 14155551234 --trunk-id <inbound_trunk_id> --dry-run
```

After the steps it lists what to set up on the platform's side, any recommendation such as `--secure`, and a link to Plivo's guide for that platform.

* Replace placeholders before running a step. Use a SIP username of 5 to 20 letters and digits, and supply `SIP_PASSWORD` securely: 5 to 20 characters with at least one of `~!@#$%^&*()_+`.
* Preview each step, then run it without `--dry-run`. A preview creates no IDs, so use the real URI UUID from step 1 in step 3, and the real credential from step 2 in step 4.
* Step 5 changes routing immediately when you remove `--dry-run`. Save the previous application or trunk ID first so you can restore it. Then complete the platform-side steps the plan prints, including importing or assigning the number to your agent.
* With `-o json` the plan returns `checks[]`, `requests[]` and `next_actions[]`. If a check fails, the plan stops and exits non-zero; with `-o json` it prints only the error, with the checks so far under `error.context.checks`.

### Indian numbers

For an Indian number the plan also runs the compliance check that `plivo numbers update` runs (see [Numbers](https://plivo.com/docs/cli/apis/numbers.md#compliance-when-you-buy-or-route-a-number)). A number with no know your customer (KYC) compliance attached, or with an application that isn't `accepted`, fails the `compliance` check, and the plan stops with the KYC steps in the hint. The plan also checks that the platform supports Indian numbers:

| Platform | Indian numbers |
| - | - |
| LiveKit | Supported when the LiveKit project is configured to keep calls in India (`<project>.india.sip.livekit.cloud`). The plan uses that host. |
| ElevenLabs | Supported with an ElevenLabs India deployment (`sip.rtc.in.residency.elevenlabs.io`). The plan uses that host. |
| Retell | Confirm with Retell that your deployment handles SIP traffic in India. |
| Vapi | Not supported. The plan is refused before any step is printed. |

## What `--platform` fills in

Values come from Plivo's [integration guide](https://plivo.com/docs/voice-agents/sip-trunking/integration-guides/livekit.md) for each platform. Flags you pass always win. A host or transport the guide doesn't list is used as given, with a warning.

| Platform | Inbound URI (`sip uris create`) | Outbound authentication | Secure trunking in the guide |
| - | - | - | - |
| LiveKit | Your project host, `<project>.sip.livekit.cloud`, passed with `--uri`; TCP | Credential | Yes |
| ElevenLabs | `sip.rtc.elevenlabs.io:5060`, TCP (TLS on 5061 with `--transport tls`) | Credential | Yes |
| Retell | `sip.retellai.com`, TCP | Credential | No |
| Vapi | `sip.vapi.ai`, UDP (EU: `sip.eu.vapi.ai`) | IP access control list | No |

```bash theme={null}
plivo sip uris create --name eleven --platform elevenlabs --dry-run
plivo sip uris create --name agent --platform livekit --uri "<project>.sip.livekit.cloud" --dry-run
plivo sip ip-acl create --name vapi --platform vapi --dry-run     # fills in Vapi's published IP addresses
```

* On `sip trunks create`, `--platform` only checks the trunk against the guide. It warns when the authentication isn't the guide's, and names the command that makes a missing URI, credential or IP list.
* Where the guide uses secure trunking (TLS for signaling, Secure Real-time Transport Protocol (SRTP) for audio), the CLI prints `recommended: --secure` but never turns it on, because **secure trunking is billed per minute**. Add `--secure` yourself if you want it, and turn it on on the platform's side too.
* Each preset records the date its values were checked against the guide. If that date is more than 90 days old, the CLI warns you to check the values against the platform's docs.
* Retell won't import a number without an outbound trunk's domain and credential, even for inbound-only use, so create the outbound trunk too.

## Next

Once calls flow, see [Check and diagnose a call](https://plivo.com/docs/cli/voice-agent/sip-diagnose-call.md) for who hung up, call quality and a plain-English explanation of any call. All SIP commands are on the [SIP trunking](https://plivo.com/docs/cli/apis/sip.md) page.
