[svn-commits] rmudgett: branch rmudgett/bch_shift_v1.6.2 r311685 - in /team/rmudgett/bch_sh...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Mar 25 17:05:29 CDT 2011


Author: rmudgett
Date: Fri Mar 25 17:05:24 2011
New Revision: 311685

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311685
Log:
Merged revisions 311556-311557,311604,311607-311608,311610,311664-311665,311672,311674,311676,311682 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/rmudgett/bch_shift_v1.8

........
  r311556 | rmudgett | 2011-03-22 17:52:16 -0500 (Tue, 22 Mar 2011) | 1 line
  
  Mostly restart message format changes.
........
  r311557 | rmudgett | 2011-03-22 17:58:26 -0500 (Tue, 22 Mar 2011) | 1 line
  
  Add allocated flag to 'dahdi show channel' PRI output.
........
  r311604 | rmudgett | 2011-03-23 09:40:26 -0500 (Wed, 23 Mar 2011) | 1 line
  
  Block SETUPs with duplicate call ptr.
........
  r311607 | rmudgett | 2011-03-23 11:39:27 -0500 (Wed, 23 Mar 2011) | 1 line
  
  Add conditional code around force restart code.
........
  r311608 | rmudgett | 2011-03-23 12:15:03 -0500 (Wed, 23 Mar 2011) | 1 line
  
  Invert test logic.  It will work better now.
........
  r311610 | rmudgett | 2011-03-23 15:10:31 -0500 (Wed, 23 Mar 2011) | 1 line
  
  Make RESTART request not destroy call and update hangup/restart verbose messages.
........
  r311664 | rmudgett | 2011-03-24 13:35:05 -0500 (Thu, 24 Mar 2011) | 2 lines
  
  Just destroy calls if T309 is not enabled.
........
  r311665 | rmudgett | 2011-03-24 14:41:56 -0500 (Thu, 24 Mar 2011) | 30 lines
  
  Invalid PRI call ptr message associated with force channel RESTART.
  
  When Asterisk receives a cause PRI_CAUSE_REQUESTED_CHAN_UNAVAIL(44), it
  forces a RESTART on that B channel.  Due to timing, another SETUP
  requesting the same B channel could come in right after the
  RELEASE_COMPLETE with cause 44.  That call SETUP would get shifted to
  another channel and two messages sent immediately (SETUP_ACKNOWLEDGE,
  PROCEEDING, ALERTING, or CONNECT).  The peer Asterisk box on receiving the
  RESTART, immediately hangs up and destroys the new call associated with the B channel.
  When the peer then processes the two messages for the destroyed call, it
  responds with PRI_CAUSE_INVALID_CALL_REFERENCE(81) to both.
  
  --> SETUP(call-1)
  <-- RELEASE_COMPLETE(call-1, PRI_CAUSE_REQUESTED_CHAN_UNAVAIL)
  <-- SETUP(call-2, same B channel)
  --> RESTART
  --> SETUP_ACKNOWLEDGE(call-2, New B channel)
  --> CONNECT(call-2)
  <-- RESTART_ACKNOWLEDGE (Destroys call-2 because associated with B channel)
  <-- RELEASE_COMPLETE(call-2, PRI_CAUSE_INVALID_CALL_REFERENCE)
  <-- RELEASE_COMPLETE(call-2, PRI_CAUSE_INVALID_CALL_REFERENCE)
  
  If both RELEASE_COMPLETE responses are processed by libpri before the
  Asterisk core hangs up the call, then the invalid call ptr message is
  generated.  Libpri has already destroyed the call structure when it
  processed the second RELEASE_COMPLETE.
  
  Fixed by making sure that the call is hung up and forgotten immediately if
  the hangup cause is PRI_CAUSE_INVALID_CALL_REFERENCE.
........
  r311672 | rmudgett | 2011-03-24 16:48:42 -0500 (Thu, 24 Mar 2011) | 7 lines
  
  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.
........
  r311674 | rmudgett | 2011-03-24 18:02:23 -0500 (Thu, 24 Mar 2011) | 1 line
  
  Make sure that the last call has completed hanging up before setting up for the new.
........
  r311676 | rmudgett | 2011-03-25 09:47:44 -0500 (Fri, 25 Mar 2011) | 1 line
  
  Update comment since I fixed the problem it mentions.
........
  r311682 | rmudgett | 2011-03-25 12:58:58 -0500 (Fri, 25 Mar 2011) | 1 line
  
  Prevent potential deadlock with failed idle call.
