[asterisk-commits] jpeeler: branch 1.4 r182963 - in /branches/1.4: ./ autoconf/ channels/ channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 18 14:57:08 CDT 2009


Author: jpeeler
Date: Wed Mar 18 14:57:05 2009
New Revision: 182963

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=182963
Log:
Allow H.323 Plus library to be used in addition to the OpenH323 library

Chan_h323 can now be compiled against both the previously supported versions of
OpenH323 as well as the current H.323 Plus (version 1.20.2). The configure
script has been modified to look in the default install location of h323 to
hopefully help avoid using the environment variables OPENH323DIR and PWLIBDIR.
Also, the CLI command "h323 show version" has been added which indicates which
version of h323 is in use.

(closes issue 0011261)
Reported by: vhatz
Patches:
      asterisk-1.6.0.6-h323plus.patch uploaded by jthurman (license 614)


Modified:
    branches/1.4/autoconf/ast_check_openh323.m4
    branches/1.4/channels/chan_h323.c
    branches/1.4/channels/h323/ast_h323.cxx
    branches/1.4/channels/h323/ast_h323.h
    branches/1.4/channels/h323/chan_h323.h
    branches/1.4/channels/h323/compat_h323.cxx
    branches/1.4/channels/h323/compat_h323.h
    branches/1.4/configure

Modified: branches/1.4/autoconf/ast_check_openh323.m4
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/autoconf/ast_check_openh323.m4?view=diff&rev=182963&r1=182962&r2=182963
==============================================================================
--- branches/1.4/autoconf/ast_check_openh323.m4 (original)
+++ branches/1.4/autoconf/ast_check_openh323.m4 Wed Mar 18 14:57:05 2009
@@ -16,19 +16,19 @@
   else
     saved_cppflags="${CPPFLAGS}"
     CPPFLAGS="${CPPFLAGS} -I${HOME}/openh323/include -I${PWLIB_INCDIR}"
