Adds cdr logging of calls resulting in CONGESTION

Applies a patch made a long time ago by alecdavis which adds a CDR feature for logging
calls that failed due to congestion.

(closes issue #15907)
Reported by: alecdavis
Patches: 
      cdr_congestion.diff.txt uploaded by alecdavis (license #5546)

Review: https://reviewboard.asterisk.org/r/454/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@329835 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2011-07-27 20:42:18 +00:00
parent 1e332468dc
commit 3ee80d6a90
4 changed files with 39 additions and 1 deletions

View File

@@ -776,6 +776,26 @@ void ast_cdr_noanswer(struct ast_cdr *cdr)
}
}
void ast_cdr_congestion(struct ast_cdr *cdr)
{
char *chan;
while (cdr) {
if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED)) {
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
}
if (cdr->disposition < AST_CDR_CONGESTION) {
cdr->disposition = AST_CDR_CONGESTION;
}
}
cdr = cdr->next;
}
}
/* everywhere ast_cdr_disposition is called, it will call ast_cdr_failed()
if ast_cdr_disposition returns a non-zero value */
@@ -792,6 +812,9 @@ int ast_cdr_disposition(struct ast_cdr *cdr, int cause)
case AST_CAUSE_NO_ANSWER:
ast_cdr_noanswer(cdr);
break;
case AST_CAUSE_NORMAL_CIRCUIT_CONGESTION:
ast_cdr_congestion(cdr);
break;
case AST_CAUSE_NORMAL:
break;
default:
@@ -961,6 +984,8 @@ char *ast_cdr_disp2str(int disposition)
return "BUSY";
case AST_CDR_ANSWERED:
return "ANSWERED";
case AST_CDR_CONGESTION:
return "CONGESTION";
}
return "UNKNOWN";
}