Many a time you may want to play out an dynamic audio file to the caller based on who's calling, when they are calling or based on their IVR inputs. In order to do that you need to do the following.
1) In the Audio picker, you need to choose the 'Type Text' option
2) Enter your application URL which will in-turn return a URL of the Audio file.
3) The Audio file MUST be in the .wav, .mp3, 8Khz Mono format. The bit depth must be 16 bit.
NOTE: All other formats are not supported (eg. 16Kz Mono/Stereo etc)
Here's an example:
In the 'Type Text' option of the audio picker, we have configured a URL
When Exotel makes a HTTP GET to this URL (http://example.com/exotel/dynamicaudio.php),
the HTTP response should
- Contain this header: content-type: text/plain
- HTTP body must have the wav file URL one in each line
Exotel will then download and play the audio files one after the other to the person on the call.
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 if 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)
Conversion of audio files from any format to the required format
If you're on linux, you can use ffmpeg to convert any audio file to the file format accepted by Exotel using the below command:
ffmpeg -loglevel quiet -y -i /path/to/audiofile -ar 8000 -ac 1 /path/to/target.wav
Explain Shell has a good explanation of what these options to ffmpeg mean: http://explainshell.com/explain?cmd=ffmpeg+-loglevel+quiet+-y+-i+%2Fpath%2Fto%2Faudiofile+-ar+8000+-ac+1+%2Fpath%2Fto%2Ftarget.wav