ODBC CDR not inserting any data to MYSQL

I have configured ODBC CDR for inserting the call records data to cdr table running at mysql.
I have configured cdr_odbc.conf as below :

[global]
dsn=asterisk-connector
loguniqueid=yes
dispositionstring=yes
table=cdr               ;"cdr" is default table name
;usegmtime=no             ; set to "yes" to log in GMT
;hrtime=yes             ;Enables microsecond accuracy with the billsec and duration fields
newcdrcolumns=yes ; Enable logging of post-1.8 CDR columns (peeraccount, linkedid, sequence)

Now I have created the table at Mysql and tried calling to other peers. But no data is being inserted at the table. Is cdr_mysql.conf file is required? If so, then how Do I configure as my database is running with ODBC connection.
Please advice

Have you enabled CDR at cdr.conf?

Yes I have enabled CDR at cdr.conf.
I have configured Two files:

  1. cdr_odbc.conf. Configuration is below
[global]
dsn=asterisk-connector
loguniqueid=yes
dispositionstring=yes
table=cdr               ;"cdr" is default table name
;usegmtime=no             ; set to "yes" to log in GMT
;hrtime=yes             ;Enables microsecond accuracy with the billsec and duration fields
newcdrcolumns=yes ; Enable logging of post-1.8 CDR columns (peeraccount, linkedid, sequence)
  1. cdr_adaptive_odbc.conf. Below is the configuration
[root]
connection=asterisk ;this is a database name in mysql
table=cdr

I am getting the below error:

ERROR[7730]: cdr_odbc.c:174 odbc_log: Unable to retrieve database handle.  CDR failed.

please advice

I am getting the below error:

WARNING[8381]: 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 '2020-02-25 16:17:36'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

Any advice on this please?

Compare the row names from your database table with names from CDR error message.
Probably you received another error message with the root cause of insert error.

In time, you just need cdr_odbc. Adaptative odbc isn’t needed for cdr.

I have not received any such additional error msg instead of the above. I have compared the column name of the table with the SQL statement above I posted. No difference found.
Also could you please point me out from where the above SQL query is being generating?

Issue has been resolved. Call data is being inserted successfully at the cdr table.

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