[asterisk-commits] chan dahdi: Add the chan dahdi.conf force restart unavailabl... (asterisk[11])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 30 11:11:05 CDT 2015


Mark Michelson has submitted this change and it was merged.

Change subject: chan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option.
......................................................................


chan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option.

Some telco switches occasionally ignore ISDN RESTART requests.  The fix
for ASTERISK-19608 added an escape clause for B channels in the restarting
state if the telco ignores a RESTART request.  If the telco fails to
acknowledge the RESTART then Asterisk will assume the telco acknowledged
the RESTART on the second call attempt requesting the B channel by the
telco.  The escape clause is good for dealing with RESTART requests in
general but it does cause the next call for the restarting B channel to be
rejected if the telco insists the call must go on that B channel.

chan_dahdi doesn't really need to issue a RESTART request in response to
receiving a cause 44 (Requested channel not available) code.  Sending the
RESTART in such a situation is not required (nor prohibited) by the
standards.  I think chan_dahdi does this for historical reasons to deal
with buggy peers to get channels unstuck in a similar fashion as the
chan_dahdi.conf resetinterval option.

* Add the chan_dahdi.conf force_restart_unavailable_chans compatability
option that when disabled will prevent chan_dahdi from trying to RESTART
the channel in response to a cause 44 code.

ASTERISK-25034 #close
Reported by: Richard Mudgett

Change-Id: Ib8b17a438799920f4a2038826ff99a1884042f65
---
M UPGRADE.txt
M channels/chan_dahdi.c
M channels/sig_pri.c
M channels/sig_pri.h
M configs/chan_dahdi.conf.sample
5 files changed, 29 insertions(+), 13 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/UPGRADE.txt b/UPGRADE.txt
index 2be7d14..b0e89ee 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -44,6 +44,13 @@
    by the CLI command is always the Asterisk version. This CLI command
    will be removed in Asterisk 14.
 
+chan_dahdi:
+ - Added the force_restart_unavailable_chans compatibility option.  When
+   enabled it causes Asterisk to restart the ISDN B channel if an outgoing
+   call receives cause 44 (Requested channel not available).  The new option
+   is enabled by default in current release branches for backward
+   compatibility.
+
 cdr_odbc:
  - Added support for post-1.8 CDR columns 'peeraccount', 'linkedid', and
    'sequence'. Support for the new columns can be enabled via the newcdrcolumns
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 8360de6..23494e0 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -1427,6 +1427,7 @@
 			.privateprefix = "",
 			.unknownprefix = "",
 			.colp_send = SIG_PRI_COLP_UPDATE,
+			.force_restart_unavailable_chans = 1,
 			.resetinterval = -1,
 		},
 #endif
@@ -13000,6 +13001,7 @@
 #if defined(HAVE_PRI_MCID)
 						pris[span].pri.mcid_send = conf->pri.pri.mcid_send;
 #endif	/* defined(HAVE_PRI_MCID) */
+						pris[span].pri.force_restart_unavailable_chans = conf->pri.pri.force_restart_unavailable_chans;
 #if defined(HAVE_PRI_DATETIME_SEND)
 						pris[span].pri.datetime_send = conf->pri.pri.datetime_send;
 #endif	/* defined(HAVE_PRI_DATETIME_SEND) */
@@ -18188,6 +18190,8 @@
 				else
 					ast_log(LOG_WARNING, "'%s' is not a valid reset interval, should be >= 60 seconds or 'never' at line %d.\n",
 						v->value, v->lineno);
