[Asterisk-Users] PERL AGI DIALSTATUS
Paul Tinsley
pdt at jackhammer.org
Mon Dec 19 23:29:55 MST 2005
While his if statement will never do what he expects (check for the
value "ANSWER" in $dialstatus) it should work when the call is answered
as an assignment in an if statement will pretty much always return
true... and he isn't overwriting a variable he uses in his execute....
so the thing should work in that case.
What you mean for your code to say is this:
$AGI->exec('Dial', $dialext);
my $dialstatus = $AGI->get_variable("DIALSTATUS");
if($dialstatus eq "ANSWER") {
$Accounting_update->execute($fdatetime,$Cuniq,$UserName,$CalledN);
}
But like I am saying above, that won't fix your problem, without your
other code there is no way to really diagnose the problem. The only
other thing I notice from the blurb is that you have a capital A in
accounting where every other variable you reference other than $AGI is
in lowercase. Are you using strict to make sure you are referencing
variables that exist? You can do that by adding the following line to
the top of your script:
use strict;
you might also try changing the execute line to say:
$Accounting_update->execute($fdatetime,$Cuniq,$UserName,$CalledN) or
print STDERR "update failed!";
So that you would know if it failed....
Furqan wrote:
> Hi Code Lover,
>
> Please try this code :
>
> if ($dialstatus eq
> "ANSWER"){$Accounting_update->execute($fdatetime,$Cuniq,$UserName,$CalledN);}
>
>
> I hope it will solve your problem. We use "eq" instead of "=" in perl
> or cgi for strings.
>
> Thanks
>
> Furqan Ahmed
> Software Engineer
> B.E. (Computer System), DBA
> Super Technologies Inc., Pensacola, Florida
>
> Http://www.SuperTec.com - Tommrow's Technology, Today.
> Http://www.SuperTec.com/solutions/ - VOIP Billing Solutions.
> Http://www.AsteriskSupport.com - Premium Asterisk Support &
> Development Services.
>
> ----- Original Message ----- From: "Code Lover" <lateef.np at gmail.com>
> To: <asterisk-users at lists.digium.com>
> Sent: Sunday, December 18, 2005 2:13 AM
> Subject: [Asterisk-Users] PERL AGI DIALSTATUS
>
>
> Hi all,
>
> I wanted to execute one of mySQL query when the call is answered i
> tried with the following code but it dones not seems to work.
>
> $AGI->exec('Dial', $dialext);
>
> my $dialstatus = $AGI->get_variable("DIALSTATUS");
> if($dialstatus="ANSWER"){$Accounting_update->execute($fdatetime,$Cuniq,$UserName,$CalledN);}
>
>
> It is not updating my query when the call is successfull answered, and
> i checked my query from outside using perl commond it is working well
> without any issue.
>
>
>
>
> --
> Thank You,
> Code Lover
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list