/*
- * h323wrap.h
+ * ast_h323.h
*
* OpenH323 Channel Driver for ASTERISK PBX.
* By Jeremy McNamara
* For The NuFone Network
*
- * This code has been derived from code created by
- * Michael Manousos and Mark Spencer
+ * This code has been derived from code created by
+ * Michael Manousos and Mark Spencer
*
* This file is part of the chan_h323 driver for Asterisk
*
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+ * Version Info: $Id$
*/
#define AST_FORMAT_G729A (1 << 8)
/*! SpeeX Free Compression */
#define AST_FORMAT_SPEEX (1 << 9)
-
+/*! ILBC Free Codec */
+#define AST_FORMAT_ILBC (1 << 10)
/**This class describes the G.723.1 codec capability.
*/
BOOL annexA;
};
+/**This class describes the (fake) G729 codec capability.
+ */
+class AST_G729Capability : public H323AudioCapability
+{
+ PCLASSINFO(AST_G729Capability, H323AudioCapability);
+
+ public:
+ /**@name Construction */
+ //@{
+ /**Create a new G.729 capability.
+ */
+ AST_G729Capability();
+ //@}
+
+ /**@name Overrides from class PObject */
+ //@{
+ /**Create a copy of the object.
+ */
+ virtual PObject * Clone() const;
+ //@}
+
+ /**@name Operations */
+ //@{
+ /**Create the codec instance, allocating resources as required.
+ */
+ virtual H323Codec * CreateCodec(
+ H323Codec::Direction direction /// Direction in which this instance runs
+ ) const;
+ //@}
+
+ /**@name Identification functions */
+ //@{
+ /**Get the sub-type of the capability. This is a code dependent on the
+ main type of the capability.
+
+ This returns one of the four possible combinations of mode and speed
+ using the enum values of the protocol ASN H245_AudioCapability class.
+ */
+ virtual unsigned GetSubType() const;
+
+ /**Get the name of the media data format this class represents.
+ */
+ virtual PString GetFormatName() const;
+ //@}
+};
+
+
+/**This class describes the VoiceAge G729A codec capability.
+ */
+class AST_G729ACapability : public H323AudioCapability
+{
+ PCLASSINFO(AST_G729ACapability, H323AudioCapability);
+
+ public:
+ /**@name Construction */
+ //@{
+ /**Create a new G.729A capability.
+ */
+ AST_G729ACapability();
+ //@}
+
+ /**@name Overrides from class PObject */
+ //@{
+ /**Create a copy of the object.
+ */
+ virtual PObject * Clone() const;
+ //@}
+
+ /**@name Operations */
+ //@{
+ /**Create the codec instance, allocating resources as required.
+ */
+ virtual H323Codec * CreateCodec(
+ H323Codec::Direction direction /// Direction in which this instance runs
+ ) const;
+ //@}
+
+ /**@name Identification functions */
+ //@{
+ /**Get the sub-type of the capability. This is a code dependent on the
+ main type of the capability.
+
+ This returns one of the four possible combinations of mode and speed
+ using the enum values of the protocol ASN H245_AudioCapability class.
+ */
+ virtual unsigned GetSubType() const;
+
+ /**Get the name of the media data format this class represents.
+ */
+ virtual PString GetFormatName() const;
+ //@}
+};
+
+
class MyH323EndPoint : public H323EndPoint {
PCLASSINFO(MyH323EndPoint, H323EndPoint);
public:
- int MakeCall(const PString &, PString &, unsigned int *, unsigned int);
+ int MakeCall(const PString &, PString &, unsigned int *, unsigned int, char *);
BOOL ClearCall(const PString &);
-// BOOL OnIncomingCall( H323Connection & connection, const H323SignalPDU &, H323SignalPDU &);
void OnClosedLogicalChannel(H323Connection &, const H323Channel &);
void OnConnectionEstablished(H323Connection &, const PString &);
H323Connection * CreateConnection(unsigned, void *);
void SendUserTone(const PString &, char);
H323Capabilities GetCapabilities(void);
+ BOOL OnConnectionForwarded(H323Connection &, const PString &, const H323SignalPDU &);
+
+ BOOL ForwardConnection(H323Connection &, const PString &, const H323SignalPDU &);
PStringArray SupportedPrefixes;
- void SetEndpointTypeInfo( H225_EndpointType & info ) const;
- void SetGateway(void);
+ void SetEndpointTypeInfo( H225_EndpointType & info ) const;
+ void SetGateway(void);
};
-
class MyH323Connection : public H323Connection {
PCLASSINFO(MyH323Connection, H323Connection);
public:
- MyH323Connection(MyH323EndPoint &, unsigned, unsigned, WORD);
+ MyH323Connection(MyH323EndPoint &, unsigned, unsigned);
~MyH323Connection();
H323Channel * CreateRealTimeLogicalChannel(const H323Capability &, H323Channel::Directions, unsigned,
const H245_H2250LogicalChannelParameters *);
H323Connection::AnswerCallResponse OnAnswerCall(const PString &, const H323SignalPDU &, H323SignalPDU &);
+ void OnReceivedReleaseComplete(const H323SignalPDU &);
BOOL OnAlerting(const H323SignalPDU &, const PString &);
+ BOOL OnSendReleaseComplete(H323SignalPDU &);
BOOL OnReceivedSignalSetup(const H323SignalPDU &);
- void OnReceivedReleaseComplete(const H323SignalPDU &);
+ BOOL OnReceivedFacility(const H323SignalPDU &);
BOOL OnSendSignalSetup(H323SignalPDU &);
BOOL OnStartLogicalChannel(H323Channel &);
- BOOL OnClosingLogicalChannel(H323Channel &);
+ BOOL OnClosingLogicalChannel(H323Channel &);
void SendUserInputTone(char, unsigned);
void OnUserInputTone(char, unsigned, unsigned, unsigned);
void OnUserInputString(const PString &value);
PString destE164;
PIPSocket::Address externalIpAddress; // IP address of media server
- PIPSocket::Address remoteIpAddress; // IP Address of remote endpoint
+ PIPSocket::Address remoteIpAddress; // IP Address of remote endpoint
WORD externalPort; // local media server Data port (control is dataPort+1)
WORD remotePort; // remote endpoint Data port (control is dataPort+1)
+ WORD sessionId;
+ BOOL bridging; // Used to help determine which IP to use
};
+class MyH323_ExternalRTPChannel : public H323_ExternalRTPChannel {
-#if 0
-class MyGatekeeperServer : public H323GatekeeperServer
-{
- PCLASSINFO(MyGatekeeperServer, H323GatekeeperServer);
- public:
- MyGatekeeperServer(MyH323EndPoint & ep);
+ PCLASSINFO(MyH323_ExternalRTPChannel, H323_ExternalRTPChannel);
- // Overrides
- virtual H323GatekeeperCall * CreateCall(
- const OpalGloballyUniqueID & callIdentifier,
- H323GatekeeperCall::Direction direction
- );
- virtual BOOL TranslateAliasAddressToSignalAddress(
- const H225_AliasAddress & alias,
- H323TransportAddress & address
+ public:
+
+ MyH323_ExternalRTPChannel(MyH323Connection &, const H323Capability &, Directions,
+ unsigned, const PIPSocket::Address &, WORD);
+
+ ~MyH323_ExternalRTPChannel();
+
+ BOOL OnReceivedPDU(
+ const H245_H2250LogicalChannelParameters & param, /// Acknowledgement PDU
+ unsigned & errorCode /// Error on failure
);
- // new functions
- BOOL Initialise();
-
- private:
- class RouteMap : public PObject {
- PCLASSINFO(RouteMap, PObject);
- public:
- RouteMap(
- const PString & alias,
- const PString & host
- );
- RouteMap(
- const RouteMap & map
- ) : alias(map.alias), regex(map.alias), host(map.host) { }
-
- void PrintOn(
- ostream & strm
- ) const;
-
- BOOL IsValid() const;
-
- BOOL IsMatch(
- const PString & alias
- ) const;
-
- const H323TransportAddress & GetHost() const { return host; }
-
- private:
- PString alias;
- PRegularExpression regex;
- H323TransportAddress host;
- };
- PList<RouteMap> routes;
-
- PMutex reconfigurationMutex;
-};
+ BOOL OnReceivedAckPDU(const H245_H2250LogicalChannelAckParameters & param);
-#endif
+};
/**
* The MyProcess is a necessary descendant PProcess class so that the H323EndPoint
public:
MyProcess();
- ~MyProcess();
void Main();
};
-
-/**
- * This class handles the termination of a call.
- * Note that OpenH323 Library requires that the termination
- * of a call should be done inside a separate thread of execution.
- */
-class ClearCallThread : public PThread {
-
- PCLASSINFO(ClearCallThread, PThread);
-
- public:
- ClearCallThread(const char *tc);
- ~ClearCallThread();
-
- void Main();
-
- protected:
- PString token;
-};
-
-