Hello, good morning, I'm working with Asterisk v 1.4 and AGI, in the AGI file I'm working with Perl where I have the following code:
#!/usr/bin/perl
use DBI;
use POSIX;
use Asterisk::AGI;
$valor = 8;
%MYSQL = (
hostname => "localhost",
username => "root",
password => "xxx",
database => "xxx"
);
my $dbh = DBI->connect("dbi:mysql:$MYSQL{database}:$MYSQL{hostname}","$MYSQL{username}","$MYSQL{password}")or die("No se hiso la conexion!\n");
my $get_rows = "SELECT calldate from cdr limit 1";
my $rows_r = $dbh->prepare($get_rows);
$rows_r->execute();
$dbh->disconnect;
my $AGI = new Asterisk::AGI;
$AGI->set_variable("result", $valor);
I execute it and it does not mark any error and it returns me the 8, until here all good
In the Asterisk I have the following code where I command to call that AGI file:
exten => 0444423117XX,1,AGI(limit_ldi.agi)
exten => 0444423117XX,2,NoOp(${result})
exten => 0444423117XX,3,Set(GLOBAL(Count_Min)=${result})
exten => 0444423117XX,4,GotoIf($[${Count_Min} > 10 ]?203)
exten => 0444423117XX,5,Macro(dialldicve_time|SIP/TRK-4421612608|${EXTEN}|${CONTEXT})
exten => 0444423117XX,203,NoOp(NO HAY SALDO)
exten => 0444423117XX,204,Set(DIALSTATUS=CHANUNAVAIL)
And I think that I am going to get the value 8 of AGI in Asterisk, it sends me the following error and I do not get the 8, it is empty when the result is printed in NoOp.
AGI Script limit_ldi.agi completed, returning 0
-- Executing [0444423117XXX@prodar:2] NoOp("SIP/prodar-171-00000109", "") in new stack
-- Executing [0444423117XXX@prodar:3] Set("SIP/prodar-171-00000109", "GLOBAL(Count_Min)=") in new stack
== Setting global variable 'Count_Min' to ''
I hope you can support me.
Thanks