Faisal, 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. maybe you can have a look at http://wiki.freeswitch.org/wiki/Billing#FreeSWITCH_Viking where it points you the git and you can take and use only what you need to have your reports... Hope it helps David On Fri, Oct 28, 2011 at 6:14 PM, Abdul Basit <basit.engg@gmail.com> wrote:
For asterisk, ASR and ACD is as follows: (just addition) billsec is 14th field
cat /var/log/asterisk/cdr-csv/Master.csv | sed "s/\\\"//g" | awk '{ FS=","; }{ if($14>0){ CONN=CONN+1; BSEC=BSEC+$14} TOTAL=TOTAL+1; }END{ print "CONNECT: "CONN; print "TOTAL: " TOTAL; ASR=(CONN/TOTAL)*100; print "ASR: "ASR; print "BILLSEC: "BSEC; print "ACD: "BSEC/CONN; if(ASR<100){ system("echo send email");} }'
here is the result
CONNECT: 1573542 TOTAL: 1584174 ASR: 99.3289 BILLSEC: 448223564 ACD: 284.85 send email
-- Regards,
Abdul Basit | +92 32 1416 4196 | +92 30 0841 1445
On Fri, Oct 28, 2011 at 8:33 PM, Michael Collins <msc@freeswitch.org>wrote:
Basic awk scripting. The $9 means "ninth field" and $14 means "14th" field. Those are the respective locations of the "billsec" field in the FS and Asterisk Master.csv files.
-MC
On Fri, Oct 28, 2011 at 12:47 AM, Faisal Rehman < faisal.rehman22@hotmail.com> wrote:
Hi Micheal,
What would be the difference between $14 and $9, will you please a little explain?
Thanks
Faisal Rehman
------------------------------ Date: Thu, 27 Oct 2011 08:40:12 -0700 From: msc@freeswitch.org
To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Script for ASR & ACD Monitoring
On Thu, Oct 27, 2011 at 1:02 AM, Faisal Rehman < faisal.rehman22@hotmail.com> wrote:
Hi David,
Thanks for sharing the script but will that work too for Asterisk's Master.csv if I needed the ASR & ACD records from that file?
Use $14 (instead of $9) for Asterisk's Master.csv file. -MC
Regards,
Faisal Rehman
------------------------------ From: david.villasmil.work@gmail.com Date: Wed, 26 Oct 2011 19:48:57 +0200 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Script for ASR & ACD Monitoring
Hello,
That's a faily simple bash script.
"cat" the log file to an awk script like so;
cat /usr/local/freeswitch/log/cdr-csv/Master.csv | sed "s/\\\"//g" | awk '{ FS=","; }{ if($9>0){ CONN=CONN+1; } TOTAL=TOTAL+1; }END{ print "CONNECT: "CONN; print "TOTAL: " TOTAL; ASR=(CONN/TOTAL)*100; print "ASR: "ASR; if(ASR<100){ system("echo send email");} }'
the "system" is where you put the mail command
also, bear in mind that the master can get VERY large if you don't rotate it.
david
On Wed, Oct 26, 2011 at 1:59 PM, Faisal Rehman < faisal.rehman22@hotmail.com> wrote:
*Hi Waseem,*
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'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 & 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.
Thanks in Advance!!
*Faisal Rehman * ------------------------------ From: wasim@convergence.pk Date: Tue, 25 Oct 2011 07:32:35 +0500 To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Script for ASR & ACD Monitoring
Faisal:
Load up the CDR into a db (MySQL or otherwise) ...
For ACD you'll want a SQL query akin
- SELECT COUNT(*) AS calls_answered, SUM(billusec) AS billusec, SUM(billusec)/COUNT(*) AS acd FROM freeswitchdb.freeswitchcdr WHERE disposition=1;
For ASR you'll need another query
- SELECT COUNT(*) AS calls_total FROM freeswitchdb.freeswitchcdr; - ASR is calls_answered/calls_total
There is sample (read: poor) code in http://jira.freeswitch.org/browse/FS-1981 which a google for "freeswitch ACD ASR" would have helped you get to in the first place.
-wasim
On Mon, Oct 24, 2011 at 15:39, Faisal Rehman < faisal.rehman22@hotmail.com> wrote:
Hi Everyone,
I want to write a script that reads the Master.csv & generate an alert if the ASR & ACD is low from the desired value. Anybody has written such script, please help me write it or provide any sample.
Thanks
Faisal Rehman
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- wasim h. baig | principal consultant | convergence pk | +92 30 0850 8070| peace be upon you ...
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-usersUNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-usersUNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-usersUNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org