> ## Documentation Index
> Fetch the complete documentation index at: https://docs.osvi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Exotel Integration

> Connect your Exotel telephony infrastructure with Osvi AI conversational agents over SIP or the Exotel Voicebot WebSocket.

<div style={{display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '2.5rem', padding: '1.75rem 2rem', background: '#ffffff', borderRadius: '12px', margin: '1.5rem 0', flexWrap: 'wrap', boxShadow: '0 1px 2px rgba(0,0,0,0.04)'}}>
  <img src="https://mintcdn.com/osviai/72IncIb9hk2inxpP/logo/logo-osvi.png?fit=max&auto=format&n=72IncIb9hk2inxpP&q=85&s=258868231c43cb5d7f6f971ef2fa6ea0" alt="Osvi AI" style={{height: '40px', width: 'auto'}} width="268" height="268" data-path="logo/logo-osvi.png" />

  <span style={{fontSize: '1.75rem', fontWeight: 300, color: '#a1a1aa'}}>×</span>

  <img src="https://mintcdn.com/osviai/KXPY2vBHfqbxQyjo/logo/integrations/exotel.svg?fit=max&auto=format&n=KXPY2vBHfqbxQyjo&q=85&s=141aec4140fa123e287cc66ccf6594a6" alt="Exotel" style={{height: '40px', width: 'auto'}} width="156" height="46" data-path="logo/integrations/exotel.svg" />
</div>

This guide explains how to connect your Exotel telephony infrastructure to Osvi AI's conversational AI agents.

Once connected, your Osvi agents can handle both inbound and outbound calls across India with real-time performance and multilingual support — without requiring migration of your existing Exotel SIP trunks or DIDs.

Exotel is unique among the carriers Osvi supports because the platform offers **two distinct transports**:

* **SIP** — same vendor-agnostic SIP path used for Plivo, Ozonetel and Vobiz.
* **WebSocket (Exotel Voicebot)** — bidirectional streaming through Exotel's Voicebot applet, used when you want to keep the call inside an existing Exotel app flow (Voicebot → Passthru → Connect).

You can pick whichever fits your existing Exotel setup; both connect to the same agent runtime.

***

# Prerequisites

## From Exotel

### Required Before Starting

Ensure the following details are available from your Exotel account:

* Active Exotel account
* Assigned DIDs / ExoPhone numbers / CLIs
* Admin credentials and Exotel dashboard access\
  `https://my.exotel.com`
* Sufficient channels procured
  * `1 channel = 1 concurrent call`

**For SIP connectivity, additionally:**

* SIP domain / trunk URI provisioned for your account
* SIP username and password for registration-based trunk\
  (or IP whitelist for IP-based authentication)

**For WebSocket (Voicebot) connectivity, additionally:**

* An Exotel app configured with a **Voicebot** applet pointing at the Osvi-supplied WebSocket URL
* Optional Basic-auth credentials if you want the handshake authenticated
* A **Passthru** applet wired immediately after Voicebot, and a **Connect** applet after Passthru (these power Exotel's native call-transfer flow — see below)

***

## From Osvi AI

### Required Before Starting

Ensure the following is configured on the Osvi side:

* Active Osvi AI account
  * Both SIP and WebSocket support are enabled by default
* Add the SIP endpoint and phone number directly to the agent for outbound calling (SIP mode)
* Obtain UDP SIP server details from your Osvi account manager for inbound SIP routing
* For Voicebot mode, your Osvi account manager will provide the WebSocket URL in the form `wss://<osvi-host>/exotel/voicebot/<agent_id>`

***

# Platform Configuration

Osvi AI supports simple telephony configuration directly at the agent level.

Supported connectivity methods for Exotel:

* SIP Configuration
* WebSocket Streaming (Exotel Voicebot)

This allows seamless integration with your existing Exotel infrastructure while enabling AI-powered inbound and outbound voice workflows.

To add a SIP number for outbound, paste the SIP URL from Exotel and the phone number. For inbound SIP, get the forwarding URL from your Osvi FDE and point your Exotel trunk at it.\
SIP supports authentication-based handshakes for more reliable connections.

For WebSocket mode, configure the Voicebot applet in your Exotel app with the WebSocket URL provided by Osvi. The `agent_id` segment in the URL path determines which Osvi agent answers the call — this is the most reliable place to put it because Exotel's Voicebot UI does not always expose a custom-parameters editor.

***

# Exotel-Specific Behavior

A few aspects of the Exotel integration differ from the other SIP carriers and are worth calling out explicitly.

<Note>
  **Call transfer is handled by Exotel itself.**

  On SIP-based providers, Osvi performs a transfer by dialing a new SIP participant into the call. On Exotel WebSocket calls, the caller is not on a SIP leg — they're on a WebSocket bridged into the room.

  When the agent triggers a transfer, Osvi records the transfer intent (and any destination override) and cleanly closes the WebSocket. Exotel then advances to the next applet in your app: **Voicebot → Passthru → Connect**. The Passthru handler reads the intent from Osvi and tells Exotel either to dial the override number or to proceed with the destination hardcoded on the Connect applet.

  This means the actual handoff — dialling the human agent, bridging the legs, releasing the bot leg — is performed entirely by Exotel's own platform, not by Osvi. Your Exotel app's Connect applet remains the source of truth for the human-agent destination unless an override is provided by the bot.
</Note>

<Note>
  **Outbound audio is capped at 8 kHz.**

  The Exotel Voicebot WebSocket protocol exchanges 16-bit signed little-endian PCM (mono) and caps the outbound (agent → caller) sample rate at **8 kHz**. Osvi automatically resamples the agent's TTS output down to 8 kHz and frames it into Exotel-compliant chunks (multiples of 320 bytes, minimum 3200 bytes per chunk, paced at realtime).

  If your agent's TTS provider is configured for a higher rate (e.g. 16 kHz or 24 kHz), nothing breaks — Osvi handles the downsample transparently — but you should be aware that the audio reaching the caller is bandwidth-limited to the 8 kHz Exotel constraint. This is a property of the Exotel Voicebot transport and does not apply to the SIP path.
</Note>

***

# Choosing Between SIP and WebSocket

| Scenario                                                                                     | Recommended transport |
| -------------------------------------------------------------------------------------------- | --------------------- |
| You already run inbound/outbound through an Exotel SIP trunk and just want AI on top         | SIP                   |
| You already have an Exotel app with applets you want to keep (IVR, business hours, fallback) | WebSocket (Voicebot)  |
| You want Exotel to natively own the call-transfer flow via Connect                           | WebSocket (Voicebot)  |
| You want higher-bandwidth audio (no 8 kHz cap)                                               | SIP                   |

Both transports run against the same Osvi agent — switching between them is a configuration change, not a redesign of your agent.
