Cdr_csv and cdr_custom


Where can I find the default mapping for cdr_csv reporting(which columns/fields are selected to generate the Master.csv)? Or would anyone happen to know the names of the columns that are selected from asteriskcdrdb to generate the Master.csv under /var/log/asterisk/cdr-csv? I just migrated from vanilla asterisk 13 to freePBX 16. On my vanilla asterisk system there is a script that generates a report using the CDR stats logged to Master.csv. It looks like the schema on the new system has changed and does not log stats in the same way to Master.csv.

On my freepbx system, I’m unable to generate a report with the “default” mapping, I had to create cdr_custom.conf and add the mapping there to get a Master.csv created. When I check the modules registered to the cdr backend I see cdr-custom but not cdr_csv. I can see that the cdr_csv module is running. If I knew what the column IDs on the asterisk 13 system I could recreate the report but from what I can tell the machine only has sqlite3 installed and doesn’t list and DBs or tables that I could look at to compare.

I don’t understand why there should have been a change, but cdr-csv data never goes through a database, and has a fixed format, as documented at

The code that constructs the record, and in which you can see the field names from the cdr data structure starts at

As you can see at, for example,

some fields are optional. These are controlled by the obvious options in the [csv] section of cdr.conf (FreePBX may well require you to actually use a custom file, included from this.

Start with good old

There can be several cdr ‘backends’ , but mostly FreePBXers rely on the built in ‘Adaptive ODBC’

A ‘goldie but oldie’ showing the default format of Master.csv

\Asterisk call data records in comma-separated text files

but if you want a ‘customize’ csv also, then you will need a /etc/asterisk/cdr.conf which ‘includes’ something like:-

asterisk/cdr_custom.conf at master · asterisk/asterisk · GitHub, take it from there.

Found the root cause of the report breaking. Since we’re using PJSIP on the new freePBX system, channel and dstchannel are logged as PJSIP/XXXX instead of SIP/XXXX which was throwing off the anticipated string length for out scripted report generator. A full reboot fixed the default logging to /cdr-csv/Master.csv, and the mapping is in fact the same between both old and new systems. Thanks @david55 and @dicko for the information, I learned quite a bit and it helped narrow down the issue.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.