<div>Thanks for your reply.</div> <div>I think i'll write a daemon program to manage cdr using AMI cdr events as you advise.</div> <div>But do you now if there is a perl class witch make easier to do that.</div> <div>Thanks in advance,</div> <div> </div> <div><B><I>Godson Gera <godson.g@gmail.com></I></B> a écrit :</div> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR><BR> <DIV class=gmail_quote> <BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><BR> <DIV>I wrote an AGI programme that dials extensions and after i read variables like " <B>ANSWEREDTIME" "DIALSTATUS"</B></DIV> <DIV>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</DIV> <DIV> </DIV><FONT size=1> <DIV>$callstart=localdate(time);</DIV>
<DIV> </DIV></FONT> <DIV><FONT size=1>$AGI->set_callerid("$trunk{'cliname'}<$trunk{'cliname'}>");</FONT></DIV> <DIV><FONT size=1></FONT> </DIV> <DIV><FONT size=1>$dialstr = $trunk{'strcon'}.$phoneno.'@'.$trunk{'outboundname'}.'|30|L('.($maxmins * 60 * 1000) . ":60000)";</FONT></DIV> <DIV><FONT size=1></FONT> </DIV> <DIV><FONT size=1>$res = $AGI->exec("DIAL $dialstr");</FONT></DIV> <DIV><FONT size=1></FONT> </DIV> <DIV><FONT size=1>$answeredtime = $AGI->get_variable("ANSWEREDTIME"); </FONT></DIV> <DIV><FONT size=1></FONT> </DIV> <DIV><FONT size=1>$dialstatus = $AGI->get_variable("DIALSTATUS");</FONT></DIV> <DIV><FONT size=1></FONT> </DIV></BLOCKQUOTE></DIV>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. <BR><BR>The safe way is reading the CDR events using AMI, to get accurate billable seconds. <BR><BR><A href="http://www.voip-info.org/wiki/view/Asterisk+cdr+manager">http://www.voip-info.org/wiki/view/Asterisk+cdr+manager </A><BR><BR clear=all>HTH<BR>-- <BR>Godson Gera,<BR><A href="http://godson.in/">http://godson.in</A> _______________________________________________<BR>--Bandwidth and Colocation Provided by http://www.api-digital.com--<BR><BR>asterisk-dev mailing list<BR>To UNSUBSCRIBE or update options visit:<BR>http://lists.digium.com/mailman/listinfo/asterisk-dev</BLOCKQUOTE><BR><p> 
<hr size="1">
Ne gardez plus qu'une seule adresse mail ! <a href="http://fr.rd.yahoo.com/mail/mail_taglines/trueswitch/*http://www.trueswitch.com/yahoo-fr/">Copiez vos mails</a> vers Yahoo! Mail