Customized MySQL CDR

I have updated my cdr_custom.conf file so that my CDR has a new field CDR(dnis).

I have confirmed that the /var/log/asterisk/cdr-custom/Master.csv file is correctly recording this new field.

My problem is that MySQL is not storing data in the new field. How do I do this?

PS - please don’t respond saying that I should use accountcode or userfield. I use these for something else.


You will need to dig into the source code, or just write direct to the cdr database.


Hi hff135,

I remember that I experienced some headache over a similar matter a while ago. I did however find an alternative named: CDR Yada. It writes directly to the database and support custom table cells, oh and it also has a fail over function (write to file) in case it loses connection to the database.

And you simply set fields you want to store with:

CDR Yada will store the value in ${MONITORFILE} to the cell named: monitorfile and ${username} to cell: userfield.

I hope that this can work as an alternative in case you don’t find any other solution.

Is there any way to do it without getting into the source code? I was thinking that there would be a config file somewhere that allowed me to define the MySQL query.

Even better, I was hoping that Asterisk would magically be able to construct the MySQL query from the cdr_custom.conf file.

Hi The query is in the source AFAIK I had to edit it to get the userfielt to be written correctly to the database recently


Precisely what I was seeking to do. I too thought modifying cdr_custom.conf (and making the necessary changes to the database table) would get me a custom MySQL CDR database. Sigh. Anyone knows better of MySQL CDR?

Thanks afudali for pointing out cdr_yada. Will have to try that out.

Haven’t tried out cdr_adaptive_odbc yet, seems to be one of the preferred choices.