Voice menu openIVR
A system for design of interactive voice menu.
Use: Asterisk v 1.4 and above, Perl, Postgresql
User creates ivr-file with rules of the voice menu. The file consists of blocks, each block contains a set of commands.Transfer rules are defined by command 'press'. For example:
press (
1 => menu1,
2 => menu2,
# => Repeat,
);
In this example, you can go to [menu1] block by pressing "1" DTMF and to [menu2] block by by pressing "2" DTMF button. You can repeat current block by pressing the "#" DTMF button. You can execute the press command without arguments to "reset" transfer table.
Command 'play' needs for playback audiofiles. For examples:
play ('ru/happy_ny_2010');
play (file => 'sample', repeat => 3, pause => 2);
The parameters are: file name, number of repeats, pause in second between repeats.
Command 'agi' needs for executing agi script. For example: agi ('name_script.agi')
Use command 'set' to set the variable for agi-script. For example: set (foo = bar).
To set random value from list, use command 'random'. The list of values that will be randomly selected are separated by comma. For example: random (foo_rnd = value1, value2, value3)
Use 'goto' command to transfer to anower block. For example: goto (block_name). To return to the previous block, use 'return' command.
To set pause in seconds, use 'pause' command.
For dial number, use 'dial' command. For example: dial (SIP/1003).
To go to a specific extension of Asterisk, use 'call' command. Example: call (incoming_calls, s, 2). IVR program exits after the transfer.
'hangup' command is used to break the current connection.
It is possible to check for errors after ivr rules are written. There are three types of errors and two types of alerts:
ERROR: No data or main menu block in 'file'
ERROR: block 'block' has dublicates
ERROR: Link to unknown block
WARNING: Unknown command in line 'line'
WARNING: Unknown key in line 'line'
Ivr isn't accepted if there is errors, but it's ok if there is warnings only.
All information about caller and his actions are stored in database.
Example of using in Asterisk:
[Ivr-main]
exten => s, 1, agi (openivr.pl, main); main - the name of the file ivr-
exten => s, n, Hangup ()
exten => h, 1, DeadAGI (openivr.pl)
Example ivr-file:
[Main_menu]
play ('ru/happy_ny_2010'); // remove this after 01/15/10
press (
1 => weather, // go to "weather" block if one was pressed
2 => time, // go to "time" block if 2 was pressed
# => Repeat, // repeating if isnt "repeat" block
0 => main_menu, // repeating too
);
play (
file => 'audio-content/index', // file to play
repeat => 3, // count of playing
pause => 2, // pause in sec between plays
);
press; // nothing to press
play ('ru / sorry_you_havent_chose');
hangup;
// Run agi time
[Time]
press (# => repeat, 0 => return);
agi ('time.agi');
pause (2);
return ();
// Run agi weather
[Weather]
press (# => repeat, 0 => return, 1 => _set.voice1, 2 => _set.voice2, 3 => _set.random_voice);
agi ('weather.agi');
play (file => 'ru / return_or_change_voice', repeat => 3, pause => 2);
return;
// Set of voice variables
[_set.voice1]
set (voice = v1); return;
[_set.voice2]
set (voice = v2); return;
[_set.random_voice]
random (voice = v1, v2); return;