Richard Reina
2006-Mar-01 11:54 UTC
[Asterisk-Users] perl AGI won't run from extensions.conf
Dear Asterisk Nation, I am attempting to write a perl AGI script that will give the caller status of a P.O. When I run the script directly (by hand) it executes. I know this because it leaves data in TEST.txt. However, when I try to execute it via extensions.conf the CLI says it executes returning 0, but it does not dump data into TEST.txt. Can anyone help me determine why? extensions.conf (snippet) exten => 830,1,Read(Contno,enterpono,6,s) exten => 830,2,Wait(1.2) exten => 830,3,SatDigits(${Contno:0:6}) exten => 830,4,AGI(AP_info.agi|${Contno}) PO_info.agi #!/usr/bin/perl use Asterisk::AGI->new(); my ($contno) = $ARGV[0]; open (TEST, ">>/home/richard/TEST.txt") or die "Can't open" print TEST "CONTNO " . $contno . "\n"; close (TEST); use DBI; my $dbh = DBI->connect("DBI:mysql:database=accounting;192.168.0.1",$user,$pass); my $q = "SELECT amount, INV_RCVD, CHK_CUT, CHK_NO FROM payable p WHERE contno = ?"; my $sth = $dbh->prepare($q); $sth->execute($contno); my ($amount, $rcvd, $cut, $cno) = $sth->fetchrow_array; if ($cno > 1) { $agi->exec('SayDigits', $amount); return $amount, $rcvd, $cut, $cno; } elsif ($rcvd > 1) { $agi->exec('SayDigits', $amount); return $amount, $rcvd; } __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060301/eea61cac/attachment.htm