CDR Reports Not Working

Hello All,

I am currently running Asterisk on Freepbx running on CentOS.

Everything is working fine except there are no results returned when searching for CDR Reports (or anything under the “Reports” Panel!)

Any ideas guys?

Are you sure the system is logging the calls to the mysql database?

If you know the mysql usercode and password, then you could check this as follows:

mysql -u asterisk -p

use asteriskcdrdb;

select COUNT(*) from cdr;


For example:
mysql> select COUNT() from cdr;
) |
| 42633 |
1 row in set (0.00 sec)

Hey thanks for the reply.

Using that command returns

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘mysql> select COUNT(*) from cdr’ at line 1

Am i using the syntax incorrectly?

Ah sorry, forgot to type first command :slight_smile:

It would seem not, the command returned

mysql> select count() from cdr;
| count(
) |
| 0 |
1 row in set (0.00 sec)

How can i solve this?

I did modules show like mysql and it returns 0 modules loaded, i’ve also completed yum install asterisk16 for the latest addons updates but still no joy…

You have to have the matching Asterisk add ons package.

The cdr_mysql module must be loaded:

localhost*CLI> module show like mysql Module Description Use Count MySQL RealTime Configuration Driver 0 Simple Mysql Interface 0 MySQL CDR Backend 0

localhost*CLI> cdr mysql status Connected to asteriskcdrdb on socket file default using table cdr for 18 days, 6 hours, 8 minutes, 52 seconds. Wrote 33544 records since last restart. localhost*CLI>

Lastly you have to have the CDR module configured to conect to your database.

[root@localhost asterisk]# cat cdr_mysql.conf ; ; Note - if the database server is hosted on the same machine as the ; asterisk server, you can achieve a local Unix socket connection by ; setting hostname = localhost ; ; port and sock are both optional parameters. If hostname is specified ; and is not "localhost", then cdr_mysql will attempt to connect to the ; port specified or use the default port. If hostname is not specified ; or if hostname is "localhost", then cdr_mysql will attempt to connect ; to the socket file specified by sock or otherwise use the default socket ; file. ; [global] hostname = localhost dbname=asteriskcdrdb password = amp109 user = asteriskuser userfield=1 ;port=3306 ;sock=/tmp/mysql.sock loguniqueid=yes [root@localhost asterisk]#

Thanks for that very useful post :slight_smile: installed the correct addons, restarted and tested OK!

Thanks !

If you want to import all the CDR’s you missed into your mysql database, there is a great php script here:

Ah, so Asterisk was logging them the whole time?

That’s great. Thank you pretief.