[asterisk-commits] rmudgett: trunk r362430 - in /trunk: ./ channels/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 18 11:41:22 CDT 2012


Author: rmudgett
Date: Wed Apr 18 11:41:17 2012
New Revision: 362430

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=362430
Log:
Add ability to ignore layer 1 alarms for BRI PTMP lines.

Several telcos bring the BRI PTMP layer 1 down when the line is idle.
When layer 1 goes down, Asterisk cannot make outgoing calls.  Incoming
calls could fail as well because the alarm processing is handled by a
different code path than the Q.931 messages.

* Add the layer1_presence configuration option to ignore layer 1 alarms
when the telco brings layer 1 down.  This option can be configured by span
while the similar DAHDI driver teignorered=1 option is system wide.  This
option unlike layer2_persistence does not require libpri v1.4.13 or newer.

Related to JIRA AST-598

JIRA ABE-2845
........

Merged revisions 362428 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 362429 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    trunk/   (props changed)
    trunk/channels/chan_dahdi.c
    trunk/channels/sig_pri.c
    trunk/channels/sig_pri.h
    trunk/configs/chan_dahdi.conf.sample

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=362430&r1=362429&r2=362430
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Apr 18 11:41:17 2012
@@ -3140,8 +3140,19 @@
 	int x;
 
 	ioctl(pri->fds[index], DAHDI_GETEVENT, &x);