+			} else if (!strcasecmp(v->name, "force_restart_unavailable_chans")) {
+				confp->pri.pri.force_restart_unavailable_chans = ast_true(v->value);
 			} else if (!strcasecmp(v->name, "minunused")) {
 				confp->pri.pri.minunused = atoi(v->value);
 			} else if (!strcasecmp(v->name, "minidle")) {
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index 870fce0..0a92c2a 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -69,15 +69,6 @@
  */
 //#define ALWAYS_PICK_CHANNEL	1
 
-/*!
- * 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
-
 #if defined(HAVE_PRI_CCSS)
 struct sig_pri_cc_agent_prv {
 	/*! Asterisk span D channel control structure. */
@@ -7015,9 +7006,9 @@
 					pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause);
 					pri->pvts[chanpos]->call = NULL;
 				}
-#if defined(FORCE_RESTART_UNAVAIL_CHANS)
 				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL
 					&& pri->sig != SIG_BRI_PTMP && !pri->resetting
+					&& pri->force_restart_unavailable_chans
 					&& pri->pvts[chanpos]->resetting == SIG_PRI_RESET_IDLE) {
 					ast_verb(3,
 						"Span %d: Forcing restart of channel %d/%d since channel reported in use\n",
@@ -7026,7 +7017,6 @@
 					pri->pvts[chanpos]->resetting = SIG_PRI_RESET_ACTIVE;
 					pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos]));
 				}
-#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");
@@ -7164,9 +7154,9 @@
 					pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause);
 					pri->pvts[chanpos]->call = NULL;
 				}
-#if defined(FORCE_RESTART_UNAVAIL_CHANS)
 				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL
 					&& pri->sig != SIG_BRI_PTMP && !pri->resetting
+					&& pri->force_restart_unavailable_chans
 					&& pri->pvts[chanpos]->resetting == SIG_PRI_RESET_IDLE) {
 					ast_verb(3,
 						"Span %d: Forcing restart of channel %d/%d since channel reported in use\n",
@@ -7175,7 +7165,6 @@
 					pri->pvts[chanpos]->resetting = SIG_PRI_RESET_ACTIVE;
 					pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos]));
 				}
-#endif	/* defined(FORCE_RESTART_UNAVAIL_CHANS) */
 
 #ifdef SUPPORT_USERUSER
 				if (!ast_strlen_zero(e->hangup.useruserinfo)) {
diff --git a/channels/sig_pri.h b/channels/sig_pri.h
index e9a699f..8debbc5 100644
--- a/channels/sig_pri.h
+++ b/channels/sig_pri.h
@@ -481,6 +481,8 @@
 #if defined(HAVE_PRI_MCID)
 	/*! \brief TRUE if allow sending MCID request on this span. */
 	unsigned int mcid_send:1;
+	/*! \brief TRUE if forcing RESTART when receive cause 44 on this span. */
+	unsigned int force_restart_unavailable_chans:1;
 #endif	/* defined(HAVE_PRI_MCID) */
 #if defined(HAVE_PRI_DATETIME_SEND)
 	/*! \brief Configured date/time ie send policy option. */
diff --git a/configs/chan_dahdi.conf.sample b/configs/chan_dahdi.conf.sample
index dfd6e52..584be46 100644
--- a/configs/chan_dahdi.conf.sample
+++ b/configs/chan_dahdi.conf.sample
@@ -196,6 +196,20 @@
 ;
 ;resetinterval = 3600
 ;
+; Enable per span 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 might help.
+;
+; NOTE: Sending a RESTART in response to a cause 44 is not required
+; (nor prohibited) by the standards and is likely a primitive chan_dahdi
+; response to call collisions (glare) and buggy peers.  However, there
+; are telco switches out there that ignore the RESTART and continue to
+; send calls to the channel in the restarting state.
+; Default yes in current release branches for backward compatibility.
+;
+;force_restart_unavailable_chans=yes
+;
 ; Assume inband audio may be present when a SETUP ACK message is received.
 ; Q.931 Section 5.1.3 says that in scenarios with overlap dialing, when a
 ; dialtone is sent from the network side, progress indicator 8 "Inband info

-- 
To view, visit https://gerrit.asterisk.org/303
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib8b17a438799920f4a2038826ff99a1884042f65
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list