Cdr_adaptive_odbc vs cdr_odbc

Hello !

Using Asterisk 18.2, my goal is to : cdr → odbc → unixodbc → mariadb

When using cdr_adaptive_odbc, it is working great, not error, data are inserted into database.
Since I have no other data to store in db than the default ones, using cdr_adaptive_odbc should be equivalent to cdr_odbc, but it is not. Using cdr_odbc I get :

[Jan 24 18:28:13] WARNING[149]: cdr_odbc.c:159 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 '2022-01-24 18:28:11'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[Jan 24 18:28:13] ERROR[149]: cdr_odbc.c:188 odbc_log: CDR direct execute failed

How come ? What can produce that ?

cdr_odbc.conf :

[global]
dsn=asterisk
loguniqueid=yes
dispositionstring=yes
table=cdr
usegmtime=no
hrtime=yes
newcdrcolumns=yes

res_odbc.conf :

[asterisk]
dsn => asterisk-odbc
username => asterisk
password => xXxXxXxXxXxXx
pre-connect => yes
sanitysql => select 1
connect_timeout => 5
logging => yes

Thanks in advance,
Michel

ODBC is far more popular than cdr_odbc and the other db connectors. From a historic point of view this means that the ODBC code was always maintained, which is not the case for the other packages. Maybe only small patches are necessary, but the effort doesn’t seem to be worth it. Even if you can update chan_odbc you still have to worry about longtime stability and the things that can happen with connection losses. With unix_odbc there is much more experience and the thing simply reconnects flawlessly when necessary.

Thanks EkFudrek for your answer.

I am not sure to understand it ! What is the “ODBC” you mention ? Never heard of chan_odbc either.

I’ve set up unixodbc and verified it with isql, it is working fine.
Then with Asterisk, I’d like to insert CDR records into my database : which modules should I use for this if not res_odbc + cdr_odbc ?

Neither have I. Was a typo and I guess cdr_odbc was meant. ODBC stands for Open Database connectivity and belongs to the Microsoft world.

Ok ! :slight_smile:
So back to the original question…

Definitely res_odbc and then cdr_adaptive_odbc.

Thanks, sounds good.

I’ll open later another more precise topic about cdr_adaptive, since I am under the impression that not everything is recorder into database with this module, especially when using a queue (compare to cdr_odbc but this other module shows some errors that I do not understand).

I had a same issue. and I found why!
first check your cdr table!

in my case, there no column “calldate” in cdr table.
I add column ‘calldate’ manualy, and it works!

this is my blog : Mavercik의 행복한 이야기 : 네이버 블로그

Yes, you’re absolutely right, thanks a lot !

I had created the cdr table using alembic within the contrib/ast-db-manage folder, provided with the Asterisk source core, so it should have been fine but it is not ! Most probably - as EkFudrek has mentioned earlier in this post - the cdr_odbc is not well maintained and cdr_adaptive_odbc should now be preferred.

Are you aware of differences between cdr_adaptive_odbc and cdr_odbc ?
With some preliminary testing, I was under the impression that with cdr_adaptive_odbc not everything is inserted into the database, especially with incoming calls and a dialplan that uses queues.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.