[asterisk-commits] kpfleming: trunk r96500 - in /trunk: ./ channels/ include/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 4 11:21:25 CST 2008


Author: kpfleming
Date: Fri Jan  4 11:21:25 2008
New Revision: 96500

URL: http://svn.digium.com/view/asterisk?view=rev&rev=96500
Log:
[commit message]

(closes issue #10393)
Reported by: tzafrir
Patches:
      chan_alarm_asterisk.diff uploaded by tzafrir (license 46) (modified by me and added configure script support)


Modified:
    trunk/acinclude.m4
    trunk/channels/chan_zap.c
    trunk/configure
    trunk/configure.ac
    trunk/include/asterisk/autoconfig.h.in

Modified: trunk/acinclude.m4
URL: http://svn.digium.com/view/asterisk/trunk/acinclude.m4?view=diff&rev=96500&r1=96499&r2=96500
==============================================================================
--- trunk/acinclude.m4 (original)
+++ trunk/acinclude.m4 Fri Jan  4 11:21:25 2008
@@ -75,6 +75,7 @@
 
 # The next three functions check for the availability of a given package.
 # AST_C_DEFINE_CHECK looks for the presence of a #define in a header file,
+# AST_C_COMPILE_CHECK can be used for testing for various items in header files,
 # AST_EXT_LIB_CHECK looks for a symbol in a given library, or at least
 #	for the presence of a header file.
 # AST_EXT_TOOL_CHECK looks for a symbol in using $1-config to determine CFLAGS and LIBS
@@ -108,6 +109,35 @@
 			        #endif
 				0
 			       ])],
