Summary:ASTERISK-06440: Integer values of CDR are not corrcetly bound by ODBC driver for MySQL
Reporter:Gabor Balogh (gbalogh)Labels:
Date Opened:2006-02-28 12:30:54.000-0600Date Closed:2006-03-01 14:20:49.000-0600
Versions:Frequency of
Environment:Attachments:( 0) cdr.h
Description:In the insert query of the module's odbc_log function the columns representing duration, billsec, disposition and amaflag fields of the database table are badly bound, therefore the prepared query contains integer values that are completely off, and cause the DB server to insert the maximal possible value into these fields.


A possible workaround for this issue is to convert these integer values into char arrays, and bind these arrays to the apropirate query parameters. Still investigating whether there's a more elegant solution to this problem.
Comments:By: Tilghman Lesher (tilghman) 2006-02-28 23:56:48.000-0600

Eh?  Examples?

By: Gabor Balogh (gbalogh) 2006-03-01 01:59:07.000-0600

MySQL server 5.0.18 and asterisk 1.2.4 run on a Dell PE2850 running Debian Linux Sarge - kernel 2.6.8 complied by us.

For example:
INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES ('2006-03-01 07:45:00','\"1999XXXX\" <1999XXXX>','1999XXXX','0630XXXXXXX','customers-out','SIP/361999XXXX-215a','Zap/31-1','Dial','Zap/G1/0630XXXXXXX',15,<i>64424509440</i>,2,<i>8589934595</i>,'981080922','1141195500.0','')

By: Gabor Balogh (gbalogh) 2006-03-01 09:25:16.000-0600

Changing the declaration of variables <b>duration</b>, <b>billsec</b>, <b>disposition</b> and <b>amaflags</b> in 'struct cdr' structure to int64_t when compiled on a 64bit system seems to solve the problem.

Modified cdr.h attached.

By: Tilghman Lesher (tilghman) 2006-03-01 14:20:49.000-0600

Fixed in 1.2, merged to trunk.