Faisal,<div><br></div><div>What you should actually do is implement xml_curl to a web server and parse the cdrs there. The just create a page where you can see all the date and run a cron job periodically to calculate whether you need to send an alert or not. This way you will have a historic asr and acd for your traffic.</div>

<div><br></div><div>maybe you can have a look at <a href="http://wiki.freeswitch.org/wiki/Billing#FreeSWITCH_Viking">http://wiki.freeswitch.org/wiki/Billing#FreeSWITCH_Viking</a> where it points you the git and you can take and use only what you need to have your reports...</div>

<div><br></div><div>Hope it helps</div><div><br></div><div>David<br><br><div class="gmail_quote">On Fri, Oct 28, 2011 at 6:14 PM, Abdul Basit <span dir="ltr">&lt;<a href="mailto:basit.engg@gmail.com">basit.engg@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>For asterisk, ASR and ACD is as follows: (just addition) billsec is 14th field </div><div><br></div><div>cat /var/log/asterisk/cdr-csv/Master.csv | sed &quot;s/\\\&quot;//g&quot; | awk &#39;{ FS=&quot;,&quot;; }{ if($14&gt;0){ CONN=CONN+1; BSEC=BSEC+$14} TOTAL=TOTAL+1; }END{ print &quot;CONNECT: &quot;CONN; print &quot;TOTAL: &quot; TOTAL; ASR=(CONN/TOTAL)*100; print &quot;ASR: &quot;ASR; print &quot;BILLSEC: &quot;BSEC; print &quot;ACD: &quot;BSEC/CONN; if(ASR&lt;100){ system(&quot;echo send email&quot;);} }&#39;  </div>



<div><br></div><div>here is the result</div><div><br></div><div>CONNECT: 1573542</div><div>TOTAL: 1584174</div><div>ASR: 99.3289</div><div>BILLSEC: 448223564</div><div>ACD: 284.85</div><div>send email</div><div><br></div>

<font color="#888888">

<div><br></div><div>-- <br><div>Regards,</div><br>Abdul Basit | <a href="tel:%2B92%2032%201416%204196" value="+923214164196" target="_blank">+92 32 1416 4196</a> | <a href="tel:%2B92%2030%200841%201445" value="+923008411445" target="_blank">+92 30 0841 1445</a></div>

</font><div><div></div><div class="h5"><br><div class="gmail_quote">On Fri, Oct 28, 2011 at 8:33 PM, Michael Collins <span dir="ltr">&lt;<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Basic awk scripting. The $9 means &quot;ninth field&quot; and $14 means &quot;14th&quot; field. Those are the respective locations of the &quot;billsec&quot; field in the FS and Asterisk Master.csv files.<div>



<br></div><div><font color="#888888">
-MC</font><div><div></div><div><br><br><div class="gmail_quote">On Fri, Oct 28, 2011 at 12:47 AM, Faisal Rehman <span dir="ltr">&lt;<a href="mailto:faisal.rehman22@hotmail.com" target="_blank">faisal.rehman22@hotmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div><div dir="ltr">
Hi Micheal,<div><br></div><div>What would be the difference between $14 and $9, will you please a little explain?</div><div><br></div><div><br></div><div>Thanks</div><div><br></div><div>Faisal Rehman</div><div><br><div><hr>




Date: Thu, 27 Oct 2011 08:40:12 -0700<br>From: <a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a><div><div></div><div><br>To: <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>




Subject: Re: [Freeswitch-users] Script for ASR &amp; ACD Monitoring<br><br><br><br><div>On Thu, Oct 27, 2011 at 1:02 AM, Faisal Rehman <span dir="ltr">&lt;<a href="mailto:faisal.rehman22@hotmail.com" target="_blank">faisal.rehman22@hotmail.com</a>&gt;</span> wrote:<br>




<blockquote style="border-left:1px #ccc solid;padding-left:1ex">




<div><div dir="ltr">
Hi David,<div><br></div><div>Thanks for sharing the script but will that work too for Asterisk&#39;s Master.csv if I needed the ASR &amp; ACD records from that file?</div></div></div></blockquote><div><br></div><div>Use $14 (instead of $9) for Asterisk&#39;s Master.csv file.</div>





<div>-MC</div><div> </div><blockquote style="border-left:1px #ccc solid;padding-left:1ex"><div><div dir="ltr"><div><br></div><div><br></div><div>Regards,</div><div><br></div><div>Faisal Rehman<br>
<br><div><hr>From: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a><br>Date: Wed, 26 Oct 2011 19:48:57 +0200<br>To: <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>





