# Retell AI

Import a Vonyx number into Retell AI over SIP trunking for outbound and inbound agent calls.

Import your Vonyx number into Retell with Retell's custom telephony (elastic SIP trunking). Retell dials out through your Vonyx trunk, and Vonyx forwards inbound calls to Retell's SIP server.

## Before you start

- A Vonyx [SIP trunk](/docs/console/sip-trunks) with a [number](/docs/console/numbers) attached
- The trunk's username and password, from the Vonyx console
- A Retell account, an API key and an agent (note its agent ID)

Retell requires numbers in E.164 format, so in Retell write your Vonyx number and the numbers you call as `+91XXXXXXXXXX`.

## Outbound calls

<Steps>
<Step>

### Import your Vonyx number

<Tabs items={['Dashboard', 'API']}>
<Tab value="Dashboard">

In Retell, open **Phone Numbers**, click **+** and choose **Connect to your number via SIP trunking**. Fill in:

| Field | Value |
| --- | --- |
| Phone number | `+91XXXXXXXXXX` (your Vonyx number) |
| Termination URI | `43.204.9.41:5060` |
| Outbound Transport | TCP (UDP also works; Vonyx doesn't support TLS) |
| SIP Trunk User Name | `your_trunk_username` |
| SIP Trunk Password | `your_trunk_password` |

Click **Save**.

</Tab>
<Tab value="API">

```bash title="import-number.sh"
curl -X POST https://api.retellai.com/import-phone-number \
  -H "Authorization: Bearer $RETELL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+91XXXXXXXXXX",
    "termination_uri": "43.204.9.41:5060",
    "sip_trunk_auth_username": "your_trunk_username",
    "sip_trunk_auth_password": "your_trunk_password",
    "transport": "TCP",
    "inbound_agents": [{ "agent_id": "YOUR_AGENT_ID", "weight": 1 }],
    "outbound_agents": [{ "agent_id": "YOUR_AGENT_ID", "weight": 1 }],
    "nickname": "Vonyx"
  }'
```

`transport` can be `TCP` (Retell's default) or `UDP`. Don't use `TLS`: Vonyx doesn't support it. The weights in each agent list must add up to 1.

</Tab>
</Tabs>

</Step>
<Step>

### Bind an outbound agent

In Retell, open the number and set **Outbound Agent**. If you used the API call above, `outbound_agents` already did this.

</Step>
<Step>

### Place a call

```bash title="create-call.sh"
curl -X POST https://api.retellai.com/v2/create-phone-call \
  -H "Authorization: Bearer $RETELL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from_number": "+91XXXXXXXXXX",
    "to_number": "+91XXXXXXXXXX"
  }'
```

`from_number` is your imported Vonyx number, and it is also the caller ID, which must be one of your Vonyx numbers. To use a different agent for one call, add `override_agent_id`.

</Step>
</Steps>

## Inbound calls

<Steps>
<Step>

### Bind an inbound agent

In Retell, open the number and set **Inbound Agent** (or set `inbound_agents` on import). Retell won't take inbound calls on a number with no inbound agent. To choose the agent per call, set an `inbound_webhook_url` on the number instead.

</Step>
<Step>

### Point Vonyx at Retell

In the Vonyx console, open the trunk, turn on **Inbound calls** and set the [inbound address](/docs/console/inbound-calls) to:

```text
sip.retellai.com
```

Retell has one SIP server for every account. Vonyx forwards calls to it over UDP.

<Callout type="warn" title="Test inbound before going live">
  Vonyx forwards the called number as `91XXXXXXXXXX`, without `+`, while Retell stores your number as `+91XXXXXXXXXX`. Call your number once after setup to confirm Retell matches it to your agent.
</Callout>

</Step>
</Steps>

## Test the connection

1. In Retell, open the number's **…** menu, choose **Edit Phone Number Settings** and click **Test SIP Connection**. Retell sends a SIP OPTIONS request to the termination URI. A 2xx means Retell reached Vonyx. It doesn't check routing or audio.
2. Place an outbound call with `create-phone-call` to your own phone.
3. Call your Vonyx number from another phone. The inbound agent answers.

## Limitations

- DTMF and call transfer are not available on Vonyx yet, so Retell's transfer and DTMF features won't work on these calls.
- New accounts make 1 call at a time ([raise limits](/docs/sip/limits)). Keep Retell's concurrency and CPS settings at or below your Vonyx limits.
- No TLS or SRTP: use TCP or UDP in Retell.
- Audio is PCMU or PCMA. Retell's G.722 (HD) isn't available on Vonyx.

## Troubleshooting

| Problem | Fix |
| --- | --- |
| Test SIP Connection returns 401 or 407 | Re-enter the Vonyx trunk username and password. |
| Test SIP Connection gets no response | Check that the termination URI is `43.204.9.41:5060` and the transport is TCP or UDP, not TLS. |
| Outbound call is rejected | Make sure `from_number` is a Vonyx number attached to the trunk and both numbers are `+91XXXXXXXXXX`. |
| Inbound calls don't reach the agent | Check that **Inbound calls** is on, the inbound address is `sip.retellai.com`, and the number has an inbound agent in Retell. |
| Call connects with no audio | Media flows directly between Vonyx (RTP on UDP 10000–20000) and Retell (RTP on UDP 10000–65535). If anything between them filters traffic, allow Retell's ranges: `18.98.16.120/30` (signaling), `3.42.144.0/23` and `153.57.128.0/18` (all regions), and `143.223.88.0/21` and `161.115.160.0/19` (some US traffic). Then contact Vonyx support. |

More fixes: [SIP troubleshooting](/docs/sip/troubleshooting).
