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();
XXXXX ASTERISK CLI OUTPUT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
– Executing [1@MainExt-lists:6] AGI(“SIP/1002-00000050”, “aphone.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/aphone.agi
AGI Tx >> agi_request: aphone.agi
AGI Tx >> agi_channel: SIP/1002-00000050
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1310058231.80
AGI Tx >> agi_callerid: 1002
AGI Tx >> agi_calleridname: sammyt2
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 1001
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: MainExt-lists
AGI Tx >> agi_extension: 1
AGI Tx >> agi_priority: 6
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
– AGI Script aphone.agi completed, returning 0
You are probably trying to run non-root. Or you simply didn’t set the execute bit.
I am running in root mode # su
but execute bit ??? Sorry for my ignorance, don’t know what it is or where?
The file is executable -rwxr-xr-x 1 root root 270 2011-07-07 13:03 aphone.agi
If that is what you mean. thanks
That should be OK. Next try running it from the shell prompt, to see if it actually starts properly.
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.
not found …
there seems to be no AGI perl module on my devel machine. Is this necessary?
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