[asterisk-commits] rmudgett: branch group/CCSS r251579 - /team/group/CCSS/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 9 22:08:42 CST 2010


Author: rmudgett
Date: Tue Mar  9 22:08:38 2010
New Revision: 251579

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=251579
Log:
1) Factor in HAVE_PRI_SERVICE_MESSAGES to the congestion device state.

2) Make sure that the congestion device state is correct when
sig_pri_hangup() is called.

Modified:
    team/group/CCSS/channels/chan_dahdi.c
    team/group/CCSS/channels/sig_pri.c

Modified: team/group/CCSS/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_dahdi.c?view=diff&rev=251579&r1=251578&r2=251579
==============================================================================
--- team/group/CCSS/channels/chan_dahdi.c (original)
+++ team/group/CCSS/channels/chan_dahdi.c Tue Mar  9 22:08:38 2010
@@ -2904,7 +2904,12 @@
 		if (pri->pvts[idx] && !pri->pvts[idx]->no_b_channel) {
 			/* This is a B channel interface. */
 			++num_b_chans;
-			if (pri->pvts[idx]->owner) {
+			if (pri->pvts[idx]->owner
+#if defined(HAVE_PRI_SERVICE_MESSAGES)
+				/* Out-of-service B channels are "in-use". */
+				&& pri->pvts[idx]->service_status
+#endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
+				) {
 				++in_use;
 			}
 			if (!pri->pvts[idx]->inalarm) {
@@ -14074,6 +14079,8 @@
 				if (*why) {
 					snprintf(db_answer, sizeof(db_answer), "%s:%u", SRVST_TYPE_OOS, *why);
 					ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
+				} else {
+					dahdi_pri_update_span_devstate(tmp->pri);
 				}
 				break;
 			/* case 1:  -- loop */
@@ -14083,6 +14090,7 @@
 				*why |= SRVST_NEAREND;
 				snprintf(db_answer, sizeof(db_answer), "%s:%u", SRVST_TYPE_OOS, *why);
 				ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
+				dahdi_pri_update_span_devstate(tmp->pri);
 				break;
 			/* case 3:  -- continuity */
 			/* case 4:  -- shutdown */

Modified: team/group/CCSS/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/sig_pri.c?view=diff&rev=251579&r1=251578&r2=251579
==============================================================================
--- team/group/CCSS/channels/sig_pri.c (original)
+++ team/group/CCSS/channels/sig_pri.c Tue Mar  9 22:08:38 2010
@@ -3014,6 +3014,8 @@
 							snprintf(db_answer, sizeof(db_answer), "%s:%u",
 								SRVST_TYPE_OOS, *why);
 							ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
+						} else {
+							sig_pri_span_devstate_changed(pri);
 						}
 						break;
 					case 2: /* out-of-service */
@@ -3023,6 +3025,7 @@
 						snprintf(db_answer, sizeof(db_answer), "%s:%u", SRVST_TYPE_OOS,
 							*why);
 						ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
+						sig_pri_span_devstate_changed(pri);
 						break;
 					default:
 						ast_log(LOG_ERROR, "Huh?  changestatus is: %d\n", e->service.changestatus);
@@ -4026,7 +4029,7 @@
 
 int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
 {
-	int res = 0;
+	int res;
 #ifdef SUPPORT_USERUSER
 	const char *useruser = pbx_builtin_getvar_helper(ast, "USERUSERINFO");
 #endif
@@ -4050,48 +4053,43 @@
 	p->exten[0] = '\0';
 	sig_pri_set_dialing(p, 0);
 
-	if (!p->call) {
-		res = 0;
-		goto exit;
-	}
-
 	/* 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");
+
+#ifdef SUPPORT_USERUSER
+				pri_call_set_useruser(p->call, useruser);
+#endif
+
+				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);
+#endif
+
+				p->alreadyhungup = 1;
+				if (cause) {
+					if (atoi(cause))
+						icause = atoi(cause);
+				}
+				pri_hangup(p->pri->pri, p->call, icause);
+			}
+		}
 		sig_pri_span_devstate_changed(p->pri);
-		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);
-#endif
-
-			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);
-#endif
-
-			p->alreadyhungup = 1;
-			if (cause) {
-				if (atoi(cause))
-					icause = atoi(cause);
-			}
-			pri_hangup(p->pri->pri, p->call, icause);
-		}
-		if (res < 0)
-			ast_log(LOG_WARNING, "pri_disconnect failed\n");
 		pri_rel(p->pri);
+		res = 0;
 	} else {
 		ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->pri->span);
 		res = -1;
 	}
 
-exit:
 	ast->tech_pvt = NULL;
 	return res;
 }




More information about the asterisk-commits mailing list