How to setup IVR on Asterisk?

Dear ALL,

I am a new learner on asterisk, so alot of problem and crazy question may i asked, Now i have one problem with IVR, i have tried to created IVR following some example post on google but it doesn’t work so please every one help me to check with me message error that i got from asterisk -r

– Executing [200@internal:3] BackGround(“SIP/30-00000002”, “/var/lib/asteri sk/sounds/cdir-please-enter-first-three.wav”) in new stack
[2013-04-26 09:06:53] WARNING[3680]: file.c:663 ast_openstream_full: File /var/l ib/asterisk/sounds/cdir-please-enter-first-three.wav does not exist in any forma t
[2013-04-26 09:06:53] WARNING[3680]: file.c:958 ast_streamfile: Unable to open / var/lib/asterisk/sounds/cdir-please-enter-first-three.wav (format 0x80002 (gsm|h 263)): No such file or directory
[2013-04-26 09:06:53] WARNING[3680]: pbx.c:10083 pbx_builtin_background: ast_str eamfile failed on SIP/30-00000002 for /var/lib/asterisk/sounds/cdir-please-enter -first-three.wav
– Auto fallthrough, channel ‘SIP/30-00000002’ status is ‘NOANSWER’

please share your idear,


The First thing you got learn is to interpreter the asterisk logs and and the cli output

Make sure you the file the audio file cdir-please-enter-first-three exist under the directory
/var/l ib/asterisk/sounds/ and is already in a format that asterisk can play. Example : sln, gsm, Asterisk .wav files are 16 bit sample, 8kHz sampling rate, signed linear files.

Also, the .wav should not be part of the file name for most Asterisk applications that play files. Asterisk chooses the best file extension for the particular call, if you have the recording in multiple formats.

Dear all,

i just want to make more express on File /var/l ib/asterisk/sounds/cdir-please-enter-first-three.wav it is in default directory of asterisk but as the message shown it like isn’t in directory,
any one can help me on this problem. and i have tried to use the default file in derictory with other extiontion like .gsm, sln but the message is shown as the same.

please share your idear, thanks

-> removed the .wav

-> tried with a different file. Too you can convert ,an mp3 file using the sox tool. this is the syntax.

sox myfile.wav -t raw -r 8000 -s -2 -c 1 myfile.sln

Then move the myfile.sln file to /var/lib/asterisk/sounds/

Test Dial Plan.


Thanks ambiorixg12,

It’s working for Playback, but can you tell me why it’s not working with Background () ?
and if i want to use Background() what should i do ?


Now for background is working, and i also have some feature that i’m not clear about how to use it on asterisk like /var/lib/asterisk/agi-bin/phpagi.php ? what is it using for?

can any one give the example about how to use it ?

The phpagi file is not part of Asterisk. It will be a class library for writing AGI scripts in PHP. AGI is describe in


I am a new learner on asterisk, so alot of problem and crazy question may i asked


Hey friend why do you want to run if you still can walk. You got learn the Asterisk Basic at least
(dial plan, commands,functions,sip.conf,extensions.conf) and then Jump into more advanced stuffs.

How ever you will find examples about the phpagi class on this link. … i_php.html

Hi everyone, becuase what i have to do is my company requirement forced me to jump to the main goald, but now have problem with I IVR Options, press IVR option like when dailed to 200(exten) and then press 2(option key) to Playback(hello-world) as shown in example below, it will hangup the call 10 seconds after press the key, Any one can tell me if i want to reduce the hangup time to 2 or 3 secods after press what should i do?

; Calls to ext 200
exten => 200,1,Dial(SIP/200,1)
exten => 200,2,AGI(page.agi)
exten => 200,3,Background(myfile)
exten => 200,n,Wait(10)

exten => 30,1,Answer()
exten => 30,2,Playback(myfile)
exten => 30,3,Background(new)
exten => 30,4,Goto(2)

exten => s,1,Answer()
exten => s,n,Wait(0.5)
exten => s,n,Background(ForTodayPress1TomorrowPress2)
exten => s,2,Goto(internal,s,1)

exten => 1,1,Goto(internal,200,1)
exten => 2,1,Playback(hello-world)
exten => 3,1,Goto(internal,30,3)
exten => i,1,Goto(s,1)

thanks in advances,

Please Read the bible at

You got read this book [quote=“navaismo”]Please Read the bible at

I agree with the others. Your dialplan doesn’t make sense, and it includes a third party script that you haven’t provided us with. This forum is not the right place for detailed tuition in basic principles.

Dear All,

I had been reading hard with the linked you guide to me but it is not what i want, infact i need to reduce the time from 10 second( is the time between press 2 --------------->background(new) )to 1or 2 second, so caller no need to wait for 10 second it spend so long time

Dialling-------->200(extenstion)---------->Playing(Playback)–press 2-------------------->Background(new)

sorry every may be my question is messing alittle bit but i hope all of you will forgive me,

Such basic things are covered by the book, also you can use the help in the asterisk cli. You can run core show applications or core show functions.

Hint *** Waitexten or TIMEOUT(response)