<div><FONT size=1>Please Godson,</FONT></div> <div><FONT size=1></FONT> </div> <div><FONT size=1>As you advise, i write a perl script to handle cdr events but after hours, it seems to stop. But if i type the commande manager show connected on the CLI i seem my process manager user account.</FONT></div> <div><FONT size=1>So i dont know what wrong. this is the main part of my perl script :</FONT></div> <div><FONT size=1>//######### start of the script #################</FONT></div> <div><FONT size=1>// * Note that i have asterisk 1.4.13 installed on my box</FONT></div> <div><FONT size=1>//*</FONT></div> <div><FONT size=1>&daemonize($path_daemon);</FONT></div> <div><FONT size=1>&load_config();</FONT></div> <div><FONT size=1>$dbh=&connect_db($dbip,$dataname,$datauser,$passcode);</FONT></div> <div><FONT size=1>if (!$dbh) {</FONT></div> <div><FONT size=1>$MSG="Database is unavailable. Try later.";</FONT></div> <div><FONT
size=1>myinfo($MSG);</FONT></div> <div><FONT size=1>} </FONT></div> <div><FONT size=1>$timestamp = localdate(time);</FONT></div> <div><FONT size=1>appendfile($LOG, "$timestamp [SERVICE MAGICRATE STARTED AND FORKED]\n");</FONT></div> <div><FONT size=1>while(1){ </FONT></div> <div><FONT size=1># test if program is disconnected from manager, reconnect to it</FONT></div> <div><FONT size=1>if ($astman==undef) {</FONT></div> <div><FONT size=1>$MSG="magicrate-server disconnected to manager, trying to reconnect...";</FONT></div> <div><FONT size=1>$astman->connect || myinfo($MSG.$astman->error);</FONT></div> <div><FONT size=1>}</FONT></div> <div><FONT size=1></FONT> </div> <div><FONT size=1>#Handle manager events</FONT></div> <div><FONT size=1></FONT> </div> <div><FONT size=1></FONT></div> <div><FONT size=1>%data=$astman->handleevent;</FONT></div> <div><FONT size=1># if two channels are linked, i-e a live call is answered</FONT></div> <div><FONT
size=1>if ($data{'Event'} eq 'Link')</FONT></div> <div><FONT size=1>{</FONT></div> <div><FONT size=1>}</FONT></div> <div><FONT size=1># if two channels are unlinked, i-e a live call is hangup ( event occur before final hangup)</FONT></div> <div><FONT size=1>if ($data{'Event'} eq 'Unlink')</FONT></div> <div><FONT size=1>{</FONT></div> <div><FONT size=1>}</FONT></div> <div><FONT size=1># Peer status register/unregister</FONT></div> <div><FONT size=1>if ($data{'Event'} eq 'PeerStatus')</FONT></div> <div><FONT size=1>{</FONT></div> <div><FONT size=1>}</FONT></div> <div><FONT size=1># Cdr Event </FONT></div> <div><FONT size=1>if ($data{'Event'} eq 'Cdr')</FONT></div> <div><FONT size=1>{</FONT></div> <div><FONT size=1>if (!$dbh) {</FONT></div> <div><FONT size=1>$MSG="magicbill database not available, reconnecting...";</FONT></div> <div><FONT size=1>myinfo($MSG);</FONT></div> <div><FONT
size=1>$dbh=&connect_db($dbip,$dataname,$datauser,$passcode);</FONT></div> <div><FONT size=1>} else { </FONT></div> <div><FONT size=1>$number=&trim($data{'Destination'});</FONT></div> <div><FONT size=1>$callerid=&trim($data{'AccountCode'});</FONT></div> <div><FONT size=1>$answeredtime=$data{'BillableSeconds'};</FONT></div> <div><FONT size=1>$callstart=&trim($data{'StartTime'});</FONT></div> <div><FONT size=1>$dialstatus=&trim($data{'Disposition'});</FONT></div> <div><FONT size=1>$number=substr($number,2,length($number)-2) if (substr($number,0,2) eq '00');</FONT></div> <div><FONT size=1>$phoneno=$number;</FONT></div> <div><FONT size=1>$trunk{outboundname}=&trim($data{'DestinationChannel'});</FONT></div> <div><FONT size=1>&ret_srv();</FONT></div> <div><FONT size=1>%acc=&acc_data();</FONT></div> <div><FONT size=1>&getrates();</FONT></div> <div><FONT size=1>&calccost();</FONT></div> <div><FONT
size=1>&savedata();</FONT></div> <div><FONT size=1>&savecdr();</FONT></div> <div><FONT size=1>&setinuse(0);appendfile($LOG, "$callstart : New Cdr receive\n");</FONT></div> <div><FONT size=1>}</FONT></div> <div><FONT size=1>}</FONT></div> <div><FONT size=1></FONT></div> <div><FONT size=1>} </FONT></div> <div><FONT size=1></FONT> </div> <div><FONT size=1>//#######" End##########//</FONT></div> <div><FONT size=1></FONT> </div> <div><FONT size=1>Thanks for your replies,</FONT></div> <div><FONT size=1>Melarga</FONT></div><p> 
<hr size="1">
<a href="http://fr.rd.yahoo.com/mail/mail_taglines/gmail/*http://fr.docs.yahoo.com/mail/overview/index.html">Yahoo! Mail</a> : un mail innovant avec Messenger compatible Windows Live + stockage illimité.