OpenH323 1.18.0
|
00001 /* 00002 * h323ep.h 00003 * 00004 * H.323 protocol handler 00005 * 00006 * Open H323 Library 00007 * 00008 * Copyright (c) 1998-2001 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Open H323 Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Portions of this code were written with the assisance of funding from 00025 * Vovida Networks, Inc. http://www.vovida.com. 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Log: h323ep.h,v $ 00030 * Revision 1.76 2005/11/30 13:05:01 csoutheren 00031 * Changed tags for Doxygen 00032 * 00033 * Revision 1.75 2005/11/22 03:38:45 shorne 00034 * Added ToS support to TCP Transports. thx Norbert Bartalsky (TOPCALL) 00035 * 00036 * Revision 1.74 2005/11/21 21:02:19 shorne 00037 * Added GnuGK Nat detection support 00038 * 00039 * Revision 1.73 2005/09/16 08:12:49 csoutheren 00040 * Added ability to set timeout for connect 00041 * 00042 * Revision 1.72 2005/07/12 12:28:52 csoutheren 00043 * Fixes for H.450 errors and return values 00044 * Thanks to Iker Perez San Roman 00045 * 00046 * Revision 1.71 2005/03/10 07:01:29 csoutheren 00047 * Fixed problem with H.450 call identifiers not being unique across all calls on an 00048 * endpoint. Thanks to Thien Nguyen 00049 * 00050 * Revision 1.70 2005/01/03 14:03:20 csoutheren 00051 * Added new configure options and ability to disable/enable modules 00052 * 00053 * Revision 1.69 2005/01/03 06:25:52 csoutheren 00054 * Added extensive support for disabling code modules at compile time 00055 * 00056 * Revision 1.68 2004/12/20 02:32:34 csoutheren 00057 * Cleeaned up OSP functions 00058 * 00059 * Revision 1.67 2004/12/08 01:59:22 csoutheren 00060 * initial support for Transnexus OSP toolkit 00061 * 00062 * Revision 1.66 2004/11/25 07:38:58 csoutheren 00063 * Ensured that external TCP address translation is performed when using STUN to handle UDP 00064 * 00065 * Revision 1.65 2004/09/03 01:06:09 csoutheren 00066 * Added initial hooks for H.460 GEF 00067 * Thanks to Simon Horne and ISVO (Asia) Pte Ltd. for this contribution 00068 * 00069 * Revision 1.64 2004/07/27 05:28:45 csoutheren 00070 * Added ability to set priority of channel threads 00071 * 00072 * Revision 1.63 2004/07/27 01:15:16 csoutheren 00073 * Added virtual to InternalMakeCall 00074 * 00075 * Revision 1.62 2004/07/19 13:19:55 csoutheren 00076 * Fixed typo in secondaryConnectionsActive 00077 * 00078 * Revision 1.61 2004/07/11 11:36:25 rjongbloed 00079 * Added virtual to CleanUpConnections, thanks Eize Slange 00080 * 00081 * Revision 1.60 2004/06/15 03:30:00 csoutheren 00082 * Added OnSendARQ to allow access to the ARQ message before sent by connection 00083 * 00084 * Revision 1.59 2004/06/04 07:05:10 csoutheren 00085 * Fixed obvious typos 00086 * 00087 * Revision 1.58 2004/06/01 05:48:02 csoutheren 00088 * Changed capability table to use abstract factory routines rather than internal linked list 00089 * 00090 * Revision 1.57 2004/05/17 12:14:24 csoutheren 00091 * Added support for different SETUP PDU types 00092 * 00093 * Revision 1.56 2003/12/29 04:58:55 csoutheren 00094 * Added callbacks on H323EndPoint when gatekeeper discovery succeeds or fails 00095 * 00096 * Revision 1.55 2003/12/28 02:52:15 csoutheren 00097 * Added virtual to a few functions 00098 * 00099 * Revision 1.54 2003/12/28 02:38:14 csoutheren 00100 * Added H323EndPoint::OnOutgoingCall 00101 * 00102 * Revision 1.53 2003/12/28 00:07:10 csoutheren 00103 * Added callbacks on H323EndPoint when gatekeeper registration succeeds or fails 00104 * 00105 * Revision 1.52 2003/04/24 01:49:33 dereks 00106 * Add ability to set no media timeout interval 00107 * 00108 * Revision 1.51 2003/04/10 09:39:48 robertj 00109 * Added associated transport to new GetInterfaceAddresses() function so 00110 * interfaces can be ordered according to active transport links. Improves 00111 * interoperability. 00112 * 00113 * Revision 1.50 2003/04/10 01:05:11 craigs 00114 * Added functions to access to lists of interfaces 00115 * 00116 * Revision 1.49 2003/04/07 13:09:25 robertj 00117 * Added ILS support to callto URL parsing in MakeCall(), ie can now call hosts 00118 * registered with an ILS directory. 00119 * 00120 * Revision 1.48 2003/02/13 00:11:31 robertj 00121 * Added missing virtual for controlling call transfer, thanks Andrey Pinaev 00122 * 00123 * Revision 1.47 2003/02/09 00:48:06 robertj 00124 * Added function to return if registered with gatekeeper. 00125 * 00126 * Revision 1.46 2003/02/04 07:06:41 robertj 00127 * Added STUN support. 00128 * 00129 * Revision 1.45 2003/01/26 05:57:58 robertj 00130 * Changed ParsePartyName so will accept addresses of the form 00131 * alias@gk:address which will do an LRQ call to "address" using "alias" 00132 * to determine the IP address to connect to. 00133 * 00134 * Revision 1.44 2003/01/23 02:36:30 robertj 00135 * Increased (and made configurable) timeout for H.245 channel TCP connection. 00136 * 00137 * Revision 1.43 2002/11/28 01:19:55 craigs 00138 * Added virtual to several functions 00139 * 00140 * Revision 1.42 2002/11/27 06:54:52 robertj 00141 * Added Service Control Session management as per Annex K/H.323 via RAS 00142 * only at this stage. 00143 * Added H.248 ASN and very primitive infrastructure for linking into the 00144 * Service Control Session management system. 00145 * Added basic infrastructure for Annex K/H.323 HTTP transport system. 00146 * Added Call Credit Service Control to display account balances. 00147 * 00148 * Revision 1.41 2002/11/15 05:17:22 robertj 00149 * Added facility redirect support without changing the call token for access 00150 * to the call. If it gets redirected a new H323Connection object is 00151 * created but it looks like the same thing to an application. 00152 * 00153 * Revision 1.40 2002/11/10 08:10:43 robertj 00154 * Moved constants for "well known" ports to better place (OPAL change). 00155 * 00156 * Revision 1.39 2002/10/31 00:32:15 robertj 00157 * Enhanced jitter buffer system so operates dynamically between minimum and 00158 * maximum values. Altered API to assure app writers note the change! 00159 * 00160 * Revision 1.38 2002/10/23 06:06:10 robertj 00161 * Added function to be smarter in using a gatekeeper for use by endpoint. 00162 * 00163 * Revision 1.37 2002/10/21 06:07:44 robertj 00164 * Added function to set gatekeeper access token OID. 00165 * 00166 * Revision 1.36 2002/09/16 01:14:15 robertj 00167 * Added #define so can select if #pragma interface/implementation is used on 00168 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00169 * 00170 * Revision 1.35 2002/09/10 06:32:25 robertj 00171 * Added function to get gatekeeper password. 00172 * 00173 * Revision 1.34 2002/09/03 06:19:36 robertj 00174 * Normalised the multi-include header prevention ifdef/define symbol. 00175 * 00176 * Revision 1.33 2002/07/19 03:39:19 robertj 00177 * Bullet proofed setting of RTP IP port base, can't be zero! 00178 * 00179 * Revision 1.32 2002/07/18 01:50:10 robertj 00180 * Changed port secltion code to force apps to use function interface. 00181 * 00182 * Revision 1.31 2002/06/22 05:48:38 robertj 00183 * Added partial implementation for H.450.11 Call Intrusion 00184 * 00185 * Revision 1.30 2002/06/13 06:15:19 robertj 00186 * Allowed TransferCall() to be used on H323Connection as well as H323EndPoint. 00187 * 00188 * Revision 1.29 2002/06/12 03:55:21 robertj 00189 * Added function to add/remove multiple listeners in one go comparing against 00190 * what is already running so does not interrupt unchanged listeners. 00191 * 00192 * Revision 1.28 2002/05/29 06:40:29 robertj 00193 * Changed sending of endSession/ReleaseComplete PDU's to occur immediately 00194 * on call clearance and not wait for background thread to do it. 00195 * Stricter compliance by waiting for reply endSession before closing down. 00196 * 00197 * Revision 1.27 2002/05/28 06:15:09 robertj 00198 * Split UDP (for RAS) from RTP port bases. 00199 * Added current port variable so cycles around the port range specified which 00200 * fixes some wierd problems on some platforms, thanks Federico Pinna 00201 * 00202 * Revision 1.26 2002/05/17 03:38:05 robertj 00203 * Fixed problems with H.235 authentication on RAS for server and client. 00204 * 00205 * Revision 1.25 2002/05/16 00:03:05 robertj 00206 * Added function to get the tokens for all active calls. 00207 * Improved documentation for use of T.38 and T.120 functions. 00208 * 00209 * Revision 1.24 2002/05/15 08:59:18 rogerh 00210 * Update comments 00211 * 00212 * Revision 1.23 2002/05/03 05:38:15 robertj 00213 * Added Q.931 Keypad IE mechanism for user indications (DTMF). 00214 * 00215 * Revision 1.22 2002/05/02 07:56:24 robertj 00216 * Added automatic clearing of call if no media (RTP data) is transferred in a 00217 * configurable (default 5 minutes) amount of time. 00218 * 00219 * Revision 1.21 2002/04/18 01:41:07 robertj 00220 * Fixed bad variable name for disabling DTMF detection, very confusing. 00221 * 00222 * Revision 1.20 2002/04/17 00:49:56 robertj 00223 * Added ability to disable the in band DTMF detection. 00224 * 00225 * Revision 1.19 2002/04/10 06:48:47 robertj 00226 * Added functions to set port member variables. 00227 * 00228 * Revision 1.18 2002/03/14 03:49:38 dereks 00229 * Fix minor documentation error. 00230 * 00231 * Revision 1.17 2002/02/04 07:17:52 robertj 00232 * Added H.450.2 Consultation Transfer, thanks Norwood Systems. 00233 * 00234 * Revision 1.16 2002/01/24 06:29:02 robertj 00235 * Added option to disable H.245 negotiation in SETUP pdu, this required 00236 * API change so have a bit mask instead of a series of booleans. 00237 * 00238 * Revision 1.15 2002/01/17 07:04:58 robertj 00239 * Added support for RFC2833 embedded DTMF in the RTP stream. 00240 * 00241 * Revision 1.14 2002/01/13 23:59:43 robertj 00242 * Added CallTransfer timeouts to endpoint, hanks Ben Madsen of Norwood Systems. 00243 * 00244 * Revision 1.13 2002/01/08 04:45:35 robertj 00245 * Added MakeCallLocked() so can start a call with the H323Connection instance 00246 * initally locked so can do things to it before the call really starts. 00247 * 00248 * Revision 1.12 2001/12/22 03:20:44 robertj 00249 * Added create protocol function to H323Connection. 00250 * 00251 * Revision 1.11 2001/12/13 10:55:30 robertj 00252 * Added gatekeeper access token OID specification for auto inclusion of 00253 * access tokens frm ACF to SETUP pdu. 00254 * 00255 * Revision 1.10 2001/11/09 05:39:54 craigs 00256 * Added initial T.38 support thanks to Adam Lazur 00257 * 00258 * Revision 1.9 2001/11/01 00:27:33 robertj 00259 * Added default Fast Start disabled and H.245 tunneling disable flags 00260 * to the endpoint instance. 00261 * 00262 * Revision 1.8 2001/09/11 01:24:36 robertj 00263 * Added conditional compilation to remove video and/or audio codecs. 00264 * 00265 * Revision 1.7 2001/09/11 00:21:21 robertj 00266 * Fixed missing stack sizes in endpoint for cleaner thread and jitter thread. 00267 * 00268 * Revision 1.6 2001/08/24 14:03:26 rogerh 00269 * Fix some spelling mistakes 00270 * 00271 * Revision 1.5 2001/08/16 07:49:16 robertj 00272 * Changed the H.450 support to be more extensible. Protocol handlers 00273 * are now in separate classes instead of all in H323Connection. 00274 * 00275 * Revision 1.4 2001/08/10 11:03:49 robertj 00276 * Major changes to H.235 support in RAS to support server. 00277 * 00278 * Revision 1.3 2001/08/08 23:54:11 robertj 00279 * Fixed problem with setting gk password before have a gk variable. 00280 * 00281 * Revision 1.2 2001/08/06 03:15:17 robertj 00282 * Improved access to H.235 secure RAS functionality. 00283 * 00284 * Revision 1.1 2001/08/06 03:08:11 robertj 00285 * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files. 00286 * 00287 */ 00288 00289 #ifndef __OPAL_H323EP_H 00290 #define __OPAL_H323EP_H 00291 00292 #include "h323.h" 00293 #include "h323con.h" 00294 #include "h235auth.h" 00295 00296 #ifdef H323_TRANSNEXUS_OSP 00297 #include "opalosp.h" 00298 #endif 00299 00300 /* The following classes have forward references to avoid including the VERY 00301 large header files for H225 and H245. If an application requires access 00302 to the protocol classes they can include them, but for simple usage their 00303 inclusion can be avoided. 00304 */ 00305 class H225_EndpointType; 00306 class H225_VendorIdentifier; 00307 class H225_H221NonStandard; 00308 class H225_ServiceControlDescriptor; 00309 00310 class H323SignalPDU; 00311 class H323ConnectionsCleaner; 00312 class H323ServiceControlSession; 00313 00314 #ifdef H323_T120 00315 class OpalT120Protocol; 00316 #endif 00317 00318 #ifdef H323_T38 00319 class OpalT38Protocol; 00320 #endif 00321 00322 #ifdef P_STUN 00323 class PSTUNClient; 00324 #endif 00325 00326 #ifdef P_USE_PRAGMA 00327 #pragma interface 00328 #endif 00329 00330 00332 00345 class H323EndPoint : public PObject 00346 { 00347 PCLASSINFO(H323EndPoint, PObject); 00348 00349 public: 00350 enum { 00351 DefaultTcpPort = 1720 00352 }; 00353 00358 H323EndPoint(); 00359 00362 ~H323EndPoint(); 00363 00366 virtual void SetEndpointTypeInfo( 00367 H225_EndpointType & info 00368 ) const; 00369 00372 virtual void SetVendorIdentifierInfo( 00373 H225_VendorIdentifier & info 00374 ) const; 00375 00378 virtual void SetH221NonStandardInfo( 00379 H225_H221NonStandard & info 00380 ) const; 00382 00383 00394 void AddCapability( 00395 H323Capability * capability 00396 ); 00397 00418 PINDEX SetCapability( 00419 PINDEX descriptorNum, 00420 PINDEX simultaneous, 00421 H323Capability * cap 00422 ); 00423 00428 PINDEX AddAllCapabilities( 00429 PINDEX descriptorNum, 00430 PINDEX simultaneous, 00431 const PString & name 00432 ); 00433 00436 void AddAllUserInputCapabilities( 00437 PINDEX descriptorNum, 00438 PINDEX simultaneous 00439 ); 00440 00443 void RemoveCapabilities( 00444 const PStringArray & codecNames 00445 ); 00446 00449 void ReorderCapabilities( 00450 const PStringArray & preferenceOrder 00451 ); 00452 00455 H323Capability * FindCapability( 00456 const H245_Capability & cap 00457 ) const; 00458 00461 H323Capability * FindCapability( 00462 const H245_DataType & dataType 00463 ) const; 00464 00467 H323Capability * FindCapability( 00468 H323Capability::MainTypes mainType, 00469 unsigned subType 00470 ) const; 00472 00492 BOOL UseGatekeeper( 00493 const PString & address = PString::Empty(), 00494 const PString & identifier = PString::Empty(), 00495 const PString & localAddress = PString::Empty() 00496 ); 00497 00508 BOOL SetGatekeeper( 00509 const PString & address, 00510 H323Transport * transport = NULL 00511 ); 00512 00527 BOOL SetGatekeeperZone( 00528 const PString & address, 00529 const PString & identifier, 00530 H323Transport * transport = NULL 00531 ); 00532 00542 BOOL LocateGatekeeper( 00543 const PString & identifier, 00544 H323Transport * transport = NULL 00545 ); 00546 00555 BOOL DiscoverGatekeeper( 00556 H323Transport * transport = NULL 00557 ); 00558 00566 virtual H323Gatekeeper * CreateGatekeeper( 00567 H323Transport * transport 00568 ); 00569 00572 H323Gatekeeper * GetGatekeeper() const { return gatekeeper; } 00573 00576 BOOL IsRegisteredWithGatekeeper() const; 00577 00583 BOOL RemoveGatekeeper( 00584 int reason = -1 00585 ); 00586 00589 virtual void SetGatekeeperPassword( 00590 const PString & password 00591 ); 00592 00595 virtual const PString & GetGatekeeperPassword() const { return gatekeeperPassword; } 00596 00599 virtual H235Authenticators CreateAuthenticators(); 00600 00603 virtual void OnGatekeeperConfirm(); 00604 00607 virtual void OnGatekeeperReject(); 00608 00611 virtual void OnRegistrationConfirm(); 00612 00615 virtual void OnRegistrationReject(); 00617 00618 #ifdef H323_TRANSNEXUS_OSP 00619 00625 inline int SetOSPProvider( 00626 const PString & server 00627 ) 00628 { return SetOSPProvider(server, PDirectory()); } 00629 virtual int SetOSPProvider( 00630 const PString & server, 00631 const PDirectory & ospDir 00632 ); 00633 virtual void SetOSPProvider( 00634 OpalOSP::Provider * provider 00635 ); 00636 00639 virtual OpalOSP::Provider * GetOSPProvider() 00640 { return ospProvider; } 00641 00642 #endif 00643 00660 BOOL StartListener( 00661 H323Listener * listener 00662 ); 00663 00675 BOOL StartListener( 00676 const H323TransportAddress & iface 00677 ); 00678 00695 BOOL StartListeners( 00696 const H323TransportAddressArray & ifaces 00697 ); 00698 00702 BOOL RemoveListener( 00703 H323Listener * listener 00704 ); 00705 00708 H323TransportAddressArray GetInterfaceAddresses( 00709 BOOL excludeLocalHost = TRUE, 00710 H323Transport * associatedTransport = NULL 00712 ); 00713 00732 H323Connection * MakeCall( 00733 const PString & remoteParty, 00734 PString & token, 00735 void * userData = NULL 00736 ); 00737 00758 H323Connection * MakeCall( 00759 const PString & remoteParty, 00760 H323Transport * transport, 00761 PString & token, 00762 void * userData = NULL 00763 ); 00764 00775 H323Connection * MakeCallLocked( 00776 const PString & remoteParty, 00777 PString & token, 00778 void * userData = NULL, 00779 H323Transport * transport = NULL 00780 ); 00781 00782 #ifdef H323_H450 00783 00804 virtual H323Connection * SetupTransfer( 00805 const PString & token, 00806 const PString & callIdentity, 00807 const PString & remoteParty, 00808 PString & newToken, 00809 void * userData = NULL 00810 ); 00811 00817 void TransferCall( 00818 const PString & token, 00819 const PString & remoteParty, 00820 const PString & callIdentity = PString::Empty() 00822 ); 00823 00830 void ConsultationTransfer( 00831 const PString & primaryCallToken, 00832 const PString & secondaryCallToken 00833 ); 00834 00838 void HoldCall( 00839 const PString & token, 00840 BOOL localHold 00841 ); 00842 00846 H323Connection * IntrudeCall( 00847 const PString & remoteParty, 00848 PString & token, 00849 unsigned capabilityLevel, 00850 void * userData = NULL 00851 ); 00852 00853 H323Connection * IntrudeCall( 00854 const PString & remoteParty, 00855 H323Transport * transport, 00856 PString & token, 00857 unsigned capabilityLevel, 00858 void * userData = NULL 00859 ); 00860 00861 #endif // H323_H450 00862 00869 BOOL ParsePartyName( 00870 const PString & party, 00871 PString & alias, 00872 H323TransportAddress & address 00873 ); 00874 00879 virtual BOOL ClearCall( 00880 const PString & token, 00881 H323Connection::CallEndReason reason = 00882 H323Connection::EndedByLocalUser 00883 ); 00884 00889 virtual BOOL ClearCallSynchronous( 00890 const PString & token, 00891 H323Connection::CallEndReason reason = 00892 H323Connection::EndedByLocalUser 00893 ); 00894 virtual BOOL ClearCallSynchronous( 00895 const PString & token, 00896 H323Connection::CallEndReason reason, 00897 PSyncPoint * sync 00898 ); 00899 00906 virtual void ClearAllCalls( 00907 H323Connection::CallEndReason reason = 00908 H323Connection::EndedByLocalUser, 00909 BOOL wait = TRUE 00910 ); 00911 00914 virtual BOOL HasConnection( 00915 const PString & token 00916 ); 00917 00929 H323Connection * FindConnectionWithLock( 00930 const PString & token 00931 ); 00932 00935 PStringList GetAllConnections(); 00936 00948 virtual BOOL OnIncomingCall( 00949 H323Connection & connection, 00950 const H323SignalPDU & setupPDU, 00951 H323SignalPDU & alertingPDU 00952 ); 00953 virtual BOOL OnIncomingCall( 00954 H323Connection & connection, 00955 const H323SignalPDU & setupPDU, 00956 H323SignalPDU & alertingPDU, 00957 H323Connection::CallEndReason & reason 00958 ); 00959 00964 virtual BOOL OnCallTransferInitiate( 00965 H323Connection & connection, 00966 const PString & remoteParty 00967 ); 00968 00973 virtual BOOL OnCallTransferIdentify( 00974 H323Connection & connection 00975 ); 00976 00981 virtual void OnSendARQ( 00982 H323Connection & conn, 00983 H225_AdmissionRequest & arq 00984 ); 00985 01004 virtual H323Connection::AnswerCallResponse OnAnswerCall( 01005 H323Connection & connection, 01006 const PString & callerName, 01007 const H323SignalPDU & setupPDU, 01008 H323SignalPDU & connectPDU 01009 ); 01010 01021 virtual BOOL OnAlerting( 01022 H323Connection & connection, 01023 const H323SignalPDU & alertingPDU, 01024 const PString & user 01025 ); 01026 01035 virtual BOOL OnConnectionForwarded( 01036 H323Connection & connection, 01037 const PString & forwardParty, 01038 const H323SignalPDU & pdu 01039 ); 01040 01049 virtual BOOL ForwardConnection( 01050 H323Connection & connection, 01051 const PString & forwardParty, 01052 const H323SignalPDU & pdu 01053 ); 01054 01061 virtual void OnConnectionEstablished( 01062 H323Connection & connection, 01063 const PString & token 01064 ); 01065 01068 virtual BOOL IsConnectionEstablished( 01069 const PString & token 01070 ); 01071 01078 virtual void OnConnectionCleared( 01079 H323Connection & connection, 01080 const PString & token 01081 ); 01082 01087 static PString BuildConnectionToken( 01088 const H323Transport & transport, 01089 unsigned callReference, 01090 BOOL fromRemote 01091 ); 01092 01098 virtual H323Connection * OnIncomingConnection( 01099 H323Transport * transport, 01100 H323SignalPDU & setupPDU 01101 ); 01102 01109 virtual BOOL OnOutgoingCall( 01110 H323Connection & conn, 01111 const H323SignalPDU & connectPDU 01112 ); 01113 01116 virtual H323Connection * CreateConnection( 01117 unsigned callReference, 01118 void * userData, 01119 H323Transport * transport, 01120 H323SignalPDU * setupPDU 01121 ); 01122 virtual H323Connection * CreateConnection( 01123 unsigned callReference, 01124 void * userData 01125 ); 01126 virtual H323Connection * CreateConnection( 01127 unsigned callReference 01128 ); 01129 01136 virtual void CleanUpConnections(); 01138 01139 01146 virtual BOOL OnStartLogicalChannel( 01147 H323Connection & connection, 01148 H323Channel & channel 01149 ); 01150 01155 virtual void OnClosedLogicalChannel( 01156 H323Connection & connection, 01157 const H323Channel & channel 01158 ); 01159 01160 #ifndef NO_H323_AUDIO_CODECS 01161 01168 virtual BOOL OpenAudioChannel( 01169 H323Connection & connection, 01170 BOOL isEncoding, 01171 unsigned bufferSize, 01172 H323AudioCodec & codec 01173 ); 01174 #endif 01175 01176 #ifndef NO_H323_VIDEO 01177 01183 virtual BOOL OpenVideoChannel( 01184 H323Connection & connection, 01185 BOOL isEncoding, 01186 H323VideoCodec & codec 01187 ); 01188 #endif // NO_H323_VIDEO 01189 01197 virtual void OnRTPStatistics( 01198 const H323Connection & connection, 01199 const RTP_Session & session 01200 ) const; 01202 01209 virtual void OnUserInputString( 01210 H323Connection & connection, 01211 const PString & value 01212 ); 01213 01218 virtual void OnUserInputTone( 01219 H323Connection & connection, 01220 char tone, 01221 unsigned duration, 01222 unsigned logicalChannel, 01223 unsigned rtpTimestamp 01224 ); 01225 01229 virtual void OnGatekeeperNATDetect( 01230 PIPSocket::Address publicAddr, 01231 PString & gkIdentifier, 01232 H323TransportAddress & gkRouteAddress 01233 ); 01235 01236 #ifdef H323_H248 01237 01246 virtual void OnHTTPServiceControl( 01247 unsigned operation, 01248 unsigned sessionId, 01249 const PString & url 01250 ); 01251 01261 virtual void OnCallCreditServiceControl( 01262 const PString & amount, 01263 BOOL mode 01264 ); 01265 01269 virtual void OnServiceControlSession( 01270 unsigned type, 01271 unsigned sessionid, 01272 const H323ServiceControlSession & session, 01273 H323Connection * connection 01274 ); 01275 01278 virtual H323ServiceControlSession * CreateServiceControlSession( 01279 const H225_ServiceControlDescriptor & contents 01280 ); 01282 #endif // H323_H248 01283 01286 #ifdef H323_T120 01287 01297 virtual OpalT120Protocol * CreateT120ProtocolHandler( 01298 const H323Connection & connection 01299 ) const; 01300 #endif 01301 01302 #ifdef H323_T38 01303 01313 virtual OpalT38Protocol * CreateT38ProtocolHandler( 01314 const H323Connection & connection 01315 ) const; 01317 #endif 01318 01326 virtual BOOL OnConferenceInvite( 01327 const H323SignalPDU & setupPDU 01328 ); 01329 01335 virtual BOOL OnCallIndependentSupplementaryService( 01336 const H323SignalPDU & setupPDU 01337 ); 01338 01344 virtual BOOL OnNegotiateConferenceCapabilities( 01345 const H323SignalPDU & setupPDU 01346 ); 01348 01359 virtual void SetLocalUserName( 01360 const PString & name 01361 ); 01362 01367 virtual const PString & GetLocalUserName() const { return localAliasNames[0]; } 01368 01375 BOOL AddAliasName( 01376 const PString & name 01377 ); 01378 01382 BOOL RemoveAliasName( 01383 const PString & name 01384 ); 01385 01390 const PStringList & GetAliasNames() const { return localAliasNames; } 01391 01392 #if P_LDAP 01393 01396 const PString & GetDefaultILSServer() const { return ilsServer; } 01397 01400 void SetDefaultILSServer( 01401 const PString & server 01402 ) { ilsServer = server; } 01403 01404 #endif 01405 01408 BOOL IsFastStartDisabled() const 01409 { return disableFastStart; } 01410 01413 void DisableFastStart( 01414 BOOL mode 01415 ) { disableFastStart = mode; } 01416 01419 BOOL IsH245TunnelingDisabled() const 01420 { return disableH245Tunneling; } 01421 01424 void DisableH245Tunneling( 01425 BOOL mode 01426 ) { disableH245Tunneling = mode; } 01427 01430 BOOL IsH245inSetupDisabled() const 01431 { return disableH245inSetup; } 01432 01435 void DisableH245inSetup( 01436 BOOL mode 01437 ) { disableH245inSetup = mode; } 01438 01441 BOOL DetectInBandDTMFDisabled() const 01442 { return disableDetectInBandDTMF; } 01443 01446 void DisableDetectInBandDTMF( 01447 BOOL mode 01448 ) { disableDetectInBandDTMF = mode; } 01449 01452 BOOL CanDisplayAmountString() const 01453 { return canDisplayAmountString; } 01454 01457 void SetCanDisplayAmountString( 01458 BOOL mode 01459 ) { canDisplayAmountString = mode; } 01460 01463 BOOL CanEnforceDurationLimit() const 01464 { return canEnforceDurationLimit; } 01465 01468 void SetCanEnforceDurationLimit( 01469 BOOL mode 01470 ) { canEnforceDurationLimit = mode; } 01471 01472 #ifdef H323_H450 01473 01476 unsigned GetCallIntrusionProtectionLevel() const { return callIntrusionProtectionLevel; } 01477 01480 void SetCallIntrusionProtectionLevel( 01481 unsigned level 01482 ) { PAssert(level<=3, PInvalidParameter); callIntrusionProtectionLevel = level; } 01483 01486 virtual void OnReceivedInitiateReturnError(); 01487 01488 #endif // H323_H450 01489 01490 #ifdef H323_AUDIO_CODECS 01491 #ifdef P_AUDIO 01492 01500 virtual BOOL SetSoundChannelPlayDevice(const PString & name); 01501 virtual BOOL SetSoundChannelPlayDriver(const PString & name); 01502 01507 const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; } 01508 const PString & GetSoundChannelPlayDriver() const { return soundChannelPlayDriver; } 01509 01517 virtual BOOL SetSoundChannelRecordDevice(const PString & name); 01518 virtual BOOL SetSoundChannelRecordDriver(const PString & name); 01519 01524 const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; } 01525 const PString & GetSoundChannelRecordDriver() const { return soundChannelRecordDriver; } 01526 01529 unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; } 01530 01533 void SetSoundChannelBufferDepth( 01534 unsigned depth 01535 ); 01536 01537 #endif // P_AUDIO 01538 01541 H323AudioCodec::SilenceDetectionMode GetSilenceDetectionMode() const 01542 { return defaultSilenceDetection; } 01543 01546 void SetSilenceDetectionMode( 01547 H323AudioCodec::SilenceDetectionMode mode 01548 ) { defaultSilenceDetection = mode; } 01549 01550 #endif // H323_AUDIO_CODECS 01551 01554 H323Connection::SendUserInputModes GetSendUserInputMode() const { return defaultSendUserInputMode; } 01555 01558 void SetSendUserInputMode(H323Connection::SendUserInputModes mode) { defaultSendUserInputMode = mode; } 01559 01560 #ifdef H323_VIDEO 01561 01564 BOOL CanAutoStartReceiveVideo() const { return autoStartReceiveVideo; } 01565 01568 BOOL CanAutoStartTransmitVideo() const { return autoStartTransmitVideo; } 01569 01570 #endif // H323_VIDEO 01571 01572 #ifdef H323_T38 01573 01576 BOOL CanAutoStartReceiveFax() const { return autoStartReceiveFax; } 01577 01580 BOOL CanAutoStartTransmitFax() const { return autoStartTransmitFax; } 01581 01582 #endif // H323_T38 01583 01586 BOOL CanAutoCallForward() const { return autoCallForward; } 01587 01590 const H323ListenerList & GetListeners() const { return listeners; } 01591 01594 const H323Capabilities & GetCapabilities() const { return capabilities; } 01595 01598 enum TerminalTypes { 01599 e_TerminalOnly = 50, 01600 e_TerminalAndMC = 70, 01601 e_GatewayOnly = 60, 01602 e_GatewayAndMC = 80, 01603 e_GatewayAndMCWithDataMP = 90, 01604 e_GatewayAndMCWithAudioMP = 100, 01605 e_GatewayAndMCWithAVMP = 110, 01606 e_GatekeeperOnly = 120, 01607 e_GatekeeperWithDataMP = 130, 01608 e_GatekeeperWithAudioMP = 140, 01609 e_GatekeeperWithAVMP = 150, 01610 e_MCUOnly = 160, 01611 e_MCUWithDataMP = 170, 01612 e_MCUWithAudioMP = 180, 01613 e_MCUWithAVMP = 190 01614 }; 01615 01618 TerminalTypes GetTerminalType() const { return terminalType; } 01619 01622 BOOL IsTerminal() const; 01623 01626 BOOL IsGateway() const; 01627 01630 BOOL IsGatekeeper() const; 01631 01634 BOOL IsMCU() const; 01635 01636 #ifdef H323_AUDIO_CODECS 01637 01640 unsigned GetMinAudioJitterDelay() const { return minAudioJitterDelay; } 01641 01645 unsigned GetMaxAudioJitterDelay() const { return maxAudioJitterDelay; } 01646 01649 void SetAudioJitterDelay( 01650 unsigned minDelay, 01651 unsigned maxDelay 01652 ); 01653 #endif 01654 01657 unsigned GetInitialBandwidth() const { return initialBandwidth; } 01658 01661 void SetInitialBandwidth(unsigned bandwidth) { initialBandwidth = bandwidth; } 01662 01665 virtual BOOL OnSendFeatureSet(unsigned, H225_FeatureSet &); 01666 01669 virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet &); 01670 01671 #ifdef P_STUN 01672 01678 PSTUNClient * GetSTUN( 01679 const PIPSocket::Address & address = 0 01680 ) const; 01681 01684 void SetSTUNServer( 01685 const PString & server 01686 ); 01687 01688 #endif // P_NONCORE 01689 01692 virtual BOOL IsLocalAddress( 01693 const PIPSocket::Address & remoteAddress 01694 ) const; 01695 01698 virtual void TranslateTCPAddress( 01699 PIPSocket::Address & /*localAddr*/, 01700 const PIPSocket::Address & /*remoteAddr */ 01701 ) { } 01702 void InternalTranslateTCPAddress( 01703 PIPSocket::Address & /*localAddr*/, 01704 const PIPSocket::Address & /*remoteAddr */ 01705 ); 01706 01709 WORD GetTCPPortBase() const { return tcpPorts.base; } 01710 01713 WORD GetTCPPortMax() const { return tcpPorts.max; } 01714 01717 void SetTCPPorts(unsigned tcpBase, unsigned tcpMax); 01718 01721 WORD GetNextTCPPort(); 01722 01725 WORD GetUDPPortBase() const { return udpPorts.base; } 01726 01729 WORD GetUDPPortMax() const { return udpPorts.max; } 01730 01733 void SetUDPPorts(unsigned udpBase, unsigned udpMax); 01734 01737 WORD GetNextUDPPort(); 01738 01741 WORD GetRtpIpPortBase() const { return rtpIpPorts.base; } 01742 01745 WORD GetRtpIpPortMax() const { return rtpIpPorts.max; } 01746 01749 void SetRtpIpPorts(unsigned udpBase, unsigned udpMax); 01750 01753 WORD GetRtpIpPortPair(); 01754 01757 BYTE GetRtpIpTypeofService() const { return rtpIpTypeofService; } 01758 01761 void SetRtpIpTypeofService(unsigned tos) { rtpIpTypeofService = (BYTE)tos; } 01762 01765 BYTE GetTcpIpTypeofService() const { return tcpIpTypeofService; } 01766 01769 void SetTcpIpTypeofService(unsigned tos) { tcpIpTypeofService = (BYTE)tos; } 01770 01773 const PTimeInterval & GetSignallingChannelConnectTimeout() const { return signallingChannelConnectTimeout; } 01774 01777 const PTimeInterval & GetSignallingChannelCallTimeout() const { return signallingChannelCallTimeout; } 01778 01781 const PTimeInterval & GetControlChannelStartTimeout() const { return controlChannelStartTimeout; } 01782 01785 const PTimeInterval & GetEndSessionTimeout() const { return endSessionTimeout; } 01786 01789 const PTimeInterval & GetMasterSlaveDeterminationTimeout() const { return masterSlaveDeterminationTimeout; } 01790 01793 unsigned GetMasterSlaveDeterminationRetries() const { return masterSlaveDeterminationRetries; } 01794 01797 const PTimeInterval & GetCapabilityExchangeTimeout() const { return capabilityExchangeTimeout; } 01798 01801 const PTimeInterval & GetLogicalChannelTimeout() const { return logicalChannelTimeout; } 01802 01805 const PTimeInterval & GetRequestModeTimeout() const { return logicalChannelTimeout; } 01806 01809 const PTimeInterval & GetRoundTripDelayTimeout() const { return roundTripDelayTimeout; } 01810 01813 const PTimeInterval & GetRoundTripDelayRate() const { return roundTripDelayRate; } 01814 01817 BOOL ShouldClearCallOnRoundTripFail() const { return clearCallOnRoundTripFail; } 01818 01821 const PTimeInterval & GetNoMediaTimeout() const; 01822 01825 BOOL SetNoMediaTimeout(PTimeInterval newInterval); 01826 01829 const PTimeInterval & GetGatekeeperRequestTimeout() const { return gatekeeperRequestTimeout; } 01830 01833 unsigned GetGatekeeperRequestRetries() const { return gatekeeperRequestRetries; } 01834 01837 const PTimeInterval & GetRasRequestTimeout() const { return rasRequestTimeout; } 01838 01841 unsigned GetRasRequestRetries() const { return rasRequestRetries; } 01842 01846 const PTimeInterval & GetGatekeeperTimeToLive() const { return registrationTimeToLive; } 01847 01850 const PString & GetGkAccessTokenOID() const { return gkAccessTokenOID; } 01851 01854 void SetGkAccessTokenOID(const PString & token) { gkAccessTokenOID = token; } 01855 01856 #ifdef H323_H450 01857 01860 const PTimeInterval & GetCallTransferT1() const { return callTransferT1; } 01861 01864 const PTimeInterval & GetCallTransferT2() const { return callTransferT2; } 01865 01868 const PTimeInterval & GetCallTransferT3() const { return callTransferT3; } 01869 01872 const PTimeInterval & GetCallTransferT4() const { return callTransferT4; } 01873 01875 const PTimeInterval & GetCallIntrusionT1() const { return callIntrusionT1; } 01876 const PTimeInterval & GetCallIntrusionT2() const { return callIntrusionT2; } 01877 const PTimeInterval & GetCallIntrusionT3() const { return callIntrusionT3; } 01878 const PTimeInterval & GetCallIntrusionT4() const { return callIntrusionT4; } 01879 const PTimeInterval & GetCallIntrusionT5() const { return callIntrusionT5; } 01880 const PTimeInterval & GetCallIntrusionT6() const { return callIntrusionT6; } 01881 01884 H323CallIdentityDict& GetCallIdentityDictionary() { return secondaryConnectionsActive; } 01885 01888 unsigned GetNextH450CallIdentityValue() const { return ++nextH450CallIdentity; } 01889 01890 #endif // H323_H450 01891 01894 PINDEX GetCleanerThreadStackSize() const { return cleanerThreadStackSize; } 01895 01898 PINDEX GetListenerThreadStackSize() const { return listenerThreadStackSize; } 01899 01902 PINDEX GetSignallingThreadStackSize() const { return signallingThreadStackSize; } 01903 01906 PINDEX GetControlThreadStackSize() const { return controlThreadStackSize; } 01907 01910 PINDEX GetChannelThreadStackSize() const { return logicalThreadStackSize; } 01911 01914 PINDEX GetRasThreadStackSize() const { return rasThreadStackSize; } 01915 01918 PINDEX GetJitterThreadStackSize() const { return jitterThreadStackSize; } 01919 01922 PThread::Priority GetChannelThreadPriority() const { return channelThreadPriority; } 01923 01925 01929 static BYTE defaultT35CountryCode; 01930 static BYTE defaultT35Extension; 01931 static WORD defaultManufacturerCode; 01932 01933 protected: 01934 H323Gatekeeper * InternalCreateGatekeeper(H323Transport * transport); 01935 BOOL InternalRegisterGatekeeper(H323Gatekeeper * gk, BOOL discovered); 01936 H323Connection * FindConnectionWithoutLocks(const PString & token); 01937 virtual H323Connection * InternalMakeCall( 01938 const PString & existingToken, 01939 const PString & callIdentity, 01940 unsigned capabilityLevel, 01941 const PString & remoteParty, 01942 H323Transport * transport, 01943 PString & token, 01944 void * userData 01945 ); 01946 01947 // Configuration variables, commonly changed 01948 PStringList localAliasNames; 01949 01950 #ifdef H323_AUDIO_CODECS 01951 H323AudioCodec::SilenceDetectionMode defaultSilenceDetection; 01952 unsigned minAudioJitterDelay; 01953 unsigned maxAudioJitterDelay; 01954 #ifdef P_AUDIO 01955 PString soundChannelPlayDevice; 01956 PString soundChannelPlayDriver; 01957 PString soundChannelRecordDevice; 01958 PString soundChannelRecordDriver; 01959 unsigned soundChannelBuffers; 01960 #endif // P_AUDIO 01961 #endif // H323_AUDIO_CODECS 01962 01963 #ifdef H323_VIDEO 01964 PString videoChannelPlayDevice; 01965 PString videoChannelRecordDevice; 01966 BOOL autoStartReceiveVideo; 01967 BOOL autoStartTransmitVideo; 01968 #endif // H323_VIDEO 01969 01970 #ifdef H323_T38 01971 BOOL autoStartReceiveFax; 01972 BOOL autoStartTransmitFax; 01973 #endif // H323_T38 01974 01975 BOOL autoCallForward; 01976 BOOL disableFastStart; 01977 BOOL disableH245Tunneling; 01978 BOOL disableH245inSetup; 01979 BOOL disableDetectInBandDTMF; 01980 BOOL canDisplayAmountString; 01981 BOOL canEnforceDurationLimit; 01982 01983 #ifdef H323_H450 01984 unsigned callIntrusionProtectionLevel; 01985 #endif // H323_H450 01986 01987 H323Connection::SendUserInputModes defaultSendUserInputMode; 01988 01989 #ifdef P_LDAP 01990 PString ilsServer; 01991 #endif // P_LDAP 01992 01993 // Some more configuration variables, rarely changed. 01994 BYTE rtpIpTypeofService; 01995 BYTE tcpIpTypeofService; 01996 PTimeInterval signallingChannelConnectTimeout; 01997 PTimeInterval signallingChannelCallTimeout; 01998 PTimeInterval controlChannelStartTimeout; 01999 PTimeInterval endSessionTimeout; 02000 PTimeInterval masterSlaveDeterminationTimeout; 02001 unsigned masterSlaveDeterminationRetries; 02002 PTimeInterval capabilityExchangeTimeout; 02003 PTimeInterval logicalChannelTimeout; 02004 PTimeInterval requestModeTimeout; 02005 PTimeInterval roundTripDelayTimeout; 02006 PTimeInterval roundTripDelayRate; 02007 PTimeInterval noMediaTimeout; 02008 PTimeInterval gatekeeperRequestTimeout; 02009 unsigned gatekeeperRequestRetries; 02010 PTimeInterval rasRequestTimeout; 02011 unsigned rasRequestRetries; 02012 PTimeInterval registrationTimeToLive; 02013 PString gkAccessTokenOID; 02014 02015 unsigned initialBandwidth; // in 100s of bits/sev 02016 BOOL clearCallOnRoundTripFail; 02017 02018 struct PortInfo { 02019 void Set( 02020 unsigned base, 02021 unsigned max, 02022 unsigned range, 02023 unsigned dflt 02024 ); 02025 WORD GetNext( 02026 unsigned increment 02027 ); 02028 02029 PMutex mutex; 02030 WORD base; 02031 WORD max; 02032 WORD current; 02033 } tcpPorts, udpPorts, rtpIpPorts; 02034 02035 #ifdef P_STUN 02036 PSTUNClient * stun; 02037 #endif 02038 02039 BYTE t35CountryCode; 02040 BYTE t35Extension; 02041 WORD manufacturerCode; 02042 02043 TerminalTypes terminalType; 02044 02045 #ifdef H323_H450 02046 02047 /* Protect against absence of a response to the ctIdentify reqest 02048 (Transferring Endpoint - Call Transfer with a secondary Call) */ 02049 PTimeInterval callTransferT1; 02050 /* Protect against failure of completion of the call transfer operation 02051 involving a secondary Call (Transferred-to Endpoint) */ 02052 PTimeInterval callTransferT2; 02053 /* Protect against failure of the Transferred Endpoint not responding 02054 within sufficient time to the ctInitiate APDU (Transferring Endpoint) */ 02055 PTimeInterval callTransferT3; 02056 /* May optionally operate - protects against absence of a response to the 02057 ctSetup request (Transferred Endpoint) */ 02058 PTimeInterval callTransferT4; 02059 02061 PTimeInterval callIntrusionT1; 02062 PTimeInterval callIntrusionT2; 02063 PTimeInterval callIntrusionT3; 02064 PTimeInterval callIntrusionT4; 02065 PTimeInterval callIntrusionT5; 02066 PTimeInterval callIntrusionT6; 02067 02068 H323CallIdentityDict secondaryConnectionsActive; 02069 02070 mutable PAtomicInteger nextH450CallIdentity; 02072 02073 #endif // H323_H450 02074 02075 PINDEX cleanerThreadStackSize; 02076 PINDEX listenerThreadStackSize; 02077 PINDEX signallingThreadStackSize; 02078 PINDEX controlThreadStackSize; 02079 PINDEX logicalThreadStackSize; 02080 PINDEX rasThreadStackSize; 02081 PINDEX jitterThreadStackSize; 02082 02083 PThread::Priority channelThreadPriority; 02084 02085 // Dynamic variables 02086 H323ListenerList listeners; 02087 H323Capabilities capabilities; 02088 H323Gatekeeper * gatekeeper; 02089 PString gatekeeperPassword; 02090 02091 H323ConnectionDict connectionsActive; 02092 02093 PMutex connectionsMutex; 02094 PMutex noMediaMutex; 02095 PStringSet connectionsToBeCleaned; 02096 H323ConnectionsCleaner * connectionsCleaner; 02097 PSyncPoint connectionsAreCleaned; 02098 02099 #ifdef H323_TRANSNEXUS_OSP 02100 OpalOSP::Provider * ospProvider; 02101 #endif 02102 02103 }; 02104 02105 02106 #endif // __OPAL_H323EP_H 02107 02108