In a number of earlier blog entries, I developed and posted a Perl script named ciscowatcher.pl. The script attaches to a Linux based Syslog service and listens for Cisco device generated syslog messages.
One of the messages listened for is the %VOIPAAA-5-VOIP_CALL_HISTORY message generated by H.323 voice gateways. The script generates two Postgresql database files. One is a raw data file called calllog, which contains call-leg information, one call-leg is a voip leg and the other leg is a PSTN leg. With those two legs, one can determine the calling party and the called party. The script generates the database table called cdr from these two pieces of information.
This information is useful for Cisco Telephone Solutions based upon Cisco Unified Callmanager Express Systems, which do not have a real Call Detail Record capability.
Even for organizations with Cisco's Callmanager Solution, getting Call Detail Records can be a problem sometimes because of the way the SQL service is authenticated.
To tie the bow on this situation, I've added a Perl script called sendcdr.pl. It takes the information form the cdr table, formats it, and writes it out as an Excel spreadsheet file using the Spreadsheet::WriteExcel Perl Module from CPAN. The Spreadsheet module is surprisingly powerful in that it can provide bolded and centered column headers as well as properly formatted date/time stamps.
Once the spreadsheet file is generated, it is then emailed using the Mail::Sender Perl Module, also from CPAN.
By placing the script into a cron job entry, call details records can be automatically emailed on a regular basis. The only thing missing is a utility to purge call detail records once they have been emitted. That will be a subject for my next revision.