> ## Documentation Index
> Fetch the complete documentation index at: https://onextel-09023014.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your voice platform

> The SIP trunk your voice platform needs to provide to receive WhatsApp calls: transport, authentication, call details, audio and failover.

Your voice platform receives WhatsApp calls as ordinary SIP calls on a trunk you provide. Any
standards-compliant SIP platform works: an IVR, a contact-centre platform, a SIP server or a voice bot.

## What your platform provides

| Setting | Options | Notes |
| - | - | - |
| Address | Hostname or IP, and a port | Port 5060 for UDP and TCP, 5061 for TLS, unless you choose another. |
| Transport | UDP, TCP or TLS | |
| Authentication | By source IP address | Your platform accepts calls from the OneXtel gateway's addresses. Username and password trunk authentication is not available yet. |
| Audio security | Plain RTP, or SRTP with SDES keys | |
| Codecs | G.711 µ-law (PCMU), G.711 A-law (PCMA), G.729, Opus | List the ones your platform accepts. The gateway converts from WhatsApp's Opus when needed, including to G.729. |
| Maximum calls | A number, or no limit | When a trunk is at its limit, the gateway uses the next trunk, or refuses the call if there is none. |
| Failover time | 500 ms to 60 s, default 3 s | How long the gateway waits for any response before trying the next trunk. See [Failover and fallback](#failover-and-fallback). |
| Ring limit | 3 to 60 seconds, or none | How long the trunk may ring without answering before the gateway tries the next trunk. Without a limit it waits up to 60 seconds. |
| If your platform rejects the call | Pass the rejection back (default), or try the next trunk | Applies to busy, unavailable and declined answers. |

<Warning>
  Allow the OneXtel gateway to reach your platform for both signalling and audio. OneXtel gives you the
  gateway addresses during onboarding. Keep them allowed in every firewall between the internet and your platform.
</Warning>

## What your platform receives

Each call arrives as a SIP INVITE with an SDP offer.

```text theme={null}
INVITE sip:+919999999999@platform.example.com:5060;transport=udp SIP/2.0
From: <sip:+918888888888@...>;tag=...
To: <sip:+919999999999@platform.example.com>
X-WA-Tenant: <OneXtel identifier>
X-WA-Number: <OneXtel identifier>
X-WA-Channel: whatsapp
Content-Type: application/sdp
```

| Where | What it carries |
| - | - |
| Request address user part | Your WhatsApp Business number in international format with a plus sign, by default. See [Routing options](#routing-options). |
| `To` | The same address as the request line: the same user and your platform's host. Platforms that route on the `To` header (many voice AI agent platforms do) match exactly what you configured. With a fixed SIP user, `To` carries that user too. |
| `From` | The caller's WhatsApp number in international format, as supplied by WhatsApp. |
| `X-WA-Tenant` and `X-WA-Number` | OneXtel identifiers for your account and number. Quote them when you contact support. |
| `X-WA-Channel` | Always `whatsapp`. If your platform serves both the phone network and WhatsApp on the same number, use it to tell WhatsApp calls apart. |
| `X-WA-Route` | Only when you choose header routing. See below. |

## What your platform must do

<Steps>
  <Step title="Answer the call">
    Reply with 180 Ringing if you like, then 200 OK with an SDP answer that picks one of your accepted codecs.
  </Step>

  <Step title="Send audio first">
    Start sending audio as soon as you answer: a greeting, music, or silence. WhatsApp waits for the
    business side to send first. A platform that only listens produces a silent call.
  </Step>

  <Step title="Send and receive on the addresses in the SDP">
    Use the audio address and port in the gateway's SDP. Send your audio from the same address and port
    you advertise.
  </Step>

  <Step title="End the call with BYE">
    Either side may send BYE. The gateway closes both legs.
  </Step>
</Steps>

## Routing options

Choose how the gateway addresses your trunk. This is set per trunk.

| Option | Behaviour |
| - | - |
| Dialled number (default) | The request address user part is your WhatsApp number in international format. |
| Fixed user | The request address user part is a fixed value you choose, for example an IVR extension. |
| Header | The user part stays your number, and the gateway adds an `X-WA-Route` header with the value you choose. |

<Tip>
  Some platforms, such as voice AI agent platforms, match the call to a number or agent you imported there by an
  identifier. Choose **A fixed SIP user** and enter the identifier exactly as you imported it, including capital
  letters and any leading plus sign. The gateway puts it in both the request line and the `To` header. If the call
  is answered with `404`, the identifier usually does not match. See [Troubleshooting](/guides/whatsapp-voice/troubleshooting#your-platform-answers-with-an-error).
</Tip>

## Failover and fallback

You can attach more than one trunk to a number, for example your main platform, then a backup agent or a human
queue. The gateway tries them in priority order and moves to the next trunk when:

* the trunk gives **no response** within the failover time,
* the trunk answers with a **server error** (5xx),
* the trunk **rings but does not answer** within its ring limit, or
* the trunk **rejects the call as busy, unavailable or declined** (480, 486, 600 or 603), if you turned on
  *try the next trunk* for that trunk.

Without that last setting, a busy or decline is passed back to the caller as it is. A trunk that has reached
its call limit is skipped. If there is no further trunk, the call fails and the caller hears it.

<Info>
  The ring limit starts when your platform replies Ringing. Until then, the failover time applies. When the limit
  passes, the gateway cancels the call to that trunk and sends it to the next one, so your platform sees a normal
  CANCEL.
</Info>

<Tip>
  Use a ring limit together with *try the next trunk* on a platform that can be briefly unavailable, such as a voice
  AI agent that is at its concurrency limit. The caller then reaches a working destination instead of waiting for
  the call to fail. Keep the ring limit short. Ask your account team to attach the backup trunk and set the limits.
</Tip>

## During the call

* **Re-INVITE** (for example hold and resume) is passed through.
* **Transfers** should be done inside your platform. The gateway does not transfer calls on to other WhatsApp numbers.
* **Keypad tones (DTMF)** arrive as standard RFC 4733 telephone-events. See [Protocols and media](/guides/whatsapp-voice/protocols-and-media#keypad-tones-dtmf).

## Related

* [Protocols and media](/guides/whatsapp-voice/protocols-and-media)
* [Troubleshooting](/guides/whatsapp-voice/troubleshooting)


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