[asterisk-commits] jpeeler: branch jpeeler/bug11261 r181973 - /team/jpeeler/bug11261/channels/h323/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 13 10:51:12 CDT 2009


Author: jpeeler
Date: Fri Mar 13 10:51:09 2009
New Revision: 181973

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=181973
Log:
commit current work

Modified:
    team/jpeeler/bug11261/channels/h323/ast_h323.cxx
    team/jpeeler/bug11261/channels/h323/ast_h323.h
    team/jpeeler/bug11261/channels/h323/compat_h323.cxx

Modified: team/jpeeler/bug11261/channels/h323/ast_h323.cxx
URL: http://svn.digium.com/svn-view/asterisk/team/jpeeler/bug11261/channels/h323/ast_h323.cxx?view=diff&rev=181973&r1=181972&r2=181973
==============================================================================
--- team/jpeeler/bug11261/channels/h323/ast_h323.cxx (original)
+++ team/jpeeler/bug11261/channels/h323/ast_h323.cxx Fri Mar 13 10:51:09 2009
@@ -42,13 +42,18 @@
 #include <h323pdu.h>
 #include <h323neg.h>
 #include <mediafmt.h>
-#include <lid.h>
 #ifdef H323_H450
-#include "h4501.h"
-#include "h4504.h"
-#include "h45011.h"
-#include "h450pdu.h"
-#endif
+#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
+
+#include "compat_h323.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -70,11 +75,29 @@
 #define SKIP_PWLIB_PIPE_BUG_WORKAROUND 1
 #endif
 
+///////////////////////////////////////////////
+/* We have to have a PProcess running for the life of the instance to give
+ * h323plus a static instance of PProcess to get system information.
+ * This class is defined with PDECLARE_PROCESS().  See pprocess.h from pwlib.
+ */
+
 /* PWlib Required Components  */
 #define MAJOR_VERSION 1
-#define MINOR_VERSION 0
+#define MINOR_VERSION 19
 #define BUILD_TYPE    ReleaseCode
-#define BUILD_NUMBER  0
+#define BUILD_NUMBER  6
+ 
+const char * h323manufact = "The NuFone Networks";
+const char * h323product  = "H.323 Channel Driver for Asterisk";
+ 
+PDECLARE_PROCESS(MyProcess,PProcess,h323manufact,h323product,MAJOR_VERSION,MINOR_VERSION,BUILD_TYPE,BUILD_NUMBER)
+static MyProcess localProcess;  // active for the life of the DLL
+/* void MyProcess::Main()
+{
+}
+*/
+////////////////////////////////////////////////
+
 
 /** Counter for the number of connections */
 static int channelsOpen;
@@ -85,13 +108,6 @@
  * FIXME: Singleton this, for safety
  */
 static MyH323EndPoint *endPoint = NULL;
-
-/** PWLib entry point */
-static MyProcess *localProcess = NULL;
-
-#ifndef SKIP_PWLIB_PIPE_BUG_WORKAROUND
-static int _timerChangePipe[2];
-#endif
 
 static unsigned traceOptions = PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine;
 
@@ -177,36 +193,6 @@
 	(logstream ? (PTrace::ClearOptions((unsigned)-1), PTrace::Begin(0, __FILE__, __LINE__)) : std::cout)
 #define endl my_endl
 
-/* Special class designed to call cleanup code on module destruction */
-class MyH323_Shutdown {
-	public:
-	MyH323_Shutdown() { };
-	~MyH323_Shutdown()
-	{
-		h323_end_process();
-	};
-};
-
-MyProcess::MyProcess(): PProcess("The NuFone Networks",
-			"H.323 Channel Driver for Asterisk",
-			MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER)
-{
-	/* Call shutdown when module being unload or asterisk has been stopped */
-	static MyH323_Shutdown x;
-
-	/* Fix missed one in PWLib */
-	PX_firstTimeStart = FALSE;
-	Resume();
-}
-
-MyProcess::~MyProcess()
-{
-#ifndef SKIP_PWLIB_PIPE_BUG_WORKAROUND
-	_timerChangePipe[0] = timerChangePipe[0];
-	_timerChangePipe[1] = timerChangePipe[1];
-#endif
-}
-
 void MyProcess::Main()
 {
 	PTrace::Initialise(PTrace::GetLevel(), NULL, traceOptions);
@@ -279,7 +265,8 @@
 				if (addr) {
 					if (h323debug)
 						cout << "Using " << addr << " for outbound call" << endl;
-					transport = new MyH323TransportTCP(*this, addr);
+/* jpeeler: fix */
+					transport = new H323TransportTCP(*this, addr);
 					if (!transport)
 						cout << "Unable to create transport for outgoing call" << endl;
 				}
@@ -2061,6 +2048,7 @@
 			cout << "Using " << addr << " for outbound H.245 transport" << endl;
 		controlChannel = new MyH323TransportTCP(endpoint, addr);
 	} else
