Asterisk CDR setup
cdr_adaptive_odbc
Debian 9 Stretch
Asterisk 13.14.1 from debian repo.
MariaDB 10.3.7 from MariaaDB repo.
/etc/odbcinst.ini
[mariadb]
Description=MariaDB Connector/ODBC v.2.0
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage=1
UsageCount=2
/etc/odbc.ini
[asteriskcdr-odbc]
Description=ODBC for Asterisk CDR
Driver=mariadb
#
Database={asterisk_db}
Server=127.0.0.1
User={db_login_asterisk}
Password={db_password_asterisk}
PORT=3306
option=3
/etc/asterisk/res_odbc.conf
Проверка:
Troubleshooting:
Trouble1: Can't open lib '/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so' : file not found
$ isql -v asteriskcdr-odbc asterisk passwordasterisk
[01000][unixODBC][Driver Manager]Can't open lib '/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so' : file not found
[ISQL]ERROR: Could not SQLConnect
# mariadb-connector-odbc-3.0.3-ga-debian-x86_64
$ ldd libmaodbc.so
linux-vdso.so.1 (0x00007fff15bc7000)
libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007fea2cb5d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fea2c859000)
libssl.so.1.0.0 => not found
libcrypto.so.1.0.0 => not found
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fea2c4ba000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007fea2c2b0000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fea2c093000)
/lib64/ld-linux-x86-64.so.2 (0x00007fea2d01f000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fea2be8f000)
Solution: download and install version 2.0.* : https://downloads.mariadb.com/Connectors/odbc/
# mariadb-connector-odbc-2.0.16-ga-debian-x86_64
$ ldd libmaodbc.so
linux-vdso.so.1 (0x00007ffcf47ca000)
libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007f5b72683000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5b7237f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5b71fe0000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f5b71dd6000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5b71bb9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5b72b43000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5b719b5000)
Result:
$ isql -v asteriskcdr-odbc asterisk passwordasterisk
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
Connection problems testing
odbc show
ODBC DSN Settings
-----------------
Name: asterisk
DSN: asteriskcdr-odbc
Last connection attempt: 2066-10-21 05:00:18
Number of active connections: 0 (out of 1)
cdr show status
Call Detail Record (CDR) settings
----------------------------------
Logging: Enabled
Mode: Simple
Log unanswered calls: No
Log congestion: No
* Registered Backends
-------------------
cdr-custom
csv
cdr_manager (suspended)
Adaptive ODBC
module reload cdr_adaptive_odbc.so
Module 'cdr_adaptive_odbc.so' reloaded successfully.
-- Reloading module 'cdr_adaptive_odbc.so' (Adaptive ODBC CDR backend)
== Parsing '/etc/asterisk/cdr_adaptive_odbc.conf': Found
WARNING[22096]: res_odbc.c:958 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=1045 [unixODBC][ma-2.0.18]Access denied for user 'asterisk'@'localhost' (using password: YES)
WARNING[22096]: cdr_adaptive_odbc.c:135 load_config: No such connection 'asterisk' in the 'cdr_adaptive_connection' section of cdr_adaptive_odbc.conf. Check res_odbc.conf.
Fields aliases
/etc/asterisk/cdr_adaptive_odbc.conf