Short video:



What is usual?

Typically, while configuring your app, you would enter the text or upload the audio that you want your callers to listen to. This is static in nature - i.e., all your callers will hear the same message/audio.


How to make it dynamic?

In Exotel, you have an option to make this greeting dynamic - i.e., you can potentially play a different greeting to different callers. 

In the Greeting (or Menu) applet, you can specify a URL (instead of a static text) in the "Read text like a robot" option. See below. 



When the text box contains a URL, Exotel will make an HTTP GET request to that URL (which is hosted at your server). Your server can now return either a text or a URL (to an audio file). If it returns a text, the text will be converted to audio using our Text-To-Speech (TTS) engine and then played out. 


The applets mentioned above are a part of the Custom App section also called App Builder, to know more about App Builder please follow----> Exotel App Builder


HTTP Request from Exotel (to your URL)

The GET request that Exotel makes to the URL will have the following query parameters:

 
PARAMETER NAMEVALUE
CallSidstring; unique identifier of the call
Fromstring; the number of the calling party
Tostring; your Exotel company number that is being called; this will be from your "Company Numbers" page
DialWhomNumberstring; the number that is being called currently (This might be empty also)
CustomFieldstring; This is set if CustomField was provided while initiating an Outbound call (Not applicable for IB calls)


To know more about passing custom fields, while making an Outbound call, please follow ---> APIs

HTTP Response from your web server

Your web server:

  • MUST set the Content-Type HTTP header to 'text/plain' and nothing else.

  • MUST support a HEAD request from Exotel and return the exact same headers that it would for a GET request.


In case you want to read out a text,

  • The HTTP response body must contain the text to be read out in plain English - and nothing else. Such as this:

Thanks for calling Super Kart. Your order has already been shipped. It will reach you in 2 to 3 business days.


In case you want to play an audio

  • The HTTP response body must contain the URL of the audio file (one per line). Such as this:

http://example.com/first-audio.wav

http://example.com/second-audio.wav

  • The Audio files MUST be in the .wav/.mp3, 8Khz Mono format. The bit depth must be 16 bit.

            NOTE: All other formats are not supported (like 16Kz Mono/Stereo etc)


Caching of the audio files

Exotel caches the audio files that it downloads and plays - so that the next time you send the same file, we don't need to download and it will be faster. 

Exotel caches the file based on the name of the URL. So in case you are changing first-audio.wav, you will need to send in another name the next time (Ex: http://example.com/first-audio-new.wav)


Note: If you do not wish to play the dynamic content, you can also play a voice message by adding the context instead of the URL. Please find the link useful on How can I request a voice over and where can I find my voice over recordings?


If you have any questions or concerns, please connect with us using the chat widget on your Exotel Dashboard or Whatsapp us on 08088919888.