| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2003-06-20 06:03:34 +00:00
										 |  |  |  * ast_h323.h | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * OpenH323 Channel Driver for ASTERISK PBX. | 
					
						
							|  |  |  |  *			By Jeremy McNamara | 
					
						
							|  |  |  |  *                      For The NuFone Network  | 
					
						
							|  |  |  |  *  | 
					
						
							| 
									
										
										
										
											2003-07-23 19:55:13 +00:00
										 |  |  |  * This code has been derived from code created by | 
					
						
							|  |  |  |  *              Michael Manousos and Mark Spencer | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  |  * (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  |  * 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. | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  |  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  |  * Version Info: $Id$ | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-26 03:50:14 +00:00
										 |  |  | #ifndef AST_H323_H
 | 
					
						
							|  |  |  | #define AST_H323_H
 | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | #define VERSION(a,b,c) ((a)*10000+(b)*100+(c))
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class MyH323EndPoint : public H323EndPoint | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	PCLASSINFO(MyH323EndPoint, H323EndPoint); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2005-05-19 19:13:19 +00:00
										 |  |  | 	MyH323EndPoint(); | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	int MyMakeCall(const PString &, PString &, void *_callReference, void *_opts); | 
					
						
							| 
									
										
										
										
											2004-12-15 23:24:13 +00:00
										 |  |  | 	BOOL ClearCall(const PString &, H323Connection::CallEndReason reason); | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	BOOL ClearCall(const PString &); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void OnClosedLogicalChannel(H323Connection &, const H323Channel &); | 
					
						
							|  |  |  | 	void OnConnectionEstablished(H323Connection &, const PString &); | 
					
						
							|  |  |  | 	void OnConnectionCleared(H323Connection &, const PString &); | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	virtual H323Connection * CreateConnection(unsigned, void *, H323Transport *, H323SignalPDU *); | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	void SendUserTone(const PString &, char); | 
					
						
							| 
									
										
										
										
											2003-09-06 20:29:25 +00:00
										 |  |  | 	BOOL OnConnectionForwarded(H323Connection &, const PString &, const H323SignalPDU &); | 
					
						
							|  |  |  | 	BOOL ForwardConnection(H323Connection &, const PString &, const H323SignalPDU &); | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	void SetEndpointTypeInfo( H225_EndpointType & info ) const; | 
					
						
							|  |  |  | 	void SetGateway(void); | 
					
						
							|  |  |  | 	PStringArray SupportedPrefixes; | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | class MyH323Connection : public H323Connection | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	PCLASSINFO(MyH323Connection, H323Connection); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2003-05-31 18:42:09 +00:00
										 |  |  | 	MyH323Connection(MyH323EndPoint &, unsigned, unsigned); | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	~MyH323Connection(); | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	H323Channel * CreateRealTimeLogicalChannel(const H323Capability &, | 
					
						
							|  |  |  | 			H323Channel::Directions, | 
					
						
							|  |  |  | 			unsigned, | 
					
						
							|  |  |  | 			const H245_H2250LogicalChannelParameters *, | 
					
						
							|  |  |  | 			RTP_QOS *); | 
					
						
							|  |  |  | 	H323Connection::AnswerCallResponse OnAnswerCall(const PString &, | 
					
						
							|  |  |  | 			const H323SignalPDU &, | 
					
						
							|  |  |  | 			H323SignalPDU &); | 
					
						
							| 
									
										
										
										
											2003-09-06 20:29:25 +00:00
										 |  |  | 	void OnReceivedReleaseComplete(const H323SignalPDU &); | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	BOOL OnAlerting(const H323SignalPDU &, const PString &); | 
					
						
							| 
									
										
										
										
											2003-05-12 00:55:52 +00:00
										 |  |  | 	BOOL OnSendReleaseComplete(H323SignalPDU &); | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	BOOL OnReceivedSignalSetup(const H323SignalPDU &); | 
					
						
							| 
									
										
										
										
											2003-05-12 00:55:52 +00:00
										 |  |  | 	BOOL OnReceivedFacility(const H323SignalPDU &); | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	BOOL OnSendSignalSetup(H323SignalPDU &); | 
					
						
							|  |  |  | 	BOOL OnStartLogicalChannel(H323Channel &); | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	BOOL OnClosingLogicalChannel(H323Channel &); | 
					
						
							|  |  |  | 	virtual void SendUserInputTone(char tone, unsigned duration = 0, unsigned logicalChannel = 0, unsigned rtpTimestamp = 0); | 
					
						
							|  |  |  | 	virtual void OnUserInputTone(char, unsigned, unsigned, unsigned); | 
					
						
							|  |  |  | 	virtual void OnUserInputString(const PString &value); | 
					
						
							| 
									
										
										
										
											2004-12-15 23:24:13 +00:00
										 |  |  | 	BOOL OnReceivedProgress(const H323SignalPDU &); | 
					
						
							| 
									
										
										
										
											2006-09-28 12:58:22 +00:00
										 |  |  | 	BOOL MySendProgress(); | 
					
						
							| 
									
										
										
										
											2004-12-15 23:24:13 +00:00
										 |  |  | 	void OnSendCapabilitySet(H245_TerminalCapabilitySet &); | 
					
						
							| 
									
										
										
										
											2005-05-19 19:13:19 +00:00
										 |  |  | 	void OnSetLocalCapabilities(); | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	void SetCapabilities(int, int, void *, int); | 
					
						
							| 
									
										
										
										
											2004-12-15 23:24:13 +00:00
										 |  |  | 	BOOL OnReceivedCapabilitySet(const H323Capabilities &, const H245_MultiplexCapability *, | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 			H245_TerminalCapabilitySetReject &); | 
					
						
							| 
									
										
										
										
											2005-04-04 07:06:26 +00:00
										 |  |  | 	void SetCause(int _cause) { cause = _cause; }; | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	virtual BOOL StartControlChannel(const H225_TransportAddress & h245Address); | 
					
						
							|  |  |  | 	void SetCallOptions(void *opts, BOOL isIncoming); | 
					
						
							|  |  |  | 	void SetCallDetails(void *callDetails, const H323SignalPDU &setupPDU, BOOL isIncoming); | 
					
						
							|  |  |  | #ifdef TUNNELLING
 | 
					
						
							|  |  |  | 	virtual BOOL HandleSignalPDU(H323SignalPDU &pdu); | 
					
						
							|  |  |  | 	BOOL EmbedTunneledInfo(H323SignalPDU &pdu); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	PString sourceAliases; | 
					
						
							|  |  |  | 	PString destAliases; | 
					
						
							|  |  |  | 	PString sourceE164; | 
					
						
							|  |  |  | 	PString destE164; | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	PString rdnis; | 
					
						
							|  |  |  | 	int redirect_reason; | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-05-20 07:07:18 +00:00
										 |  |  | 	WORD sessionId; | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	BOOL bridging; | 
					
						
							|  |  |  | #ifdef TUNNELLING
 | 
					
						
							|  |  |  | 	int remoteTunnelOptions; | 
					
						
							|  |  |  | 	int tunnelOptions; | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2004-12-15 23:24:13 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	unsigned progressSetup; | 
					
						
							|  |  |  | 	unsigned progressAlert; | 
					
						
							| 
									
										
										
										
											2005-04-04 07:06:26 +00:00
										 |  |  | 	int cause; | 
					
						
							| 
									
										
										
										
											2004-12-15 23:24:13 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	RTP_DataFrame::PayloadTypes dtmfCodec; | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	int dtmfMode; | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | class MyH323_ExternalRTPChannel : public H323_ExternalRTPChannel | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	PCLASSINFO(MyH323_ExternalRTPChannel, H323_ExternalRTPChannel); | 
					
						
							| 
									
										
										
										
											2004-05-20 07:07:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2004-05-20 07:07:18 +00:00
										 |  |  | 	MyH323_ExternalRTPChannel( | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 			MyH323Connection & connection, | 
					
						
							|  |  |  | 			const H323Capability & capability, | 
					
						
							|  |  |  | 			Directions direction, | 
					
						
							|  |  |  | 			unsigned sessionID); | 
					
						
							| 
									
										
										
										
											2004-05-20 07:07:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-20 14:29:36 +00:00
										 |  |  | 	~MyH323_ExternalRTPChannel(); | 
					
						
							| 
									
										
										
										
											2004-12-15 23:24:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-10-10 12:20:18 +00:00
										 |  |  | 	/* Overrides */ | 
					
						
							|  |  |  | 	BOOL Start(void); | 
					
						
							| 
									
										
										
										
											2004-12-15 23:24:13 +00:00
										 |  |  | 	BOOL OnReceivedAckPDU(const H245_H2250LogicalChannelAckParameters & param); | 
					
						
							| 
									
										
										
										
											2004-10-10 12:20:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2004-10-10 12:20:18 +00:00
										 |  |  | 	BYTE payloadCode; | 
					
						
							| 
									
										
										
										
											2004-03-20 14:29:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-10-10 12:20:18 +00:00
										 |  |  | 	PIPSocket::Address localIpAddr; | 
					
						
							|  |  |  | 	PIPSocket::Address remoteIpAddr; | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	WORD localPort; | 
					
						
							|  |  |  | 	WORD remotePort; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2004-03-20 14:29:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  |  * 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). | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | class MyProcess : public PProcess | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	PCLASSINFO(MyProcess, PProcess); | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | 	MyProcess(); | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | 	~MyProcess(); | 
					
						
							|  |  |  | 	void Main(); | 
					
						
							| 
									
										
										
										
											2003-03-31 07:13:36 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 17:07:22 +00:00
										 |  |  | #include "compat_h323.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-26 03:50:14 +00:00
										 |  |  | #endif /* !defined AST_H323_H */
 |