No CDR. Asterisk 10 still not recognizing MySQL module!

I know this problem has been brought up already on maybe a dozen different threads, but none of them end in a solution, or the solution didn’t work for me (such as re-installing free PBX), or the poster said “nevermind, fixed it” or something to that extent.

PROBLEM: No CDR reports


1- I get a MySQL OK on FreePBX admin panel

2- Confirmed MySQL is installed, and I can get to the MySQL command line

3- Reinstalled Asterisk, upgraded from Asterisk 1.8 to Asterisk 10. Reinstalled Asterisk 10

4- at no point has Asterisk ever recognized a MySQL module…

*CLI> module show like sql
Module Description Use Count
0 modules loaded

I thought upgrading Asterisk from 1.8 to 10 would fix it, but it didn’t! I’m thinking there’s something I have to CHOWN to Asterisk, which has been the solution to many of my previous ‘known issues’. Thanks in advance for any help you can give!

mysql is not built by default from the asterisk codebase. You will need to makemenuselect and add the deprecated mysql lines in add-ons for asterisk 1.8 and above before you configure/set it up.

You need to setup the cdr-mysql stuff.

Great… those are exactly the kind of answers I was looking for, but how do you do that?!


If I do…

#mysql> DESCRIBE cdr;

I get…
ERROR 1046 (3D000): No database selected

The freepbx installation did create the file “/etc/asterisk/cdr_mysql.conf”

It says that for precisely the reason that you have not selected that (or any database) , the cdr table is in actual fact the only table in that database, just “use” it first.

You will either need to understand mysql better or perhaps in your case rely on the prepackaged FreePBX iso images that require less thinking. In general although limited to a particular philosophy, those iso images actually work.

I am using the system… no CDR’s logging

I am using the system… no CDR’s logging

That answer makes no sense to me, sorry. Obviously you are using “the system”, but do you know “what system” if you use the same "system"as the one you imported, then magically your mysql cdr records will start working. If you want to, start a new “system” that works, it is just that simple. As I suggested before, why not just use the FreePBX iso and stop worrying about thinking.

Sorry, what did you mean by “just use it first”?

The CDR problem seems to be a common one… is there no solution?

A common necessity in mysql is to “use” a dabase before one can operate on it. The syntax is, in your case

use asteriskcdrdb;

This is about as basic a mysql statement as is posssible, did you care to read any FM’s yet? it will be on either page one or latest page two!

And, No this is not a common problem at all, if you build asterisk with mysql cdr support it just works in FreePBX, if you read the documentation, it will explain what you need to do. There is no confusion there. maybe try for a very basic explanation about how it all works.

Ok… got the source of the problem FIXED, but now CDR’s still aren’t working (I probably broke something when I was troubleshooting)

I’m quite sure the MySQL was working in Asterisk 1.6, but had broke when I upgraded Asterisk from 1.6 to 1.8, and I never fixed it. The issue first appeared in 1.8 and was never fixed in Asterisk 10.

Had to edit the following line in /usr/src/asterisk/asterisk-10.9.0/menuselect/Makefile… then recompile Asterisk 10

C_LIBS +=$(NCURSES_LIB) -ltinfo

This problem was described here:


*>module show like mysql

Module Description Use Count Simple Mysql Interface 0 MySQL CDR Backend 0 MySQL RealTime Configuration Driver 0
3 modules loaded


will help.