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

# SIP trunks

> Connect the SIP trunk of your PBX or carrier so its calls reach your voice agents, and so your agents can call out through it.

A **SIP trunk** connects your phone system (PBX) or your carrier to Jelou. The calls your customers make to your numbers arrive through your trunk and a voice agent answers them. If you want, your agents can also call out through it, with your numbers and your carrier.

You set everything up yourself from **Voice**, in **SIP trunks**, without going through the Jelou team: you connect the trunk, copy the settings into your PBX, and add your numbers.

> [!NOTE]
>
> If you don't have your own PBX or carrier and only need a number for your agent, see [Numbers and the ElevenLabs channel](https://docs.jelou.ai/en/guides/voice/numbers.md).

## Before you start

You need:

* A PBX (Asterisk, FreePBX, 3CX, or another) or a carrier that speaks SIP over the internet, with a **public IP**.
* A PBX that can authenticate with a **username and password** (digest) when it sends calls.
* Your numbers in international format (E.164), for example `+593984900754`.
* The agents that will answer, already created in Voice. They can be ElevenLabs or Vapi agents.

> [!NOTE]
>
> Trunks that connect over a VPN or with private addresses are not set up here: the Jelou team still configures them.

## How it works

* **Inbound calls**: your PBX sends the call to `sip.jelou.ai` with the dialed number. Jelou hands it to the agent you assigned to that number.
* **Outbound calls (optional)**: when an ElevenLabs agent calls from one of your numbers, Jelou sends the call to your PBX, which places it through your carrier.

Each trunk only receives calls for its own numbers.

## Connect a trunk

**1. Open SIP trunks**

In **Voice**, open **SIP trunks** and click **Connect trunk**.

**2. Name it**

The **Name** is how you'll recognize the trunk in the list, for example `Carrier Quito`.

**3. Choose how we recognize your trunk**

Under **How we recognize your trunk**, pick one of two options:

| Option | What it does |
| - | - |
| **Username and password** | We give you a username and password for your PBX to authenticate with. |
| **IP and password** | We give you a username and password that only work from the IPs you list. |

With **IP and password**, fill in **IPs your trunk calls from**: one public IP or CIDR block (`/16` or smaller) per line.

**4. Decide whether your agents call through your trunk**

Turn on **Send the agents' calls to your PBX** only if you want your agents to call out through your trunk. You can leave it for later; the fields are explained in [Outbound calls through your trunk](#outbound-calls-through-your-trunk).

**5. Connect**

Click **Connect**. **Settings for your PBX** opens with everything you need for the next step.

## The settings for your PBX

**Settings for your PBX** shows each value with a button to copy it:

| Setting | What it is |
| - | - |
| **Server** | `sip.jelou.ai`, where your PBX sends the calls. |
| **Public IP** | The IP of the Jelou server, to allow it in your firewall. |
| **Signaling ports** | `5060`, over UDP or TCP. |
| **Audio ports (RTP, UDP)** | `10000-20000`. |
| **Codecs** | G.711 µ-law (`ulaw`), G.711 A-law (`alaw`), and G.722 (`g722`). |
| **Username** | Your trunk's username, shaped like `jt-…`. |
| **Password** | Your trunk's password. |

> [!WARNING]
>
> Copy the password now: we won't show it again. If you lose it, generate a new one with **Generate new password**; the old one stops working in less than a minute, and you'll need to set the new one on your PBX.

The same settings, except the password, stay in the trunk's details, under **Settings for your PBX**.

## Set up your PBX

Every PBX names things differently, but the steps are the same:

1. Create a SIP trunk to `sip.jelou.ai`, port `5060`, over UDP or TCP.
2. Use the Jelou **Username** and **Password** as the authentication credentials. **Don't set up registration** (REGISTER): your PBX authenticates on every call it sends.
3. Send each call to the dialed number in international format, for example `sip:+593984900754@sip.jelou.ai`. Jelou also recognizes the number without the `+`.
4. Use G.711 (`ulaw` or `alaw`) or G.722, and DTMF over RFC 4733 (also known as RFC 2833).
5. Allow the Jelou **Public IP** in your firewall: SIP on `5060` and audio on `10000-20000` UDP.

If you chose **IP and password**, calls must leave from the IPs you listed.

> [accordion] Example for Asterisk (PJSIP)
>
> ```ini pjsip.conf theme={null}
> [jelou-auth]
> type=auth
> auth_type=userpass
> username=jt-3fa9c01b2e      ; your Username
> password=YOUR_PASSWORD      ; your Password
>
> [jelou]
> type=aor
> contact=sip:sip.jelou.ai:5060
>
> [jelou]
> type=endpoint
> transport=transport-udp     ; your UDP transport
> context=from-jelou          ; your inbound context
> disallow=all
> allow=ulaw,alaw
> dtmf_mode=rfc4733
> aors=jelou
> outbound_auth=jelou-auth
>
> ; Only if the agents call out through your trunk:
> ; recognize the calls Jelou sends you.
> [jelou-identify]
> type=identify
> endpoint=jelou
> match=JELOU_PUBLIC_IP
> ```
>
> To send a call to your agent: `Dial(PJSIP/+593984900754@jelou)`.
>
> Replace `transport-udp` with the name of your UDP transport and `from-jelou` with the context where you handle incoming calls. If the agents call out through your trunk, that context receives those calls: send them on to your carrier, with the number in the format you chose in **Format of the number we send**.
>
> ```ini extensions.conf theme={null}
> [from-jelou]
> exten => _[+0-9].,1,Dial(PJSIP/${EXTEN}@your-carrier,60)
> ```

