[asterisk-commits] jrose: trunk r329835 - in /trunk: ./ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 27 15:42:24 CDT 2011
Author: jrose
Date: Wed Jul 27 15:42:18 2011
New Revision: 329835
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=329835
Log:
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/
Modified:
trunk/CHANGES
trunk/include/asterisk/cdr.h
trunk/main/cdr.c
trunk/main/pbx.c
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=329835&r1=329834&r2=329835
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Jul 27 15:42:18 2011
@@ -70,6 +70,7 @@
--------------------------
* The filter option in cdr_adaptive_odbc now supports negating the argument,
thus allowing records which do NOT match the specified filter.
+ * Added ability to log CONGESTION calls to CDR
CODECS
--------------------------
Modified: trunk/include/asterisk/cdr.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/cdr.h?view=diff&rev=329835&r1=329834&r2=329835
==============================================================================
--- trunk/include/asterisk/cdr.h (original)
+++ trunk/include/asterisk/cdr.h Wed Jul 27 15:42:18 2011
@@ -58,6 +58,7 @@
AST_CDR_FAILED = (1 << 1),
AST_CDR_BUSY = (1 << 2),
AST_CDR_ANSWERED = (1 << 3),
+ AST_CDR_CONGESTION = (1 << 4),
};
/*!
@@ -267,6 +268,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
+ * Markst he 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"
Modified: trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cdr.c?view=diff&rev=329835&r1=329834&r2=329835
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Wed Jul 27 15:42:18 2011
@@ -776,6 +776,26 @@
}
}
+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 */
@@ -791,6 +811,9 @@
break;
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;
@@ -961,6 +984,8 @@
return "BUSY";
case AST_CDR_ANSWERED:
return "ANSWERED";
+ case AST_CDR_CONGESTION:
+ return "CONGESTION";
}
return "UNKNOWN";
}
Modified: trunk/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/pbx.c?view=diff&rev=329835&r1=329834&r2=329835
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Wed Jul 27 15:42:18 2011
@@ -9321,8 +9321,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;
}
More information about the asterisk-commits
mailing list