X-Git-Url: http://git.asterisk.org/gitweb/?p=asterisk%2Fasterisk.git;a=blobdiff_plain;f=channels%2Fh323%2Fast_h323.h;h=91ebab0aeafc1da2a69b4989c6649e1243772f12;hp=468f778155092654ab9524e56670c63349cbb7e7;hb=68e767078fffb8c1678b9d25bd906682300a62bb;hpb=3fabe9006782fb35e0c8ff7fe79a57574563f9cd;ds=sidebyside diff --git a/channels/h323/ast_h323.h b/channels/h323/ast_h323.h index 468f778..91ebab0 100755 --- a/channels/h323/ast_h323.h +++ b/channels/h323/ast_h323.h @@ -5,8 +5,8 @@ * 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 * @@ -23,6 +23,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * Version Info: $Id$ */ @@ -97,6 +98,100 @@ class H323_G7231Capability : public H323AudioCapability 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); @@ -112,14 +207,16 @@ class MyH323EndPoint : public H323EndPoint { 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); @@ -131,14 +228,14 @@ class MyH323Connection : public H323Connection { 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); @@ -149,67 +246,32 @@ class MyH323Connection : public H323Connection { 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 routes; - - PMutex reconfigurationMutex; -}; + BOOL OnReceivedAckPDU(const H245_H2250LogicalChannelAckParameters & param); -#endif +}; /** * The MyProcess is a necessary descendant PProcess class so that the H323EndPoint @@ -221,31 +283,9 @@ class MyProcess : public PProcess { 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; -}; - -