# Create a Trunk

> Create an Edesy termination trunk in the portal or with POST /v1/trunks, and read back its SIP host, port, transport and credentials.

Source: https://edesy.in/docs/sip-trunking/termination-trunks/create-a-trunk

A termination trunk is a SIP endpoint that Edesy issues to you. Your PBX or voice-agent platform sends calls to it, and Edesy places them on the Indian phone network. Each trunk has its own host (`tk-<id>.trunk.edesy.in`), port `5070`, an authentication mode, and a cap on concurrent calls.

## In the portal

1. Sign in at [voice-app.edesy.in](https://voice-app.edesy.in) and open **SIP**.
2. On the **Outbound trunks** card, click **Manage**, then **New trunk**.
3. Fill in the form:

   | Field | What to enter |
   |---|---|
   | Name | A label for you, such as `FreePBX office` or `LiveKit production` |
   | Max concurrent calls | The most calls this trunk may carry at once. Default 50. |
   | Authentication | **IP allowlist** (enter IPs or CIDRs, one per line) or **SIP credentials** |

4. Click **Create trunk**. The dialog shows the SIP server, and for credentials mode the username and password. Copy them now.

> **Note:** You can reveal the password again later from the trunk page (up to 5 times an hour) or rotate it. See [Rotate the Password](https://edesy.in/docs/sip-trunking/termination-trunks/rotate-password).

## With the API

`POST https://voice-api.edesy.in/v1/trunks`

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Up to 255 characters |
| `auth_mode` | string | yes | `ip_allowlist` or `credentials` |
| `allowed_ips` | string[] | for `ip_allowlist` | IPv4/IPv6 addresses or CIDRs. A bare IP becomes `/32` (IPv4) or `/128` (IPv6). |
| `sip_username` | string | no | Credentials mode. 4-64 characters: letters, digits, dot, dash, underscore. Generated if omitted. |
| `sip_password` | string | no | Credentials mode. 16-128 characters, at least one letter and one digit, no spaces. Generated if omitted. |
| `max_concurrent_calls` | integer | no | 1-10,000. Default 50. |
| `inbound_target_type` | string | no | `sip` or `webhook`. A trunk-level inbound fallback for numbers routed to this trunk. |
| `inbound_sip_uri` | string | no | Used when `inbound_target_type` is `sip` |
| `inbound_webhook_url` | string | no | Used when `inbound_target_type` is `webhook` |

```bash
curl -X POST https://voice-api.edesy.in/v1/trunks \
  -H "Authorization: Bearer sk_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Office PBX",
    "auth_mode": "ip_allowlist",
    "allowed_ips": ["203.0.113.7", "198.51.100.0/24"],
    "max_concurrent_calls": 30
  }'
```

<!-- response 201 -->
```json
{
  "data": {
    "id": "1a2b3c4d-0000-4000-8000-000000000000",
    "name": "Office PBX",
    "sip_uri": "tk-1a2b3c4d.trunk.edesy.in",
    "auth_mode": "ip_allowlist",
    "allowed_ips": ["203.0.113.7/32", "198.51.100.0/24"],
    "max_concurrent_calls": 30,
    "status": "active",
    "created_at": "2026-10-28T10:00:00Z",
    "updated_at": "2026-10-28T10:00:00Z"
  }
}
```

For a credentials trunk, `data` also includes `sip_username` and `sip_password`. The password appears in this response only.

## Other trunk endpoints

| Method | Path | Purpose |
|---|---|---|
| `GET` | `/v1/trunks` | List your trunks |
| `GET` | `/v1/trunks/:id` | Get one trunk (no password) |
| `PATCH` | `/v1/trunks/:id` | Rename, change the allowlist, set the inbound fallback, change max calls, or set `status` to `active` / `suspended` |
| `GET` | `/v1/trunks/:id/status` | Registration or allowlist state |
| `POST` | `/v1/trunks/:id/test-call` | Outbound or inbound test call. See [Test Calls](https://edesy.in/docs/sip-trunking/inbound/test-call). |
| `POST` | `/v1/trunks/:id/rotate-password` | New password |
| `GET` | `/v1/trunks/:id/reveal-password` | Show the current password |
| `DELETE` | `/v1/trunks/:id` | Delete the trunk |

## Connection details for your platform

| Setting | Value |
|---|---|
| SIP server | The trunk's `sip_uri`, such as `tk-1a2b3c4d.trunk.edesy.in` |
| Port | `5070` |
| Transport | UDP or TCP. TLS is available on request. |
| Codecs | G.711 μ-law (PCMU), G.711 A-law (PCMA) |
| DTMF | RFC 2833 / RFC 4733 |
| Number format | E.164. For India, `91` followed by the 10-digit number. |
| Caller ID | The `From` number must be an Edesy number you own |

## Caller ID rule

Every call through a trunk is checked: the SIP `From` number must be a number your workspace owns on Edesy. A call with any other caller ID is rejected with `403 Caller ID Not Authorized` and logged. A common cause is a PBX sending its SIP username as the `From` user; set the caller ID to your Edesy number instead.

## Next

- [IP vs Credential Auth](https://edesy.in/docs/sip-trunking/termination-trunks/ip-vs-credential-auth)
- [Channels and Limits](https://edesy.in/docs/sip-trunking/termination-trunks/channels-and-limits)
