diff --git a/main/cdr.c b/main/cdr.c index e862caffe2c8a12ce4cfe2111ef3d6b1ae0799d6..6a823a980710c96ab222e41f89de7192cf80b3d8 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) {