Asterisk mysql - cdr

Hi,

I am working on the connection of mysql and asterisk for the CDR. Below are my config.

cdr_mysql.conf

[global]
hostname=localhost
dbname=asteriskcdrdb
password=password
user=asteriskcdruser
port=3306
sock=/var/lib/mysql/mysql.sock

modules.conf

[modules]
load => cdr_addon_mysql.so

i already created the database and tables and grant all insert priviledges to asteriskcdruser.

But i am getting the error below.

Connected to Asterisk 1.4.33.1 currently running on Astertest (pid = 2620)
Verbosity is at least 3
AstertestCLI> cdr mysql status
Not currently connected to a MySQL server.
Astertest
CLI>

Can someone help me on this issue?

Thanks

Try with:

Astertest*CLI> module unload cdr_addon_mysql.so
Astertest*CLI> module load cdr_addon_mysql.so

And tell us the error.
Or put Verbose and Debug to higher level, in logger.conf uncomment “full” and see in /var/log/asterisk/full

Thanks so much, its now working.

Is it possible for me to dump the cdr on a separate database? not on local host? If so, do you have the procedure?

AstertestCLI> module unload cdr_addon_mysql.so
== Unregistered ‘mysql’ CDR backend
Astertest
CLI> module load cdr
cdr_csv.so cdr_custom.so cdr_manager.so cdr_odbc.so
cdr_addon_mysql.so
AstertestCLI> module load cdr_addon_mysql.so
== Parsing ‘/etc/asterisk/cdr_mysql.conf’: Found
Loaded cdr_addon_mysql.so => (MySQL CDR Backend)
Astertest
CLI> cdr mysql status
Connected to asterisk@localhost, port 3306 using table cdr for 12 seconds.
Wrote 0 records since last restart.
Astertest*CLI>

Hi fmpalmos!

In cdr_mysql.conf change the hostname of the machine that holds the database.

[global] hostname=hostname_of_db_computer dbname=asteriskcdrdb password=password user=asteriskcdruser port=3306 sock=/var/lib/mysql/mysql.sock
That should do it!

everything is working now. many thanks.