+/* jpeeler: fix */
 		controlChannel = new H323TransportTCP(endpoint);
 	if (!controlChannel->SetRemoteAddress(h245Address)) {
 		PTRACE(1, "H225\tCould not extract H245 address");
@@ -2250,8 +2238,7 @@
 {
 	channelsOpen = 0;
 	logstream = new PAsteriskLog();
-	localProcess = new MyProcess();
-	localProcess->Main();
+	endPoint = new MyH323EndPoint();
 }
 
 void h323_gk_urq(void)
@@ -2359,6 +2346,32 @@
 	return 0;
 };
 
+/* Addition of functions just to make the channel driver compile with H323Plus */
+
+/* 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;
+}
+
+
 int h323_set_alias(struct oh323_alias *alias)
 {
 	char *p;
@@ -2374,7 +2387,7 @@
 
 	cout << "== Adding alias \"" << h323id << "\" to endpoint" << endl;
 	endPoint->AddAliasName(h323id);
-	endPoint->RemoveAliasName(localProcess->GetUserName());
+	endPoint->RemoveAliasName(PProcess::Current().GetName());
 
 	if (!e164.IsEmpty()) {
 		cout << "== Adding E.164 \"" << e164 << "\" to endpoint" << endl;
@@ -2432,14 +2445,14 @@
 	}
 	if (gatekeeper_discover) {
 		/* discover the gk using multicast */
-		if (endPoint->DiscoverGatekeeper(new MyH323TransportUDP(*endPoint))) {
+		if (endPoint->DiscoverGatekeeper(new H323TransportUDP(*endPoint))) {
 			cout << "== Using " << (endPoint->GetGatekeeper())->GetName() << " as our Gatekeeper." << endl;
 		} else {
 			cout << "Warning: Could not find a gatekeeper." << endl;
 			return 1;
 		}
 	} else {
-		rasChannel = new MyH323TransportUDP(*endPoint);
+		rasChannel = new H323TransportUDP(*endPoint);
 
 		if (!rasChannel) {
 			cout << "Error: No RAS Channel, this is bad" << endl;
@@ -2626,22 +2639,10 @@
 void h323_end_process(void)
 {
 	if (endPoint) {
-		endPoint->ClearAllCalls();
-		endPoint->RemoveListener(NULL);
 		delete endPoint;
 		endPoint = NULL;
 	}
-	if (localProcess) {
-		delete localProcess;
-		localProcess = NULL;
-#ifndef SKIP_PWLIB_PIPE_BUG_WORKAROUND
-		close(_timerChangePipe[0]);
-		close(_timerChangePipe[1]);
-#endif
-	}
 	if (logstream) {
-		PTrace::SetLevel(0);
-		PTrace::SetStream(&cout);
 		delete logstream;
 		logstream = NULL;
 	}

Modified: team/jpeeler/bug11261/channels/h323/ast_h323.h
URL: http://svn.digium.com/svn-view/asterisk/team/jpeeler/bug11261/channels/h323/ast_h323.h?view=diff&rev=181973&r1=181972&r2=181973
==============================================================================
--- team/jpeeler/bug11261/channels/h323/ast_h323.h (original)
+++ team/jpeeler/bug11261/channels/h323/ast_h323.h Fri Mar 13 10:51:09 2009
@@ -151,26 +151,17 @@
 
 	PIPSocket::Address localIpAddr;
 	PIPSocket::Address remoteIpAddr;
+	/* Additional functions in order to have chan_h323 compile with H323Plus */
+	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);
 	WORD localPort;
 	WORD remotePort;
 };
 
-/**
- * The MyProcess is a necessary descendant PProcess class so that the H323EndPoint
- * objected to be created from within that class. (Solves the who owns main() problem).
- */
-class MyProcess : public PProcess
-{
-	PCLASSINFO(MyProcess, PProcess);
-
-public:
-	MyProcess();
-	~MyProcess();
-	void Main();
-};
-
 #ifdef H323_H450
-#include <h450pdu.h>
+#include <h450/h450pdu.h>
 
 class MyH4504Handler : public H4504Handler
 {
@@ -186,6 +177,4 @@
 };
 #endif
 
-#include "compat_h323.h"
-
 #endif /* !defined AST_H323_H */

Modified: team/jpeeler/bug11261/channels/h323/compat_h323.cxx
URL: http://svn.digium.com/svn-view/asterisk/team/jpeeler/bug11261/channels/h323/compat_h323.cxx?view=diff&rev=181973&r1=181972&r2=181973
==============================================================================
--- team/jpeeler/bug11261/channels/h323/compat_h323.cxx (original)
+++ team/jpeeler/bug11261/channels/h323/compat_h323.cxx Fri Mar 13 10:51:09 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(




More information about the asterisk-commits mailing list