Hi,
I’m having a problem with the CDRs not being written into the database lately. They have never worked, but I think I’m rather close to fix this. I was hoping someone can help understanding what the problem is. I’m running Asterisk 16 and FreePBX 15 on Debian.
I can connect to database with mysql and the below configured user fine. I cannot somehow make connection between asterisk and database and I get this error
– Reloading module ‘res_odbc.so’ (ODBC resource)
[2019-01-22 16:20:24] WARNING[7978]: res_odbc.c:941 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
[2019-01-22 16:20:24] NOTICE[7978]: res_odbc.c:596 load_odbc_config: Registered ODBC class ‘asteriskcdrdb’ dsn->[MySQL-asteriskcdrdb]
[2019-01-22 16:20:24] NOTICE[7978]: res_odbc.c:488 load_odbc_config: Adding ENV var: ODBCSYSINI=/etc
[2019-01-22 16:20:24] NOTICE[7978]: res_odbc.c:488 load_odbc_config: Adding ENV var: ODBCINI=/etc/odbc.ini
– Reloading module ‘extconfig’ (Configuration)
– Reloading module ‘res_config_odbc.so’ (Realtime ODBC configuration)
– Reloading module ‘cdr’ (CDR Engine)
[2019-01-22 16:20:24] NOTICE[7978]: cdr.c:4485 cdr_toggle_runtime_options: CDR simple logging enabled.
– Reloading module ‘cdr_adaptive_odbc.so’ (Adaptive ODBC CDR backend)
[2019-01-22 16:20:24] WARNING[7978]: res_odbc.c:941 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
[2019-01-22 16:20:24] WARNING[7978]: cdr_adaptive_odbc.c:136 load_config: No such connection ‘asteriskcdrdb’ in the ‘asteriskcdrdb’ section of cdr_adaptive_odbc.conf. Check res_odbc.conf.
<odbc.ini>
[asteriskcdrdb]
Description=MySQL connection to ‘asteriskcdrdb’ database
#driver=MySQL
driver=/usr/lib/x86_64-linux-gnu/libmysqlclient.so
server=localhost
database=asteriskcdrdb
Port=3306
Socket=/var/run/mysqld/mysql.sock
option=3
Charset=utf8
Trace=Yes
username=cdruser
password=password
<odbcinst.ini>
[MySQL]
Description = ODBC for MySQL
Driver64 = /usr/lib/x86_64-linux-gnu/libodbc.so
Setup64 = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
#Driver64 = /usr/lib64/libmyodbc5.so
#Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1
Pooling = Yes
CPTimeout = 120
<res_odbc.conf>
#include res_odbc_custom.conf
#include res_odbc_additional.conf
[ENV]
ODBCSYSINI => /etc
ODBCINI => /etc/odbc.ini
<res_odbc_additional.conf>
[asteriskcdrdb]
enabled=>yes
dsn=>MySQL-asteriskcdrdb
pre-connect=>yes
max_connections=>5
username=>cdruser
password=>password
database=>asteriskcdrdb
Now I think that error tries to tell me I don’t have Data Source configured in the odbc.ini, but I don’t know how to configure it. I’ve found this somewhere else, but I’m struggling to see what should I use for Asterisk
[ODBC Data Sources]
MapR Drill 32-bit=MapR Drill ODBC Driver 32-bit
MapR Drill 64-bit=MapR Drill ODBC Driver 64-bit
Secondly, even isql is giving me error.
isql -v asteriskcdrdb cdruser password
[IM004][unixODBC][Driver Manager]Driver’s SQLAllocHandle on SQL_HANDLE_HENV failed
[ISQL]ERROR: Could not SQLConnect
Does anyone please know how to configure Data Source in odbc configuration and how can I perhaps make changes to the configuration in FreePBX GUI (as I cannot make changes to the res_odbc.conf in shell) so I can proceed? I’m out of ideas.
Thank you,
Kind regards,