It is possible to obtain Cisco Callmanager Call Detail Records through Perl. However, there are a few prepatory steps to make it work.
Because Cisco recommends that Callmanager not be a member of a domain, it isn't possible to use flow through authentication to
access the SQL Database server when on a host other than Callmanager. Cisco therefore suggests that SQL Authentication be
changed to 'Mixed Mode'. This can be accomplished by starting sQL Enterprise Manager on the Callmanager Server containing the
CDRs (there should only be one server in the cluster with CDR responsibilites), right click on the server name and select
properties, select the security tab, and choose 'SQL Server and Windows' for authentication. Callmanager will need to be
restarted.
To connect to the database tables, one could code the sa username and password into the queries, but that probably isn't a
very good thing. Instead, I'd suggest creating a new login, call it cdr_reader, and assign it to the CDR database with public
and db_owner roles.
Perl DBD drivers for Sybase can be used for connecting to the SQL 2000 database tables in Callmanager 3.3 and 4.X. For those
who aren't using Debian, steps outlined at
Linux Journal
and FreeTDS: Tabular Data Stream.
For Debian users, obtaining the package is as simple as running 'apt-get install libdbd-sybase-perl' from unstable or testing.
As of the time of this writing, I don't think Stable has the most recent and appropriate version.
I then modified the example from a
Perl HowTo slightly to give
it a try:
#!/usr/bin/perl
#-- open database
use DBI;
my $dbh = DBI->connect('DBI:Sybase:server=10.10.10.10','cdr_reader','password') or die $DBI::errstr;
$dbh->do("use CDR");
#-- sample query
my $rows = $dbh->selectrow_array("SELECT COUNT(*) FROM CallDetailRecord");
print "CDR has $rows records\n" if ( defined $rows );
That turned out to be quite straightforward. I'll publish another article with some perl queries and summaries I've used.