[asterisk-users] CDR to MS-SQL via ODBC issue
Leif Madsen
leif.madsen at asteriskdocs.org
Thu May 6 06:27:38 CDT 2010
Tilghman Lesher wrote:
> Okay, second idea is that you should very carefully examine your CDR table
> layout and ensure that the columns that you have match EXACTLY what the
> module expects you to have. If Asterisk expects you to have a column that you
> don't (or the column type is wrong), that is another reason that the prepare
> might fail. You might consider using the cdr_adaptive_odbc driver, instead,
> as it is designed to create the insert based upon the structure of the table.
Ya, after thinking a bit more I had the same thought. Here are the table formats
I found in cdr_odbc.c.
if (loguniqueid) {
snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO %s "
"(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,"
"lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) "
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", table);
} else {
snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO %s "
"(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,"
"duration,billsec,disposition,amaflags,accountcode) "
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)", table);
}
So if in cdr_odbc.conf you have:
loguniqueid=yes
Looks like the system expects the first table layout, otherwise it expects to
use the 2nd table layout.
Based on the table layout you emailed me previously, the fields missing are
'calldate' and 'userfield'.
Thanks!
Leif.
More information about the asterisk-users
mailing list