# Bring Your Own Carrier

> Route calls over a SIP trunk you already have (Twilio, Telnyx, Vonage, Plivo or your own PBX) through Edesy, with one provisioning request that creates the carrier, gateways and numbers.

Source: https://edesy.in/docs/sip-trunking/byoc

Bring your own carrier (BYOC) lets you keep a SIP trunk you already pay for, such as Twilio Elastic SIP, Telnyx, Vonage, Plivo or an office PBX, and use its numbers with Edesy call flows and AI voice agents. You register the carrier, its SIP gateway and your numbers with Edesy, then point the carrier at Edesy.

## How it works

```
INBOUND   caller --> your carrier --SIP--> Edesy --> your app, agent or IVR
OUTBOUND  POST /v1/calls (from = your carrier's number) --> Edesy --SIP--> your carrier --> callee
```

- **Inbound:** Edesy recognises your carrier by the source IP of its INVITE (the gateway you registered), finds the dialled number, and runs the application linked to it.
- **Outbound:** Edesy picks the carrier from the `from` number. A call from one of your BYOC numbers leaves through your carrier's gateway.

## Set it up

1. **Register the carrier, gateway and numbers** with one request (below), or ask support to do it with you.
2. **Configure your carrier** to send inbound calls to the Edesy SIP address given to you during onboarding (port `5070`), and to accept calls from Edesy, by IP allowlist or registration.
3. **Place a test call** with `POST /v1/calls` using one of your BYOC numbers as `from`.

### One-request provisioning

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

```bash
curl -X POST https://voice-api.edesy.in/v1/trunk-portal/trunks \
  -H "Authorization: Bearer sk_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My carrier",
    "requires_register": false,
    "gateways": [
      { "ipv4": "sip1.carrier.example.com", "port": 5060, "protocol": "udp" },
      { "ipv4": "sip2.carrier.example.com", "port": 5060, "protocol": "udp" }
    ],
    "numbers": ["+1XXXXXXXXXX"]
  }'
```

Edesy creates the carrier, every gateway, an optional application and the numbers in order. If any step fails, everything created by that request is rolled back, so you never get a half-built trunk.

| Field | Type | Description |
|---|---|---|
| `name` | string | Required. Display name. |
| `requires_register` | boolean | `true` if Edesy must register to your carrier |
| `register_username`, `register_password`, `register_sip_realm` | string | Registration details, when `requires_register` is `true` |
| `tech_prefix` | string | Digits added in front of outbound numbers |
| `e164_leading_plus` | boolean | Send numbers with a leading `+` |
| `dtmf_type` | string | `rfc2833` (default), `tones` or `info` |
| `host`, `port`, `protocol` | string, integer, string | Shortcut for a single gateway |
| `gateways` | array | One or more gateways: `ipv4` (IP or hostname, required), `port`, `protocol`, `netmask`, `inbound`, `outbound`. `inbound` and `outbound` default to `true`. |
| `application` | object | Optional application for the numbers: `call_hook_url` (required), `call_status_url`, `record_all_calls`, `name` |
| `numbers` | string[] | Your DIDs in E.164 |

For editing an existing BYOC setup (adding a gateway, one more number, or changing the application), see the granular endpoints in the [BYOC API reference](https://edesy.in/docs/sip-trunk-for-ai-voice-agents/connect/byoc).

## Provider recipes

| Provider | Auth to the carrier | Gateway | Guide |
|---|---|---|---|
| Twilio Elastic SIP | IP allowlist | `<your-trunk>.pstn.twilio.com:5060` | [Twilio](https://edesy.in/docs/sip-trunking/byoc/twilio-elastic-sip) |
| Telnyx | Registration | `sip.telnyx.com:5060` | [Telnyx](https://edesy.in/docs/sip-trunking/byoc/telnyx) |
| Vonage | IP allowlist | `sip.nexmo.com:5060` | [Vonage](https://edesy.in/docs/sip-trunking/byoc/vonage) |
| Plivo | Registration | `phone.plivo.com:5060` | [Plivo](https://edesy.in/docs/sip-trunking/byoc/plivo) |
| Your PBX | IP allowlist | Your PBX's public IP, port 5060 | [Generic PBX](https://edesy.in/docs/sip-trunking/byoc/generic-pbx) |

Gateway hostnames come from each provider's public docs and can change. Always confirm them in your provider's console.

## FAQ

### When should I use BYOC instead of Edesy numbers?

When you already have numbers or rates with another carrier, or need numbers outside India. For Indian numbers, buying them on Edesy is simpler: no carrier setup and self-serve KYC.

### Can a carrier have more than one gateway?

Yes. Add a primary and a failover gateway in the `gateways` array.

### How does Edesy know a call came from my carrier?

By the source IP of the INVITE, matched against the gateways you registered. Use `netmask` for a range.

### Do I still need a termination trunk?

No. A termination trunk is for your own PBX or agent platform to dial *into* Edesy. BYOC is for Edesy to use *your* carrier.

### Is BYOC self-serve?

The API is available with your API key. If you would rather not script it, [contact us](https://edesy.in/contact) and we will set it up with you.

### How is BYOC priced?

It depends on the setup and volume. [Contact us](https://edesy.in/contact) for a quote.
