Central CDR Collection

Dear All,

I a two-location SOHO situation, I did recently install two FreePBX instances based on the distro. Things are working well after dealing with various trunk issues.

What I would like to achieve is a central mysql database containing the CDRs from both locations. To get there, I went by the Asterisk The Definitive Guide 4th Edition book chapter 16 to configure ODBC. In a separate server, I set up a mysql database (table definition below) and tested all connection issues.

To my surprise, while the central database does accumulate all CDRs, the calldate field is always the default (i.e. zeroes in the defined structure). All other fields do work. On the freepbx VMs, the calldate field is always filled adequately. I did not define an index. All machines are set to the same system locale.

Admittedly, I am not a great mysql expert, so stupid mistakes are somewhat likely. However just one field not recording is a surprise to me.

Could someone please point me to the right direction?

Regards,

Michael

CREATE TABLE cdr (
calldate datetime NOT NULL default ‘0000-00-00 00:00:00’,
clid varchar(80) NOT NULL default ‘’,
src varchar(80) NOT NULL default ‘’,
dst varchar(80) NOT NULL default ‘’,
dcontext varchar(80) NOT NULL default ‘’,
channel varchar(80) NOT NULL default ‘’,
dstchannel varchar(80) NOT NULL default ‘’,
lastapp varchar(80) NOT NULL default ‘’,
lastdata varchar(80) NOT NULL default ‘’,
duration int(11) NOT NULL default ‘0’,
billsec int(11) NOT NULL default ‘0’,
disposition varchar(45) NOT NULL default ‘’,
amaflags int(11) NOT NULL default ‘0’,
accountcode varchar(20) NOT NULL default ‘’,
uniqueid varchar(32) NOT NULL default ‘’,
userfield varchar(255) NOT NULL default ‘’,
peeraccount varchar(20) NOT NULL default ‘’,
linkedid varchar(32) NOT NULL default ‘’,
sequence int(11) NOT NULL default ‘0’
);

Dear All,

The cause was that the file cdr_adaptive_odbc.conf in /etc/asterisk has to contain the line:

alias start => calldate

Otherwise, the first column calldate is missing - for a reason which is not obvious. The Asterisk The Definitive Guide 4th Edition book chapter 16 page 460 lacks just that line, unfortunately.

Regards,

Michael