From: Richard Mudgett Date: Wed, 23 Oct 2013 16:49:51 +0000 (+0000) Subject: cdr_adaptive_odbc: Also apply a filter when the CDR value is empty. X-Git-Tag: 12.0.0-beta2~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f855ba2a7625575c55e0b992e851ab06fe8c43c3;p=thirdparty%2Fasterisk.git cdr_adaptive_odbc: Also apply a filter when the CDR value is empty. Extra CDR records are written if a filtered CDR value is empty because the filter is not checked. (closes issue ASTERISK-22272) Reported by: Jordi Llull Chavarria ........ Merged revisions 401577 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401579 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@401581 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c index a590fb32a1..0a9cfdbdd9 100644 --- a/cdr/cdr_adaptive_odbc.c +++ b/cdr/cdr_adaptive_odbc.c @@ -720,6 +720,14 @@ static int odbc_log(struct ast_cdr *cdr) continue; } first = 0; + } else if (entry->filtervalue + && ((!entry->negatefiltervalue && entry->filtervalue[0] != '\0') + || (entry->negatefiltervalue && entry->filtervalue[0] == '\0'))) { + ast_verb(4, "CDR column '%s' was not set and does not match filter of" + " %s'%s'. Cancelling this CDR.\n", + entry->cdrname, entry->negatefiltervalue ? "!" : "", + entry->filtervalue); + goto early_release; } }