I’ve been having hard time to understand the CDR reports from FreePBX. There were a lot of duplicates, lots of couple of second connection entries, etc… All I needed is to set a criteria and see the reports related to that criteria.
So here is how it goes:
- I need only ANSWERED calls.
- I need only calls longer than 30 seconds.
- I need last 24 hours and also last month call reports.
- I want the script to be able to run on cron whenever I want to, so the output should be purely “emailable”
- At the end of the report I need the total talk time.
So I came up with this perl script. If you need similar stuff, please don’t hesitate to use it.
Here is a little howto:
First you need to edit the script to fit your database settings, it’s pretty self explanatory in the script itself.
- cdrreports -d gives you the daily report (or the last 24 hours to be more precise)
- cdrreports -m gives you the monthly report (or the last 30 days to be more precise)
- if you run cdrreports without any arguments, it will give you all the calls you made so far.
Lastly, the way I use this script is by running from two cronjobs. One at night for the last 24 hours, and one every 1st day of the month for the monthly reports. It’s up to you how to use it 😉