-    AC_CHECK_HEADER(${HOME}/openh323/include/h323.h, HAS_OPENH323=1, )
+    AC_CHECK_HEADER(${HOME}/openh323/include/h323.h, HAS_OPENH323=1, , [#include <ptlib.h>])
     CPPFLAGS="${saved_cppflags}"
     if test "${HAS_OPENH323:-unset}" != "unset" ; then
       OPENH323DIR="${HOME}/openh323"
     else
       saved_cppflags="${CPPFLAGS}"
       CPPFLAGS="${CPPFLAGS} -I/usr/local/include/openh323 -I${PWLIB_INCDIR}"
-      AC_CHECK_HEADER(/usr/local/include/openh323/h323.h, HAS_OPENH323=1, )
+      AC_CHECK_HEADER(/usr/local/include/openh323/h323.h, HAS_OPENH323=1, , [#include <ptlib.h>])
       CPPFLAGS="${saved_cppflags}"
       if test "${HAS_OPENH323:-unset}" != "unset" ; then
         OPENH323DIR="/usr/local/share/openh323"
         OPENH323_INCDIR="/usr/local/include/openh323"
-        if test "x$LIB64" != "x"; then
+        if test "x$LIB64" != "x" && test -d "/usr/local/lib64"; then
           OPENH323_LIBDIR="/usr/local/lib64"
         else
           OPENH323_LIBDIR="/usr/local/lib"
@@ -41,7 +41,7 @@
         if test "${HAS_OPENH323:-unset}" != "unset" ; then
           OPENH323DIR="/usr/share/openh323"
           OPENH323_INCDIR="/usr/include/openh323"
-          if test "x$LIB64" != "x"; then
+          if test "x$LIB64" != "x" && test -d "/usr/local/lib64"; then
             OPENH323_LIBDIR="/usr/lib64"
           else
             OPENH323_LIBDIR="/usr/lib"
@@ -77,6 +77,10 @@
 		prefixes="h323_${PWLIB_PLATFORM}_ h323_ openh323"
 		for pfx in $prefixes; do
 			files=`ls -l ${OPENH323_LIBDIR}/lib${pfx}*.so* 2>/dev/null`
+			if test -z "$files"; then
+				# check the default location
+				#files=`ls -l /usr/local/lib/lib${pfx}*.so* 2>/dev/null`
+			fi	
 			libfile=
 			if test -n "$files"; then
 				for f in $files; do

Modified: branches/1.4/channels/chan_h323.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/channels/chan_h323.c?view=diff&rev=182963&r1=182962&r2=182963
==============================================================================
--- branches/1.4/channels/chan_h323.c (original)
+++ branches/1.4/channels/chan_h323.c Wed Mar 18 14:57:05 2009
@@ -2618,6 +2618,15 @@
 	return RESULT_SUCCESS;
 }
 
+static int h323_version_show(int fd, int argc, char *argv[])
+{
+	if (argc != 3) {
+		return RESULT_SHOWUSAGE;
+	}
+	h323_show_version();
+	return RESULT_SUCCESS;
+}
+
 static char trace_usage[] =
 "Usage: h.323 trace <level num>\n"
 "       Enables H.323 stack tracing for debugging purposes\n";
@@ -2645,6 +2654,10 @@
 static char show_tokens_usage[] =
 "Usage: h.323 show tokens\n"
 "       Print out all active call tokens\n";
+
+static char show_version_usage[] =
+"Usage: h.323 show version\n"
+"		Print the version of the H.323 library in use\n";
 
 static char h323_reload_usage[] =
 "Usage: h323 reload\n"
@@ -2703,6 +2716,10 @@
 	{ { "h323", "show", "tokens", NULL },
 	h323_tokens_show, "Show all active call tokens",
 	show_tokens_usage },
+
+	{ { "h323", "show", "version", NULL },
+	h323_version_show, "Show the version of the H.323 library in use",
+	show_version_usage },
 };
 
 static void delete_users(void)

Modified: branches/1.4/channels/h323/ast_h323.cxx
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/channels/h323/ast_h323.cxx?view=diff&rev=182963&r1=182962&r2=182963
==============================================================================
--- branches/1.4/channels/h323/ast_h323.cxx (original)
+++ branches/1.4/channels/h323/ast_h323.cxx Wed Mar 18 14:57:05 2009
@@ -1,6 +1,3 @@
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 /*
  * ast_h323.cpp
  *
@@ -29,6 +26,8 @@
  * Version Info: $Id$
  */
 #include "asterisk.h"
+#define VERSION(a,b,c) ((a)*10000+(b)*100+(c))
+
 
 #include <arpa/inet.h>
 
@@ -41,6 +40,24 @@
 #include <h323pdu.h>
 #include <h323neg.h>
 #include <mediafmt.h>
+
+
+/* H323 Plus */
+#if VERSION(OPENH323_MAJOR, OPENH323_MINOR, OPENH323_BUILD) > VERSION(1,19,4)
+
+#ifdef H323_H450
+#include "h450/h4501.h"
+#include "h450/h4504.h"
+#include "h450/h45011.h"
+#include "h450/h450pdu.h"
+#endif
+
+#ifdef H323_H460
+#include <h460/h4601.h>
+#endif
+
+#else /* !H323 Plus */
+
 #include <lid.h>
 #ifdef H323_H450
 #include "h4501.h"
@@ -49,6 +66,10 @@
 #include "h450pdu.h"
 #endif
 
+#endif /* H323 Plus */
+
+#include "compat_h323.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -64,15 +85,23 @@
 #include "cisco-h225.h"
 #include "caps_h323.h"
 
-#if PWLIB_MAJOR * 10000 + PWLIB_MINOR * 100 + PWLIB_BUILD >= 1 * 10000 + 12 * 100 + 0
+/* PWLIB_MAJOR renamed to PTLIB_MAJOR in 2.x.x */
+#if (defined(PTLIB_MAJOR) || VERSION(PWLIB_MAJOR, PWLIB_MINOR, PWLIB_BUILD) >= VERSION(1,12,0))
 #define SKIP_PWLIB_PIPE_BUG_WORKAROUND 1
 #endif
 
 /* PWlib Required Components  */
+#if VERSION(OPENH323_MAJOR, OPENH323_MINOR, OPENH323_BUILD) > VERSION(1,19,4)
+#define MAJOR_VERSION 1
+#define MINOR_VERSION 19
+#define BUILD_TYPE    ReleaseCode
+#define BUILD_NUMBER  6
+#else
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 0
 #define BUILD_TYPE    ReleaseCode
 #define BUILD_NUMBER  0
+#endif
 
 /** Counter for the number of connections */
 static int channelsOpen;
@@ -1979,7 +2008,7 @@
 			cout << "Using " << addr << " for outbound H.245 transport" << endl;
 		controlChannel = new MyH323TransportTCP(endpoint, addr);
 	} else
-		controlChannel = new H323TransportTCP(endpoint);
+		controlChannel = new MyH323TransportTCP(endpoint);
 	if (!controlChannel->SetRemoteAddress(h245Address)) {
 		PTRACE(1, "H225\tCould not extract H245 address");
 		delete controlChannel;
@@ -2207,6 +2236,35 @@
 	return 0;
 };
 
+/* Addition of functions just to make the channel driver compile with H323Plus */
+#if VERSION(OPENH323_MAJOR, OPENH323_MINOR, OPENH323_BUILD) > VERSION(1,19,4)
+/* Alternate RTP port information for Same NAT */
+BOOL MyH323_ExternalRTPChannel::OnReceivedAltPDU(const H245_ArrayOf_GenericInformation & alternate )
+{
+	return TRUE;
+}
+
+/* Alternate RTP port information for Same NAT */
+BOOL MyH323_ExternalRTPChannel::OnSendingAltPDU(H245_ArrayOf_GenericInformation & alternate) const
+{
+	return TRUE;
+}
+
+/* Alternate RTP port information for Same NAT */
+void MyH323_ExternalRTPChannel::OnSendOpenAckAlt(H245_ArrayOf_GenericInformation & alternate) const
+{
+}
+
+/* Alternate RTP port information for Same NAT */
+BOOL MyH323_ExternalRTPChannel::OnReceivedAckAltPDU(const H245_ArrayOf_GenericInformation & alternate)
+{
+	return TRUE;
+}
+#endif
+
+
+
+
 int h323_set_alias(struct oh323_alias *alias)
 {
 	char *p;
@@ -2255,6 +2313,11 @@
 void h323_show_tokens(void)
 {
 	cout << "Current call tokens: " << setprecision(2) << endPoint->GetAllConnections() << endl;
+}
+
+void h323_show_version(void)
+{
+    cout << "H.323 version: " << OPENH323_MAJOR << "." << OPENH323_MINOR << "." << OPENH323_BUILD << endl;
 }
 
 /** Establish Gatekeeper communiations, if so configured,

Modified: branches/1.4/channels/h323/ast_h323.h
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/channels/h323/ast_h323.h?view=diff&rev=182963&r1=182962&r2=182963
==============================================================================
--- branches/1.4/channels/h323/ast_h323.h (original)
+++ branches/1.4/channels/h323/ast_h323.h Wed Mar 18 14:57:05 2009
@@ -145,6 +145,13 @@
 
 	PIPSocket::Address localIpAddr;
 	PIPSocket::Address remoteIpAddr;
+	/* Additional functions in order to have chan_h323 compile with H323Plus */
+#if VERSION(OPENH323_MAJOR, OPENH323_MINOR, OPENH323_BUILD) > VERSION(1,19,4)
+	BOOL OnReceivedAltPDU(const H245_ArrayOf_GenericInformation & alternate );
+	BOOL OnSendingAltPDU(H245_ArrayOf_GenericInformation & alternate) const;
+	void OnSendOpenAckAlt(H245_ArrayOf_GenericInformation & alternate) const;
+	BOOL OnReceivedAckAltPDU(const H245_ArrayOf_GenericInformation & alternate);
+#endif
 	WORD localPort;
 	WORD remotePort;
 };

Modified: branches/1.4/channels/h323/chan_h323.h
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/channels/h323/chan_h323.h?view=diff&rev=182963&r1=182962&r2=182963
==============================================================================
--- branches/1.4/channels/h323/chan_h323.h (original)
+++ branches/1.4/channels/h323/chan_h323.h Wed Mar 18 14:57:05 2009
@@ -228,6 +228,7 @@
 	int h323_set_gk(int, char *, char *);
 	void h323_set_id(char *);
 	void h323_show_tokens(void);
+	void h323_show_version(void);
 
 	/* H323 listener related funcions */
 	int h323_start_listener(int, struct sockaddr_in);

Modified: branches/1.4/channels/h323/compat_h323.cxx
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/channels/h323/compat_h323.cxx?view=diff&rev=182963&r1=182962&r2=182963
==============================================================================
--- branches/1.4/channels/h323/compat_h323.cxx (original)
+++ branches/1.4/channels/h323/compat_h323.cxx Wed Mar 18 14:57:05 2009
@@ -33,6 +33,7 @@
 #include <transports.h>
 
 #include "ast_h323.h"
+#include "compat_h323.h"
 
 #if VERSION(OPENH323_MAJOR,OPENH323_MINOR,OPENH323_BUILD) < VERSION(1,17,3)
 MyH323TransportTCP::MyH323TransportTCP(

Modified: branches/1.4/channels/h323/compat_h323.h
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/channels/h323/compat_h323.h?view=diff&rev=182963&r1=182962&r2=182963
==============================================================================
--- branches/1.4/channels/h323/compat_h323.h (original)
+++ branches/1.4/channels/h323/compat_h323.h Wed Mar 18 14:57:05 2009
@@ -1,5 +1,7 @@
 #ifndef COMPAT_H323_H
 #define COMPAT_H323_H
+
+#include "ast_ptlib.h"
 
 #if VERSION(OPENH323_MAJOR,OPENH323_MINOR,OPENH323_BUILD) < VERSION(1,17,3)
 /**




More information about the asterisk-commits mailing list