Asterisk::CDR - Perl extension for accessing Asterisk CDRs stored in a database as objects
use Asterisk::CDR; Asterisk::CDR->init_db( dsn => 'dbi:mysql:database', username => 'username', password => 'password' ); my @cdrs = Asterisk::CDR->search(userfield => 'some data');
Asterisk::CDR is a Perl module for accessing Asterisk CDRs stored in a dabatase as objects. It inherits all but one of its useful methods from Class::DBI.
Database information is supplied as a list to the init_db() class method. A DBI data source string, username and password must be supplied. By default, Asterisk::CDR will use cdr as the table and the standard columns expected by Asterisk's cdr_odbc module. Both the table name and the columns can be overriden by specifiying them when calling init_db():
use Asterisk::CDR; Asterisk::CDR->init_db ( dsn => 'dbi:mysql:database', username => 'username', password => 'password', table => 'my_cdrs', columns => \@my_columns );
After init_db() is called, Class::DBI methods may be called to retrieve CDRs as objects:
my @cdrs = Asterisk::CDR->retrieve(src => '5555551212'); # Retrieve CDRs originating from 555-555-1212
Class::DBI, Asterisk cdr odbc (http://www.voip-info.org/wiki/view/Asterisk+cdr+odbc)
Jason Bodnar, <jbodnar@gnumber.com>
Copyright (C) 2006 by Jason Bodnar, gNumber, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
To install Asterisk::CDR, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Asterisk::CDR
CPAN shell
perl -MCPAN -e shell install Asterisk::CDR
For more information on module installation, please visit the detailed CPAN module installation guide.