[asterisk-dev] RE : Re: Problem with asterisk 1.4.13 and AGI variables
MELARGA COULIBALY
melargacoulibaly at yahoo.fr
Mon Dec 3 05:29:03 CST 2007
Thanks for your reply.
I think i'll write a daemon program to manage cdr using AMI cdr events as you advise.
But do you now if there is a perl class witch make easier to do that.
Thanks in advance,
Godson Gera <godson.g at gmail.com> a écrit :
I wrote an AGI programme that dials extensions and after i read variables like " ANSWEREDTIME" "DIALSTATUS"
my problem is : if the callee hangup, i can capture the variables but if the caller hangup, it is impossible to get the variables. this is my code in perl
$callstart=localdate(time);
$AGI->set_callerid("$trunk{'cliname'}<$trunk{'cliname'}>");
$dialstr = $trunk{'strcon'}.$phoneno.'@'.$trunk{'outboundname'}.'|30|L('.($maxmins * 60 * 1000) . ":60000)";
$res = $AGI->exec("DIAL $dialstr");
$answeredtime = $AGI->get_variable("ANSWEREDTIME");
$dialstatus = $AGI->get_variable("DIALSTATUS");
That behavior is normal as asterisk closes the connection to your AGI script when caller hangsup. A quick hack is, you can use DeadAGI application in your dial plan to invoke your AGI script then you'll be able read those variables, even if the caller hangs up. But then your script must be quick to hang up the channel, once you read those variables. However this is not recommended as it has its side effects like if your scripts fails to hangup the channel it will still be considered as up by asterisk.
The safe way is reading the CDR events using AMI, to get accurate billable seconds.
http://www.voip-info.org/wiki/view/Asterisk+cdr+manager
HTH
--
Godson Gera,
http://godson.in _______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
---------------------------------
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20071203/3eb50092/attachment.htm
More information about the asterisk-dev
mailing list