I am little new to Asterisk AGI. I am using perl with asterisk agi.
I need to design an IVR solution using Perl asterisk agi.
I have write a little code and it is executing fine.
Perl Code:-
#!/usr/bin/perl -w
use strict;
use warnings;
use Asterisk::AGI;
my $agi = new Asterisk::AGI;
my $option1 = "";
my $option2 = "";
$agi->exec("Read","option1,recording-201503252343,1,,,");
$option2 = $agi->get_variable("$option1");
$agi->exec("NoOp","$option1");
if($option2 == 1)
{
$agi->exec("Playback","hello-world");
$agi->exec("Goto","English,s,1");
}
Asterisk Dialplan:-
exten => 12345,1,Answer()
exten => 12345,2,AGI(agi_new-new.pl)
exten => 12345,n,NoOP(${AGISTATUS})
exten => 12345,n,Hangup()
Actually what i did in the code is that i want a user to dial the extension lead by the IVR in which 2 options are prompted and he has to choose between 2 options when he/she enter the options i want to store that digit into a variable so that i use condition on that variable. I use get_variable to get the variable but when i press the desired option it gets that dtmf input but it is not storing in the variable via the command get_variable.
please i need little help on this.
if anyone could help it will be highly appreciated.
"$option"is the same'' . $option- maybe you want'$option'instead? Single quotes don't interpolate. - choroba