Please Help? Been trying to get a simple Asterisk to AGI script to work. Tried various scripts. Ended up using the AGI script from the Hitchhiker’s Guide to Asterisk. See below. No matter what combination
I put in I still get just the channel variables printing out. I can never get any of the AGI functions to work???
Using Asterisk 1.4 and Perl version 5.10.0
Please help. Really bewildered. thanks very much Sandy 508-289-2899
#!/usr/bin/perl -w
use strict;
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse(); #Read in the initial data
$AGI->stream_file('the-number-is');
$AGI->say_digits($input{callerid});
$AGI->exec('WaitMusicOnHold','2');
$AGI->hangup();
I ran the aphone.agi script from the commmand line and get a path error:
./aphone.agi
Can’t locate Asterisk/AGI.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at ./aphone.agi line 4.
BEGIN failed–compilation aborted at ./aphone.agi line 4.
Loaded AGI.pm module .09. Now getting the messages below when running the script in shell.
cleopatra:/var/lib/asterisk/agi-bin# .\phone.agi
bash: .phone.agi: command not found
cleopatra:/var/lib/asterisk/agi-bin# ./aphone.agi
Global symbol “$AGI” requires explicit package name at ./aphone.agi line 6.
Global symbol “$AGI” requires explicit package name at ./aphone.agi line 7.
Global symbol “$AGI” requires explicit package name at ./aphone.agi line 9.
Global symbol “$AGI” requires explicit package name at ./aphone.agi line 10.
Global symbol “$AGI” requires explicit package name at ./aphone.agi line 11.
Global symbol “$AGI” requires explicit package name at ./aphone.agi line 12.
Execution of ./aphone.agi aborted due to compilation errors.
Thank you so much David55 for your help yesterday. Loaded AGI.pm agi perl interface and declared $AGI with the my $AGI, everything works like a champ. thanks for taking the time. Sammy