Asterisk 1.8 cdr-adaptive mysql

5.6k views Asked by At

i'm having a little problem. I'm using Debian and I got asterisk 1.8 and I want to use CDR along with mysql. In Asterisk 1.8 you apparently gotta use cdr-adaptive module instead of the regular. That is just what I did. Now I have 1 error when I "module reload cdr_adaptive_odbc.so" and I can't solve it :

WARNING[23172]: cdr_adaptive_odbc.c:123 load_config: No such connection 'MySQL-asterisk' in the 'adaptive-connection' section of cdr_adaptive_odbc.conf.  Check res_odbc.conf.

Now here are all the files related, I can't understand what is wrong :

/etc/odbc.ini :

[MySQL]
Description = MySQL ODBC MyODBC Driver
Driver = /usr/lib/libmyodbc3.so
FileUsage = 1

[Text]
Description = ODBC for Text Files
Driver = /usr/lib/libodbctxt.so
Setup = /usr/lib/libodbctxtS.so
FileUsage = 1
CPTimeout =
CPReuse =

[PostgreSQL]
Description = PostgreSQL driver for Linux & Win32
Driver = /usr/lib/libodbcpsql.so
Setup = /usr/lib/libodbcpsqlS.so
FileUsage = 1

[DB2]
Description = DB2 Driver
Driver = /opt/IBM/db2/V8.1/lib64/libdb2.so
FileUsage = 1
DontDLClose = 1
DMEnvAttr = SQL_ATTR_UNIXODBC_ENVATTR={DB2INSTANCE=db2inst1}

[MySQL-asterisk]
Description = MySQL asterisk database
Driver = MySQL
Socket = /var/run/mysqld/mysqld.sock
Server = localhost
User = root
Password = XXXXX
Database = ics
Option = 3

/etc/asterisk/cdr_adaptive_odbc.conf :

[adaptive-connection]
connection = MySQL-asterisk
table = cdr
alias start => calldate

/etc/asterisk/res_odbc.conf :

[Asterisk]
enabled => yes
dsn => MySQL-asterisk
username => root
password => XXX
;pooling => no
;limit => 0
pre-connect => yes

This is what I get when i check the cdd status :

Call Detail Record (CDR) settings
----------------------------------
  Logging:                    Enabled
  Mode:                       Simple
  Log unanswered calls:       No

* Registered Backends
  -------------------
    Adaptive ODBC
    cdr-custom
    ODBC
    csv
    radius
    res_config_sqlite

And this is what I get when i check de odcb

ODBC DSN Settings
-----------------

  Name:   Asterisk
  DSN:    MySQL-asterisk

I can't figure out what's wrong. Anyone has an idea ?

1

There are 1 answers

1
chris On

I assume you've fixed this now. I ran into a similar issue and the problem stemmed from the documentation. It refers to connection= in cdr_adaptive_odbc.conf being the DSN name. It's the name you want and not the DSN. So in your case:

connection = Asterisk

then at the command line do a

CLI> module reload cdr_adaptive_odbc.so

and you should see a screenfull as Asterisk finds the tables and does any mappings you have specified.