+	    [   AC_MSG_RESULT(yes)
+		PBX_$1=1
+		AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.])
+		AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version])
+	    ],
+	    [       AC_MSG_RESULT(no) ] 
+	)
+	CPPFLAGS="${saved_cppflags}"
+    fi
+])
+
+
+# Check if a given expression will compile using a certain header.
+
+# AST_C_COMPILE_CHECK([package], [expression], [header file], [version])
+AC_DEFUN([AST_C_COMPILE_CHECK],
+[
+    if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
+	AC_MSG_CHECKING([if "$2" compiles using $3])
+	saved_cppflags="${CPPFLAGS}"
+	if test "x${$1_DIR}" != "x"; then
+	    $1_INCLUDE="-I${$1_DIR}/include"
+	fi
+	CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
+
+	AC_COMPILE_IFELSE(
+	    [ AC_LANG_PROGRAM( [#include <$3>],
+			       [ $2; ]
+			       )],
 	    [   AC_MSG_RESULT(yes)
 		PBX_$1=1
 		AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.])

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=96500&r1=96499&r2=96500
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Fri Jan  4 11:21:25 2008
@@ -4170,18 +4170,35 @@
 	return 0;
 }
 
+/*! Checks channel for alarms
+ * \param p a channel to check for alarms.
+ * \returns the alarms on the span to which the channel belongs, or alarms on
+ *          the channel if no span alarms.
+ */
 static int get_alarms(struct zt_pvt *p)
 {
 	int res;
 	ZT_SPANINFO zi;
+#if defined(HAVE_ZAPTEL_CHANALARMS)
+	struct zt_params params;
+#endif
+
 	memset(&zi, 0, sizeof(zi));
 	zi.spanno = p->span;
-	res = ioctl(p->subs[SUB_REAL].zfd, ZT_SPANSTAT, &zi);
-	if (res < 0) {
-		ast_log(LOG_WARNING, "Unable to determine alarm on channel %d\n", p->channel);
-		return 0;
-	}
-	return zi.alarms;
+	if ((res = ioctl(p->subs[SUB_REAL].zfd, ZT_SPANSTAT, &zi)) >= 0) {
+		if (zi.alarms != ZT_ALARM_NONE)
+			return zi.alarms;
+	}
+
+#if defined(HAVE_ZAPTEL_CHANALARMS)
+	/* No alarms on the span. Check for channel alarms. */
+	if ((res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &params)) >= 0)
+		return params.chan_alarms;
+#endif
+
+	ast_log(LOG_WARNING, "Unable to determine alarm on channel %d\n", p->channel);
+
+	return ZT_ALARM_NONE;
 }
 
 static void zt_handle_dtmfup(struct ast_channel *ast, int index, struct ast_frame **dest)

Modified: trunk/configure
URL: http://svn.digium.com/view/asterisk/trunk/configure?view=diff&rev=96500&r1=96499&r2=96500
==============================================================================
--- trunk/configure (original)
+++ trunk/configure Fri Jan  4 11:21:25 2008
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 95937 .
+# From configure.ac Revision: 96071 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for asterisk 1.4.
 #
@@ -932,6 +932,10 @@
 ZAPTEL_ECHOCANPARAMS_INCLUDE
 ZAPTEL_ECHOCANPARAMS_DIR
 PBX_ZAPTEL_ECHOCANPARAMS
+ZAPTEL_CHANALARMS_LIB
+ZAPTEL_CHANALARMS_INCLUDE
+ZAPTEL_CHANALARMS_DIR
+PBX_ZAPTEL_CHANALARMS
 SDL_LIB
 SDL_INCLUDE
 SDL_DIR
@@ -1630,6 +1634,8 @@
   --with-zaptel_echocanparams=PATH
                           use Zaptel Echo Canceler Parameter Support files in
                           PATH
+  --with-zaptel_chanalarms=PATH
+                          use Zaptel Channel Alarm Support files in PATH
   --with-sdl=PATH         use Sdl files in PATH
   --with-SDL_image=PATH   use Sdl Image library files in PATH
   --with-avcodec=PATH     use Ffmpeg and avcodec library files in PATH
@@ -9370,6 +9376,34 @@
 fi
 
     PBX_ZAPTEL_ECHOCANPARAMS=0
+
+
+
+
+
+
+    ZAPTEL_CHANALARMS_DESCRIP="Zaptel Channel Alarm Support"
+    ZAPTEL_CHANALARMS_OPTION="zaptel_chanalarms"
+
+# Check whether --with-zaptel_chanalarms was given.
+if test "${with_zaptel_chanalarms+set}" = set; then
+  withval=$with_zaptel_chanalarms;
+	case ${withval} in
+	n|no)
+	USE_ZAPTEL_CHANALARMS=no
+	;;
+	y|ye|yes)
+	ac_mandatory_list="${ac_mandatory_list} ZAPTEL_CHANALARMS"
+	;;
+	*)
+	ZAPTEL_CHANALARMS_DIR="${withval}"
+	ac_mandatory_list="${ac_mandatory_list} ZAPTEL_CHANALARMS"
+	;;
+	esac
+
+fi
+
+    PBX_ZAPTEL_CHANALARMS=0
 
 
 
@@ -44995,7 +45029,7 @@
     fi
 
 
