[svn-commits] kpfleming: branch 1.4 r139145 - in /branches/1.4: ./ channels/ include/asterisk/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 20 14:35:59 CDT 2008


Author: kpfleming
Date: Wed Aug 20 14:35:59 2008
New Revision: 139145

URL: http://svn.digium.com/view/asterisk?view=rev&rev=139145
Log:
Backport support for Zaptel/DAHDI channel-level alarms from trunk/1.6, because not doing so just makes it difficult for people with channels that are in alarm when Asterisk starts up to get them going once the alarm is cleared

(closes issue #12160)
Reported by: tzafrir
Patches:
      asterisk-chanalarms_14.patch uploaded by tzafrir (license 46)
Tested by: tzafrir

Modified:
    branches/1.4/channels/chan_dahdi.c
    branches/1.4/configure
    branches/1.4/configure.ac
    branches/1.4/include/asterisk/autoconfig.h.in

Modified: branches/1.4/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_dahdi.c?view=diff&rev=139145&r1=139144&r2=139145
==============================================================================
--- branches/1.4/channels/chan_dahdi.c (original)
+++ branches/1.4/channels/chan_dahdi.c Wed Aug 20 14:35:59 2008
@@ -3666,14 +3666,33 @@
 {
 	int res;
 	struct dahdi_spaninfo zi;
+#if defined(HAVE_DAHDI) || defined(HAVE_ZAPTEL_CHANALARMS)
+	/*
+	 * The conditional compilation is needed only in asterisk-1.4 for
+	 * backward compatibility with old zaptel drivers that don't have
+	 * a DAHDI_PARAMS.chan_alarms field.
+	 */
+	struct dahdi_params params;
+#endif
+
 	memset(&zi, 0, sizeof(zi));
 	zi.spanno = p->span;
-	res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SPANSTAT, &zi);
-	if (res < 0) {
+
+	/* First check for span alarms */
+	if((res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SPANSTAT, &zi)) < 0) {
 		ast_log(LOG_WARNING, "Unable to determine alarm on channel %d: %s\n", p->channel, strerror(errno));
 		return 0;
 	}
-	return zi.alarms;
+	if (zi.alarms != DAHDI_ALARM_NONE)
+		return zi.alarms;
+#if defined(HAVE_DAHDI) || defined(HAVE_ZAPTEL_CHANALARMS)
+	/* No alarms on the span. Check for channel alarms. */
+	if ((res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &params)) >= 0)
+		return params.chan_alarms;
+	/* ioctl failed */
+	ast_log(LOG_WARNING, "Unable to determine alarm on channel %d\n", p->channel);
+#endif
+	return DAHDI_ALARM_NONE;
 }
 
 static void dahdi_handle_dtmfup(struct ast_channel *ast, int index, struct ast_frame **dest)

Modified: branches/1.4/configure.ac
URL: http://svn.digium.com/view/asterisk/branches/1.4/configure.ac?view=diff&rev=139145&r1=139144&r2=139145
==============================================================================
--- branches/1.4/configure.ac (original)
+++ branches/1.4/configure.ac Wed Aug 20 14:35:59 2008
@@ -1458,6 +1458,15 @@
 	fi
 	PBX_ZAPTEL=1
 	AC_DEFINE([HAVE_ZAPTEL], 1, [Define if your system has the Zaptel headers.])
+	saved_cppflags="${CPPFLAGS}"
+	CPPFLAGS="${CPPFLAGS} ${ZAPTEL_INCLUDE}"
+	AC_CHECK_MEMBER([ZT_PARAMS.chan_alarms],,,[#include <zaptel/zaptel.h>])
+	CPPFLAGS="${saved_cppflags}"
+	if test "${ac_cv_member_ZT_PARAMS_chan_alarms}" = "yes"; then
+	     AC_DEFINE([HAVE_ZAPTEL_CHANALARMS], 1, [Define if your Zaptel drivers have chan_alarms.])
+	else
+	     AC_DEFINE([HAVE_ZAPTEL_CHANALARMS], 0, [Define if your Zaptel drivers have chan_alarms.])
+	fi
    elif test -n "${ZAPTEL_MANDATORY}"; 
    then
       AC_MSG_NOTICE([***])

Modified: branches/1.4/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/autoconfig.h.in?view=diff&rev=139145&r1=139144&r2=139145
==============================================================================
--- branches/1.4/include/asterisk/autoconfig.h.in (original)
+++ branches/1.4/include/asterisk/autoconfig.h.in Wed Aug 20 14:35:59 2008
@@ -545,6 +545,9 @@
 
 /* Define if your system has the Zaptel headers. */
 #undef HAVE_ZAPTEL
+
+/* Define if your Zaptel drivers have chan_alarms. */
+#undef HAVE_ZAPTEL_CHANALARMS
 
 /* Define to indicate the ${ZLIB_DESCRIP} library */
 #undef HAVE_ZLIB




More information about the svn-commits mailing list