[asterisk-commits] rmudgett: branch rmudgett/call_waiting r251136 - /team/rmudgett/call_waiting/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 5 21:15:28 CST 2010


Author: rmudgett
Date: Fri Mar  5 21:15:24 2010
New Revision: 251136

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=251136
Log:
Prevent new calls from stealing B channels from call waiting calls.

Only do call waiting calls if we have any call waiting call outstanding.
We do not want new calls to steal a B channel freed for an earlier call
waiting call.


Modified:
    team/rmudgett/call_waiting/channels/sig_pri.c

Modified: team/rmudgett/call_waiting/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/call_waiting/channels/sig_pri.c?view=diff&rev=251136&r1=251135&r2=251136
==============================================================================
--- team/rmudgett/call_waiting/channels/sig_pri.c (original)
+++ team/rmudgett/call_waiting/channels/sig_pri.c Fri Mar  5 21:15:24 2010
@@ -4825,11 +4825,18 @@
 	cw = NULL;
 	ast_mutex_lock(&pri->lock);
 	if (pri->num_call_waiting_calls < pri->max_call_waiting_calls) {
-		for (idx = 0; idx < pri->numchans; ++idx) {
-			if (pri->pvts[idx] && sig_pri_available_check(pri->pvts[idx])) {
-				/* There is another channel that is available on this span. */
-				ast_mutex_unlock(&pri->lock);
-				return cw;
+		if (!pri->num_call_waiting_calls) {
+			/*
+			 * There are no outstanding call waiting calls.  Check to see
+			 * if the span is in a congested state for the first call
+			 * waiting call.
+			 */
+			for (idx = 0; idx < pri->numchans; ++idx) {
+				if (pri->pvts[idx] && sig_pri_available_check(pri->pvts[idx])) {
+					/* There is another channel that is available on this span. */
+					ast_mutex_unlock(&pri->lock);
+					return cw;
+				}
 			}
 		}
 		idx = pri_find_empty_nobch(pri);
@@ -4855,7 +4862,17 @@
 		return 0;
 	}
 
-	if (sig_pri_available_check(p)) {
+	if (
+#if defined(HAVE_PRI_CALL_WAITING)
+		/*
+		 * Only do call waiting calls if we have any
+		 * call waiting call outstanding.  We do not
+		 * want new calls to steal a B channel
+		 * freed for an earlier call waiting call.
+		 */
+		!p->pri->num_call_waiting_calls &&
+#endif	/* defined(HAVE_PRI_CALL_WAITING) */
+		sig_pri_available_check(p)) {
 		return 1;
 	}
 #if defined(HAVE_PRI_SERVICE_MESSAGES)




More information about the asterisk-commits mailing list