........

Modified:
    team/rmudgett/bch_shift_v1.6.2/   (props changed)
    team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c

Propchange: team/rmudgett/bch_shift_v1.6.2/
------------------------------------------------------------------------------
--- bch_shift_v1.8-integrated (original)
+++ bch_shift_v1.8-integrated Fri Mar 25 17:05:24 2011
@@ -1,1 +1,1 @@
-/team/rmudgett/bch_shift_v1.8:1-311500
+/team/rmudgett/bch_shift_v1.8:1-311684

Modified: team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c?view=diff&rev=311685&r1=311684&r2=311685
==============================================================================
--- team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c (original)
+++ team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c Fri Mar 25 17:05:24 2011
@@ -185,6 +185,22 @@
 #undef SUPPORT_USERUSER
 
 /*!
+ * Define to make always pick a channel if allowed.  Useful for
+ * testing channel shifting.
+ */
+//#define ALWAYS_PICK_CHANNEL	1
+#define ALWAYS_PICK_CHANNEL	1	//BUGBUG
+
+/*!
+ * Define to force a RESTART on a channel that returns a cause
+ * code of PRI_CAUSE_REQUESTED_CHAN_UNAVAIL(44).  If the cause
+ * is because of a stuck channel on the peer and the channel is
+ * always the next channel we pick for an outgoing call then
+ * this can help.
+ */
+#define FORCE_RESTART_UNAVAIL_CHANS		1
+
+/*!
  * \note Define ZHONE_HACK to cause us to go off hook and then back on hook when
  * the user hangs up to reset the state machine so ring works properly.
  * This is used to be able to support kewlstart by putting the zhone in
@@ -204,8 +220,6 @@
 
 /*! \brief Typically, how many rings before we should send Caller*ID */
 #define DEFAULT_CIDRINGS 1
-
-#define CHANNEL_PSEUDO -12
 
 #define AST_LAW(p) (((p)->law == DAHDI_LAW_ALAW) ? AST_FORMAT_ALAW : AST_FORMAT_ULAW)
 
@@ -4605,7 +4619,6 @@
 	}
 
 	if (!p->subs[SUB_REAL].owner && !p->subs[SUB_CALLWAIT].owner && !p->subs[SUB_THREEWAY].owner) {
-		p->owner = NULL;
 		p->ringt = 0;
 		p->distinctivering = 0;
 		p->confirmanswer = 0;
@@ -4615,9 +4628,6 @@
 		p->faxhandled = 0;
 		p->pulsedial = 0;
 		p->onhooktime = time(NULL);
-#if defined(HAVE_PRI)
-		p->allocated = 0;
-#endif	/* defined(HAVE_PRI) */
 #if defined(HAVE_PRI) || defined(HAVE_SS7)
 		p->dialing = 0;
 		p->progress = 0;
@@ -4696,7 +4706,7 @@
 			p->mfcr2call = 0;
 		}
 #endif
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 		if (p->pri) {
 #ifdef SUPPORT_USERUSER
 			const char *useruser = pbx_builtin_getvar_helper(ast,"USERUSERINFO");
@@ -4704,51 +4714,52 @@
 
 			/* Make sure we have a call (or REALLY have a call in the case of a PRI) */
 			if (p->call && (!p->bearer || (p->bearer->call == p->call))) {
-				if (!pri_grab(p, p->pri)) {
-					if (p->alreadyhungup) {
-						ast_debug(1, "Already hungup...  Calling hangup once, and clearing call\n");
+				pri_grab(p, p->pri);
+				if (p->alreadyhungup) {
+					ast_debug(1, "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;
-						if (p->bearer)
-							p->bearer->call = NULL;
-					} else {
-						const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE");
-						int icause = ast->hangupcause ? ast->hangupcause : -1;
-						ast_debug(1, "Not yet hungup...  Calling hangup once with icause, and clearing call\n");
+					pri_call_set_useruser(p->call, useruser);
+#endif
+
+					pri_hangup(p->pri->pri, p->call, -1);
+					p->call = NULL;
+					if (p->bearer)
+						p->bearer->call = NULL;
+				} else {
+					const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE");
+					int icause = ast->hangupcause ? ast->hangupcause : -1;
+					ast_debug(1, "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 (p->bearer)
-							p->bearer->alreadyhungup = 1;
-						if (cause) {
-							if (atoi(cause))
-								icause = atoi(cause);
-						}
-						pri_hangup(p->pri->pri, p->call, icause);
+					pri_call_set_useruser(p->call, useruser);
+#endif
+
+					p->alreadyhungup = 1;
+					if (p->bearer)
+						p->bearer->alreadyhungup = 1;
+					if (cause) {
+						if (atoi(cause))
+							icause = atoi(cause);
 					}
-					if (res < 0)
-						ast_log(LOG_WARNING, "pri_disconnect failed\n");
-					pri_rel(p->pri);
-				} else {
-					ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
-					res = -1;
-				}
+					pri_hangup(p->pri->pri, p->call, icause);
+				}
+				p->allocated = 0;
+				p->owner = NULL;
+				pri_rel(p->pri);
 			} else {
 				if (p->bearer)
 					ast_debug(1, "Bearer call is %p, while ours is still %p\n", p->bearer->call, p->call);
 				p->call = NULL;
+				p->allocated = 0;
+				p->owner = NULL;
 				res = 0;
 			}
-		}
-#endif
+		} else
+#endif	/* defined(HAVE_PRI) */
+		{
+			p->owner = NULL;
+		}
 		if (p->sig && ((p->sig != SIG_PRI) && (p->sig != SIG_SS7)
 			&& (p->sig != SIG_BRI)
 			&& (p->sig != SIG_BRI_PTMP))
@@ -4833,11 +4844,9 @@
 	p->oprmode = 0;
 	ast->tech_pvt = NULL;
 	ast_mutex_unlock(&p->lock);
-	ast_module_unref(ast_module_info->self);
 	ast_verb(3, "Hungup '%s'\n", ast->name);
 
 	ast_mutex_lock(&iflock);
-
 	if (p->restartpending) {
 		num_restart_pending--;
 	}
@@ -4856,6 +4865,8 @@
 		}
 	}
 	ast_mutex_unlock(&iflock);
+
+	ast_module_unref(ast_module_info->self);
 	return 0;
 }
 