-	if (x) {
-		ast_log(LOG_NOTICE, "PRI got event: %s (%d) on D-channel of span %d\n", event2str(x), x, pri->span);
+	switch (x) {
+	case DAHDI_EVENT_NONE:
+		break;
+	case DAHDI_EVENT_ALARM:
+	case DAHDI_EVENT_NOALARM:
+		if (sig_pri_is_alarm_ignored(pri)) {
+			break;
+		}
+		/* Fall through */
+	default:
+		ast_log(LOG_NOTICE, "PRI got event: %s (%d) on D-channel of span %d\n",
+			event2str(x), x, pri->span);
+		break;
 	}
 	/* Keep track of alarm state */
 	switch (x) {
@@ -3831,6 +3842,12 @@
 
 static void handle_clear_alarms(struct dahdi_pvt *p)
 {
+#if defined(HAVE_PRI)
+	if (dahdi_sig_pri_lib_handles(p->sig) && sig_pri_is_alarm_ignored(p->pri)) {
+		return;
+	}
+#endif	/* defined(HAVE_PRI) */
+
 	if (report_alarms & REPORT_CHANNEL_ALARMS) {
 		ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
 		manager_event(EVENT_FLAG_SYSTEM, "AlarmClear", "Channel: %d\r\n", p->channel);
@@ -7901,8 +7918,15 @@
 
 static void handle_alarms(struct dahdi_pvt *p, int alms)
 {
-	const char *alarm_str = alarm2str(alms);
-
+	const char *alarm_str;
+
+#if defined(HAVE_PRI)
+	if (dahdi_sig_pri_lib_handles(p->sig) && sig_pri_is_alarm_ignored(p->pri)) {
+		return;
+	}
+#endif	/* defined(HAVE_PRI) */
+
+	alarm_str = alarm2str(alms);
 	if (report_alarms & REPORT_CHANNEL_ALARMS) {
 		ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", p->channel, alarm_str);
 		manager_event(EVENT_FLAG_SYSTEM, "Alarm",
@@ -12696,6 +12720,12 @@
 						pris[span].pri.aoc_passthrough_flag = conf->pri.pri.aoc_passthrough_flag;
 						pris[span].pri.aoce_delayhangup = conf->pri.pri.aoce_delayhangup;
 #endif	/* defined(HAVE_PRI_AOC_EVENTS) */
+						if (chan_sig == SIG_BRI_PTMP) {
+							pris[span].pri.layer1_ignored = conf->pri.pri.layer1_ignored;
+						} else {
+							/* Option does not apply to this line type. */
+							pris[span].pri.layer1_ignored = 0;
+						}
 						pris[span].pri.append_msn_to_user_tag = conf->pri.pri.append_msn_to_user_tag;
 						ast_copy_string(pris[span].pri.initial_user_tag, conf->chan.cid_tag, sizeof(pris[span].pri.initial_user_tag));
 						ast_copy_string(pris[span].pri.msn_list, conf->pri.pri.msn_list, sizeof(pris[span].pri.msn_list));
@@ -17966,6 +17996,15 @@
 			} else if (!strcasecmp(v->name, "datetime_send")) {
 				confp->pri.pri.datetime_send = dahdi_datetime_send_option(v->value);
 #endif	/* defined(HAVE_PRI_DATETIME_SEND) */
+			} else if (!strcasecmp(v->name, "layer1_presence")) {
+				if (!strcasecmp(v->value, "required")) {
+					confp->pri.pri.layer1_ignored = 0;
+				} else if (!strcasecmp(v->value, "ignore")) {
+					confp->pri.pri.layer1_ignored = 1;
+				} else {
+					/* Default */
+					confp->pri.pri.layer1_ignored = 0;
+				}
 #if defined(HAVE_PRI_L2_PERSISTENCE)
 			} else if (!strcasecmp(v->name, "layer2_persistence")) {
 				if (!strcasecmp(v->value, "keep_up")) {

Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=362430&r1=362429&r2=362430
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Wed Apr 18 11:41:17 2012
@@ -190,6 +190,11 @@
 
 void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
 {
+	if (sig_pri_is_alarm_ignored(p->pri)) {
+		/* Always set not in alarm */
+		in_alarm = 0;
+	}
+
 	/*
 	 * Clear the channel restart flag when the channel alarm changes
 	 * to prevent the flag from getting stuck when the link goes
@@ -8834,6 +8839,18 @@
 	pri_rel(p->pri);
 }
 
+/*!
+ * \brief Determine if layer 1 alarms are ignored.
+ *
+ * \param p Channel private pointer.
+ *
+ * \return TRUE if the alarm is ignored.
+ */
+int sig_pri_is_alarm_ignored(struct sig_pri_span *pri)
+{
+	return pri->layer1_ignored;
+}
+
 struct sig_pri_chan *sig_pri_chan_new(void *pvt_data, struct sig_pri_callback *callback, struct sig_pri_span *pri, int logicalspan, int channo, int trunkgroup)
 {
 	struct sig_pri_chan *p;

Modified: trunk/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.h?view=diff&rev=362430&r1=362429&r2=362430
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Wed Apr 18 11:41:17 2012
@@ -439,6 +439,8 @@
 	/*! \brief TRUE if we will allow incoming ISDN call waiting calls. */
 	unsigned int allow_call_waiting_calls:1;
 #endif	/* defined(HAVE_PRI_CALL_WAITING) */
+	/*! TRUE if layer 1 alarm status is ignored */
+	unsigned int layer1_ignored:1;
 	/*!
 	 * TRUE if a new call's sig_pri_chan.user_tag[] has the MSN
 	 * appended to the initial_user_tag[].
@@ -618,8 +620,8 @@
 void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm);
 void sig_pri_chan_alarm_notify(struct sig_pri_chan *p, int noalarm);
 
+int sig_pri_is_alarm_ignored(struct sig_pri_span *pri);
 void pri_event_alarm(struct sig_pri_span *pri, int index, int before_start_pri);
-
 void pri_event_noalarm(struct sig_pri_span *pri, int index, int before_start_pri);
 
 struct ast_channel *sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law, const struct ast_channel *requestor, int transfercapability);

Modified: trunk/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/chan_dahdi.conf.sample?view=diff&rev=362430&r1=362429&r2=362430
==============================================================================
--- trunk/configs/chan_dahdi.conf.sample (original)
+++ trunk/configs/chan_dahdi.conf.sample Wed Apr 18 11:41:17 2012
@@ -267,6 +267,18 @@
 ; transfer feature of an analog phone.
 ; The default is no.
 ;hold_disconnect_transfer=yes
+
+; BRI PTMP layer 1 presence.
+; You should normally not need to set this option.
+; You may need to set this option if your telco brings layer 1 down when
+; the line is idle.
+; required:      Layer 1 presence required for outgoing calls. (default)
+; ignore:        Ignore alarms from DAHDI about this span.
+;                (Layer 1 and 2 will be brought back up for an outgoing call.)
+;                NOTE:  You will not be able to detect physical line problems
+;                until an outgoing call is attempted and fails.
+;
+;layer1_presence=ignore
 
 ; BRI PTMP layer 2 persistence.
 ; You should normally not need to set this option.




More information about the asterisk-commits mailing list