Tuesday, May 24, 2011

How to play mp3 files on asterisk for IVR?

If you are using the Background() application on your dial plan you can do this by converting your mp3 files to gsm.

1. You need to install lame and sox
apt-get install lame
apt-get install sox

2. Convert MP3 to wav and wav to gsm.
$ lame --decode example.mp3 example.wav
$ sox -V example.wav -r 8000 -c 1 example.gsm resample -ql

Example IVR Dialplan:
exten => s,1,Answer(500)
same => n(loop),Background(example&press-1&or&press-2)
same => n,WaitExten()

exten => 1,1,Playback(you-entered)
same => n,SayNumber(1)
same => n,Goto(s,loop)

exten => 2,1,Playback(you-entered)
same => n,SayNumber(2)
same => n,Goto(s,loop)

No comments:

Post a Comment