## Add numbers

Click the trunk to open its details and, under **Numbers**, click **Add number**:

| Field | Content |
| - | - |
| **Number** | The number your trunk carries, in international format. |
| **Label** | Optional, to recognize it, for example `Sales`. |
| **Agent provider** | ElevenLabs or Vapi. |
| **Agent that answers** | The agent from that provider that answers calls to the number. |
| **Call out with this number** | Lets the agents call through your trunk with this number. See [Outbound calls through your trunk](#outbound-calls-through-your-trunk). |

When you add it, Jelou registers the number with the agent's provider and gets it ready for the calls your trunk sends.

A number can only be on one trunk, and it can't be a line that already exists in Jelou. To change a number's agent, remove it with **Remove number** and add it again with the new agent.

## Outbound calls through your trunk

For your agents to call out through your trunk, edit the trunk with **Edit trunk** and turn on **Send the agents' calls to your PBX**:

| Field | Content |
| - | - |
| **Your PBX host or IP** | A domain or a public IP. |
| **Port** | `5060` by default. |
| **Transport** | UDP, TCP, or TLS. |
| **Username your PBX asks for (optional)** | If your PBX asks for authentication on the calls we send it. |
| **Password your PBX asks for (optional)** | That username's password. When editing, leave it empty to keep the saved one. |

Then turn on **Call out with this number** on each number the agents can use. The calls an agent places from that number, including [campaign](https://docs.jelou.ai/en/guides/voice/campaigns.md) calls, go out through your PBX.

Your PBX must accept the calls that come from the Jelou **Public IP**, either by recognizing that IP or by asking for the username and password you set up.

> [!NOTE]
>
> For now only ElevenLabs agents can call through a trunk.

### Advanced

The **Advanced** section of the form adjusts how calls are sent:

| Field | What it does |
| - | - |
| **Codecs** | The codecs your trunk accepts. |
| **From user** and **From domain** | Only if your carrier requires a specific From on the calls we send it. |
| **Format of the number we send** | **International (+1…)** or **Digits only**, without the `+`. |
| **Remove prefix** and **Add prefix** | Adjust the number before it's sent: first a prefix is removed, then another one is added. |
| **Allowed destinations** | International prefixes separated by commas, for example `+593`. Leave it empty to allow any destination. |
| **Calls at once** | Maximum simultaneous calls through the trunk, between 1 and 500, inbound and outbound together. |
| **Check availability** | We send an OPTIONS to your PBX every minute. Turn it off if it doesn't answer them: without an answer, we send it no calls. |
| **Encrypt the audio (SRTP)** | Requires sending the calls over TLS. |

> [!TIP]
>
> To send Ecuadorian numbers in national format, use **International (+1…)**, **Remove prefix** `+593`, and **Add prefix** `0`: the number `+593984900754` is sent as `0984900754`.

## Trunk statuses

The **Status** column of the list shows how each trunk is doing:

| Status | What it means |
| - | - |
| **Pending** | Jelou hasn't loaded the trunk yet. It takes less than a minute. |
| **Ready** | Loaded and ready to receive calls. It's the status of trunks that don't send calls to your PBX, or that have **Check availability** turned off. |
| **Connected** | Your PBX answers the availability check. |
| **Not responding** | Your PBX doesn't answer the OPTIONS, so Jelou sends it no calls. |
| **Paused** | You paused it: it doesn't receive or send calls. |

If a trunk stays **Not responding**, check **Your PBX host or IP**, the **Port**, and the **Transport**, and that your firewall allows the Jelou **Public IP**. If your PBX doesn't answer OPTIONS by design, turn off **Check availability** under **Advanced**.

## Edit, pause, and delete

The menu in the **Actions** column has:

| Action | What it does |
| - | - |
| **View details** | Opens the settings for your PBX and the trunk's numbers. |
| **Edit trunk** | Changes the configuration. Changes apply in less than a minute. |
| **Pause** / **Resume** | Stops receiving and sending calls without losing the configuration or the numbers. |
| **Generate new password** | Issues a new password; the current one stops working in less than a minute. |
| **Delete trunk** | Deletes the trunk and its numbers. |

> [!WARNING]
>
> **Delete trunk** stops receiving and sending calls, and deletes its numbers from ElevenLabs or Vapi. This can't be undone.

## Current limits

* A trunk can't be recognized by its IP alone: it always uses a username and password. With **IP and password**, those credentials also only work from your IPs.
* TLS is only available for the calls Jelou sends to your PBX. Your PBX sends calls to Jelou over UDP or TCP.
* Only ElevenLabs agents call out through a trunk.
* The Jelou team sets up trunks over a VPN or with a private IP.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.