From df767e58db37c175de07b4afeecefe7df14242cd Mon Sep 17 00:00:00 2001 From: Yalu Zhang <yalu.zhang@iopsys.eu> Date: Mon, 21 Sep 2020 16:34:15 +0200 Subject: [PATCH] Prevent generating false call logs (CDR's) (cherry picked from commit 629000dcb4711891902fb448a443500dab4c4196 on branch iopsys-16.3) --- main/cdr.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main/cdr.c b/main/cdr.c index e862caffe2..6a823a9807 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -3524,6 +3524,20 @@ static void post_cdr(struct ast_cdr *cdr) continue; } + /* + * When Asterisk receives an SIP-INVITE from an unknown source, a CDR is generated. The workaround below + * is trying to skip this kind of CDR. Otherwise a large number of invalid CDRs will be generated. + * + * TODO: In future, SIP user agent will receive requests from the configured source(s) only, i.e. proxy + * or registrar only. SIP request messages from unwanted sources will be dropped silently without any + * further processing. + */ + if (strcasecmp(cdr->dcontext, "call_line") == 0 && strcasecmp(cdr->lastapp, "Goto") == 0 && + cdr->disposition == AST_CDR_FAILED) { + ast_debug(1, "Skipping CDR because it might be caused by an incoming call from an unwanted source\n"); + continue; + } + /* Modify CDR's */ AST_RWLIST_RDLOCK(&mo_list); AST_RWLIST_TRAVERSE(&mo_list, i, list) { -- GitLab