@@ -6142,11 +6153,10 @@
 #ifdef HAVE_PRI
 			if ((p->sig == SIG_PRI) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) {
 				if (!p->pri || !p->pri->pri || (pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0)) {
-					/* T309 is not enabled : hangup calls when alarm occurs */
+					/* T309 is not enabled : destroy calls when alarm occurs */
 					if (p->call) {
 						if (p->pri && p->pri->pri) {
 							if (!pri_grab(p, p->pri)) {
-								pri_hangup(p->pri->pri, p->call, -1);
 								pri_destroycall(p->pri->pri, p->call);
 								p->call = NULL;
 								pri_rel(p->pri);
@@ -11595,6 +11605,21 @@
 					break;
 				}
 			}
+#if defined(HAVE_PRI)
+			switch (p->sig) {
+			case SIG_PRI_LIB_HANDLE_CASES:
+				/*
+				 * We already have the B channel reserved for this call.  We
+				 * just need to make sure that dahdi_hangup() has completed
+				 * cleaning up before continuing.
+				 */
+				ast_mutex_lock(&p->lock);
+				ast_mutex_unlock(&p->lock);
+				break;
+			default:
+				break;
+			}
+#endif	/* defined(HAVE_PRI) */
 			p->outgoing = 1;
 			tmp = dahdi_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0);
 			if (!tmp) {
@@ -13373,7 +13398,9 @@
 						pri->pvts[nextidle]->isidlecall = 1;
 						if (ast_pthread_create_background(&p, NULL, do_idle_thread, idle)) {
 							ast_log(LOG_WARNING, "Unable to start new thread for idle channel '%s'\n", idle->name);
+							ast_mutex_unlock(&pri->lock);
 							ast_hangup(idle);
+							ast_mutex_lock(&pri->lock);
 						}
 					} else {
 						ast_log(LOG_WARNING, "Unable to request channel 'DAHDI/%s' for idle call\n", idlen);
@@ -13539,10 +13566,9 @@
 						struct dahdi_pvt *p = pri->pvts[i];
 						if (p) {
 							if (!p->pri || !p->pri->pri || pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
-								/* T309 is not enabled : hangup calls when alarm occurs */
+								/* T309 is not enabled : destroy calls when alarm occurs */
 								if (p->call) {
 									if (p->pri && p->pri->pri) {
-										pri_hangup(p->pri->pri, p->call, -1);
 										pri_destroycall(p->pri->pri, p->call);
 										p->call = NULL;
 									} else
@@ -13563,14 +13589,17 @@
 				}
 				break;
 			case PRI_EVENT_RESTART:
-				if (e->restart.channel > -1) {
+				if (e->restart.channel > -1 && PRI_CHANNEL(e->ring.channel) != 0xFF) {
 					chanpos = pri_find_principle(pri, e->restart.channel);
 					if (chanpos < 0)
-						ast_log(LOG_WARNING, "Restart requested on odd/unavailable channel number %d/%d on span %d\n",
-							PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
+						ast_log(LOG_WARNING,
+							"Span %d: Restart requested on odd/unavailable channel number %d/%d\n",
+							pri->span, PRI_SPAN(e->restart.channel),
+							PRI_CHANNEL(e->restart.channel));
 					else {
-						ast_verb(3, "B-channel %d/%d restarted on span %d\n",
-								PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
+						ast_verb(3, "Span %d: Channel %d/%d restarted\n", pri->span,
+							PRI_SPAN(e->restart.channel),
+							PRI_CHANNEL(e->restart.channel));
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 						if (pri->pvts[chanpos]->call) {
 							pri_destroycall(pri->pri, pri->pvts[chanpos]->call);
@@ -13584,7 +13613,7 @@
 						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 					}
 				} else {
-					ast_verb(3, "Restart on requested on entire span %d\n", pri->span);
+					ast_verb(3, "Restart requested on entire span %d\n", pri->span);
 					for (x = 0; x < pri->numchans; x++)
 						if (pri->pvts[x]) {
 							ast_mutex_lock(&pri->pvts[x]->lock);
@@ -13653,6 +13682,15 @@
 				break;
 			case PRI_EVENT_RING:
 				crv = NULL;
+				chanpos = pri_find_principle_by_call(pri, e->ring.call);
+				if (-1 < chanpos) {
+					/* Libpri has already filtered out duplicate SETUPs. */
+					ast_log(LOG_WARNING,
+						"Span %d: Got SETUP with duplicate call ptr.  Dropping call.\n",
+						pri->span);
+					pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_NORMAL_TEMPORARY_FAILURE);
+					break;
+				}
 				if (e->ring.channel == -1 || PRI_CHANNEL(e->ring.channel) == 0xFF) {
 					/* Any channel requested. */
 					chanpos = pri_find_empty_chan(pri, 1);
@@ -13672,14 +13710,6 @@
 							pri->span, PRI_SPAN(e->ring.channel),
 							PRI_CHANNEL(e->ring.channel));
 					} else if (!sig_pri_is_chan_available(pri->pvts[chanpos])) {
-						/* Libpri has already filtered out duplicate SETUPs anyway. */
-						if (pri->pvts[chanpos]->call == e->ring.call) {
-							ast_log(LOG_WARNING,
-								"Span %d: Ignoring duplicate SETUP on channel %d/%d\n",
-								pri->span, PRI_SPAN(e->ring.channel),
-								PRI_CHANNEL(e->ring.channel));
-							break;
-						}
 						/* This is where we handle initial glare */
 						ast_debug(1,
 							"Span %d: SETUP requested unavailable channel %d/%d.  Attempting to renegotiate.\n",
@@ -13687,12 +13717,6 @@
 							PRI_CHANNEL(e->ring.channel));
 						chanpos = -1;
 					}
-/*!
- * Define to make always pick a channel if allowed.  Useful for
- * testing channel shifting.
- */
-//#define ALWAYS_PICK_CHANNEL	1
-#define ALWAYS_PICK_CHANNEL	1	//BUGBUG
 #if defined(ALWAYS_PICK_CHANNEL)
 					if (e->ring.flexible) {
 						chanpos = -1;
@@ -14193,6 +14217,18 @@
 					break;
 				}
 				ast_mutex_lock(&pri->pvts[chanpos]->lock);
+				switch (e->hangup.cause) {
+				case PRI_CAUSE_INVALID_CALL_REFERENCE:
+					/*
+					 * The peer denies the existence of this call so we must
+					 * continue hanging it up and forget about it.
+					 */
+					pri_hangup(pri->pri, e->hangup.call, e->hangup.cause);
+					pri->pvts[chanpos]->call = NULL;
+					break;
+				default:
+					break;
+				}
 				if (!pri->pvts[chanpos]->alreadyhungup) {
 					/* we're calling here dahdi_hangup so once we get there we need to clear p->call after calling pri_hangup */
 					pri->pvts[chanpos]->alreadyhungup = 1;
@@ -14241,19 +14277,26 @@
 						pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause);
 						pri->pvts[chanpos]->call = NULL;
 					}
-					ast_verb(3, "Channel %d/%d, span %d got hangup, cause %d\n",
-							pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, e->hangup.cause);
+					ast_verb(3, "Span %d: Channel %d/%d got hangup, cause %d\n",
+						pri->span, pri->pvts[chanpos]->logicalspan,
+						pri->pvts[chanpos]->prioffset, e->hangup.cause);
 				} else {
 					/* Continue hanging up the call. */
 					pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause);
 					pri->pvts[chanpos]->call = NULL;
 				}
-				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL) {
-					ast_verb(3, "Forcing restart of channel %d/%d on span %d since channel reported in use\n",
-							PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
+#if defined(FORCE_RESTART_UNAVAIL_CHANS)
+				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL
+					&& pri->sig != SIG_BRI_PTMP && !pri->resetting
+					&& !pri->pvts[chanpos]->resetting) {
+					ast_verb(3,
+						"Span %d: Forcing restart of channel %d/%d since channel reported in use\n",
+						pri->span, pri->pvts[chanpos]->logicalspan,
+						pri->pvts[chanpos]->prioffset);
+					pri->pvts[chanpos]->resetting = 1;
 					pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos]));
-					pri->pvts[chanpos]->resetting = 1;
-				}
+				}
+#endif	/* defined(FORCE_RESTART_UNAVAIL_CHANS) */
 				if (e->hangup.aoc_units > -1)
 					ast_verb(3, "Channel %d/%d, span %d received AOC-E charging %d unit%s\n",
 							pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, (int)e->hangup.aoc_units, (e->hangup.aoc_units == 1) ? "" : "s");
@@ -14283,6 +14326,20 @@
 					break;
 				}
 				ast_mutex_lock(&pri->pvts[chanpos]->lock);
+				switch (e->hangup.cause) {
+				case PRI_CAUSE_INVALID_CALL_REFERENCE:
+					/*
+					 * The peer denies the existence of this call so we must
+					 * continue hanging it up and forget about it.  We should not
+					 * get this cause here, but for completeness we will handle it
+					 * anyway.
+					 */
+					pri_hangup(pri->pri, e->hangup.call, e->hangup.cause);
+					pri->pvts[chanpos]->call = NULL;
+					break;
+				default:
+					break;
+				}
 				if (pri->pvts[chanpos]->realcall)
 					pri_hangup_all(pri->pvts[chanpos]->realcall, pri);
 				else if (pri->pvts[chanpos]->owner) {
@@ -14319,7 +14376,9 @@
 						}
 						break;
 					}
