[asterisk-users] cell mysql odbc support

Arstan arstanj at gmail.com
Sun Feb 26 20:58:27 CST 2012


I did install CEL logging for Debian 6. Here's my notes, I hope it helps

How to cel logging in asterisk 1.8

1.)
apt-get remove unixODBC unixODBC-dev
apt-get install libmyodbc

2.)
download and compile asterisk 1.8 and above.. with cel logging enabled

3.)
vim /etc/odbc.ini
[asterisk-connector]
Description           = MySQL connection to 'asterisk' database
Driver                = MySQL
Database              = asteriskcdrdb
Server                = localhost
UserName              = asteriskuser
Password              = intuit
Port                  = 3306
Socket                = /var/run/mysqld/mysqld.sock


4.)
vim /etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/odbc/libmyodbc.so
Setup = /usr/lib/odbc/libodbcmyS.so
FileUsage = 1

5.)
vim /etc/asterisk/cel.conf
[general]
enable=yes
apps=dial,queue
events=CHAN_START,CHAN_END, ANSWER,HANGUP
dateformat=%F %T

6.)
vim /etc/asterisk/res_odbc.conf
[asterisk]
enabled => yes
dsn => asterisk-connector
username => asteriskuser
password => intuit
pooling => no
limit => 1
pre-connect => yes

7.)
vim /etc/asterisk/cel_odbc.conf
[mytable]
connection = asterisk
table = cel

8.)

CREATE TABLE `cel` (
  `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  `eventtype` VARCHAR(30) COLLATE utf8_unicode_ci NOT NULL,
  `eventtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
   ON UPDATE CURRENT_TIMESTAMP,
  `userdeftype` VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL,
  `cid_name` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `cid_num` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `cid_ani` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `cid_rdnis` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `cid_dnid` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `exten` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `context` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `channame` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `appname` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `appdata` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  `amaflags` INT(11) NOT NULL,
  `accountcode` VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL,
  `peeraccount` VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL,
  `uniqueid` VARCHAR(150) COLLATE utf8_unicode_ci NOT NULL,
  `linkedid` VARCHAR(150) COLLATE utf8_unicode_ci NOT NULL,
  `userfield` VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL,
  `peer` VARCHAR(80) COLLATE utf8_unicode_ci NOT NULL,
  UNIQUE KEY `id` (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

9.)
amportal kill
amportal start

10.) problem with libmyodbc package version, need to downgrade:
http://forums.asterisk.org/viewtopic.php?p=161963

download from http://packages.debian.org/lenny/libmyodbc with dependencies:

but before remove the existing packages:
apt-get remove unixODBC unixODBC-dev
    apt-get remove libmyodbc
 remove the newer version
apt-get remove odbcinst1debian2

  wget
http://ftp.us.debian.org/debian/pool/main/libt/libtool/libltdl3_1.5.26-4+lenny1_i386.deb
  wget
http://ftp.us.debian.org/debian/pool/main/u/unixodbc/odbcinst1debian1_2.2.11-16_i386.deb
  wget
http://ftp.us.debian.org/debian/pool/main/m/myodbc/libmyodbc_3.51.15r409-4_i386.deb
  wget
http://ftp.us.debian.org/debian/pool/main/m/mysql-dfsg-5.0/libmysqlclient15off_5.0.51a-24+lenny5_i386.deb
  wget
http://ftp.us.debian.org/debian/pool/main/u/unixodbc/unixodbc_2.2.11-16_i386.deb

  dpkg -i unixodbc_2.2.11-16_i386.deb
  dpkg -i odbcinst1debian1_2.2.11-16_i386.deb
  dpkg -i libmysqlclient15off_5.0.51a-24+lenny5_i386.deb
  dpkg -i libmyodbc_3.51.15r409-4_i386.deb

  NOTE: remember if asterisk make menuselect show that res_odbc cant find
generic_odbc and other dependencies to install back the
  unixODBC unixODBC-dev packages from apt and configure make make install
and then remove those and install back the older ones.



On Sat, Feb 25, 2012 at 2:28 AM, cegadsl <cegadsl at idecnet.com> wrote:

>  Looking for information I've read that it is a datatype problem and that
> with a simple 'if' on cel_odbc.c it is solved,  but I use the asterisk for
> debian repositories do not want to compile anything.
>
> Also wonder therefore that there is no documentation about this problem.
>
> I dont want to use pgsql only for cel, all my work with asterisk is for
> MySQL.
>
>
> El 24/02/2012 18:22, Eric Wieling escribió:
>
> I experienced a similar problem, asked here, and go NO response.  I put CEL on the shelf until an Asterisk 1.8 release has working CEL.
>
> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com <asterisk-users-bounces at lists.digium.com>] On Behalf Of cegadsl
> Sent: Friday, February 24, 2012 1:17 PM
> To: asterisk-users at lists.digium.com
> Subject: [asterisk-users] cell mysql odbc support
>
> Hi All
>
> I am trying to log CEL Events to mysql through odbc, but I get the message:
>
>
>
>    Feb 24 18:03:08] WARNING[12915]: cel_odbc.c:699 odbc_log: Column type -9 (field 'odbcconnection:cel:cid_name') is unsupported at this time.
> <<
>
> I think that is a datatype problem, but i cannot solve the problem. it only happens with char or varchar datatypes:
>
> My MySQL cel table structure:
>
> CREATE TABLE `cel` (
>   `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
>   `eventtype` VARCHAR(30)  NOT NULL,
>   `eventtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
>    ON UPDATE CURRENT_TIMESTAMP,
>   `userdeftype` VARCHAR(255) 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,
>   `appname` VARCHAR(80) NOT NULL,
>   `appdata` VARCHAR(80) NOT NULL,
>   `amaflags` INT(11) NOT NULL,
>   `accountcode` VARCHAR(20) NOT NULL,
>   `peeraccount` VARCHAR(20) NOT NULL,
>   `uniqueid` VARCHAR(150) NOT NULL,
>   `linkedid` VARCHAR(150) NOT NULL,
>   `userfield` VARCHAR(255) NOT NULL,
>   `peer` VARCHAR(80) NOT NULL,
>   UNIQUE KEY `id` (`id`)
> )
>
>
>
> Thanks in advance¡¡¡
>
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
Regards,
Arstan Jusupov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120227/96e320d9/attachment.htm>


More information about the asterisk-users mailing list