[svn-commits] rmudgett: branch rmudgett/bch_shift_v1.8 r311672 - /team/rmudgett/bch_shift_v...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Mar 24 16:48:46 CDT 2011


Author: rmudgett
Date: Thu Mar 24 16:48:42 2011
New Revision: 311672

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311672
Log:
Don't continue to deal with the B channel after we have effectively released it.

In sig_pri_hangup(), the owner ptr and allocated flag should not be
cleared outside of the PRI lock protection.  Also they should be cleared
as the last steps in hangup since they release the B channel for other
calls to use.

Modified:
    team/rmudgett/bch_shift_v1.8/channels/sig_pri.c

Modified: team/rmudgett/bch_shift_v1.8/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bch_shift_v1.8/channels/sig_pri.c?view=diff&rev=311672&r1=311671&r2=311672
==============================================================================
--- team/rmudgett/bch_shift_v1.8/channels/sig_pri.c (original)
+++ team/rmudgett/bch_shift_v1.8/channels/sig_pri.c Thu Mar 24 16:48:42 2011
@@ -6167,7 +6167,6 @@
 
 int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
 {
-	int res;
 #ifdef SUPPORT_USERUSER
 	const char *useruser = pbx_builtin_getvar_helper(ast, "USERUSERINFO");
 #endif
@@ -6178,8 +6177,6 @@
 		return 0;
 	}
 
-	p->owner = NULL;
-	p->allocated = 0;
 	p->outgoing = 0;
 	sig_pri_set_digital(p, 0);	/* push up to parent for EC*/
 #if defined(HAVE_PRI_CALL_WAITING)
@@ -6198,59 +6195,58 @@
 	sig_pri_set_dialing(p, 0);
 
 	/* Make sure we have a call (or REALLY have a call in the case of a PRI) */
-	if (!pri_grab(p, p->pri)) {
-		if (p->call) {
-			if (p->alreadyhungup) {
-				ast_log(LOG_DEBUG, "Already hungup...  Calling hangup once, and clearing call\n");
+	pri_grab(p, p->pri);
+	if (p->call) {
+		if (p->alreadyhungup) {
+			ast_log(LOG_DEBUG, "Already hungup...  Calling hangup once, and clearing call\n");
 
 #ifdef SUPPORT_USERUSER
-				pri_call_set_useruser(p->call, useruser);
+			pri_call_set_useruser(p->call, useruser);
 #endif
 
 #if defined(HAVE_PRI_AOC_EVENTS)
-				if (p->holding_aoce) {
-					pri_aoc_e_send(p->pri->pri, p->call, &p->aoc_e);
-				}
+			if (p->holding_aoce) {
+				pri_aoc_e_send(p->pri->pri, p->call, &p->aoc_e);
+			}
 #endif	/* defined(HAVE_PRI_AOC_EVENTS) */
-				pri_hangup(p->pri->pri, p->call, -1);
-				p->call = NULL;
-			} else {
-				const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE");
-				int icause = ast->hangupcause ? ast->hangupcause : -1;
-				ast_log(LOG_DEBUG, "Not yet hungup...  Calling hangup once with icause, and clearing call\n");
+			pri_hangup(p->pri->pri, p->call, -1);
+			p->call = NULL;
+		} else {
+			const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE");
+			int icause = ast->hangupcause ? ast->hangupcause : -1;
+			ast_log(LOG_DEBUG, "Not yet hungup...  Calling hangup once with icause, and clearing call\n");
 
 #ifdef SUPPORT_USERUSER
-				pri_call_set_useruser(p->call, useruser);
+			pri_call_set_useruser(p->call, useruser);
 #endif
 
-				p->alreadyhungup = 1;
-				if (cause) {
-					if (atoi(cause))
-						icause = atoi(cause);
-				}
+			p->alreadyhungup = 1;
+			if (cause) {
+				if (atoi(cause))
+					icause = atoi(cause);
+			}
 #if defined(HAVE_PRI_AOC_EVENTS)
-				if (p->holding_aoce) {
-					pri_aoc_e_send(p->pri->pri, p->call, &p->aoc_e);
-				}
+			if (p->holding_aoce) {
+				pri_aoc_e_send(p->pri->pri, p->call, &p->aoc_e);
+			}
 #endif	/* defined(HAVE_PRI_AOC_EVENTS) */
-				pri_hangup(p->pri->pri, p->call, icause);
-			}
-		}
-		sig_pri_span_devstate_changed(p->pri);
-		pri_rel(p->pri);
-		res = 0;
-	} else {
-		ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->pri->span);
-		res = -1;
-	}
-
+			pri_hangup(p->pri->pri, p->call, icause);
+		}
+	}
 #if defined(HAVE_PRI_AOC_EVENTS)
 	p->aoc_s_request_invoke_id_valid = 0;
 	p->holding_aoce = 0;
 	p->waiting_for_aoce = 0;
 #endif	/* defined(HAVE_PRI_AOC_EVENTS) */
+
+	p->allocated = 0;
+	p->owner = NULL;
+
+	sig_pri_span_devstate_changed(p->pri);
+	pri_rel(p->pri);
+
 	ast->tech_pvt = NULL;
-	return res;
+	return 0;
 }
 
 /*!




More information about the svn-commits mailing list