Work!!!
authorMatthew Fredrickson <creslin@digium.com>
Tue, 19 Sep 2006 19:04:13 +0000 (19:04 +0000)
committerMatthew Fredrickson <creslin@digium.com>
Tue, 19 Sep 2006 19:04:13 +0000 (19:04 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43287 65c4cc65-6c06-0410-ace0-fbb531ad65f3

CREDITS
channels/h323/Makefile.in [new file with mode: 0644]
channels/h323/cisco-h225.asn [new file with mode: 0644]
channels/h323/cisco-h225.cpp [new file with mode: 0644]
channels/h323/cisco-h225.h [new file with mode: 0644]
channels/h323/compat_h323.cpp [new file with mode: 0644]
channels/h323/compat_h323.h [new file with mode: 0644]
channels/h323/noexport.map [new file with mode: 0644]

diff --git a/CREDITS b/CREDITS
index f561fd4..e3dac5f 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -150,6 +150,8 @@ Bartosz Supczinski - Support for Polish added by DIR (www.dir.pl) Bartosz.Supczi
 
 James Rothenberger - Support for IMAP storage integration added by OneBizTone LLC Work funded by University of Pennsylvania jar@onebiztone.com
 
+Paul Cadach - Bringing chan_h323 up to date, bug fixes, and more!
+
 === OTHER CONTRIBUTIONS ===
 John Todd - Monkey sounds and associated teletorture prompt
 Michael Jerris - bug marshaling
diff --git a/channels/h323/Makefile.in b/channels/h323/Makefile.in
new file mode 100644 (file)
index 0000000..357313d
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Makefile
+#
+# Make file for OpenH323 support layer
+#
+
+.PHONY: Makefile.ast clean
+
+default::      @OPENH323_BUILD@
+
+# Verify those options with main Makefile
+STDCCFLAGS     = -DNDEBUG
+STDCCFLAGS     += -I../../include -include ../../include/asterisk/autoconfig.h
+STDCCFLAGS     += -fPIC
+#OPTCCFLAGS    +=
+CFLAGS         = -pipe
+TARGET         = libchanh323.a
+TARGET         += Makefile.ast
+SOURCES                = ast_h323.cxx compat_h323.cxx cisco-h225.cxx
+OBJDIR         = .
+OBJS           =
+
+ifndef OPENH323DIR
+OPENH323DIR=@OPENH323DIR@
+endif
+
+include $(OPENH323DIR)/openh323u.mak
+
+notrace::
+       $(MAKE) NOTRACE=1 opt
+
+define module_cxx_template
+$(1):: $(2)
+       ln -f $(2) $(1)
+endef
+
+$(foreach mod,$(SOURCES),$(eval $(call module_cxx_template,$(mod),$(mod:.cxx=.cpp))))
+#$(SOURCES)::  $(SOURCES:.cxx=.cpp)
+#      ln -f $(patsubst %.cxx, %.cpp, $@) $@
+
+$(SOURCES)::   Makefile ../../Makefile
+       touch $@
+
+libchanh323.a: $(OBJS)
+       ar crv $@ $(OBJS)
+
+cisco-h225.cpp::       cisco-h225.asn
+       asnparser -m CISCO_H225 -c $<
+       mv -f cisco-h225.cxx cisco-h225.cpp
+
+Makefile.ast:
+       @echo H323CFLAGS  = $(STDCCFLAGS) $(OPTCCFLAGS) $(CFLAGS) >$@.tmp
+       @echo H323LDFLAGS = $(CFLAGS) $(LDFLAGS) >>$@.tmp
+       @echo H323LDLIBS  = $(LDLIBS) $(ENDLDLIBS) $(ENDLDFLAGS) >>$@.tmp
+       @if [ -r $@ ] && cmp -s $@ $@.tmp; then rm -f $@.tmp; else mv -f $@.tmp $@; fi
+
+clean::
+       rm -f $(SOURCES) $(TARGET) $(OBJS) Makefile.ast *.dep
diff --git a/channels/h323/cisco-h225.asn b/channels/h323/cisco-h225.asn
new file mode 100644 (file)
index 0000000..c0eaeb6
--- /dev/null
@@ -0,0 +1,74 @@
+CISCO-H225-MESSAGES DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+
+H323_UU_NonStdInfo ::= SEQUENCE
+{
+       version INTEGER OPTIONAL,
+       protoParam ProtoParam OPTIONAL,
+       commonParam CommonParam OPTIONAL,
+       ...,
+       progIndParam ProgIndParam OPTIONAL,
+       dummy1 OCTET STRING OPTIONAL,
+       callMgrParam CallMgrParam OPTIONAL,
+       callSignallingParam CallSignallingParam OPTIONAL,
+       dummy2 OCTET STRING OPTIONAL,
+       callPreserveParam CallPreserveParam OPTIONAL
+}
+
+CommonParam ::= SEQUENCE
+{
+       redirectIEinfo RedirectIEinfo,
+       ...
+}
+
+RedirectIEinfo ::= SEQUENCE
+{
+       redirectIE OCTET STRING,
+       ...
+}
+
+ProgIndParam ::= SEQUENCE
+{
+       progIndIEinfo ProgIndIEinfo,
+       ...
+}
+
+ProgIndIEinfo ::= SEQUENCE
+{
+       progIndIE OCTET STRING,
+       ...
+}
+
+ProtoParam ::= SEQUENCE
+{
+       qsigNonStdInfo QsigNonStdInfo,
+       ...
+}
+
+QsigNonStdInfo ::= SEQUENCE
+{
+       iei     INTEGER,
+       rawMesg OCTET STRING,
+       ...
+}
+
+CallMgrParam ::= SEQUENCE
+{
+       interclusterVersion INTEGER,
+       enterpriseID OCTET STRING,
+       ...
+}
+
+CallPreserveParam ::= SEQUENCE
+{
+       callPreserveIE BOOLEAN,
+       ...
+}
+
+CallSignallingParam ::= SEQUENCE
+{
+       connectedNumber OCTET STRING (1..127) OPTIONAL,
+       ...
+}
+
+END
diff --git a/channels/h323/cisco-h225.cpp b/channels/h323/cisco-h225.cpp
new file mode 100644 (file)
index 0000000..1b52f4c
--- /dev/null
@@ -0,0 +1,853 @@
+//
+// cisco-h225.cxx
+//
+// Code automatically generated by asnparse.
+//
+
+#ifdef P_USE_PRAGMA
+#pragma implementation "cisco-h225.h"
+#endif
+
+#include <ptlib.h>
+#include "cisco-h225.h"
+
+#define new PNEW
+
+
+#if ! H323_DISABLE_CISCO_H225
+
+//
+// RedirectIEinfo
+//
+
+CISCO_H225_RedirectIEinfo::CISCO_H225_RedirectIEinfo(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 0, TRUE, 0)
+{
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_RedirectIEinfo::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  strm << setw(indent+13) << "redirectIE = " << setprecision(indent) << m_redirectIE << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_RedirectIEinfo::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_RedirectIEinfo), PInvalidCast);
+#endif
+  const CISCO_H225_RedirectIEinfo & other = (const CISCO_H225_RedirectIEinfo &)obj;
+
+  Comparison result;
+
+  if ((result = m_redirectIE.Compare(other.m_redirectIE)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_RedirectIEinfo::GetDataLength() const
+{
+  PINDEX length = 0;
+  length += m_redirectIE.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_RedirectIEinfo::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (!m_redirectIE.Decode(strm))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_RedirectIEinfo::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  m_redirectIE.Encode(strm);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_RedirectIEinfo::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_RedirectIEinfo::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_RedirectIEinfo(*this);
+}
+
+
+//
+// ProgIndIEinfo
+//
+
+CISCO_H225_ProgIndIEinfo::CISCO_H225_ProgIndIEinfo(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 0, TRUE, 0)
+{
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_ProgIndIEinfo::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  strm << setw(indent+12) << "progIndIE = " << setprecision(indent) << m_progIndIE << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_ProgIndIEinfo::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_ProgIndIEinfo), PInvalidCast);
+#endif
+  const CISCO_H225_ProgIndIEinfo & other = (const CISCO_H225_ProgIndIEinfo &)obj;
+
+  Comparison result;
+
+  if ((result = m_progIndIE.Compare(other.m_progIndIE)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_ProgIndIEinfo::GetDataLength() const
+{
+  PINDEX length = 0;
+  length += m_progIndIE.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_ProgIndIEinfo::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (!m_progIndIE.Decode(strm))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_ProgIndIEinfo::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  m_progIndIE.Encode(strm);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_ProgIndIEinfo::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_ProgIndIEinfo::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_ProgIndIEinfo(*this);
+}
+
+
+//
+// QsigNonStdInfo
+//
+
+CISCO_H225_QsigNonStdInfo::CISCO_H225_QsigNonStdInfo(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 0, TRUE, 0)
+{
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_QsigNonStdInfo::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  strm << setw(indent+6) << "iei = " << setprecision(indent) << m_iei << '\n';
+  strm << setw(indent+10) << "rawMesg = " << setprecision(indent) << m_rawMesg << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_QsigNonStdInfo::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_QsigNonStdInfo), PInvalidCast);
+#endif
+  const CISCO_H225_QsigNonStdInfo & other = (const CISCO_H225_QsigNonStdInfo &)obj;
+
+  Comparison result;
+
+  if ((result = m_iei.Compare(other.m_iei)) != EqualTo)
+    return result;
+  if ((result = m_rawMesg.Compare(other.m_rawMesg)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_QsigNonStdInfo::GetDataLength() const
+{
+  PINDEX length = 0;
+  length += m_iei.GetObjectLength();
+  length += m_rawMesg.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_QsigNonStdInfo::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (!m_iei.Decode(strm))
+    return FALSE;
+  if (!m_rawMesg.Decode(strm))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_QsigNonStdInfo::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  m_iei.Encode(strm);
+  m_rawMesg.Encode(strm);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_QsigNonStdInfo::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_QsigNonStdInfo::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_QsigNonStdInfo(*this);
+}
+
+
+//
+// CallMgrParam
+//
+
+CISCO_H225_CallMgrParam::CISCO_H225_CallMgrParam(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 0, TRUE, 0)
+{
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_CallMgrParam::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  strm << setw(indent+22) << "interclusterVersion = " << setprecision(indent) << m_interclusterVersion << '\n';
+  strm << setw(indent+15) << "enterpriseID = " << setprecision(indent) << m_enterpriseID << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_CallMgrParam::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_CallMgrParam), PInvalidCast);
+#endif
+  const CISCO_H225_CallMgrParam & other = (const CISCO_H225_CallMgrParam &)obj;
+
+  Comparison result;
+
+  if ((result = m_interclusterVersion.Compare(other.m_interclusterVersion)) != EqualTo)
+    return result;
+  if ((result = m_enterpriseID.Compare(other.m_enterpriseID)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_CallMgrParam::GetDataLength() const
+{
+  PINDEX length = 0;
+  length += m_interclusterVersion.GetObjectLength();
+  length += m_enterpriseID.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_CallMgrParam::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (!m_interclusterVersion.Decode(strm))
+    return FALSE;
+  if (!m_enterpriseID.Decode(strm))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_CallMgrParam::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  m_interclusterVersion.Encode(strm);
+  m_enterpriseID.Encode(strm);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_CallMgrParam::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_CallMgrParam::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_CallMgrParam(*this);
+}
+
+
+//
+// CallPreserveParam
+//
+
+CISCO_H225_CallPreserveParam::CISCO_H225_CallPreserveParam(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 0, TRUE, 0)
+{
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_CallPreserveParam::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  strm << setw(indent+17) << "callPreserveIE = " << setprecision(indent) << m_callPreserveIE << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_CallPreserveParam::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_CallPreserveParam), PInvalidCast);
+#endif
+  const CISCO_H225_CallPreserveParam & other = (const CISCO_H225_CallPreserveParam &)obj;
+
+  Comparison result;
+
+  if ((result = m_callPreserveIE.Compare(other.m_callPreserveIE)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_CallPreserveParam::GetDataLength() const
+{
+  PINDEX length = 0;
+  length += m_callPreserveIE.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_CallPreserveParam::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (!m_callPreserveIE.Decode(strm))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_CallPreserveParam::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  m_callPreserveIE.Encode(strm);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_CallPreserveParam::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_CallPreserveParam::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_CallPreserveParam(*this);
+}
+
+
+//
+// CallSignallingParam
+//
+
+CISCO_H225_CallSignallingParam::CISCO_H225_CallSignallingParam(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 1, TRUE, 0)
+{
+  m_connectedNumber.SetConstraints(PASN_Object::FixedConstraint, 1, 127);
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_CallSignallingParam::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  if (HasOptionalField(e_connectedNumber))
+    strm << setw(indent+18) << "connectedNumber = " << setprecision(indent) << m_connectedNumber << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_CallSignallingParam::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_CallSignallingParam), PInvalidCast);
+#endif
+  const CISCO_H225_CallSignallingParam & other = (const CISCO_H225_CallSignallingParam &)obj;
+
+  Comparison result;
+
+  if ((result = m_connectedNumber.Compare(other.m_connectedNumber)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_CallSignallingParam::GetDataLength() const
+{
+  PINDEX length = 0;
+  if (HasOptionalField(e_connectedNumber))
+    length += m_connectedNumber.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_CallSignallingParam::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (HasOptionalField(e_connectedNumber) && !m_connectedNumber.Decode(strm))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_CallSignallingParam::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  if (HasOptionalField(e_connectedNumber))
+    m_connectedNumber.Encode(strm);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_CallSignallingParam::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_CallSignallingParam::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_CallSignallingParam(*this);
+}
+
+
+//
+// CommonParam
+//
+
+CISCO_H225_CommonParam::CISCO_H225_CommonParam(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 0, TRUE, 0)
+{
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_CommonParam::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  strm << setw(indent+17) << "redirectIEinfo = " << setprecision(indent) << m_redirectIEinfo << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_CommonParam::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_CommonParam), PInvalidCast);
+#endif
+  const CISCO_H225_CommonParam & other = (const CISCO_H225_CommonParam &)obj;
+
+  Comparison result;
+
+  if ((result = m_redirectIEinfo.Compare(other.m_redirectIEinfo)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_CommonParam::GetDataLength() const
+{
+  PINDEX length = 0;
+  length += m_redirectIEinfo.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_CommonParam::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (!m_redirectIEinfo.Decode(strm))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_CommonParam::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  m_redirectIEinfo.Encode(strm);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_CommonParam::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_CommonParam::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_CommonParam(*this);
+}
+
+
+//
+// ProgIndParam
+//
+
+CISCO_H225_ProgIndParam::CISCO_H225_ProgIndParam(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 0, TRUE, 0)
+{
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_ProgIndParam::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  strm << setw(indent+16) << "progIndIEinfo = " << setprecision(indent) << m_progIndIEinfo << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_ProgIndParam::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_ProgIndParam), PInvalidCast);
+#endif
+  const CISCO_H225_ProgIndParam & other = (const CISCO_H225_ProgIndParam &)obj;
+
+  Comparison result;
+
+  if ((result = m_progIndIEinfo.Compare(other.m_progIndIEinfo)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_ProgIndParam::GetDataLength() const
+{
+  PINDEX length = 0;
+  length += m_progIndIEinfo.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_ProgIndParam::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (!m_progIndIEinfo.Decode(strm))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_ProgIndParam::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  m_progIndIEinfo.Encode(strm);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_ProgIndParam::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_ProgIndParam::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_ProgIndParam(*this);
+}
+
+
+//
+// ProtoParam
+//
+
+CISCO_H225_ProtoParam::CISCO_H225_ProtoParam(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 0, TRUE, 0)
+{
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_ProtoParam::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  strm << setw(indent+17) << "qsigNonStdInfo = " << setprecision(indent) << m_qsigNonStdInfo << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_ProtoParam::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_ProtoParam), PInvalidCast);
+#endif
+  const CISCO_H225_ProtoParam & other = (const CISCO_H225_ProtoParam &)obj;
+
+  Comparison result;
+
+  if ((result = m_qsigNonStdInfo.Compare(other.m_qsigNonStdInfo)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_ProtoParam::GetDataLength() const
+{
+  PINDEX length = 0;
+  length += m_qsigNonStdInfo.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_ProtoParam::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (!m_qsigNonStdInfo.Decode(strm))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_ProtoParam::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  m_qsigNonStdInfo.Encode(strm);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_ProtoParam::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_ProtoParam::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_ProtoParam(*this);
+}
+
+
+//
+// H323_UU_NonStdInfo
+//
+
+CISCO_H225_H323_UU_NonStdInfo::CISCO_H225_H323_UU_NonStdInfo(unsigned tag, PASN_Object::TagClass tagClass)
+  : PASN_Sequence(tag, tagClass, 3, TRUE, 6)
+{
+}
+
+
+#ifndef PASN_NOPRINTON
+void CISCO_H225_H323_UU_NonStdInfo::PrintOn(ostream & strm) const
+{
+  int indent = strm.precision() + 2;
+  strm << "{\n";
+  if (HasOptionalField(e_version))
+    strm << setw(indent+10) << "version = " << setprecision(indent) << m_version << '\n';
+  if (HasOptionalField(e_protoParam))
+    strm << setw(indent+13) << "protoParam = " << setprecision(indent) << m_protoParam << '\n';
+  if (HasOptionalField(e_commonParam))
+    strm << setw(indent+14) << "commonParam = " << setprecision(indent) << m_commonParam << '\n';
+  if (HasOptionalField(e_progIndParam))
+    strm << setw(indent+15) << "progIndParam = " << setprecision(indent) << m_progIndParam << '\n';
+  if (HasOptionalField(e_dummy1))
+    strm << setw(indent+9) << "dummy1 = " << setprecision(indent) << m_dummy1 << '\n';
+  if (HasOptionalField(e_callMgrParam))
+    strm << setw(indent+15) << "callMgrParam = " << setprecision(indent) << m_callMgrParam << '\n';
+  if (HasOptionalField(e_callSignallingParam))
+    strm << setw(indent+22) << "callSignallingParam = " << setprecision(indent) << m_callSignallingParam << '\n';
+  if (HasOptionalField(e_dummy2))
+    strm << setw(indent+9) << "dummy2 = " << setprecision(indent) << m_dummy2 << '\n';
+  if (HasOptionalField(e_callPreserveParam))
+    strm << setw(indent+20) << "callPreserveParam = " << setprecision(indent) << m_callPreserveParam << '\n';
+  strm << setw(indent-1) << setprecision(indent-2) << "}";
+}
+#endif
+
+
+PObject::Comparison CISCO_H225_H323_UU_NonStdInfo::Compare(const PObject & obj) const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(PIsDescendant(&obj, CISCO_H225_H323_UU_NonStdInfo), PInvalidCast);
+#endif
+  const CISCO_H225_H323_UU_NonStdInfo & other = (const CISCO_H225_H323_UU_NonStdInfo &)obj;
+
+  Comparison result;
+
+  if ((result = m_version.Compare(other.m_version)) != EqualTo)
+    return result;
+  if ((result = m_protoParam.Compare(other.m_protoParam)) != EqualTo)
+    return result;
+  if ((result = m_commonParam.Compare(other.m_commonParam)) != EqualTo)
+    return result;
+
+  return PASN_Sequence::Compare(other);
+}
+
+
+PINDEX CISCO_H225_H323_UU_NonStdInfo::GetDataLength() const
+{
+  PINDEX length = 0;
+  if (HasOptionalField(e_version))
+    length += m_version.GetObjectLength();
+  if (HasOptionalField(e_protoParam))
+    length += m_protoParam.GetObjectLength();
+  if (HasOptionalField(e_commonParam))
+    length += m_commonParam.GetObjectLength();
+  return length;
+}
+
+
+BOOL CISCO_H225_H323_UU_NonStdInfo::Decode(PASN_Stream & strm)
+{
+  if (!PreambleDecode(strm))
+    return FALSE;
+
+  if (HasOptionalField(e_version) && !m_version.Decode(strm))
+    return FALSE;
+  if (HasOptionalField(e_protoParam) && !m_protoParam.Decode(strm))
+    return FALSE;
+  if (HasOptionalField(e_commonParam) && !m_commonParam.Decode(strm))
+    return FALSE;
+  if (!KnownExtensionDecode(strm, e_progIndParam, m_progIndParam))
+    return FALSE;
+  if (!KnownExtensionDecode(strm, e_dummy1, m_dummy1))
+    return FALSE;
+  if (!KnownExtensionDecode(strm, e_callMgrParam, m_callMgrParam))
+    return FALSE;
+  if (!KnownExtensionDecode(strm, e_callSignallingParam, m_callSignallingParam))
+    return FALSE;
+  if (!KnownExtensionDecode(strm, e_dummy2, m_dummy2))
+    return FALSE;
+  if (!KnownExtensionDecode(strm, e_callPreserveParam, m_callPreserveParam))
+    return FALSE;
+
+  return UnknownExtensionsDecode(strm);
+}
+
+
+void CISCO_H225_H323_UU_NonStdInfo::Encode(PASN_Stream & strm) const
+{
+  PreambleEncode(strm);
+
+  if (HasOptionalField(e_version))
+    m_version.Encode(strm);
+  if (HasOptionalField(e_protoParam))
+    m_protoParam.Encode(strm);
+  if (HasOptionalField(e_commonParam))
+    m_commonParam.Encode(strm);
+  KnownExtensionEncode(strm, e_progIndParam, m_progIndParam);
+  KnownExtensionEncode(strm, e_dummy1, m_dummy1);
+  KnownExtensionEncode(strm, e_callMgrParam, m_callMgrParam);
+  KnownExtensionEncode(strm, e_callSignallingParam, m_callSignallingParam);
+  KnownExtensionEncode(strm, e_dummy2, m_dummy2);
+  KnownExtensionEncode(strm, e_callPreserveParam, m_callPreserveParam);
+
+  UnknownExtensionsEncode(strm);
+}
+
+
+PObject * CISCO_H225_H323_UU_NonStdInfo::Clone() const
+{
+#ifndef PASN_LEANANDMEAN
+  PAssert(IsClass(CISCO_H225_H323_UU_NonStdInfo::Class()), PInvalidCast);
+#endif
+  return new CISCO_H225_H323_UU_NonStdInfo(*this);
+}
+
+
+#endif // if ! H323_DISABLE_CISCO_H225
+
+
+// End of cisco-h225.cxx
diff --git a/channels/h323/cisco-h225.h b/channels/h323/cisco-h225.h
new file mode 100644 (file)
index 0000000..db4e0af
--- /dev/null
@@ -0,0 +1,299 @@
+//
+// cisco-h225.h
+//
+// Code automatically generated by asnparse.
+//
+
+#if ! H323_DISABLE_CISCO_H225
+
+#ifndef __CISCO_H225_H
+#define __CISCO_H225_H
+
+#ifdef P_USE_PRAGMA
+#pragma interface
+#endif
+
+#include <ptclib/asner.h>
+
+//
+// RedirectIEinfo
+//
+
+class CISCO_H225_RedirectIEinfo : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_RedirectIEinfo, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_RedirectIEinfo(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    PASN_OctetString m_redirectIE;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+//
+// ProgIndIEinfo
+//
+
+class CISCO_H225_ProgIndIEinfo : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_ProgIndIEinfo, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_ProgIndIEinfo(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    PASN_OctetString m_progIndIE;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+//
+// QsigNonStdInfo
+//
+
+class CISCO_H225_QsigNonStdInfo : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_QsigNonStdInfo, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_QsigNonStdInfo(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    PASN_Integer m_iei;
+    PASN_OctetString m_rawMesg;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+//
+// CallMgrParam
+//
+
+class CISCO_H225_CallMgrParam : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_CallMgrParam, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_CallMgrParam(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    PASN_Integer m_interclusterVersion;
+    PASN_OctetString m_enterpriseID;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+//
+// CallPreserveParam
+//
+
+class CISCO_H225_CallPreserveParam : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_CallPreserveParam, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_CallPreserveParam(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    PASN_Boolean m_callPreserveIE;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+//
+// CallSignallingParam
+//
+
+class CISCO_H225_CallSignallingParam : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_CallSignallingParam, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_CallSignallingParam(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    enum OptionalFields {
+      e_connectedNumber
+    };
+
+    PASN_OctetString m_connectedNumber;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+//
+// CommonParam
+//
+
+class CISCO_H225_CommonParam : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_CommonParam, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_CommonParam(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    CISCO_H225_RedirectIEinfo m_redirectIEinfo;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+//
+// ProgIndParam
+//
+
+class CISCO_H225_ProgIndParam : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_ProgIndParam, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_ProgIndParam(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    CISCO_H225_ProgIndIEinfo m_progIndIEinfo;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+//
+// ProtoParam
+//
+
+class CISCO_H225_ProtoParam : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_ProtoParam, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_ProtoParam(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    CISCO_H225_QsigNonStdInfo m_qsigNonStdInfo;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+//
+// H323_UU_NonStdInfo
+//
+
+class CISCO_H225_H323_UU_NonStdInfo : public PASN_Sequence
+{
+#ifndef PASN_LEANANDMEAN
+    PCLASSINFO(CISCO_H225_H323_UU_NonStdInfo, PASN_Sequence);
+#endif
+  public:
+    CISCO_H225_H323_UU_NonStdInfo(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
+
+    enum OptionalFields {
+      e_version,
+      e_protoParam,
+      e_commonParam,
+      e_progIndParam,
+      e_dummy1,
+      e_callMgrParam,
+      e_callSignallingParam,
+      e_dummy2,
+      e_callPreserveParam
+    };
+
+    PASN_Integer m_version;
+    CISCO_H225_ProtoParam m_protoParam;
+    CISCO_H225_CommonParam m_commonParam;
+    CISCO_H225_ProgIndParam m_progIndParam;
+    PASN_OctetString m_dummy1;
+    CISCO_H225_CallMgrParam m_callMgrParam;
+    CISCO_H225_CallSignallingParam m_callSignallingParam;
+    PASN_OctetString m_dummy2;
+    CISCO_H225_CallPreserveParam m_callPreserveParam;
+
+    PINDEX GetDataLength() const;
+    BOOL Decode(PASN_Stream & strm);
+    void Encode(PASN_Stream & strm) const;
+#ifndef PASN_NOPRINTON
+    void PrintOn(ostream & strm) const;
+#endif
+    Comparison Compare(const PObject & obj) const;
+    PObject * Clone() const;
+};
+
+
+#endif // __CISCO_H225_H
+
+#endif // if ! H323_DISABLE_CISCO_H225
+
+
+// End of cisco-h225.h
diff --git a/channels/h323/compat_h323.cpp b/channels/h323/compat_h323.cpp
new file mode 100644 (file)
index 0000000..eec7361
--- /dev/null
@@ -0,0 +1,138 @@
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+/*
+ * ast_h323.cpp
+ *
+ * OpenH323 Channel Driver for ASTERISK PBX.
+ *                     By  Jeremy McNamara
+ *                     For The NuFone Network
+ * 
+ * chan_h323 has been derived from code created by
+ *               Michael Manousos and Mark Spencer
+ *
+ * This file is part of the chan_h323 driver for Asterisk
+ *
+ * chan_h323 is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version. 
+ *
+ * chan_h323 is distributed WITHOUT ANY WARRANTY; without even 
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE. See the GNU General Public License for more details. 
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
+ *
+ * Version Info: $Id$
+ */
+#include <ptlib.h>
+#include <h323.h>
+#include <transports.h>
+
+#include "ast_h323.h"
+
+#if VERSION(OPENH323_MAJOR,OPENH323_MINOR,OPENH323_BUILD) < VERSION(1,17,3)
+MyH323TransportTCP::MyH323TransportTCP(
+                               H323EndPoint & endpoint,
+                               PIPSocket::Address binding,
+                               BOOL listen)
+       : H323TransportTCP(endpoint, binding, listen)
+{
+}
+
+BOOL MyH323TransportTCP::Connect()
+{
+       if (IsListening())
+               return TRUE;
+
+       PTCPSocket * socket = new PTCPSocket(remotePort);
+       Open(socket);
+
+       channelPointerMutex.StartRead();
+
+       socket->SetReadTimeout(10000/*endpoint.GetSignallingChannelConnectTimeout()*/);
+
+       localPort = endpoint.GetNextTCPPort();
+       WORD firstPort = localPort;
+       for (;;) {
+               PTRACE(4, "H323TCP\tConnecting to "
+                               << remoteAddress << ':' << remotePort
+                               << " (local port=" << localPort << ')');
+               if (socket->Connect(localAddress, localPort, remoteAddress))
+                       break;
+
+               int errnum = socket->GetErrorNumber();
+               if (localPort == 0 || (errnum != EADDRINUSE && errnum != EADDRNOTAVAIL)) {
+                       PTRACE(1, "H323TCP\tCould not connect to "
+                                       << remoteAddress << ':' << remotePort
+                                       << " (local port=" << localPort << ") - "
+                                       << socket->GetErrorText() << '(' << errnum << ')');
+                       channelPointerMutex.EndRead();
+                       return SetErrorValues(socket->GetErrorCode(), errnum);
+               }
+
+               localPort = endpoint.GetNextTCPPort();
+               if (localPort == firstPort) {
+                       PTRACE(1, "H323TCP\tCould not bind to any port in range " <<
+                                       endpoint.GetTCPPortBase() << " to " << endpoint.GetTCPPortMax());
+                       channelPointerMutex.EndRead();
+                       return SetErrorValues(socket->GetErrorCode(), errnum);
+               }
+       }
+
+       socket->SetReadTimeout(PMaxTimeInterval);
+
+       channelPointerMutex.EndRead();
+
+       return OnOpen();
+}
+#endif
+
+BOOL MyH323TransportUDP::DiscoverGatekeeper(H323Gatekeeper &gk, H323RasPDU &pdu, const H323TransportAddress &address)
+{
+       PThread *thd = PThread::Current();
+
+       /* If we run in OpenH323's thread use it instead of creating new one */
+       if (thd)
+               return H323TransportUDP::DiscoverGatekeeper(gk, pdu, address);
+
+       /* Make copy of arguments to pass them into thread */
+       discoverGatekeeper = &gk;
+       discoverPDU = &pdu;
+       discoverAddress = &address;
+
+       /* Assume discovery thread isn't finished */
+       discoverReady = FALSE;
+
+       /* Create discovery thread */
+       thd = PThread::Create(PCREATE_NOTIFIER(DiscoverMain), 0,
+                                                       PThread::NoAutoDeleteThread,
+                                                       PThread::NormalPriority,
+                                                       "GkDiscovery:%x");
+
+       /* Wait until discovery thread signal us its finished */ 
+       for(;;) {
+               discoverMutex.Wait();
+               if (discoverReady)              /* Thread has been finished */
+                       break;
+               discoverMutex.Signal();
+       }
+       discoverMutex.Signal();
+
+       /* Cleanup/delete thread */
+       thd->WaitForTermination();
+       delete thd;
+
+       return discoverResult;
+}
+
+void MyH323TransportUDP::DiscoverMain(PThread &thread, INT arg)
+{
+       PWaitAndSignal m(discoverMutex);
+
+       discoverResult = H323TransportUDP::DiscoverGatekeeper(*discoverGatekeeper, *discoverPDU, *discoverAddress);
+       discoverReady = TRUE;
+}
diff --git a/channels/h323/compat_h323.h b/channels/h323/compat_h323.h
new file mode 100644 (file)
index 0000000..2ea640c
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef COMPAT_H323_H
+#define COMPAT_H323_H
+
+#if VERSION(OPENH323_MAJOR,OPENH323_MINOR,OPENH323_BUILD) < VERSION(1,17,3)
+/**
+ *  Workaround for broken (less than 1.17.3) OpenH323 stack to be able to
+ *  make TCP connections from specific address
+ */
+class MyH323TransportTCP : public H323TransportTCP
+{
+       PCLASSINFO(MyH323TransportTCP, H323TransportTCP);
+
+public:
+       MyH323TransportTCP(
+               H323EndPoint & endpoint,    ///<  H323 End Point object
+               PIPSocket::Address binding = PIPSocket::GetDefaultIpAny(), ///<  Local interface to use
+               BOOL listen = FALSE         ///<  Flag for need to wait for remote to connect
+       );
+       /**Connect to the remote party.
+        */
+       virtual BOOL Connect();
+};
+#else
+#define MyH323TransportTCP H323TransportTCP
+#endif /* <VERSION(1,17,3) */
+
+class MyH323TransportUDP: public H323TransportUDP
+{
+       PCLASSINFO(MyH323TransportUDP, H323TransportUDP);
+
+public:
+       MyH323TransportUDP(H323EndPoint &endpoint,
+               PIPSocket::Address binding = PIPSocket::GetDefaultIpAny(),
+               WORD localPort = 0,
+               WORD remotePort = 0): H323TransportUDP(endpoint, binding, localPort, remotePort)
+       {
+       }
+       virtual BOOL DiscoverGatekeeper(H323Gatekeeper &,
+               H323RasPDU &,
+               const H323TransportAddress &);
+protected:
+       PDECLARE_NOTIFIER(PThread, MyH323TransportUDP, DiscoverMain);
+       H323Gatekeeper *discoverGatekeeper;
+       H323RasPDU *discoverPDU;
+       const H323TransportAddress *discoverAddress;
+       BOOL discoverResult;
+       BOOL discoverReady;
+       PMutex discoverMutex;
+};
+
+template <class _Abstract_T, typename _Key_T = PString>
+class MyPFactory: public PFactory<_Abstract_T, _Key_T>
+{
+public:
+       template <class _Contrete_T> class Worker: public PFactory<_Abstract_T, _Key_T>::WorkerBase
+       {
+       public:
+               Worker(const _Key_T &_key, bool singleton = false)
+                       :PFactory<_Abstract_T, _Key_T>::WorkerBase(singleton), key(_key)
+               {
+                       PFactory<_Abstract_T, _Key_T>::Register(key, this);
+               }
+               ~Worker()
+               {
+                       PFactory<_Abstract_T, _Key_T>::Unregister(key);
+               }
+
+       private:
+               PString key;
+    };
+};
+
+#ifdef H323_REGISTER_CAPABILITY
+#undef H323_REGISTER_CAPABILITY
+#endif
+#define H323_REGISTER_CAPABILITY(cls, capName) static MyPFactory<H323Capability>::Worker<cls> cls##Factory(capName, true)
+
+#endif /* !defined AST_H323_H */
diff --git a/channels/h323/noexport.map b/channels/h323/noexport.map
new file mode 100644 (file)
index 0000000..b51f842
--- /dev/null
@@ -0,0 +1,5 @@
+{
+       global:
+               _Z11PAssertFuncPKc;
+       local:  *;
+};
\ No newline at end of file