Sunday, January 4, 2009

Enable the CDR viewer of AsteriskNow GUI

CDR stands for Call Data Records. By default, Asterisk 1.4 generates CDR records in comma-separated text files in the /var/log/asterisk/cdr-csv directory. The file Master.csv contains all records. I have the following in the file /etc/asterisk/cdr.conf
[csv]
usegmtime=no ; log date/time in GMT. Default is "no"
loguniqueid=no ; log uniqueid. Default is "no"
loguserfield=no ; log user field. Default is "no"

In the file /var/lib/asterisk/static-http/config/cdr.html there's a statement to load the csv file for viewing the CDRs in web browser: ASTGUI.loadHTML("./Master.csv"). However, it fails since it couldn't find the file Master.csv in the folder /var/lib/asterisk/static-http/config. What I did is to create a symbolic link in this folder by the following command
ln -s /var/log/asterisk/cdr-csv/Master.csv
and the CDR viewer started working in AsteriskNow GUI (after Showing Advanced Options) .

Edit the file /etc/logrotate.d/asterisk to roate the CDRs monthly:
/var/log/asterisk/cdr-csv/*csv {
monthly
missingok
rotate 6
compress
delaycompress
}

2 comments:

Vlad said...

It looks like the CDRs are now kept in MySQL in AsteriskNOW 1.5 with FreePBX 2.5. And there is no CDR browsing interface available yet, at least I failed to locate it...

PIII said...

Hi Vlad, there should be tons of web interfaces available for browsing the content of a MySQL database or you can write your own in PHP without much efforts. The last option is to edit /etc/asterisk/cdr.conf to generate the CDRs in other formats.