Add Zap MTP2 support to chan_zap
authorMatthew Fredrickson <creslin@digium.com>
Sun, 11 May 2008 03:23:05 +0000 (03:23 +0000)
committerMatthew Fredrickson <creslin@digium.com>
Sun, 11 May 2008 03:23:05 +0000 (03:23 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115600 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_zap.c
configure
configure.ac
include/asterisk/autoconfig.h.in

index d134f69..81166ee 100644 (file)
@@ -9315,7 +9315,7 @@ static void *ss7_linkset(void *data)
 
                for (i = 0; i < linkset->numsigchans; i++) {
                        pollers[i].fd = linkset->fds[i];
-                       pollers[i].events = POLLIN | POLLOUT | POLLPRI;
+                       pollers[i].events = ss7_pollflags(ss7, linkset->fds[i]);
                        pollers[i].revents = 0;
                }
 
@@ -12849,7 +12849,11 @@ static int linkset_addsigchan(int sigchan)
                        ast_log(LOG_ERROR, "Unable to get parameters for sigchan %d (%s)\n", sigchan, strerror(errno));
                        return -1;
                }
-               if ((p.sigtype != ZT_SIG_HDLCFCS) && (p.sigtype != ZT_SIG_HARDHDLC)) {
+               if ((p.sigtype != ZT_SIG_HDLCFCS) && (p.sigtype != ZT_SIG_HARDHDLC) 
+#if defined(HAVE_ZAPTEL_SIG_MTP2)
+                               && (p.sigtype != ZT_SIG_MTP2)
+#endif
+                               ) {
                        zt_close(link->fds[curfd]);
                        link->fds[curfd] = -1;
                        ast_log(LOG_ERROR, "sigchan %d is not in HDLC/FCS mode.  See /etc/zaptel.conf\n", sigchan);
index edf62cd..1c64ba7 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 115342 .
+# From configure.ac Revision: 115580 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for asterisk 1.6.
 #
@@ -970,6 +970,7 @@ PBX_ZAPTEL_ECHOCANPARAMS
 PBX_ZAPTEL_TRANSCODE
 PBX_ZAPTEL_HWGAIN
 PBX_ZAPTEL_NEONMWI
+PBX_ZAPTEL_SIG_MTP2
 EDITLINE_LIB
 PBX_H323
 PBX_IXJUSER
@@ -38844,7 +38845,7 @@ if test "x${PBX_SS7}" != "x1" -a "${USE_SS7}" != "no"; then
         pbxlibdir="-L${SS7_DIR}"
       fi
    fi
-   pbxfuncname="ss7_get_version"
+   pbxfuncname="ss7_pollflags"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
       AST_SS7_FOUND=yes
    else
@@ -46804,6 +46805,84 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     fi
 
 
+# Check for ZT_SIG_MTP2
+
+    if test "x${PBX_ZAPTEL_SIG_MTP2}" != "x1"; then
+       { echo "$as_me:$LINENO: checking for ZT_SIG_MTP2 in zaptel/zaptel.h" >&5
+echo $ECHO_N "checking for ZT_SIG_MTP2 in zaptel/zaptel.h... $ECHO_C" >&6; }
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${ZAPTEL_SIG_MTP2_DIR}" != "x"; then
+           ZAPTEL_SIG_MTP2_INCLUDE="-I${ZAPTEL_SIG_MTP2_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${ZAPTEL_SIG_MTP2_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 ()
+{
+#if defined(ZT_SIG_MTP2)
+                               int foo = 0;
+                               #else
+                               int foo = bar;
+                               #endif
+                               0
+
+  ;
+  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_SIG_MTP2=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ZAPTEL_SIG_MTP2 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ZAPTEL_SIG_MTP2_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
+
+
+
 # On FreeBSD, try old zaptel (0.80 or so) and pretend we have vldtmf
 case "${host_os}" in
     freebsd*)
@@ -51193,6 +51272,7 @@ PBX_ZAPTEL_ECHOCANPARAMS!$PBX_ZAPTEL_ECHOCANPARAMS$ac_delim
 PBX_ZAPTEL_TRANSCODE!$PBX_ZAPTEL_TRANSCODE$ac_delim
 PBX_ZAPTEL_HWGAIN!$PBX_ZAPTEL_HWGAIN$ac_delim
 PBX_ZAPTEL_NEONMWI!$PBX_ZAPTEL_NEONMWI$ac_delim
+PBX_ZAPTEL_SIG_MTP2!$PBX_ZAPTEL_SIG_MTP2$ac_delim
 EDITLINE_LIB!$EDITLINE_LIB$ac_delim
 PBX_H323!$PBX_H323$ac_delim
 PBX_IXJUSER!$PBX_IXJUSER$ac_delim
@@ -51203,7 +51283,7 @@ CURL_CONFIG!$CURL_CONFIG$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 68; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 69; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index 15a3f3a..731197f 100644 (file)
@@ -1290,7 +1290,7 @@ AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 
 AST_EXT_LIB_CHECK([PRI], [pri], [pri_get_version], [libpri.h])
 
-AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_get_version], [libss7.h])
+AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_pollflags], [libss7.h])
 
 if test "${USE_PWLIB}" != "no"; then
        if test -n "${PWLIB_DIR}"; then
@@ -1485,6 +1485,9 @@ AST_C_DEFINE_CHECK([ZAPTEL_NEONMWI], [ZT_EVENT_NEONMWI_ACTIVE], [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])
 
+# Check for ZT_SIG_MTP2
+AST_C_DEFINE_CHECK([ZAPTEL_SIG_MTP2], [ZT_SIG_MTP2], [zaptel/zaptel.h])
+
 # On FreeBSD, try old zaptel (0.80 or so) and pretend we have vldtmf
 case "${host_os}" in
     freebsd*)
index c5da3f7..4f19c8f 100644 (file)
 /* Define ZAPTEL_NEONMWI headers version */
 #undef HAVE_ZAPTEL_NEONMWI_VERSION
 
+/* Define if your system has the ZAPTEL_SIG_MTP2 headers. */
+#undef HAVE_ZAPTEL_SIG_MTP2
+
+/* Define ZAPTEL_SIG_MTP2 headers version */
+#undef HAVE_ZAPTEL_SIG_MTP2_VERSION
+
 /* Define if your system has the ZAPTEL_TRANSCODE headers. */
 #undef HAVE_ZAPTEL_TRANSCODE