I’m trying to get odbc working and connected to MySQL for cdr using asterisk 1.8.3.2 and I get no errors and no cdr logging. Can anyone help with this?
I get this output from odbc show:
[code]*CLI> odbc show
ODBC DSN Settings
phreaknasty*CLI>[/code]
and this output from cdr show status:
[code]*CLI> cdr show status
Call Detail Record (CDR) settings
Logging: Enabled
Mode: Simple
Log unanswered calls: No
-
Registered Backends
cdr-custom
csv
cdr_sqlite3_custom
Adaptive ODBC
phreaknasty*CLI>[/code]
and this output from echo “select 1” | isql -v asterisk-connector:
[root]# echo "select 1" | isql -v asterisk-connector
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> +---------------------+
| 1 |
+---------------------+
| 1 |
+---------------------+
SQLRowCount returns 1
1 rows fetched
SQL> [root]#
I have edited these files and restarted asterisk:
/etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc3.so
Setup = /usr/lib/libodbcmyS.so
FileUsage = 1
/etc/odbc.ini
[asterisk-connector]
Description = MySQL connection to 'asterisk' database
Driver = MySQL
Database = asterisk
Server = localhost
User = asterisk
Password = ****
Port = 3306
Socket = /var/lib/mysql/mysql.sock
/etc/asterisk/modules.conf
preload => res_odbc.so
preload => res_config_odbc.so
/etc/asterisk/res_odbc.conf
[asterisk]
enabled => yes
dsn => asterisk-connector
username => asterisk
password => ****
pre-connect => yes
limit => 0
pooling => no
/etc/asterisk/cdr_adaptive_odbc.conf
[first]
connection=asterisk
table=cdr
and I have created a mysql database, user, and table as follows:
[code]CREATE USER ‘asterisk’@‘localhost’ IDENTIFIED BY '***’;
CREATE DATABASE asterisk;
GRANT ALL PRIVILEGES ON asterisk. TO ‘asterisk’@‘localhost’;
FLUSH PRIVILEGES;
CREATE TABLE cdr (
calldate datetime NOT NULL default ‘0000-00-00 00:00:00’,
clid varchar(80) NOT NULL default ‘’,
src varchar(80) NOT NULL default ‘’,
dst varchar(80) NOT NULL default ‘’,
dcontext varchar(80) NOT NULL default ‘’,
channel varchar(80) NOT NULL default ‘’,
dstchannel varchar(80) NOT NULL default ‘’,
lastapp varchar(80) NOT NULL default ‘’,
lastdata varchar(80) NOT NULL default ‘’,
duration int(11) NOT NULL default ‘0’,
billsec int(11) NOT NULL default ‘0’,
disposition varchar(45) NOT NULL default ‘’,
amaflags int(11) NOT NULL default ‘0’,
accountcode varchar(20) NOT NULL default ‘’,
uniqueid varchar(32) NOT NULL default ‘’,
userfield varchar(255) NOT NULL default ‘’
);[/code]