Index: include/asterisk/cdr.h =================================================================== --- include/asterisk/cdr.h (revision 212427) +++ include/asterisk/cdr.h (working copy) @@ -49,6 +49,7 @@ #define AST_CDR_BUSY (1 << 1) #define AST_CDR_NOANSWER (1 << 2) #define AST_CDR_ANSWERED (1 << 3) +#define AST_CDR_CONGESTION (1 << 4) /*@} */ /*! \name CDR AMA Flags */ @@ -214,6 +215,15 @@ extern void ast_cdr_noanswer(struct ast_cdr *cdr); /*! + * \brief A call was set to congestion + * \param cdr the cdr you wish to associate with the call + * Marks the channel disposition as "CONGESTION" + * Will skip CDR's in chain with ANS_LOCK bit set. (see + * forkCDR() application. + */ +extern void ast_cdr_congestion(struct ast_cdr *cdr); + +/*! * \brief Busy a call * \param cdr the cdr you wish to associate with the call * Marks the channel disposition as "BUSY" Index: main/cdr.c =================================================================== --- main/cdr.c (revision 212427) +++ main/cdr.c (working copy) @@ -740,6 +740,23 @@ } } + +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 : ""; + 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 */ @@ -756,6 +773,9 @@ 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: @@ -914,6 +934,8 @@ return "BUSY"; case AST_CDR_ANSWERED: return "ANSWERED"; + case AST_CDR_CONGESTION: + return "CONGESTION"; } return "UNKNOWN"; } Index: main/pbx.c =================================================================== --- main/pbx.c (revision 212427) +++ main/pbx.c (working copy) @@ -8463,8 +8463,10 @@ ast_indicate(chan, AST_CONTROL_CONGESTION); /* Don't change state of an UP channel, just indicate congestion in audio */ - if (chan->_state != AST_STATE_UP) + if (chan->_state != AST_STATE_UP){ ast_setstate(chan, AST_STATE_BUSY); + ast_cdr_congestion(chan->cdr); + } wait_for_hangup(chan, data); return -1; }