MySQL-asterisk


#1

Hello friends

to store the cdrs in mysql table, i used unixodbc and MyODBC , it’s kind of working and registers the dsn, i am using the instructions given on

voip-info.org/tiki-index.php … k+cdr+odbc

voip-info.org/tiki-index.php … +cdr+mysql

i get this message when running asterisk with debug switch it registerd the databse handle sucessfully

NOTICE[22807]: res_odbc.c:133 load_odbc_config: registered database handle ‘mysql1’ dsn->[MySQL-asterisk]
NOTICE[22807]: res_odbc.c:133 load_odbc_config: registered database handle ‘mysql2’ dsn->[MySQL-asterisk]
NOTICE[22807]: res_odbc.c:415 load_module: res_odbc loaded.
[res_config_odbc.so] => (ODBC Configuration)
NOTICE[22807]: config.c:888 ast_config_register: Registered Config Engine odbc
NOTICE[22807]: res_config_odbc.c:190 load_module: res_config_odbc loaded.


but i aslo get the following error later at the end


cdr_odbc.so] => (ODBC CDR Backend)
NOTICE[25255]: cdr_odbc.c:289 odbc_load_module: cdr_odbc: Logging uniqueid
– cdr_odbc: dsn is MySQL-asterisk
– cdr_odbc: username is user
– cdr_odbc: password is [secret]
> cdr_odbc: Error SQLConnect -1
ERROR[25255]: cdr_odbc.c:307 odbc_load_module: cdr_odbc: Unable to connect to datasource: MySQL-asterisk
– cdr_odbc: Unable to connect to datasource: MySQL-asterisk

nevertheless in the mysql cdr table the cdr’s are getting stored properly, but i wonder why i am still getting the above error

any advice would be appreciated

Diyanat


#2

ODBC won’t be needed whatsoever for cdr/mysql. Shut down everything ODBC and simply configure cdr_mysql.conf. Once you have imported the table structure into table ‘cdr’ and configured an ‘asterisk’@‘localhost’ grant table for mysql(DB), you simply fire up asterisk with a valid cdr_mysql.conf and it will work. Resist the temptation to use ‘root’ at all costs. ODBC is only necessary when native solutions are not available. If you’re on a linux host with both the asterisk and mysql daemons on the same box, simply use mysql.sock and all is well. Linux hosts will pretty much always default to named pipe even if specified (host: localhost) via IP, so feel free to keep the IP portion pointing to localhost as well.

Caveat: hostname=127.0.0.1 does work on asterisk =<1.0.9 production, however, it does not work on 1.2.0beta1 and probably everything beyond. Move to hostname=localhost if you hadn’t already.

cdr parameters can be massaged via cdr.conf as well. Unless you’re running a production enterprise exchange, batch=no, scheduleronly=yes and safeshutdown=yes is a good set of options. If you ARE running a busy server, move to batch callinfo processing.

HTH
Jayson