Skip to navigation

Connect Exotel to an AI voice agent

View as Markdown

Connect your Exotel account to Voice Agents for inbound and outbound voice calling.

Setup has two parts: add your Exotel credentials on Voice Agents, then configure the call flow on Exotel’s dashboard.

Before you start: an active Exotel account with admin access to its dashboard, at least one Exophone (Exotel’s term for a virtual phone number), and Voice Agents access with permission to add telephony connections (Deploy → Phone Numbers).

Watch the setup

Connecting your Exotel account to Voice Agents, end to end.

Add the connection on Voice Agents

Voice Agents needs four values from your Exotel account - the Account SID, API Key, API Token, and Base URL. Get them from the Exotel dashboard, then enter them on Sarvam.

1

Get your Account SID (on Exotel)

In the Exotel dashboard, go to Settings → API Settings and copy the Account SID.

2

Get your API Key (on Exotel)

On the same page, under API Credentials, copy the API Key. Click Create to generate one if it doesn’t exist yet.

3

Get your API Token (on Exotel)

Copy the API Token shown alongside the API Key.

The API Token is shown only once when generated. Save it immediately.

4

Find your Base URL (on Exotel)

The Base URL is the API domain for your Exotel account’s region. India accounts use api.in.exotel.com; Singapore accounts use api.exotel.com. Confirm yours from the domain in your Exotel dashboard URL, or on the API Credentials page (top of your dashboard, or under Developer Settings).

5

Enter and save on Voice Agents

In Voice Agents, go to Deploy → Phone Numbers → Add Connection, select Exotel, and enter all four values - Account SID, API Key, API Token, and Base URL - then click Save. The connection now appears under Deploy → Phone Numbers.


Configure the call flow on Exotel

Create an Exotel App that routes incoming calls to your Sarvam agent, then assign it to your Exophone.

1

Create a new App

In the Exotel dashboard, open App Bazaar and click Create to add a new App. Give it a recognizable name (e.g. sarvam-prod).

2

Add the Voicebot applet

In the App flow editor, drag the Voicebot applet into the Call Start flow. (If you don’t see it, search for “Voicebot” in the applet list.)

3

Configure the WebSocket URL

In the Voicebot applet, under “Which bot you want to connect the enduser?”, enter the Sarvam endpoint that streams call audio to your agent:

https://apps.sarvam.ai/api/app-runtime/channels/exotel
4

Set recording options

Configure the recording settings (recommended defaults):

SettingValue
Record this?Checked
Recording Channels?Single
Recording Format?MP3
Encrypt DTMF?Unchecked
5

Save the App

Save and close the App editor.

6

Assign to your Exophone

Go to My Numbers, open the Exophone you want to use with Sarvam, and assign this App to it. Save the assignment.


After connecting

Once both sides are configured:

1

Add your phone number

In Voice Agents, open your Exotel connection under Deploy → Phone Numbers and add the Exophone number. See Manage Phone Numbers.

2

Route calls to an agent

For incoming calls, create an Inbound deployment to route the number to an agent. To dial out, add the number to a Campaign.

3

Verify with a test call

Place a test call to the number and confirm your agent answers. See Manage Phone Numbers for the test-call steps.

Outbound calling uses this same connection - dial out by adding the number to a Campaign. No separate credentials are required.


Enable call transfer

Call transfer on Exotel needs additional applets in your Exotel App. Set up Call transfer on the agent first.

Sarvam URLs

NameURL
Voice Bothttps://apps.sarvam.ai/api/app-runtime/channels/exotel
Call Transfer Statushttps://apps.sarvam.ai/api/app-runtime/v1/channel-providers/exotel/call-transfer/status
Call Transfer Destinationhttps://apps.sarvam.ai/api/app-runtime/v1/channel-providers/exotel/call-transfer/destination
Call Transfer Detailshttps://apps.sarvam.ai/api/app-runtime/v1/channel-providers/exotel/call-transfer/webhooks/status

Configure the applets

In the Exotel dashboard, open your App in App Bazaar and build the flow below.

1

Greeting

In the Call Start flow, add a Greeting applet. Under Audio Choice, choose Type Text, enter a single period (.), and click Save. Under Next, add a Voicebot applet.

2

Voicebot

SettingValue
Which bot you want to connect the enduser?Voice Bot URL
Record this?Checked
Recording Channels?Single
Recording Format?MP3

Under Next, add a Passthru applet.

Exotel Voicebot applet with the Sarvam URL, recording enabled in single-channel MP3, and Passthru as the next applet.

Voicebot applet pointing at Sarvam, followed by a Passthru applet.
3

Passthru: transfer status

  • Set the URL to the Call Transfer Status URL.
  • Leave Make Passthru Async unchecked.
  • Under Once the URL returns OK (200 OK), add a Switch Case applet.
  • Under If the url returns anything else, add a Hangup applet.

Exotel Passthru applet with the Sarvam call-transfer status URL, async unchecked, Switch Case on 200 OK, and Hangup otherwise.

Passthru applet calling the Call Transfer Status URL.
4

Switch Case

InputApplet
trueConnect
falseHangup
DefaultHangup

Exotel Switch Case applet with true mapped to Connect, false mapped to Hangup, and Hangup as the default.

Switch Case: transfer on true, hang up otherwise.
5

Connect

Under Dial Whom, select Dial phone number(s) returned by URL.

SettingValue
Primary URLCall Transfer Destination URL
Fetch numbers after every call attemptChecked
Record this call?Checked
Recording Channels?Single

Exotel Connect applet with Dial phone numbers returned by URL selected, the Sarvam destination URL as the primary URL, and Fetch numbers after every call attempt checked.

Connect applet fetching the transfer destination from Sarvam.
6

Passthru: transfer details

In the Connect applet, add a Passthru applet under each of After the call conversation ends…, If nobody answers…, and We didn’t dial anyone….

In each Passthru, set the URL to the Call Transfer Details URL and add a Hangup applet under both responses.

Exotel Connect applet outcome slots, each containing a Passthru applet.

Passthru applets on every Connect outcome.
7

Save

Save the App and make sure it is assigned to your Exophone under My Numbers.

Next