-# Check for Zaptel hwgain support
+# Check for hwgain support
 
     if test "x${PBX_ZAPTEL_HWGAIN}" != "x1" -a "${USE_ZAPTEL_HWGAIN}" != "no"; then
 	{ echo "$as_me:$LINENO: checking for ZT_SET_HWGAIN in zaptel/zaptel.h" >&5
@@ -45055,6 +45089,78 @@
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_ZAPTEL_HWGAIN_VERSION
+_ACEOF
+
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	       { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	CPPFLAGS="${saved_cppflags}"
+    fi
+
+
+# Check for channel alarm support
+
+    if test "x${PBX_ZAPTEL_CHANALARMS}" != "x1" -a "${USE_ZAPTEL_CHANALARMS}" != "no"; then
+	{ echo "$as_me:$LINENO: checking if \"size_t foo = sizeof(struct zt_params_v1)\" compiles using zaptel/zaptel.h" >&5
+echo $ECHO_N "checking if \"size_t foo = sizeof(struct zt_params_v1)\" compiles using zaptel/zaptel.h... $ECHO_C" >&6; }
+	saved_cppflags="${CPPFLAGS}"
+	if test "x${ZAPTEL_CHANALARMS_DIR}" != "x"; then
+	    ZAPTEL_CHANALARMS_INCLUDE="-I${ZAPTEL_CHANALARMS_DIR}/include"
+	fi
+	CPPFLAGS="${CPPFLAGS} ${ZAPTEL_CHANALARMS_INCLUDE}"
+
+	cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <zaptel/zaptel.h>
+int
+main ()
+{
+ size_t foo = sizeof(struct zt_params_v1);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+     { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+		PBX_ZAPTEL_CHANALARMS=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ZAPTEL_CHANALARMS 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ZAPTEL_CHANALARMS_VERSION
 _ACEOF
 
 
@@ -49263,6 +49369,10 @@
 ZAPTEL_ECHOCANPARAMS_INCLUDE!$ZAPTEL_ECHOCANPARAMS_INCLUDE$ac_delim
 ZAPTEL_ECHOCANPARAMS_DIR!$ZAPTEL_ECHOCANPARAMS_DIR$ac_delim
 PBX_ZAPTEL_ECHOCANPARAMS!$PBX_ZAPTEL_ECHOCANPARAMS$ac_delim
+ZAPTEL_CHANALARMS_LIB!$ZAPTEL_CHANALARMS_LIB$ac_delim
+ZAPTEL_CHANALARMS_INCLUDE!$ZAPTEL_CHANALARMS_INCLUDE$ac_delim
+ZAPTEL_CHANALARMS_DIR!$ZAPTEL_CHANALARMS_DIR$ac_delim
+PBX_ZAPTEL_CHANALARMS!$PBX_ZAPTEL_CHANALARMS$ac_delim
 SDL_LIB!$SDL_LIB$ac_delim
 SDL_INCLUDE!$SDL_INCLUDE$ac_delim
 SDL_DIR!$SDL_DIR$ac_delim
@@ -49308,7 +49418,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 64; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 68; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

Modified: trunk/configure.ac
URL: http://svn.digium.com/view/asterisk/trunk/configure.ac?view=diff&rev=96500&r1=96499&r2=96500
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Fri Jan  4 11:21:25 2008
@@ -254,6 +254,7 @@
 AST_EXT_LIB_SETUP([ZAPTEL_VLDTMF], [Zaptel VLDTMF Support], [zaptel_vldtmf])
 AST_EXT_LIB_SETUP([ZAPTEL_HWGAIN], [Zaptel Hardware Gain Support], [zaptel_hwgain])
 AST_EXT_LIB_SETUP([ZAPTEL_ECHOCANPARAMS], [Zaptel Echo Canceler Parameter Support], [zaptel_echocanparams])
+AST_EXT_LIB_SETUP([ZAPTEL_CHANALARMS], [Zaptel Channel Alarm Support], [zaptel_chanalarms])
 
 AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
 AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image library], [SDL_image])
@@ -1166,8 +1167,11 @@
 # Check for transcoder support
 AST_C_DEFINE_CHECK([ZAPTEL_TRANSCODE], [ZT_TCOP_ALLOCATE], [zaptel/zaptel.h])
 
-# Check for Zaptel hwgain support
+# Check for hwgain support
 AST_C_DEFINE_CHECK([ZAPTEL_HWGAIN], [ZT_SET_HWGAIN], [zaptel/zaptel.h])
+
+# Check for channel alarm support
+AST_C_COMPILE_CHECK([ZAPTEL_CHANALARMS], [size_t foo = sizeof(struct zt_params_v1)], [zaptel/zaptel.h])
 
 # On FreeBSD, try old zaptel (0.80 or so) and pretend we have vldtmf
 case "${host_os}" in

Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=96500&r1=96499&r2=96500
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Fri Jan  4 11:21:25 2008
@@ -1007,6 +1007,12 @@
 
 /* Define this to indicate the ${ZAPTEL_DESCRIP} library */
 #undef HAVE_ZAPTEL
+
+/* Define if your system has the ZAPTEL_CHANALARMS headers. */
+#undef HAVE_ZAPTEL_CHANALARMS
+
+/* Define ZAPTEL_CHANALARMS headers version */
+#undef HAVE_ZAPTEL_CHANALARMS_VERSION
 
 /* Define if your system has the ZAPTEL_ECHOCANPARAMS headers. */
 #undef HAVE_ZAPTEL_ECHOCANPARAMS




More information about the asterisk-commits mailing list