0
votes

I am trying to pass a variable from the Asterisk Dialplan to a perl script using the AGI. I am now to this and am very confused at to how exactly this works. Right now in my dialplan I have this:

exten=>1122,1,Answer
exten=>1122,n,Read(digit)
exten=>1122,n,agi(/home/steve/Desktop/testperlping.pl,${digit})
exten=>1122,n,Hangup()

I want a user to dial the extension 1122, then enter a number from 1-10, and have the number they entered passed into perl using the AGI.

My perl script is as follows:

#!/usr/bin/perl -w
$|=1;

use Net::Ping;
use Asterisk::AGI;

$AGI = new Asterisk::AGI;

my %input = $AGI->ReadParse();

***I think I need something here***

$AGI->verbose("$numbertheytypedintophone"); #This will display the entered number back to the CLI.

Any help would be greatly appreciated.

1
my ($digit) = @ARGV;?ikegami
that doesn't seem to helpCheesegraterr
try looking for setvariable or similar method in your perl AGI api, see wiki.asterisk.org/wiki/display/AST/AGICommand_set+variablenumber5

1 Answers

-1
votes

I am using Asterisk::FastAGI(which is recomended for perl integration) and code looks like this:

my $dst = $self->param('dst');

For Asterisk::AGI it have be(i just read AGI.pm source):

my $digits=$input{'arg_1'};

I higly recomend you read source code of module if you have any issues, will be MUCH faster.