Subject: Re: [Freeswitch-users] Script for ASR &amp; ACD Monitoring<br><br>Hello,<div><br></div><div>That&#39;s a faily simple bash script. </div><div><br></div><div>&quot;cat&quot; the log file to an awk script like so;</div>





<div><br></div><div>cat /usr/local/freeswitch/log/cdr-csv/Master.csv | sed &quot;s/\\\&quot;//g&quot; | awk &#39;{ FS=&quot;,&quot;; }{ if($9&gt;0){ CONN=CONN+1; } TOTAL=TOTAL+1; }END{ print &quot;CONNECT: &quot;CONN; print &quot;TOTAL: &quot; TOTAL; ASR=(CONN/TOTAL)*100; print &quot;ASR: &quot;ASR; if(ASR&lt;100){ system(&quot;echo send email&quot;);} }&#39; </div>







<div><br></div><div>the &quot;system&quot; is where you put the mail command</div><div><br></div><div>also, bear in mind that the master can get VERY large if you don&#39;t rotate it.</div><div><br></div><div>david<br><br>







<div>On Wed, Oct 26, 2011 at 1:59 PM, Faisal Rehman <span dir="ltr">&lt;<a href="mailto:faisal.rehman22@hotmail.com" target="_blank">faisal.rehman22@hotmail.com</a>&gt;</span> wrote:<br><blockquote style="border-left:1px #ccc solid;padding-left:1ex">











<div><div dir="ltr">
<b>Hi Waseem,</b><div><br></div><div>Thanks for your help, I saw the scripts that were on the link that you provided to me but actually the problem is that I don&#39;t want to involve the database though it is a bit difficult task but according to my requirement I just want to read the whole Master.csv file &amp; if the ASR or ACD is low on any server, it should send me email, so my question is how can I skip the database from it to interact directly with the Master.csv file.</div>







<div><br></div><div><br></div><div>Thanks in Advance!!</div><div><br></div><div><b>Faisal Rehman<br></b><br><div><hr>From: <a href="mailto:wasim@convergence.pk" target="_blank">wasim@convergence.pk</a><br>Date: Tue, 25 Oct 2011 07:32:35 +0500<br>







To: <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>Subject: Re: [Freeswitch-users] Script for ASR &amp; ACD Monitoring<div><div></div><div><br>

<br><div dir="ltr">Faisal:<div><br></div><div>Load up the CDR into a db (MySQL or otherwise) ...</div><div><br></div><div>For ACD you&#39;ll want a SQL query akin</div><div><ul><li>SELECT COUNT(*) AS calls_answered, SUM(billusec) AS billusec, SUM(billusec)/COUNT(*) AS acd FROM freeswitchdb.freeswitchcdr WHERE disposition=1;</li>









</ul></div><div>For ASR you&#39;ll need another query</div><div><ul><li>SELECT COUNT(*) AS calls_total FROM freeswitchdb.freeswitchcdr;</li><li>ASR is calls_answered/calls_total</li></ul><div>There is sample (read: poor) code in <a href="http://jira.freeswitch.org/browse/FS-1981" target="_blank">http://jira.freeswitch.org/browse/FS-1981</a></div>









</div><div>which a google for &quot;freeswitch ACD ASR&quot; would have helped you get to in the first place.</div><div><br></div><div>-wasim</div><div><br><div>On Mon, Oct 24, 2011 at 15:39, Faisal Rehman <span dir="ltr">&lt;<a href="mailto:faisal.rehman22@hotmail.com" target="_blank">faisal.rehman22@hotmail.com</a>&gt;</span> wrote:<br>









<blockquote style="border-left:1px #ccc solid;padding-left:1ex">



<div><div dir="ltr">
Hi Everyone,<div><br></div><div>I want to write a script that reads the Master.csv &amp; generate an alert if the ASR &amp; ACD is low from the desired value. Anybody has written such script, please help me write it or provide any sample.</div>









<div><br></div><div><br></div><div>Thanks</div><div><br></div><font color="#888888"><div><br></div><div>Faisal Rehman</div>                                               </font></div></div>
<br><br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>wasim h. baig | principal consultant | convergence pk | <a>+92 30 0850 8070</a> | peace be upon you ...<br>


</div></div>
<br>FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></div></div></div></div>                                               </div></div>
<br><br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>
<br>FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></div></div>                                               </div></div>
<br><br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>
<br>FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></div></div></div></div>                                               </div></div>
<br><br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div></div></div>
<br><br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div>
</div></div><br><br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>