[Home]

Summary:ASTERISK-23770: calldate missing from contrib/ast-db-manage/cdr
Reporter:Stephen More (mores)Labels:
Date Opened:2014-05-21 12:16:35Date Closed:2014-05-21 12:47:05
Priority:MajorRegression?
Status:Closed/CompleteComponents:Contrib/General
Versions:12.2.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:cdr/cdr_odbc.c shows:
"INSERT INTO %s "
               "(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,"
               "lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) "
               "VALUES ({ts '%s'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", table, timestr);

There is no calldate defined in contrib/ast-db-manage/cdr
Comments:By: Matt Jordan (mjordan) 2014-05-21 12:45:38.732-0500

That's because {{cdr_odbc}} is weird, strange, and uses non-standard CDR columns. No other module uses {{calldate}}, nor should any other module use {{calldate}}. As such, the recommended SQL columns in the contrib script really shouldn't be updated to include it.

The preferred module to use for ODBC CDRs is {{cdr_adaptive_odbc}}. Not only would it not have this problem, but if you _really_ wanted a calldate column, you could add one and map the standard fields to it.

By: Matt Jordan (mjordan) 2014-05-21 12:46:45.276-0500

I should amend my previous comment that "no other module uses {{calldate}}" - {{cdr_mysql}} does, but it at least is smart enough to provide an escape option:

{code}
if (!strcmp(entry->name, "calldate")) {
/*!\note
* For some dumb reason, "calldate" used to be formulated using
* the datetime the record was posted, rather than the start
* time of the call.  If someone really wants the old compatible
* behavior, it's provided here.
*/
if (calldate_compat) {
struct timeval tv = ast_tvnow();
struct ast_tm tm;
char timestr[128];
ast_localtime(&tv, &tm, ast_str_strlen(cdrzone) ? ast_str_buffer(cdrzone) : NULL);
ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %T", &tm);
value = ast_strdupa(timestr);
cdrname = "calldate";
} else {
cdrname = "start";
}
{code}

By: Stephen More (mores) 2014-06-05 19:59:48.797-0500

To remove confusion in future revisions, it would be helpful to have cdr_odbc removed.