Recording prompts
For your IVR configuration you will need first to record some sound messages.
You can record your own sound files using the Asterisk. For this purpose you should add an extension for the recording in the extensions.conf file. In our example, you can dial the extension 100, after the beep you can start recording your message.
To end the recording press "#". The message is recorded in .gsm format and is called recording.gsm in the /var/lib/asterisk/sounds directory. Asterisk plays back the message after you pressed "#"(after 2 seconds).
Here we are using Wait(), Record(), Playback() and Hangup() applications. You can see their descriptions by typing "core show application <application>" in Asterisk 1.4, or use "show application <application> (this will be removed in future).
Let's make more clearness:
Wait(2) - waits 2 seconds, then the dialplan continues to the next priority. The 2 seconds are to be sure that the channel is up and ready for recording.
Record(file:gsm) - records from the channel into a file with format gsm. This application sets a channel variable named RECORDED_FILE, which contains the name of recorded filename.
You can use NoOp() application to see what contains the RECORDED_FILE variable.
exten => s,n,NoOp(${RECORDED_FILE})
Playback() application - plays the recording file. This application sets the following channel variable - PLAYBACKSTATUS. The result is SUCCESS or FAILED.
Hangup() application - hang up the calling channel.
Implementing a IVR using menu structure
The following is an example for an IVR system. You dial any number in the range 01-9 and you enter the IVR system. First there is checking if it is business hours and if you are, you will be send in the ivr-lang context, after that you will get the greeting message and during the message you can press a key from one to three to choose your language. According the number you pressed, you will be directed to the right extension (context).
For your IVR configuration you will need first to record some sound messages.
You can record your own sound files using the Asterisk. For this purpose you should add an extension for the recording in the extensions.conf file. In our example, you can dial the extension 100, after the beep you can start recording your message.
To end the recording press "#". The message is recorded in .gsm format and is called recording.gsm in the /var/lib/asterisk/sounds directory. Asterisk plays back the message after you pressed "#"(after 2 seconds).
exten => 100,1,Wait(2)
exten => 100,n,Record(/var/lib/asterisk/sounds/recording:gsm)
exten => 100,n,NoOp(${RECORDED_FILE})
exten => 100,n,Wait(2)
exten => 100,n,Playback(/var/lib/asterisk/sounds/recording)
exten => 100,n,NoOp(${PLAYBACKSTATUS})
exten => 100,n,Wait(1)
exten => 100,n,Hangup()
Here we are using Wait(), Record(), Playback() and Hangup() applications. You can see their descriptions by typing "core show application <application>" in Asterisk 1.4, or use "show application <application> (this will be removed in future).
Let's make more clearness:
Wait(2) - waits 2 seconds, then the dialplan continues to the next priority. The 2 seconds are to be sure that the channel is up and ready for recording.
Record(file:gsm) - records from the channel into a file with format gsm. This application sets a channel variable named RECORDED_FILE, which contains the name of recorded filename.
You can use NoOp() application to see what contains the RECORDED_FILE variable.
exten => s,n,NoOp(${RECORDED_FILE})
Playback() application - plays the recording file. This application sets the following channel variable - PLAYBACKSTATUS. The result is SUCCESS or FAILED.
Hangup() application - hang up the calling channel.
Implementing a IVR using menu structure
The following is an example for an IVR system. You dial any number in the range 01-9 and you enter the IVR system. First there is checking if it is business hours and if you are, you will be send in the ivr-lang context, after that you will get the greeting message and during the message you can press a key from one to three to choose your language. According the number you pressed, you will be directed to the right extension (context).
[incoming]
exten => _0[1-9].,1,GotoIfTime(9:00-18:00|mon-fri|*|*?ivr-lang,s,1)
exten => _0[1-9].,n,GotoIfTime(10:00-17:00|sat|*|*?ivr-lang,s,1)
exten => _0[1-9].,n,Playback(closed)
exten => _0[1-9].,n,Playback(closed)
exten => _0[1-9]. ...