Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

h323con.h

Go to the documentation of this file.
00001 /*
00002  * h323con.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: h323con.h,v $
00030  * Revision 1.75  2004/11/22 11:30:42  rjongbloed
00031  * Added ability to restart H.245 negotiations, thanks Norbert Bartalsky
00032  *
00033  * Revision 1.74  2004/09/27 08:25:14  csoutheren
00034  * Changed in-header documentation for external headers to reflect changes
00035  * in external RTP interface
00036  *
00037  * Revision 1.73  2004/09/07 22:50:55  rjongbloed
00038  * Changed usage of template function as MSVC6 will not compile it.
00039  *
00040  * Revision 1.72  2004/09/03 01:06:09  csoutheren
00041  * Added initial hooks for H.460 GEF
00042  * Thanks to Simon Horne and ISVO (Asia) Pte Ltd. for this contribution
00043  *
00044  * Revision 1.71  2004/07/13 10:19:40  csoutheren
00045  * Fixed cut & paste errors in comments
00046  *
00047  * Revision 1.70  2004/06/15 03:30:00  csoutheren
00048  * Added OnSendARQ to allow access to the ARQ message before sent by connection
00049  *
00050  * Revision 1.69  2004/04/20 05:24:54  csoutheren
00051  * Added ability to specify Q.931 DisplayName
00052  *
00053  * Revision 1.68  2004/04/13 05:50:50  csoutheren
00054  * Added function to get access to the connection NAT flag
00055  *
00056  * Revision 1.67  2004/04/07 05:31:42  csoutheren
00057  * Added ability to receive calls from endpoints behind NAT firewalls
00058  *
00059  * Revision 1.66  2004/03/04 04:48:29  csoutheren
00060  * Added virtual keyword to allow overring of capability management functions
00061  * Added additional response code needed for MCU
00062  *
00063  * Revision 1.65  2004/02/26 08:32:47  csoutheren
00064  * Added release complete codes for MCU
00065  *
00066  * Revision 1.64  2003/12/28 02:38:14  csoutheren
00067  * Added H323EndPoint::OnOutgoingCall
00068  *
00069  * Revision 1.63  2003/12/14 10:42:29  rjongbloed
00070  * Changes for compilability without video support.
00071  *
00072  * Revision 1.62  2003/10/27 06:03:38  csoutheren
00073  * Added support for QoS
00074  *   Thanks to Henry Harrison of AliceStreet
00075  *
00076  * Revision 1.61  2003/10/09 09:47:45  csoutheren
00077  * Fixed problem with re-opening RTP half-channels under unusual
00078  * circumstances. Thanks to Damien Sandras
00079  *
00080  * Revision 1.60  2003/04/30 00:28:50  robertj
00081  * Redesigned the alternate credentials in ARQ system as old implementation
00082  *   was fraught with concurrency issues, most importantly it can cause false
00083  *   detection of replay attacks taking out an endpoint completely.
00084  *
00085  * Revision 1.59  2003/02/12 23:59:22  robertj
00086  * Fixed adding missing endpoint identifer in SETUP packet when gatekeeper
00087  * routed, pointed out by Stefan Klein
00088  * Also fixed correct rutrn of gk routing in IRR packet.
00089  *
00090  * Revision 1.58  2002/11/27 06:54:52  robertj
00091  * Added Service Control Session management as per Annex K/H.323 via RAS
00092  *   only at this stage.
00093  * Added H.248 ASN and very primitive infrastructure for linking into the
00094  *   Service Control Session management system.
00095  * Added basic infrastructure for Annex K/H.323 HTTP transport system.
00096  * Added Call Credit Service Control to display account balances.
00097  *
00098  * Revision 1.57  2002/11/15 05:17:22  robertj
00099  * Added facility redirect support without changing the call token for access
00100  *   to the call. If it gets redirected a new H323Connection object is
00101  *   created but it looks like the same thing to an application.
00102  *
00103  * Revision 1.56  2002/11/13 04:37:23  robertj
00104  * Added ability to get (and set) Q.931 release complete cause codes.
00105  *
00106  * Revision 1.55  2002/11/10 06:17:26  robertj
00107  * Fixed minor documentation errors.
00108  *
00109  * Revision 1.54  2002/11/05 00:24:09  robertj
00110  * Added function to determine if Q.931 CONNECT sent/received.
00111  *
00112  * Revision 1.53  2002/10/31 00:31:47  robertj
00113  * Enhanced jitter buffer system so operates dynamically between minimum and
00114  *   maximum values. Altered API to assure app writers note the change!
00115  *
00116  * Revision 1.52  2002/09/16 01:14:15  robertj
00117  * Added #define so can select if #pragma interface/implementation is used on
00118  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00119  *
00120  * Revision 1.51  2002/09/03 06:19:36  robertj
00121  * Normalised the multi-include header prevention ifdef/define symbol.
00122  *
00123  * Revision 1.50  2002/08/05 10:03:47  robertj
00124  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00125  *
00126  * Revision 1.49  2002/08/05 05:17:37  robertj
00127  * Fairly major modifications to support different authentication credentials
00128  *   in ARQ to the logged in ones on RRQ. For both client and server.
00129  * Various other H.235 authentication bugs and anomalies fixed on the way.
00130  *
00131  * Revision 1.48  2002/07/05 02:22:56  robertj
00132  * Added support for standard and non-standard T.38 mode change.
00133  *
00134  * Revision 1.47  2002/07/04 00:40:31  robertj
00135  * More H.450.11 call intrusion implementation, thanks Aleksandar Todorovic
00136  *
00137  * Revision 1.46  2002/06/22 06:11:30  robertj
00138  * Fixed bug on sometimes missing received endSession causing 10 second
00139  *   timeout in connection clean up.
00140  *
00141  * Revision 1.45  2002/06/22 05:48:38  robertj
00142  * Added partial implementation for H.450.11 Call Intrusion
00143  *
00144  * Revision 1.44  2002/06/13 06:15:19  robertj
00145  * Allowed TransferCall() to be used on H323Connection as well as H323EndPoint.
00146  *
00147  * Revision 1.43  2002/06/05 08:58:58  robertj
00148  * Fixed documentation of remote application name string.
00149  * Added missing virtual keywards on some protocol handler functions.
00150  *
00151  * Revision 1.42  2002/05/29 06:40:29  robertj
00152  * Changed sending of endSession/ReleaseComplete PDU's to occur immediately
00153  *   on call clearance and not wait for background thread to do it.
00154  * Stricter compliance by waiting for reply endSession before closing down.
00155  *
00156  * Revision 1.41  2002/05/29 03:55:17  robertj
00157  * Added protocol version number checking infrastructure, primarily to improve
00158  *   interoperability with stacks that are unforgiving of new features.
00159  *
00160  * Revision 1.40  2002/05/21 09:32:49  robertj
00161  * Added ability to set multiple alias names ona  connection by connection
00162  *   basis, defaults to endpoint list, thanks Artis Kugevics
00163  *
00164  * Revision 1.39  2002/05/15 23:59:33  robertj
00165  * Added memory management of created T.38 and T.120 handlers.
00166  * Improved documentation for use of T.38 and T.120 functions.
00167  * Added ability to initiate a mode change for non-standard T.38
00168  *
00169  * Revision 1.38  2002/05/07 01:31:51  dereks
00170  * Fix typo in documentation.
00171  *
00172  * Revision 1.37  2002/05/03 05:38:15  robertj
00173  * Added Q.931 Keypad IE mechanism for user indications (DTMF).
00174  *
00175  * Revision 1.36  2002/05/02 07:56:24  robertj
00176  * Added automatic clearing of call if no media (RTP data) is transferred in a
00177  *   configurable (default 5 minutes) amount of time.
00178  *
00179  * Revision 1.35  2002/04/25 20:55:25  dereks
00180  * Fix documentation. Thanks Olaf Schulz.
00181  *
00182  * Revision 1.34  2002/04/17 00:50:34  robertj
00183  * Added ability to disable the in band DTMF detection.
00184  *
00185  * Revision 1.33  2002/03/27 06:04:42  robertj
00186  * Added Temporary Failure end code for connection, an application may
00187  *   immediately retry the call if this occurs.
00188  *
00189  * Revision 1.32  2002/02/11 04:20:48  robertj
00190  * Fixed documentation errors, thanks Horacio J. Peņa
00191  *
00192  * Revision 1.31  2002/02/11 04:16:37  robertj
00193  * Fixed bug where could send DRQ if never received an ACF.
00194  *
00195  * Revision 1.30  2002/02/06 06:30:47  craigs
00196  * Fixed problem whereby MSD/TCS was stalled if H245 was included in
00197  * SETUP, but other end did not respond
00198  *
00199  * Revision 1.29  2002/02/04 07:17:52  robertj
00200  * Added H.450.2 Consultation Transfer, thanks Norwood Systems.
00201  *
00202  * Revision 1.28  2002/01/25 05:20:05  robertj
00203  * Moved static strings for enum printing to inside of function, could crash with DLL's
00204  *
00205  * Revision 1.27  2002/01/24 06:29:02  robertj
00206  * Added option to disable H.245 negotiation in SETUP pdu, this required
00207  *   API change so have a bit mask instead of a series of booleans.
00208  *
00209  * Revision 1.26  2002/01/23 12:45:37  rogerh
00210  * Add the DTMF decoder. This identifies DTMF tones in an audio stream.
00211  *
00212  * Revision 1.25  2002/01/23 07:12:48  robertj
00213  * Added hooks for in band DTMF detection. Now need the detector!
00214  *
00215  * Revision 1.24  2002/01/22 22:48:21  robertj
00216  * Fixed RFC2833 support (transmitter) requiring large rewrite
00217  *
00218  * Revision 1.23  2002/01/18 06:02:08  robertj
00219  * Added some H323v4 functions (fastConnectRefused & TCS in SETUP)
00220  *
00221  * Revision 1.22  2002/01/17 07:04:58  robertj
00222  * Added support for RFC2833 embedded DTMF in the RTP stream.
00223  *
00224  * Revision 1.21  2002/01/14 00:05:24  robertj
00225  * Added H.450.6, better H.450.2 error handling and  and Music On Hold.
00226  * Added destExtraCallInfo field for ARQ.
00227  *   Thanks Ben Madsen of Norwood Systems
00228  *
00229  * Revision 1.20  2002/01/10 05:13:50  robertj
00230  * Added support for external RTP stacks, thanks NuMind Software Systems.
00231  *
00232  * Revision 1.19  2002/01/09 00:21:36  robertj
00233  * Changes to support outgoing H.245 RequstModeChange.
00234  *
00235  * Revision 1.18  2001/12/22 03:20:31  robertj
00236  * Added create protocol function to H323Connection.
00237  *
00238  * Revision 1.17  2001/12/22 03:09:36  robertj
00239  * Changed OnRequstModeChange to return ack, then actually do the change.
00240  *
00241  * Revision 1.16  2001/12/22 01:52:54  robertj
00242  * Added more support for H.245 RequestMode operation.
00243  *
00244  * Revision 1.15  2001/12/15 08:09:54  robertj
00245  * Added alerting, connect and end of call times to be sent to RAS server.
00246  *
00247  * Revision 1.14  2001/12/13 10:54:23  robertj
00248  * Added ability to automatically add ACF access token to SETUP pdu.
00249  *
00250  * Revision 1.13  2001/11/01 06:11:54  robertj
00251  * Plugged very small mutex hole that could cause crashes.
00252  *
00253  * Revision 1.12  2001/11/01 00:27:33  robertj
00254  * Added default Fast Start disabled and H.245 tunneling disable flags
00255  *   to the endpoint instance.
00256  *
00257  * Revision 1.11  2001/10/24 00:54:13  robertj
00258  * Made cosmetic changes to H.245 miscellaneous command function.
00259  *
00260  * Revision 1.10  2001/10/23 02:18:06  dereks
00261  * Initial release of CU30 video codec.
00262  *
00263  * Revision 1.9  2001/09/26 06:20:56  robertj
00264  * Fixed properly nesting connection locking and unlocking requiring a quite
00265  *   large change to teh implementation of how calls are answered.
00266  *
00267  * Revision 1.8  2001/09/19 03:30:53  robertj
00268  * Added some support for overlapped dialing, thanks Chris Purvis & Nick Hoath.
00269  *
00270  * Revision 1.7  2001/09/13 06:48:13  robertj
00271  * Added call back functions for remaining Q.931/H.225 messages.
00272  * Added call back to allow modification of Release Complete,thanks Nick Hoath
00273  *
00274  * Revision 1.6  2001/09/12 06:57:58  robertj
00275  * Added support for iNow Access Token from gk, thanks Nick Hoath
00276  *
00277  * Revision 1.5  2001/09/12 06:04:36  robertj
00278  * Added support for sending UUIE's to gk on request, thanks Nick Hoath
00279  *
00280  * Revision 1.4  2001/09/11 01:24:36  robertj
00281  * Added conditional compilation to remove video and/or audio codecs.
00282  *
00283  * Revision 1.3  2001/08/22 06:54:50  robertj
00284  * Changed connection locking to use double mutex to guarantee that
00285  *   no threads can ever deadlock or access deleted connection.
00286  *
00287  * Revision 1.2  2001/08/16 07:49:16  robertj
00288  * Changed the H.450 support to be more extensible. Protocol handlers
00289  *   are now in separate classes instead of all in H323Connection.
00290  *
00291  * Revision 1.1  2001/08/06 03:08:11  robertj
00292  * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files.
00293  *
00294  */
00295 
00296 #ifndef __OPAL_H323CON_H
00297 #define __OPAL_H323CON_H
00298 
00299 #ifdef P_USE_PRAGMA
00300 #pragma interface
00301 #endif
00302 
00303 
00304 #include <ptclib/dtmf.h>
00305 #include "h323caps.h"
00306 #include "transports.h"
00307 #include "channels.h"
00308 #include "guid.h"
00309 #include "openh323buildopts.h"
00310 
00311 
00312 /* The following classes have forward references to avoid including the VERY
00313    large header files for H225 and H245. If an application requires access
00314    to the protocol classes they can include them, but for simple usage their
00315    inclusion can be avoided.
00316  */
00317 class PPER_Stream;
00318 
00319 class H225_EndpointType;
00320 class H225_TransportAddress;
00321 class H225_ArrayOf_PASN_OctetString;
00322 class H225_ProtocolIdentifier;
00323 class H225_AdmissionRequest;
00324 class H225_FeatureSet;
00325 
00326 class H245_TerminalCapabilitySet;
00327 class H245_TerminalCapabilitySetReject;
00328 class H245_OpenLogicalChannel;
00329 class H245_OpenLogicalChannelAck;
00330 class H245_TransportAddress;
00331 class H245_UserInputIndication;
00332 class H245_RequestMode;
00333 class H245_RequestModeAck;
00334 class H245_RequestModeReject;
00335 class H245_ModeDescription;
00336 class H245_ArrayOf_ModeDescription;
00337 class H245_SendTerminalCapabilitySet;
00338 class H245_MultiplexCapability;
00339 class H245_FlowControlCommand;
00340 class H245_MiscellaneousCommand;
00341 class H245_MiscellaneousIndication;
00342 class H245_JitterIndication;
00343 
00344 class H323SignalPDU;
00345 class H323ControlPDU;
00346 
00347 class H235Authenticators;
00348 
00349 class H245NegMasterSlaveDetermination;
00350 class H245NegTerminalCapabilitySet;
00351 class H245NegLogicalChannels;
00352 class H245NegRequestMode;
00353 class H245NegRoundTripDelay;
00354 
00355 class H450xDispatcher;
00356 class H4502Handler;
00357 class H4504Handler;
00358 class H4506Handler;
00359 class H45011Handler;
00360 
00361 class OpalT120Protocol;
00362 class OpalT38Protocol;
00363 class OpalRFC2833;
00364 class OpalRFC2833Info;
00365 
00366 
00367 
00369 
00376 class H323Connection : public PObject
00377 {
00378   PCLASSINFO(H323Connection, PObject);
00379 
00380   public:
00383     enum Options {
00384       FastStartOptionDisable       = 0x0001,
00385       FastStartOptionEnable        = 0x0002,
00386       FastStartOptionMask          = 0x0003,
00387 
00388       H245TunnelingOptionDisable   = 0x0004,
00389       H245TunnelingOptionEnable    = 0x0008,
00390       H245TunnelingOptionMask      = 0x000c,
00391 
00392       H245inSetupOptionDisable     = 0x0010,
00393       H245inSetupOptionEnable      = 0x0020,
00394       H245inSetupOptionMask        = 0x0030,
00395 
00396       DetectInBandDTMFOptionDisable= 0x0040,
00397       DetectInBandDTMFOptionEnable = 0x0080,
00398       DetectInBandDTMFOptionMask   = 0x00c0,
00399     };
00400 
00403     H323Connection(
00404       H323EndPoint & endpoint,  
00405       unsigned callReference,   
00406       unsigned options = 0      
00407     );
00408 
00411     ~H323Connection();
00412 
00422     BOOL Lock();
00423 
00435     int TryLock();
00436 
00442     void Unlock();
00443 
00450     virtual void OnSendARQ(
00451       H225_AdmissionRequest & arq
00452     );
00453 
00457     virtual void OnEstablished();
00458 
00462     virtual void OnCleared();
00463 
00470     BOOL IsConnected() const { return connectionState == HasExecutedSignalConnect || connectionState == EstablishedConnection; }
00471 
00477     BOOL IsEstablished() const { return connectionState == EstablishedConnection; }
00478 
00483     enum CallEndReason {
00484       EndedByLocalUser,         
00485       EndedByNoAccept,          
00486       EndedByAnswerDenied,      
00487       EndedByRemoteUser,        
00488       EndedByRefusal,           
00489       EndedByNoAnswer,          
00490       EndedByCallerAbort,       
00491       EndedByTransportFail,     
00492       EndedByConnectFail,       
00493       EndedByGatekeeper,        
00494       EndedByNoUser,            
00495       EndedByNoBandwidth,       
00496       EndedByCapabilityExchange,
00497       EndedByCallForwarded,     
00498       EndedBySecurityDenial,    
00499       EndedByLocalBusy,         
00500       EndedByLocalCongestion,   
00501       EndedByRemoteBusy,        
00502       EndedByRemoteCongestion,  
00503       EndedByUnreachable,       
00504       EndedByNoEndPoint,        
00505       EndedByHostOffline,       
00506       EndedByTemporaryFailure,  
00507       EndedByQ931Cause,         
00508       EndedByDurationLimit,     
00509       EndedByInvalidConferenceID, // Call cleared due to invalid conference ID
00510       NumCallEndReasons
00511     };
00512 #if PTRACING
00513     friend ostream & operator<<(ostream & o, CallEndReason r);
00514 #endif
00515 
00524     CallEndReason GetCallEndReason() const { return callEndReason; }
00525 
00530     virtual void SetCallEndReason(
00531       CallEndReason reason,     
00532       PSyncPoint * sync = NULL  
00533     );
00534 
00540     virtual BOOL ClearCall(
00541       CallEndReason reason = EndedByLocalUser  
00542     );
00543 
00546     virtual BOOL ClearCallSynchronous(
00547       PSyncPoint * sync,
00548       CallEndReason reason = EndedByLocalUser  
00549     );
00550 
00559     virtual void CleanUpOnCallEnd();
00561 
00562 
00567     void AttachSignalChannel(
00568       const PString & token,    
00569       H323Transport * channel,  
00570       BOOL answeringCall        
00571     );
00572 
00575     BOOL WriteSignalPDU(
00576       H323SignalPDU & pdu       
00577     );
00578 
00582     virtual void HandleSignallingChannel();
00583 
00587     virtual BOOL HandleSignalPDU(
00588       H323SignalPDU & pdu       
00589     );
00590 
00594     virtual void HandleTunnelPDU(
00595       H323SignalPDU * txPDU       
00596     );
00597 
00605     virtual BOOL OnReceivedSignalSetup(
00606       const H323SignalPDU & pdu   
00607     );
00608 
00615     virtual BOOL OnReceivedSignalSetupAck(
00616       const H323SignalPDU & pdu   
00617     );
00618 
00625     virtual BOOL OnReceivedSignalInformation(
00626       const H323SignalPDU & pdu   
00627     );
00628 
00637     virtual BOOL OnReceivedCallProceeding(
00638       const H323SignalPDU & pdu   
00639     );
00640 
00649     virtual BOOL OnReceivedProgress(
00650       const H323SignalPDU & pdu   
00651     );
00652 
00659     virtual BOOL OnReceivedAlerting(
00660       const H323SignalPDU & pdu   
00661     );
00662 
00671     virtual BOOL OnReceivedSignalConnect(
00672       const H323SignalPDU & pdu   
00673     );
00674 
00683     virtual BOOL OnReceivedFacility(
00684       const H323SignalPDU & pdu   
00685     );
00686 
00693     virtual BOOL OnReceivedSignalNotify(
00694       const H323SignalPDU & pdu   
00695     );
00696 
00703     virtual BOOL OnReceivedSignalStatus(
00704       const H323SignalPDU & pdu   
00705     );
00706 
00713     virtual BOOL OnReceivedStatusEnquiry(
00714       const H323SignalPDU & pdu   
00715     );
00716 
00721     virtual void OnReceivedReleaseComplete(
00722       const H323SignalPDU & pdu   
00723     );
00724 
00731     virtual BOOL OnUnknownSignalPDU(
00732       const H323SignalPDU & pdu  
00733     );
00734 
00746     virtual BOOL OnIncomingCall(
00747       const H323SignalPDU & setupPDU,   
00748       H323SignalPDU & alertingPDU       
00749     );
00750 
00760     virtual BOOL ForwardCall(
00761       const PString & forwardParty   
00762     );
00763 
00768     void TransferCall(
00769       const PString & remoteParty,   
00770       const PString & callIdentity = PString::Empty()
00772     );
00773 
00778     void ConsultationTransfer(
00779       const PString & primaryCallToken  
00780     );
00781 
00788     virtual void HandleConsultationTransfer(
00789       const PString & callIdentity, 
00791       H323Connection & incoming     
00792     );
00793 
00796     BOOL IsTransferringCall() const;
00797 
00800     BOOL IsTransferredCall() const;
00801 
00806     virtual void HandleTransferCall(
00807       const PString & token,
00808       const PString & identity
00809     );
00810 
00815     int GetCallTransferInvokeId();
00816 
00824     virtual void HandleCallTransferFailure(
00825       const int returnError    
00826     );
00827 
00832     void SetAssociatedCallToken(
00833       const PString & token  
00834     );
00835 
00840     virtual void OnConsultationTransferSuccess(
00841       H323Connection & secondaryCall  
00842     );
00843 
00848     void HoldCall(
00849       BOOL localHold   
00850     );
00851 
00857     void RetrieveCall();
00858 
00865     void SetHoldMedia(
00866       PChannel * audioChannel
00867     );
00868 
00871     BOOL IsMediaOnHold() const;
00872 
00875     BOOL IsLocalHold() const;
00876 
00879     BOOL IsRemoteHold() const;
00880 
00883     BOOL IsCallOnHold() const;
00884 
00889     virtual void IntrudeCall(
00890       unsigned capabilityLevel
00891     );
00892 
00897     virtual void HandleIntrudeCall(
00898       const PString & token,
00899       const PString & identity
00900     );
00901 
00907     void SetCallIntrusion() { isCallIntrusion = TRUE; }
00908 
00909     BOOL IsCallIntrusion() { return isCallIntrusion; }
00910 
00913     unsigned GetLocalCallIntrusionProtectionLevel() { return callIntrusionProtectionLevel; }
00914 
00918     virtual BOOL GetRemoteCallIntrusionProtectionLevel(
00919       const PString & callToken,
00920       unsigned callIntrusionProtectionLevel
00921     );
00922 
00923     virtual void SetIntrusionImpending();
00924 
00925     virtual void SetForcedReleaseAccepted();
00926 
00927     virtual void SetIntrusionNotAuthorized();
00928 
00935     void SendCallWaitingIndication(
00936       const unsigned nbOfAddWaitingCalls = 0   
00937     );
00938 
00939     enum AnswerCallResponse {
00940       AnswerCallNow,               
00941       AnswerCallDenied,            
00942       AnswerCallPending,           
00943       AnswerCallDeferred,          
00944       AnswerCallAlertWithMedia,    
00945       AnswerCallDeferredWithMedia, 
00946       AnswerCallDeniedByInvalidCID, 
00947       NumAnswerCallResponses
00948     };
00949 #if PTRACING
00950     friend ostream & operator<<(ostream & o, AnswerCallResponse s);
00951 #endif
00952 
00979     virtual AnswerCallResponse OnAnswerCall(
00980       const PString & callerName,       
00981       const H323SignalPDU & setupPDU,   
00982       H323SignalPDU & connectPDU        
00983     );
00984 
00995     void AnsweringCall(
00996       AnswerCallResponse response 
00997     );
00998 
01009     virtual CallEndReason SendSignalSetup(
01010       const PString & alias,                
01011       const H323TransportAddress & address  
01012     );
01013 
01025     virtual BOOL OnSendSignalSetup(
01026       H323SignalPDU & setupPDU   
01027     );
01028 
01037     virtual BOOL OnSendCallProceeding(
01038       H323SignalPDU & callProceedingPDU   
01039     );
01040 
01052     virtual BOOL OnSendReleaseComplete(
01053       H323SignalPDU & releaseCompletePDU 
01054     );
01055 
01066     virtual BOOL OnAlerting(
01067       const H323SignalPDU & alertingPDU,  
01068       const PString & user                
01069     );
01070 
01085     virtual BOOL OnInsufficientDigits();
01086 
01099     virtual void SendMoreDigits(
01100       const PString & digits    
01101     );
01102 
01112     virtual BOOL OnOutgoingCall(
01113       const H323SignalPDU & connectPDU   
01114     );
01115 
01127     virtual BOOL SendFastStartAcknowledge(
01128       H225_ArrayOf_PASN_OctetString & array   
01129     );
01130 
01142     virtual BOOL HandleFastStartAcknowledge(
01143       const H225_ArrayOf_PASN_OctetString & array   
01144     );
01145 
01153     virtual BOOL StartControlChannel();
01154 
01166     virtual BOOL StartControlChannel(
01167       const H225_TransportAddress & h245Address   
01168     );
01170 
01177     BOOL WriteControlPDU(
01178       const H323ControlPDU & pdu
01179     );
01180 
01183     virtual BOOL StartControlNegotiations(
01184       BOOL renegotiate = FALSE  
01185     );
01186 
01189     virtual void HandleControlChannel();
01190 
01197     virtual BOOL HandleControlData(
01198       PPER_Stream & strm
01199     );
01200 
01207     virtual BOOL HandleControlPDU(
01208       const H323ControlPDU & pdu
01209     );
01210 
01220     virtual BOOL OnUnknownControlPDU(
01221       const H323ControlPDU & pdu  
01222     );
01223 
01227     virtual BOOL OnH245Request(
01228       const H323ControlPDU & pdu  
01229     );
01230 
01234     virtual BOOL OnH245Response(
01235       const H323ControlPDU & pdu  
01236     );
01237 
01241     virtual BOOL OnH245Command(
01242       const H323ControlPDU & pdu  
01243     );
01244 
01248     virtual BOOL OnH245Indication(
01249       const H323ControlPDU & pdu  
01250     );
01251 
01254     virtual BOOL OnH245_SendTerminalCapabilitySet(
01255       const H245_SendTerminalCapabilitySet & pdu  
01256     );
01257 
01262     virtual BOOL OnH245_FlowControlCommand(
01263       const H245_FlowControlCommand & pdu  
01264     );
01265 
01270     virtual BOOL OnH245_MiscellaneousCommand(
01271       const H245_MiscellaneousCommand & pdu  
01272     );
01273 
01278     virtual BOOL OnH245_MiscellaneousIndication(
01279       const H245_MiscellaneousIndication & pdu  
01280     );
01281 
01286     virtual BOOL OnH245_JitterIndication(
01287       const H245_JitterIndication & pdu  
01288     );
01289 
01292     enum ControlProtocolErrors {
01293       e_MasterSlaveDetermination,
01294       e_CapabilityExchange,
01295       e_LogicalChannel,
01296       e_ModeRequest,
01297       e_RoundTripDelay
01298     };
01299 
01311     virtual BOOL OnControlProtocolError(
01312       ControlProtocolErrors errorSource,  // Source of the proptoerror
01313       const void * errorData = NULL       // Data associated with error
01314     );
01315 
01323     virtual void OnSendCapabilitySet(
01324       H245_TerminalCapabilitySet & pdu  
01325     );
01326 
01338     virtual BOOL OnReceivedCapabilitySet(
01339       const H323Capabilities & remoteCaps,      
01340       const H245_MultiplexCapability * muxCap,  
01341       H245_TerminalCapabilitySetReject & reject 
01342     );
01343 
01346     virtual void SendCapabilitySet(
01347       BOOL empty  
01348     );
01349 
01358     virtual void OnSetLocalCapabilities();
01359 
01362     BOOL IsH245Master() const;
01363 
01366     void StartRoundTripDelay();
01367 
01370     PTimeInterval GetRoundTripDelay() const;
01372 
01412     virtual void OnSelectLogicalChannels();
01413 
01416     virtual void SelectDefaultLogicalChannel(
01417       unsigned sessionID    
01418     );
01419 
01423     virtual void SelectFastStartChannels(
01424       unsigned sessionID,   
01425       BOOL transmitter,     
01426       BOOL receiver         
01427     );
01428 
01443     virtual BOOL OpenLogicalChannel(
01444       const H323Capability & capability,  
01445       unsigned sessionID,                 
01446       H323Channel::Directions dir         
01447     );
01448 
01458     virtual BOOL OnOpenLogicalChannel(
01459       const H245_OpenLogicalChannel & openPDU,  
01460       H245_OpenLogicalChannelAck & ackPDU,      
01461       unsigned & errorCode                      
01462     );
01463 
01471     virtual BOOL OnConflictingLogicalChannel(
01472       H323Channel & channel    
01473     );
01474 
01479     virtual H323Channel * CreateLogicalChannel(
01480       const H245_OpenLogicalChannel & open, 
01481       BOOL startingFast,                    
01482       unsigned & errorCode                  
01483     );
01484 
01520     virtual H323Channel * CreateRealTimeLogicalChannel(
01521       const H323Capability & capability, 
01522       H323Channel::Directions dir,       
01523       unsigned sessionID,                
01524       const H245_H2250LogicalChannelParameters * param,
01526       RTP_QOS * rtpqos = NULL            
01527     );
01528 
01539     virtual BOOL OnCreateLogicalChannel(
01540       const H323Capability & capability,  
01541       H323Channel::Directions dir,        
01542       unsigned & errorCode                
01543     );
01544 
01549     virtual BOOL OnStartLogicalChannel(
01550       H323Channel & channel    
01551     );
01552 
01559     virtual BOOL OpenAudioChannel(
01560       BOOL isEncoding,       
01561       unsigned bufferSize,   
01562       H323AudioCodec & codec 
01563     );
01564 
01565 #ifndef NO_H323_VIDEO
01566 
01572     virtual BOOL OpenVideoChannel(
01573       BOOL isEncoding,       
01574       H323VideoCodec & codec 
01575     );
01576 #endif // NO_H323_VIDEO
01577 
01580     virtual void CloseLogicalChannel(
01581       unsigned number,    
01582       BOOL fromRemote     
01583     );
01584 
01587     virtual void CloseLogicalChannelNumber(
01588       const H323ChannelNumber & number    
01589     );
01590 
01593     virtual void CloseAllLogicalChannels(
01594       BOOL fromRemote     
01595     );
01596 
01602     virtual void OnClosedLogicalChannel(
01603       const H323Channel & channel   
01604     );
01605 
01614     virtual BOOL OnClosingLogicalChannel(
01615       H323Channel & channel   
01616     );
01617 
01626     virtual void OnLogicalChannelFlowControl(
01627       H323Channel * channel,   
01628       long bitRateRestriction  
01629     );
01630 
01639     virtual void OnLogicalChannelJitter(
01640       H323Channel * channel,   
01641       DWORD jitter,            
01642       int skippedFrameCount,   
01643       int additionalBuffer     
01644     );
01645 
01648     void SendLogicalChannelMiscCommand(
01649       H323Channel & channel,  
01650       unsigned command        
01651     );
01652 
01656     H323Channel * GetLogicalChannel(
01657       unsigned number,    
01658       BOOL fromRemote     
01659     ) const;
01660 
01666     H323Channel * FindChannel(
01667       unsigned sessionId,   
01668       BOOL fromRemote       
01669     ) const;
01671 
01678     unsigned GetBandwidthUsed() const;
01679 
01685     BOOL UseBandwidth(
01686       unsigned bandwidth,     
01687       BOOL removing           
01688     );
01689 
01692     unsigned GetBandwidthAvailable() const { return bandwidthAvailable; }
01693 
01698     BOOL SetBandwidthAvailable(
01699       unsigned newBandwidth,    
01700       BOOL force = FALSE        
01701     );
01703 
01706     enum SendUserInputModes {
01707       SendUserInputAsQ931,
01708       SendUserInputAsString,
01709       SendUserInputAsTone,
01710       SendUserInputAsInlineRFC2833,
01711       SendUserInputAsSeparateRFC2833,  // Not implemented
01712       NumSendUserInputModes
01713     };
01714 #if PTRACING
01715     friend ostream & operator<<(ostream & o, SendUserInputModes m);
01716 #endif
01717 
01720     void SetSendUserInputMode(SendUserInputModes mode);
01721 
01724     SendUserInputModes GetSendUserInputMode() const { return sendUserInputMode; }
01725 
01731     SendUserInputModes GetRealSendUserInputMode() const;
01732 
01746     virtual void SendUserInput(
01747       const PString & value                   
01748     );
01749 
01756     virtual void OnUserInputString(
01757       const PString & value   
01758     );
01759 
01784     virtual void SendUserInputTone(
01785       char tone,                   
01786       unsigned duration = 0,       
01787       unsigned logicalChannel = 0, 
01788       unsigned rtpTimestamp = 0    
01789     );
01790 
01795     virtual void OnUserInputTone(
01796       char tone,               
01797       unsigned duration,       
01798       unsigned logicalChannel, 
01799       unsigned rtpTimestamp    
01800     );
01801 
01805     void SendUserInputHookFlash(
01806       int duration = 500  
01807     ) { SendUserInputTone('!', duration); }
01808 
01815     virtual void SendUserInputIndicationQ931(
01816       const PString & value                   
01817     );
01818 
01825     virtual void SendUserInputIndicationString(
01826       const PString & value                   
01827     );
01828 
01833     virtual void SendUserInputIndicationTone(
01834       char tone,                   
01835       unsigned duration = 0,       
01836       unsigned logicalChannel = 0, 
01837       unsigned rtpTimestamp = 0    
01838     );
01839 
01848     virtual void SendUserInputIndication(
01849       const H245_UserInputIndication & pdu    
01850     );
01851 
01856     virtual void OnUserInputIndication(
01857       const H245_UserInputIndication & pdu  
01858     );
01860 
01866     virtual RTP_Session * GetSession(
01867       unsigned sessionID
01868     ) const;
01869 
01873     virtual H323_RTP_Session * GetSessionCallbacks(
01874       unsigned sessionID
01875     ) const;
01876 
01886     virtual RTP_Session * UseSession(
01887       unsigned sessionID,
01888       const H245_TransportAddress & pdu,
01889       H323Channel::Directions dir,
01890       RTP_QOS * rtpqos = NULL
01891     );
01892 
01896     virtual void ReleaseSession(
01897       unsigned sessionID
01898     );
01899 
01907     virtual void OnRTPStatistics(
01908       const RTP_Session & session   
01909     ) const;
01910 
01914     virtual PString GetSessionCodecNames(
01915       unsigned sessionID
01916     ) const;
01917 
01920     BOOL IsBehindNAT() const
01921     { return remoteIsNAT; }
01922 
01924 
01942     virtual BOOL RequestModeChange(
01943       const PString & newModes  
01944     );
01945 
01953     virtual BOOL RequestModeChange(
01954       const H245_ArrayOf_ModeDescription & newModes  
01955     );
01956 
01959     virtual BOOL OnRequestModeChange(
01960       const H245_RequestMode & pdu,     
01961       H245_RequestModeAck & ack,        
01962       H245_RequestModeReject & reject,  
01963       PINDEX & selectedMode           
01964     );
01965 
01972     virtual void OnModeChanged(
01973       const H245_ModeDescription & newMode
01974     );
01975 
01980     virtual void OnAcceptModeChange(
01981       const H245_RequestModeAck & pdu  
01982     );
01983 
01988     virtual void OnRefusedModeChange(
01989       const H245_RequestModeReject * pdu  
01990     );
01992 
02007     virtual OpalT120Protocol * CreateT120ProtocolHandler();
02008 
02021     virtual OpalT38Protocol * CreateT38ProtocolHandler();
02022 
02025     virtual BOOL RequestModeChangeT38(
02026       const char * capabilityNames = "T.38\nT38FaxUDP"
02027     );
02028 
02038     virtual BOOL GetAdmissionRequestAuthentication(
02039       const H225_AdmissionRequest & arq,  
02040       H235Authenticators & authenticators 
02041     );
02043 
02048     H323EndPoint & GetEndPoint() const { return endpoint; }
02049 
02052     BOOL HadAnsweredCall() const { return callAnswered; }
02053 
02056     BOOL IsGatekeeperRouted() const { return gatekeeperRouted; }
02057 
02061     unsigned GetQ931Cause() const { return q931Cause; }
02062 
02067     unsigned GetDistinctiveRing() const { return distinctiveRing; }
02068 
02075     void SetDistinctiveRing(unsigned pattern) { distinctiveRing = pattern&7; }
02076 
02079     const PString & GetCallToken() const { return callToken; }
02080 
02083     unsigned GetCallReference() const { return callReference; }
02084 
02087     const OpalGloballyUniqueID & GetCallIdentifier() const { return callIdentifier; }
02088 
02091     const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; }
02092 
02095     const PString & GetLocalPartyName() const { return localPartyName; }
02096 
02099     void SetLocalPartyName(const PString & name);
02100 
02103     void SetDisplayName(const PString & name) { localDisplayName = name; }
02104 
02107     const PString GetDisplayName() const { return localDisplayName; }
02108 
02109     const PStringList & GetLocalAliasNames() const { return localAliasNames; }
02110 
02117     const PString & GetRemotePartyName() const { return remotePartyName; }
02118 
02123     const PString & GetRemotePartyNumber() const { return remotePartyNumber; }
02124 
02131     const PString & GetRemotePartyAddress() const { return remotePartyAddress; }
02132 
02135     void SetRemotePartyInfo(
02136       const H323SignalPDU & pdu 
02137     );
02138 
02150     const PString & GetRemoteApplication() const { return remoteApplication; }
02151 
02154     void SetRemoteApplication(
02155       const H225_EndpointType & pdu 
02156     );
02157     
02160     const H323Capabilities & GetLocalCapabilities() const { return localCapabilities; }
02161 
02164     const H323Capabilities & GetRemoteCapabilities() const { return remoteCapabilities; }
02165 
02168     unsigned GetRemoteMaxAudioDelayJitter() const { return remoteMaxAudioDelayJitter; }
02169 
02172     const H323Transport * GetSignallingChannel() const { return signallingChannel; }
02173 
02176     unsigned GetSignallingVersion() const { return h225version; }
02177 
02180     const H323Transport & GetControlChannel() const;
02181 
02184     unsigned GetControlVersion() const { return h245version; }
02185 
02188     PTime GetSetupUpTime() const { return setupTime; }
02189 
02192     PTime GetAlertingTime() const { return alertingTime; }
02193 
02197     PTime GetConnectionStartTime() const { return connectedTime; }
02198 
02201     PTime GetConnectionEndTime() const { return callEndTime; }
02202 
02206     unsigned GetMinAudioJitterDelay() const { return minAudioJitterDelay; }
02207 
02211     unsigned GetMaxAudioJitterDelay() const { return maxAudioJitterDelay; }
02212 
02215     void SetAudioJitterDelay(
02216       unsigned minDelay,   // New minimum jitter buffer delay in milliseconds
02217       unsigned maxDelay    // New maximum jitter buffer delay in milliseconds
02218     );
02219 
02222     unsigned GetUUIEsRequested() const { return uuiesRequested; }
02223 
02226     void SetUUIEsRequested(unsigned mask) { uuiesRequested = mask; }
02227 
02230     const PString GetGkAccessTokenOID() const { return gkAccessTokenOID; }
02231 
02234     void SetGkAccessTokenOID(const PString & oid) { gkAccessTokenOID = oid; }
02235 
02238     const PBYTEArray & GetGkAccessTokenData() const { return gkAccessTokenData; }
02239 
02242     void SetDestExtraCallInfo(
02243       const PString & info
02244     ) { destExtraCallInfo = info; }
02245 
02248     void SetRemotCallWaiting(const unsigned value) { remoteCallWaiting = value; }
02249 
02255     const int GetRemoteCallWaiting() const { return remoteCallWaiting; }
02256 
02261     void SetEnforcedDurationLimit(
02262       unsigned seconds  
02263     );
02265 
02266     virtual BOOL OnSendFeatureSet(unsigned, H225_FeatureSet &) const;
02267 
02268     virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet &) const;
02269 
02270   protected:
02276     virtual void InternalEstablishedConnectionCheck();
02277     BOOL InternalEndSessionCheck(PPER_Stream & strm);
02278     void SetRemoteVersions(const H225_ProtocolIdentifier & id);
02279     void MonitorCallStatus();
02280     PDECLARE_NOTIFIER(OpalRFC2833Info, H323Connection, OnUserInputInlineRFC2833);
02281     PDECLARE_NOTIFIER(H323Codec::FilterInfo, H323Connection, OnUserInputInBandDTMF);
02282 
02283     H323EndPoint & endpoint;
02284     PSyncPoint     * endSync;
02285 
02286     int                  remoteCallWaiting; // Number of call's waiting at the remote endpoint
02287     BOOL                 callAnswered;
02288     BOOL                 gatekeeperRouted;
02289     unsigned             distinctiveRing;
02290     PString              callToken;
02291     unsigned             callReference;
02292     OpalGloballyUniqueID callIdentifier;
02293     OpalGloballyUniqueID conferenceIdentifier;
02294 
02295     PStringList        localAliasNames;
02296     PString            localPartyName;
02297     PString            localDisplayName;
02298     H323Capabilities   localCapabilities; // Capabilities local system supports
02299     PString            remotePartyName;
02300     PString            remotePartyNumber;
02301     PString            remotePartyAddress;
02302     PString            destExtraCallInfo;
02303     PString            remoteApplication;
02304     H323Capabilities   remoteCapabilities; // Capabilities remote system supports
02305     unsigned           remoteMaxAudioDelayJitter;
02306     PTimer             roundTripDelayTimer;
02307     unsigned           minAudioJitterDelay;
02308     unsigned           maxAudioJitterDelay;
02309     unsigned           bandwidthAvailable;
02310     unsigned           uuiesRequested;
02311     PString            gkAccessTokenOID;
02312     PBYTEArray         gkAccessTokenData;
02313     BOOL               addAccessTokenToSetup;
02314     SendUserInputModes sendUserInputMode;
02315 
02316     H323Transport * signallingChannel;
02317     H323Transport * controlChannel;
02318     BOOL            h245Tunneling;
02319     H323SignalPDU * h245TunnelRxPDU;
02320     H323SignalPDU * h245TunnelTxPDU;
02321     H323SignalPDU * alertingPDU;
02322     H323SignalPDU * connectPDU;
02323 
02324     enum ConnectionStates {
02325       NoConnectionActive,
02326       AwaitingGatekeeperAdmission,
02327       AwaitingTransportConnect,
02328       AwaitingSignalConnect,
02329       AwaitingLocalAnswer,
02330       HasExecutedSignalConnect,
02331       EstablishedConnection,
02332       ShuttingDownConnection,
02333       NumConnectionStates
02334     } connectionState;
02335 
02336     PTime         setupTime;
02337     PTime         alertingTime;
02338     PTime         connectedTime;
02339     PTime         callEndTime;
02340     CallEndReason callEndReason;
02341     unsigned      q931Cause;
02342 
02343     unsigned   h225version;
02344     unsigned   h245version;
02345     BOOL       h245versionSet;
02346     BOOL doH245inSETUP;
02347     BOOL lastPDUWasH245inSETUP;
02348     BOOL detectInBandDTMF;
02349     BOOL mustSendDRQ;
02350     BOOL mediaWaitForConnect;
02351     BOOL transmitterSidePaused;
02352     BOOL earlyStart;
02353     BOOL startT120;
02354     PString    t38ModeChangeCapabilities;
02355     PSyncPoint digitsWaitFlag;
02356     BOOL       endSessionNeeded;
02357     BOOL       endSessionSent;
02358     PSyncPoint endSessionReceived;
02359     PTimer     enforcedDurationLimit;
02360 
02361     // Used as part of a local call hold operation involving MOH
02362     PChannel * holdMediaChannel;
02363     BOOL       isConsultationTransfer;
02364 
02366     BOOL     isCallIntrusion;
02367     unsigned callIntrusionProtectionLevel;
02368 
02369     RTP_SessionManager rtpSessions;
02370 
02371     enum FastStartStates {
02372       FastStartDisabled,
02373       FastStartInitiate,
02374       FastStartResponse,
02375       FastStartAcknowledged,
02376       NumFastStartStates
02377     };
02378     FastStartStates        fastStartState;
02379     H323LogicalChannelList fastStartChannels;
02380 
02381 #if PTRACING
02382     static const char * const ConnectionStatesNames[NumConnectionStates];
02383     friend ostream & operator<<(ostream & o, ConnectionStates s) { return o << ConnectionStatesNames[s]; }
02384     static const char * const FastStartStateNames[NumFastStartStates];
02385     friend ostream & operator<<(ostream & o, FastStartStates s) { return o << FastStartStateNames[s]; }
02386 #endif
02387 
02388 
02389     // The following pointers are to protocol procedures, they are pointers to
02390     // hide their complexity from the H323Connection classes users.
02391     H245NegMasterSlaveDetermination  * masterSlaveDeterminationProcedure;
02392     H245NegTerminalCapabilitySet     * capabilityExchangeProcedure;
02393     H245NegLogicalChannels           * logicalChannels;
02394     H245NegRequestMode               * requestModeProcedure;
02395     H245NegRoundTripDelay            * roundTripDelayProcedure;
02396     H450xDispatcher                  * h450dispatcher;
02397     H4502Handler                     * h4502handler;
02398     H4504Handler                     * h4504handler;
02399     H4506Handler                     * h4506handler;
02400     H45011Handler                    * h45011handler;
02401     OpalRFC2833                      * rfc2833handler;
02402     OpalT120Protocol                 * t120handler;
02403     OpalT38Protocol                  * t38handler;
02404 
02405 
02406     // The In-Band DTMF detector. This is used inside an audio filter which is
02407     // added to the audio channel.
02408     PDTMFDecoder                     dtmfDecoder;
02409 
02410     // used to detect remote NAT endpoints
02411     BOOL remoteIsNAT;
02412 
02413   private:
02414     PChannel * SwapHoldMediaChannels(PChannel * newChannel);
02415 
02416     PMutex outerMutex;
02417     PMutex innerMutex;
02418 };
02419 
02420 
02421 PLIST(H323ConnectionList, H323Connection);
02422 PDICTIONARY(H323ConnectionDict, PString, H323Connection);
02423 PDICTIONARY(H323CallIdentityDict, PString, H323Connection);
02424 
02425 
02426 #endif // __OPAL_H323CON_H
02427 
02428 

Generated on Sat Mar 5 14:59:05 2005 for OpenH323 by  doxygen 1.4.1