The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Asterisk::CDR - Perl extension for accessing Asterisk CDRs stored in a database as objects


 use Asterisk::CDR;
                        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 (


Jason Bodnar, <>


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.