-					ast_verb(3, "Channel %d/%d, span %d got hangup request, cause %d\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span, e->hangup.cause);
+					ast_verb(3, "Span %d: Channel %d/%d got hangup request, cause %d\n",
+						pri->span, pri->pvts[chanpos]->logicalspan,
+						pri->pvts[chanpos]->prioffset, e->hangup.cause);
 					if (e->hangup.aoc_units > -1)
 						ast_verb(3, "Channel %d/%d, span %d received AOC-E charging %d unit%s\n",
 								pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, (int)e->hangup.aoc_units, (e->hangup.aoc_units == 1) ? "" : "s");
@@ -14331,12 +14390,18 @@
 					pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause);
 					pri->pvts[chanpos]->call = NULL;
 				}
-				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL) {
-					ast_verb(3, "Forcing restart of channel %d/%d span %d since channel reported in use\n",
-							PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
+#if defined(FORCE_RESTART_UNAVAIL_CHANS)
+				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL
+					&& pri->sig != SIG_BRI_PTMP && !pri->resetting
+					&& !pri->pvts[chanpos]->resetting) {
+					ast_verb(3,
+						"Span %d: Forcing restart of channel %d/%d since channel reported in use\n",
+						pri->span, pri->pvts[chanpos]->logicalspan,
+						pri->pvts[chanpos]->prioffset);
+					pri->pvts[chanpos]->resetting = 1;
 					pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos]));
