[Asterisk-Users] Timing out issue whenusing AGI

kurt x kurtwp at gmail.com
Tue Jul 19 13:51:49 MST 2005


I have the below script that works but for one problem.  The call
cannot last longer then 4 minutes when the script is utilized. 
However, when I configure my extension.conf to not call the script the
call will stay up until I hang-up.

I call the script as follows:

exten => _24XX,1,AGI(internal.agi|${EXTEN})
exten => _24XX,2,hangup

A brief description of the script is that it allows my asterisk server
to route calls to two different PBXs.
It does not matter which PBX the call is sent to, it will always
hang-up after 4 minutes when using the script.

Any suggestions on what might cause this.

Kurt 

#!/usr/bin/perl -w

use warnings;

use Asterisk::AGI;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse();

$AGI-answer();  #I tested with this command pounded and not pounded out.
my $val = $ARGV[0];

open(IN, "/var/lib/asterisk/agi-bin/cme_db") or die "$!";

my $ext = 0;

print STDERR "$val\n";
while (<IN>) {
  chomp;
     $ext = $_;
#     print STDERR "$ext\n";
  if ($ext == $val) {
     $AGI->exec('Dial',"SIP/$ext".'@cme-pbx');
     close(IN);
     goto EXIT;
    }
} # end while loop
close(IN);
open(IN, "/var/lib/asterisk/agi-bin/nortel_db") or die "$!";

while (<IN>) {
  chomp;
     $ext = $_;
#     print STDERR "$ext\n";
  if ($ext == $val) {
     $AGI->exec('Dial',"SIP/1555123$ext".'@nortel');
     close(IN);
     goto EXIT;
    }
} # end while loop
close(IN);
$rc = $AGI->exec('Dial',"SIP/$val".'|15|t');
if ($rc == 0) {
   $AGI->exec('Voicemail',"u$val");
   goto EXIT;
}   
EXIT: print STDERR "Exiting Script\n";



More information about the asterisk-users mailing list