[asterisk-users] CDR ODBC error

Toufic Khreish (Gmail) toufic.khreish at gmail.com
Fri Apr 15 13:00:17 CDT 2016


Hello,

 

I am trying to get CDR work for my asterisk installation.

My OS is Ubuntu 15 with asterisk 13.8 compiled locally on the machine.

MYSQL Server version is  5.6.28-0ubuntu0.15.04.1 (Ubuntu)

 

Would appreciate if someone can help solving this issue

 

 

The error that I am getting:

[2016-04-15 19:24:34] WARNING[1709]: res_odbc.c:503 load_odbc_config: The 'pooling', 'shared_connections', 'limit', and 'idlecheck' options are deprecated. Please see UPGRADE.txt for information

[2016-04-15 19:24:34] WARNING[1709]: res_odbc.c:503 load_odbc_config: The 'pooling', 'shared_connections', 'limit', and 'idlecheck' options are deprecated. Please see UPGRADE.txt for information

[2016-04-15 19:24:34] WARNING[1709]: res_odbc.c:821 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=1045 [unixODBC]

[2016-04-15 19:24:34] NOTICE[1709]: res_odbc.c:585 load_odbc_config: Registered ODBC class 'asteriskcdrdb' dsn->[MySQL-asteriskcdrdb]

 

.

The command isql MySQL-asteriskcdrdb is working fine.

isql MySQL-asteriskcdrdb

+---------------------------------------+

| Connected!                            |

|                                       |

| sql-statement                         |

| help [tablename]                      |

| quit                                  |

|                                       |

+---------------------------------------+

 

Note that could help . once on the sql command line I have to issue : 

1.       use asteriskcdrdb 

then 

2.       select * from cdr

I cannot issue first : select * from cdr   it does not work. Could be that my connection MySQL-asteriskcdrdb is not sending the database name along ? 

 

 

The following command returns errors : 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

[2016-04-15 19:31:41] WARNING[1758]: cdr_adaptive_odbc.c:135 load_config: No such connection 'MySQL-asteriskcdrdb' in the 'asteriskcdrdb' section of cdr_adaptive_odbc.conf.  Check res_odbc.conf.

 

 

odbc show,  returns the following

 

ODBC DSN Settings

-----------------

 

  Name:   asteriskcdrdb

  DSN:    MySQL-asteriskcdrdb

    Last connection attempt: 2016-04-15 19:24:40

 

 

 

cdr show status

 

Call Detail Record (CDR) settings

----------------------------------

  Logging:                    Enabled

  Mode:                       Simple

  Log unanswered calls:       No

  Log congestion:             No

 

* Registered Backends

  -------------------

    Adaptive ODBC

    cdr_manager

 

 

 

 

My ODBC related files:

1.       cdr_adaptive_odbc.conf

[asteriskcdrdb]

connection=MySQL-asteriskcdrdb

loguniqueid=yes

table=cdr

alias start => calldate

 

2.       odbcinst.ini

[MySQL]

Description = ODBC for MySQL

Driver = /usr/lib/arm-linux/odbc/libmyodbc.so

Setup = /usr/lib/arm-linux/odbc/libodbcmyS.so

FileUsage = 1

polling=no

 

3.       odbc.ini

[MySQL-asteriskcdrdb]

Description=MySQL connection to 'asteriskcdrdb' database

driver=MySQL

server=localhost

Port=3306

username=asterisk

password=xxxxxxxxxxxxxx

Socket=/run/mysqld/mysqld.sock

option=3

database=asteriskcdrdb

 

 

4.       res_odbc_additional.conf

[asteriskcdrdb]

enabled=>yes

dsn=>MySQL-asteriskcdrdb

pooling=>no

limit=>1

pre-connect=>yes

username=>asterisk

password=>xxxxxxxxxxxxxx

database=>asteriskcdrdb

 

5.       cel_odbc_custom.conf

[cel]

connection=MySQL-asteriskcdrdb

loguniqueid=yes

table=cel

 

Thank you in advance.

 

 

 

From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Matthew Jordan
Sent: Thursday, February 11, 2016 2:03 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users at lists.digium.com>
Subject: Re: [asterisk-users] CDR ODBC error

 

 

 

On Tue, Feb 9, 2016 at 4:39 PM, Carlos Chavez <cursor at telecomabmex.com <mailto:cursor at telecomabmex.com> > wrote:

    I am trying to get cdr via odbc to work on Asterisk 13.7.2 but I keep getting this error:

[Feb  9 16:21:43] WARNING[2088]: cdr_odbc.c:160 execute_cb: cdr_odbc: Error in ExecDirect: -1, query is: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield,peeraccount,linkedid,sequence) VALUES ({ts '2016-02-09 16:21:28'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ,?,?,?)
[Feb  9 16:21:43] WARNING[2088]: res_odbc.c:612 ast_odbc_direct_execute: SQL Execute error! Verifying connection to asterisk [asterisk]...
[Feb  9 16:21:43] WARNING[2088]: cdr_odbc.c:160 execute_cb: cdr_odbc: Error in ExecDirect: -1, query is: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield,peeraccount,linkedid,sequence) VALUES ({ts '2016-02-09 16:21:28'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ,?,?,?)
[Feb  9 16:21:43] ERROR[2088]: cdr_odbc.c:189 odbc_log: CDR direct execute failed

    First thing I do not get is that calldate does not exist in the CDR database (I am using the table structure that comes with the asterisk source).  If I add that column then start, answer and end do not get populated when the call ends.  Next question is which odbc cdr module I should use, cdr_odbc or cdr_adaptive_odbc?

    Also Asterisk has crashed at least three times with this message:

asterisk: /builddir/build/BUILD/mysql-connector-odbc-5.2.5-src/driver/desc.c:110: desc_free_paramdata: Assertion `aprec' failed.
[Feb  9 16:28:48] WARNING[3781]: res_odbc.c:1405 _ast_odbc_request_obj2: SetConnectAttr (Txn isolation) returned an error: HY000: [MySQL][ODBC 5.2(w) Driver]Lost connection to MySQL server during query
[Feb  9 16:28:48] WARNING[3781]: res_config_odbc.c:117 custom_prepare: SQL Prepare failed![SELECT * FROM ps_domain_aliases WHERE id = ?]
[Feb  9 16:28:48] WARNING[3781]: res_odbc.c:765 ast_odbc_sanity_check: Connection is down attempting to reconnect...
Aborted (core dumped)

 

You should use cdr_adaptive_odbc. It is far more flexible than cdr_odbc, and is essentially a replacement for it. cdr_odbc doesn't receive much attention as a result.

Frankly, we should probably just remove cdr_odbc.

 

-- 

Matthew Jordan

Digium, Inc. | Director of Technology

445 Jan Davis Drive NW - Huntsville, AL 35806 - USA

Check us out at: http://digium.com & http://asterisk.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20160415/dade76a2/attachment.html>


More information about the asterisk-users mailing list