-					pri->pvts[chanpos]->resetting = 1;
-				}
+				}
+#endif	/* defined(FORCE_RESTART_UNAVAIL_CHANS) */
 
 #ifdef SUPPORT_USERUSER
 				if (!ast_strlen_zero(e->hangup.useruserinfo)) {
@@ -14356,11 +14421,10 @@
 				}
 				ast_mutex_lock(&pri->pvts[chanpos]->lock);
 				pri->pvts[chanpos]->call = NULL;
-				pri->pvts[chanpos]->resetting = 0;
 				if (pri->pvts[chanpos]->owner) {
-					ast_verb(3, "Channel %d/%d, span %d got hangup ACK\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
-				}
-
+					ast_verb(3, "Span %d: Channel %d/%d got hangup ACK\n", pri->span,
+						pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset);
+				}
 #ifdef SUPPORT_USERUSER
 				if (!ast_strlen_zero(e->hangup.useruserinfo)) {
 					struct ast_channel *owner = pri->pvts[chanpos]->owner;
@@ -14385,18 +14449,24 @@
 						if (pri->pvts[x] && pri->pvts[x]->resetting) {
 							chanpos = x;
 							ast_mutex_lock(&pri->pvts[chanpos]->lock);
-							ast_debug(1, "Assuming restart ack is really for channel %d/%d span %d\n", pri->pvts[chanpos]->logicalspan,
-								pri->pvts[chanpos]->prioffset, pri->span);
+							ast_debug(1,
+								"Span %d: Assuming restart ack is for channel %d/%d\n",
+								pri->span, pri->pvts[chanpos]->logicalspan,
+								pri->pvts[chanpos]->prioffset);
 							if (pri->pvts[chanpos]->realcall)
 								pri_hangup_all(pri->pvts[chanpos]->realcall, pri);
 							else if (pri->pvts[chanpos]->owner) {
-								ast_log(LOG_WARNING, "Got restart ack on channel %d/%d with owner on span %d\n", pri->pvts[chanpos]->logicalspan,
-									pri->pvts[chanpos]->prioffset, pri->span);
+								ast_log(LOG_WARNING,
+									"Span %d: Got restart ack on channel %d/%d with owner\n",
+									pri->span, pri->pvts[chanpos]->logicalspan,
+									pri->pvts[chanpos]->prioffset);
 								pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 							}
 							pri->pvts[chanpos]->resetting = 0;
-							ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan,
-									pri->pvts[chanpos]->prioffset, pri->span);
+							ast_verb(3,
+								"Span %d: Channel %d/%d successfully restarted\n",
+								pri->span, pri->pvts[chanpos]->logicalspan,
+								pri->pvts[chanpos]->prioffset);
 							ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 							if (pri->resetting)
 								pri_check_restart(pri);
@@ -14404,8 +14474,10 @@
 						}
 					}
 					if (chanpos < 0) {
-						ast_log(LOG_WARNING, "Restart ACK requested on strange channel %d/%d span %d\n",
-							PRI_SPAN(e->restartack.channel), PRI_CHANNEL(e->restartack.channel), pri->span);
+						ast_log(LOG_WARNING,
+							"Span %d: Restart ACK on strange channel %d/%d\n",
+							pri->span, PRI_SPAN(e->restartack.channel),
+							PRI_CHANNEL(e->restartack.channel));
 					}
 				} else {
 					if (pri->pvts[chanpos]) {
@@ -14413,14 +14485,18 @@
 						if (pri->pvts[chanpos]->realcall)
 							pri_hangup_all(pri->pvts[chanpos]->realcall, pri);
 						else if (pri->pvts[chanpos]->owner) {
-							ast_log(LOG_WARNING, "Got restart ack on channel %d/%d span %d with owner\n",
-								PRI_SPAN(e->restartack.channel), PRI_CHANNEL(e->restartack.channel), pri->span);
+							ast_log(LOG_WARNING,
+								"Span %d: Got restart ack on channel %d/%d with owner\n",
+								pri->span, pri->pvts[chanpos]->logicalspan,
+								pri->pvts[chanpos]->prioffset);
 							pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 						}
 						pri->pvts[chanpos]->resetting = 0;
 						pri->pvts[chanpos]->inservice = 1;
-						ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan,
-									pri->pvts[chanpos]->prioffset, pri->span);
+						ast_verb(3,
+							"Span %d: Channel %d/%d successfully restarted\n",
+							pri->span, pri->pvts[chanpos]->logicalspan,
+							pri->pvts[chanpos]->prioffset);
 						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 						if (pri->resetting)
 							pri_check_restart(pri);
@@ -15760,6 +15836,9 @@
 					ast_cli(a->fd, "Call ");
 				if (tmp->bearer)
 					ast_cli(a->fd, "Bearer ");
+				if (tmp->allocated) {
+					ast_cli(a->fd, "Allocated ");
+				}
 				ast_cli(a->fd, "\n");
 				if (tmp->logicalspan)
 					ast_cli(a->fd, "PRI Logical Span: %d\n", tmp->logicalspan);




More information about the svn-commits mailing list