Asterisk (FreePBX) CEL enable ODBC
Ищем библиотеки
find / -name 'lib*odbc*.so' <spoiler|Ubuntu ODBC>
find / -name 'lib*odbc*.so' /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so /usr/lib/x86_64-linux-gnu/odbc/libodbcminiS.so /usr/lib/x86_64-linux-gnu/odbc/libodbcdrvcfg2S.so /usr/lib/x86_64-linux-gnu/odbc/liboraodbcS.so /usr/lib/x86_64-linux-gnu/odbc/libodbcnnS.so /usr/lib/x86_64-linux-gnu/odbc/libodbcdrvcfg1S.so /usr/lib/x86_64-linux-gnu/odbc/liboplodbcS.so /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so /usr/lib/x86_64-linux-gnu/odbc/libodbcpsqlS.so /usr/lib/x86_64-linux-gnu/odbc/libodbctxtS.so /usr/lib/x86_64-linux-gnu/libodbccr.so /usr/lib/x86_64-linux-gnu/libodbcinst.so /usr/lib/x86_64-linux-gnu/libodbc.so
</spoiler>
/etc/odbcinst.ini
# Driver from the mysql-connector-odbc package # Setup from the unixODBC package [MySQL] Description = ODBC for MySQL Driver = /usr/lib/libmyodbc5.so Setup = /usr/lib/libodbcmyS.so Driver64 = /usr/lib64/libmyodbc5.so Setup64 = /usr/lib64/libodbcmyS.so FileUsage = 1
nano /etc/odbc.ini
[asteriskcel] Description = MySQL connection to 'asteriskcdrdb' database Driver = MySQL Database = asteriskcdrdb Server = localhost UserName = user Password = password Port = 3306
nano /etc/asterisk/res_odbc_custom.conf
[asteriskcel] enabled => yes dsn => asteriskcel username => user password => password pooling => no pre-connect => yes
*CLI> odbc show ODBC DSN Settings ----------------- Name: asteriskcel DSN: asteriskcel Last connection attempt: 1970-01-01 03:00:00 Pooled: No Connected: Yes
Settings > Advanced Settings
[root@localhost asterisk]# cat /etc/asterisk/cel_general_additional.conf ;--------------------------------------------------------------------------------; ; Do NOT edit this file as it is auto-generated by FreePBX. ; ;--------------------------------------------------------------------------------; ; For information on adding additional paramaters to this file, please visit the ; ; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ; ; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ; ; is totally deliberate. ; ;--------------------------------------------------------------------------------; enable=yes apps=all events=all dateformat=%F %T
nano /etc/asterisk/cel_odbc_custom.conf
[first] connection=asteriskcel table=cel loguniqueid=yes
MySQL
mysql> use asteriskcdrdb;
CREATE TABLE IF NOT EXISTS `cel` ( `id` int(11) NOT NULL auto_increment, `eventtype` varchar(30) NOT NULL, `eventtime` datetime NOT NULL, `cid_name` varchar(80) NOT NULL, `cid_num` varchar(80) NOT NULL, `cid_ani` varchar(80) NOT NULL, `cid_rdnis` varchar(80) NOT NULL, `cid_dnid` varchar(80) NOT NULL, `exten` varchar(80) NOT NULL, `context` varchar(80) NOT NULL, `channame` varchar(80) NOT NULL, `src` varchar(80) NOT NULL, `dst` varchar(80) NOT NULL, `channel` varchar(80) NOT NULL, `dstchannel` varchar(80) NOT NULL, `appname` varchar(80) NOT NULL, `appdata` varchar(80) NOT NULL, `amaflags` int(11) NOT NULL, `accountcode` varchar(20) NOT NULL, `uniqueid` varchar(32) NOT NULL, `linkedid` varchar(32) NOT NULL, `peer` varchar(80) NOT NULL, `userdeftype` varchar(255) NOT NULL, `eventextra` varchar(255) NOT NULL, `userfield` varchar(255) NOT NULL, PRIMARY KEY (`id`), KEY `uniqueid_index` (`uniqueid`), KEY `linkedid_index` (`linkedid`) );
*CLI> cel show status CEL Logging: Enabled CEL Tracking Event: ALL CEL Tracking Event: CHAN_START CEL Tracking Event: CHAN_END CEL Tracking Event: HANGUP CEL Tracking Event: ANSWER CEL Tracking Event: APP_START CEL Tracking Event: APP_END CEL Tracking Event: BRIDGE_START CEL Tracking Event: BRIDGE_END CEL Tracking Event: CONF_START CEL Tracking Event: CONF_END CEL Tracking Event: PARK_START CEL Tracking Event: PARK_END CEL Tracking Event: BLINDTRANSFER CEL Tracking Event: ATTENDEDTRANSFER CEL Tracking Event: TRANSFER CEL Tracking Event: HOOKFLASH CEL Tracking Event: 3WAY_START CEL Tracking Event: 3WAY_END CEL Tracking Event: CONF_ENTER CEL Tracking Event: CONF_EXIT CEL Tracking Event: USER_DEFINED CEL Tracking Event: LINKEDID_END CEL Tracking Event: BRIDGE_UPDATE CEL Tracking Event: PICKUP CEL Tracking Event: FORWARD CEL Tracking Application: all CEL Event Subscriber: CEL Custom CSV Logging CEL Event Subscriber: ODBC CEL backend