# Dograh

> Use an Edesy SIP trunk as the telephony provider for a Dograh voice agent - outbound calls through an IP-allowlist trunk and inbound calls on your Edesy number routed to Dograh's SIP endpoint.

Source: https://edesy.in/docs/sip-trunking/guides/dograh

Dograh is the voice agent and Edesy is the carrier. For outbound calls, create an IP-allowlist termination trunk for Dograh's origin IP and add it as an outbound trunk in Dograh. For inbound calls, save Dograh's SIP endpoint as an Edesy destination and route your number to it. Set up either direction, or both.

## How it works

```
OUTBOUND  Dograh agent --SIP--> tk-<id>.trunk.edesy.in:5070 --> phone network
INBOUND   caller --> your Edesy number --SIP--> Dograh SIP endpoint --> your workflow answers
```

| Edesy provides | You configure in Dograh |
|---|---|
| A termination trunk (host, port, auth) | An outbound trunk pointing at it |
| Indian numbers (E.164) | The numbers, with a default caller ID |
| Inbound routing to any SIP URI | The inbound workflow for each number |

## Before you start

From Dograh Cloud, open **Telephony configurations**, find the managed SIP configuration, and expand **SIP connectivity**. Pick the region closest to your traffic (India for Indian numbers) and note:

- the **inbound hostname** and **SIP port** for that region
- the **outbound origin IP** to allowlist

Read these values from the panel each time; they differ by region and can change.

## 1. Create the trunk on Edesy

Dograh Cloud sends calls identified by source IP, so use **IP allowlist** and enter the origin IP for your region.

```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": "Dograh production",
    "auth_mode": "ip_allowlist",
    "allowed_ips": ["<dograh-origin-ip>"],
    "max_concurrent_calls": 50
  }'
```

If you change region later, update the allowlist with `PATCH /v1/trunks/:id`.

## 2. Outbound: add the trunk in Dograh

1. In the SIP configuration, under **Outbound trunks**, choose **Add trunk**.
2. **Name:** letters, digits and hyphens, such as `edesy-in`.
3. **SIP domain:** your trunk host, such as `tk-1a2b3c4d.trunk.edesy.in`.
4. **Region:** the same region as above. Save.
5. **Add number:** enter each Edesy number in E.164 (`+91XXXXXXXXXX`) and mark one as the **default caller ID**. Dograh needs a caller ID on every outbound call.

> **Important:** Edesy trunks listen on port `5070`, and Dograh's outbound trunk form has no port field. Ask Edesy support to confirm your trunk host resolves to port `5070` for port-less lookups before your first outbound test.

## 3. Inbound: route your number to Dograh

**In Dograh:** in **Phone numbers**, set the number's **Inbound workflow**, and allowlist Edesy's signalling IP on your Dograh SIP domain.

**In Edesy:** save Dograh as a destination, then route the number to it.

```bash
# 1. Save the destination
curl -X POST https://voice-api.edesy.in/v1/sip-destinations \
  -H "Authorization: Bearer sk_YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "name": "Dograh agent",
    "sip_uri": "sip:91XXXXXXXXXX@<your-domain>.<region-host>:<sip-port>",
    "transport": "auto"
  }'

# 2. Point the number at it
curl -X PATCH https://voice-api.edesy.in/v1/phone-numbers/NUMBER_ID/routing \
  -H "Authorization: Bearer sk_YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "inbound_target_type": "sip",
    "inbound_sip_uri": "sip:91XXXXXXXXXX@<your-domain>.<region-host>:<sip-port>"
  }'
```

The URI is forwarded as saved, including a non-standard port.

## Self-hosted Dograh

Self-hosted Dograh connects to telephony through Asterisk ARI. Terminate the Edesy trunk on your Asterisk using the [FreePBX 17 guide](https://edesy.in/docs/sip-trunking/guides/freepbx-17-pjsip) settings, set `allow=ulaw` on the Edesy endpoint, and follow Dograh's Asterisk ARI setup.

## 4. Test

- **Edesy outbound on its own:** use the outbound test on the trunk page.
- **Edesy to Dograh:** click **Test call** on the `Dograh agent` destination.
- Then place a call from Dograh, and dial your number from a phone.

## Troubleshooting

| Symptom | Likely cause |
|---|---|
| Dograh says it is not ready for outbound calls | No enabled outbound trunk, or no number with a default caller ID |
| Outbound calls fail immediately | Origin IP missing from the Edesy allowlist; port `5070` not resolved; caller ID not an Edesy number |
| `403 Caller ID Not Authorized` | The `From` number is not yours on Edesy |
| Inbound never reaches the agent | Edesy's IP not allowlisted on Dograh; no inbound workflow; wrong region host or port |
| Connected, no audio | Codec mismatch. Allow G.711 μ-law on both sides. |
| Calls stop at 50 | Raise the trunk's `max_concurrent_calls` |

See also [Dograh's telephony docs](https://docs.dograh.com/integrations/telephony/overview).
