# Telnyx

> Connect a Telnyx SIP connection to Edesy as a bring-your-own carrier using registration with your Telnyx SIP username, password and the sip.telnyx.com realm.

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

To use Telnyx with Edesy, register a credentials-based Telnyx SIP connection as a carrier: Edesy registers to `sip.telnyx.com` with your Telnyx SIP username and password, and sends calls to the `sip.telnyx.com:5060` gateway over UDP. Then attach your Telnyx numbers to that connection and list them on Edesy.

## Values

| Setting | Value |
|---|---|
| Auth to Telnyx | Registration (`requires_register: true`) |
| Username / password | Your Telnyx SIP connection credentials |
| Realm | `sip.telnyx.com` |
| Gateway | `sip.telnyx.com`, port `5060`, UDP |

## 1. Register the carrier on Edesy

```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": "Telnyx",
    "requires_register": true,
    "register_username": "YOUR_TELNYX_SIP_USERNAME",
    "register_password": "YOUR_TELNYX_SIP_PASSWORD",
    "register_sip_realm": "sip.telnyx.com",
    "host": "sip.telnyx.com",
    "port": 5060,
    "protocol": "udp",
    "numbers": ["+1XXXXXXXXXX"]
  }'
```

## 2. Configure Telnyx

1. In the Telnyx portal, create or open a **SIP Connection** with **Credentials** authentication and copy the username and password into the request above.
2. Assign your numbers to that connection.
3. Make sure the connection allows the codecs Edesy uses: G.711 μ-law and A-law.

Because Edesy registers, Telnyx delivers inbound calls on those numbers to Edesy over the registration.

## 3. Test

- Outbound: `POST /v1/calls` with `from` set to one of your Telnyx numbers.
- Inbound: dial the Telnyx number.

## FAQ

### Can I use IP authentication with Telnyx instead?

Telnyx also offers IP-authenticated connections. In that case leave `requires_register` off, add Edesy's signalling IP on the Telnyx side, and set the inbound destination to the Edesy SIP address from onboarding.

### Registration fails.

Check the username, password and realm, and that the connection uses credentials authentication.

See [Bring Your Own Carrier](https://edesy.in/docs/sip-trunking/byoc) for how routing works.
