CDR error, but adaptive is working

We are writing CDR to a MS SQL db, using settings in cdr_adaptive_odbc (our table has “user friendly” field names).

All is good, and the DB is getting populated, but for every successful insert, there is a second ODBC insert that uses the standard field names, and it throws an error:

[Oct 14 16:23:24] WARNING[26748] cdr_odbc.c: cdr_odbc: Error in ExecDirect: -1, query is: INSERT INTO MYTABLE (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES ({ts '2019-10-14 16:23:20'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[Oct 14 16:23:24] ERROR[26748] cdr_odbc.c: CDR direct execute failed

Is there a way to stop this from happening?

I’ve never seen that and I am using cdr_adaptive_odbc a lot myself. Can you post your configuration files? It looks as if something else is also active, but it’s difficult to tell if one has only the information you posted.

Here are the conf files. Please let me know if you need any more:


connection=sqlserver ;this uses the name of the section in res_odbc.conf
alias uniqueid => CallRecordingID
alias clid => FullCallerID
alias src => CallerIDNumber
alias dst => DestinationExtension
alias dcontext => DestinationContext
alias channel => CallerChannel
alias dstchannel => DestinationChannel
alias lastapp => Program
alias lastdata => ProgramArguments
alias start => CallStartTime
alias duration => CallDurationInSeconds
alias billsec => CallAnsweredDurationInSeconds
alias disposition => CallStatusTypeID


enabled => yes
dsn => MSSQL
max_connections => 5
username => MyUserName
password => NotReallyMyPassword
pre-connect => yes
sanitysql => select count(*) from systables
backslash_is_escape => no


dsn=sqlserver  ;this uses the name of the section in res_odbc.conf


; ODBC_SQL - Allow an SQL statement to be built entirely in the dialplan



usegmtime=yes    ; log date/time in GMT.  Default is "no"
loguniqueid=yes  ; log uniqueid.  Default is "no"
loguserfield=yes ; log user field.  Default is "no"
accountlogs=yes  ; create separate log file for each account code. Default is "yes"


I was having 2 rows, one from cdr adaptave and one from cdr odbc, My solution was to do a module unload

THen I only got the one row from cdr adaptive which was correct.

Thanks! I will give it a try!

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