D:/Storage/CVS_Head/h323plus/include/h323con.h

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.4  2007/10/16 17:01:33  shorne
00031  * Various little fixes
00032  *
00033  * Revision 1.3  2007/08/20 19:13:27  shorne
00034  * Added Generic Capability support. Fixed Linux compile errors
00035  *
00036  * Revision 1.2  2007/08/08 17:24:58  willamowius
00037  * fix Linux compile error (gcc 4.1.2)
00038  *
00039  * Revision 1.1  2007/08/06 20:50:49  shorne
00040  * First commit of h323plus
00041  *
00042  * Revision 1.101.2.12  2007/08/02 20:08:10  shorne
00043  * added virtual to GetPartyName
00044  *
00045  * Revision 1.101.2.11  2007/07/23 21:47:10  shorne
00046  * Added QoS GK Reporting
00047  *
00048  * Revision 1.101.2.10  2007/07/20 22:03:20  shorne
00049  * Initial H.350 Support
00050  *
00051  * Revision 1.101.2.9  2007/07/19 20:10:27  shorne
00052  * Changed HAS_AEC to H323_AEC
00053  *
00054  * Revision 1.101.2.8  2007/05/23 06:58:01  shorne
00055  * Nat Support for EP's nested behind same NAT
00056  *
00057  * Revision 1.101.2.7  2007/05/01 01:17:52  shorne
00058  * Fix for NAT support disablement for same NAT
00059  *
00060  * Revision 1.101.2.6  2007/03/24 23:39:42  shorne
00061  * More H.239 work
00062  *
00063  * Revision 1.101.2.5  2007/03/18 06:21:38  shorne
00064  * More tweaks with Multimedia OnHold
00065  *
00066  * Revision 1.101.2.4  2007/03/14 08:53:38  shorne
00067  * Added Video on Hold
00068  *
00069  * Revision 1.101.2.3  2007/02/18 17:11:23  shorne
00070  * Added H.249 Extended UserInput Support
00071  *
00072  * Revision 1.101.2.2  2007/02/11 00:45:20  shorne
00073  * Added ability to disable NAT method on a call by call basis
00074  *
00075  * Revision 1.101.2.1  2006/12/23 19:08:02  shorne
00076  * Plugin video codecs & sundry
00077  *
00078  * Revision 1.101  2006/07/06 05:20:18  shorne
00079  * Added Feature CallEndReason
00080  *
00081  * Revision 1.100  2006/06/27 12:35:03  csoutheren
00082  * Patch 1366328 - Support for H.450.3 divertingLegInformation2
00083  * Thanks to Norbert Bartalsky
00084  *
00085  * Revision 1.99  2006/06/23 20:01:28  shorne
00086  * More H460 support
00087  *
00088  * Revision 1.98  2006/06/23 07:06:04  csoutheren
00089  * Fixed linux compile
00090  *
00091  * Revision 1.97  2006/06/23 06:02:44  csoutheren
00092  * Added missing declarations for H.224 backport
00093  *
00094  * Revision 1.96  2006/05/30 11:14:55  hfriederich
00095  * Switch from DISABLE_H460 to H323_H460
00096  *
00097  * Revision 1.95  2006/05/16 11:41:15  shorne
00098  * call credit, AEC and H460 support
00099  *
00100  * Revision 1.94  2006/04/07 10:24:20  rjongbloed
00101  * Fixed DevStudio compile errors
00102  *
00103  * Revision 1.93  2006/04/06 08:22:17  csoutheren
00104  * Added support for conference commands
00105  *
00106  * Revision 1.92  2006/03/02 07:52:49  csoutheren
00107  * Ensure prompt close of channels when using aggregation
00108  * Ensure MonitorCallStatus called when using aggregation
00109  *
00110  * Revision 1.91  2006/02/24 04:52:17  csoutheren
00111  * Fixd problem with H.245 aggregation
00112  *
00113  * Revision 1.90  2006/01/26 03:36:51  shorne
00114  * Add the ability to remove a local input device when placing a call on hold
00115  *
00116  * Revision 1.89  2006/01/24 08:15:24  csoutheren
00117  * Implement outgoing H.225 aggregation, and H.245 aggregation (disabled by default)
00118  * More testing to do, but this looks good :)
00119  *
00120  * Revision 1.88  2006/01/23 05:58:25  csoutheren
00121  * Working outgoing H.225 aggregation (disabled by default)
00122  *
00123  * Revision 1.87  2006/01/20 00:32:24  csoutheren
00124  * First check-in of signalling aggregation code - incomplete and disabled by default
00125  *
00126  * Revision 1.86  2006/01/18 07:46:08  csoutheren
00127  * Initial version of RTP aggregation (disabled by default)
00128  *
00129  * Revision 1.85  2005/12/09 05:20:07  csoutheren
00130  * Added ability to set explicit Q.931 cause code on call end
00131  *
00132  * Revision 1.84  2005/12/06 05:28:55  csoutheren
00133  * Changed AttachSignalChannel to be virtual
00134  *
00135  * Revision 1.83  2005/11/30 13:05:01  csoutheren
00136  * Changed tags for Doxygen
00137  *
00138  * Revision 1.82  2005/11/04 06:41:28  csoutheren
00139  * Changed PMutex to PTimedMutex
00140  *
00141  * Revision 1.81  2005/09/16 08:11:06  csoutheren
00142  * Added new error code
00143  * Added override for OnIncomingCall that can set return code
00144  *
00145  * Revision 1.80  2005/08/30 08:29:30  csoutheren
00146  * Added new error code
00147  *
00148  * Revision 1.79  2005/08/27 02:14:21  csoutheren
00149  * Capture time that reverse fast start acknowledge is received
00150  * Capture time that connect is sent/received
00151  *
00152  * Revision 1.78  2005/01/03 14:03:20  csoutheren
00153  * Added new configure options and ability to disable/enable modules
00154  *
00155  * Revision 1.77  2005/01/03 06:25:52  csoutheren
00156  * Added extensive support for disabling code modules at compile time
00157  *
00158  * Revision 1.76  2004/12/08 01:59:22  csoutheren
00159  * initial support for Transnexus OSP toolkit
00160  *
00161  * Revision 1.75  2004/11/22 11:30:42  rjongbloed
00162  * Added ability to restart H.245 negotiations, thanks Norbert Bartalsky
00163  *
00164  * Revision 1.74  2004/09/27 08:25:14  csoutheren
00165  * Changed in-header documentation for external headers to reflect changes
00166  * in external RTP interface
00167  *
00168  * Revision 1.73  2004/09/07 22:50:55  rjongbloed
00169  * Changed usage of template function as MSVC6 will not compile it.
00170  *
00171  * Revision 1.72  2004/09/03 01:06:09  csoutheren
00172  * Added initial hooks for H.460 GEF
00173  * Thanks to Simon Horne and ISVO (Asia) Pte Ltd. for this contribution
00174  *
00175  * Revision 1.71  2004/07/13 10:19:40  csoutheren
00176  * Fixed cut & paste errors in comments
00177  *
00178  * Revision 1.70  2004/06/15 03:30:00  csoutheren
00179  * Added OnSendARQ to allow access to the ARQ message before sent by connection
00180  *
00181  * Revision 1.69  2004/04/20 05:24:54  csoutheren
00182  * Added ability to specify Q.931 DisplayName
00183  *
00184  * Revision 1.68  2004/04/13 05:50:50  csoutheren
00185  * Added function to get access to the connection NAT flag
00186  *
00187  * Revision 1.67  2004/04/07 05:31:42  csoutheren
00188  * Added ability to receive calls from endpoints behind NAT firewalls
00189  *
00190  * Revision 1.66  2004/03/04 04:48:29  csoutheren
00191  * Added virtual keyword to allow overring of capability management functions
00192  * Added additional response code needed for MCU
00193  *
00194  * Revision 1.65  2004/02/26 08:32:47  csoutheren
00195  * Added release complete codes for MCU
00196  *
00197  * Revision 1.64  2003/12/28 02:38:14  csoutheren
00198  * Added H323EndPoint::OnOutgoingCall
00199  *
00200  * Revision 1.63  2003/12/14 10:42:29  rjongbloed
00201  * Changes for compilability without video support.
00202  *
00203  * Revision 1.62  2003/10/27 06:03:38  csoutheren
00204  * Added support for QoS
00205  *   Thanks to Henry Harrison of AliceStreet
00206  *
00207  * Revision 1.61  2003/10/09 09:47:45  csoutheren
00208  * Fixed problem with re-opening RTP half-channels under unusual
00209  * circumstances. Thanks to Damien Sandras
00210  *
00211  * Revision 1.60  2003/04/30 00:28:50  robertj
00212  * Redesigned the alternate credentials in ARQ system as old implementation
00213  *   was fraught with concurrency issues, most importantly it can cause false
00214  *   detection of replay attacks taking out an endpoint completely.
00215  *
00216  * Revision 1.59  2003/02/12 23:59:22  robertj
00217  * Fixed adding missing endpoint identifer in SETUP packet when gatekeeper
00218  * routed, pointed out by Stefan Klein
00219  * Also fixed correct rutrn of gk routing in IRR packet.
00220  *
00221  * Revision 1.58  2002/11/27 06:54:52  robertj
00222  * Added Service Control Session management as per Annex K/H.323 via RAS
00223  *   only at this stage.
00224  * Added H.248 ASN and very primitive infrastructure for linking into the
00225  *   Service Control Session management system.
00226  * Added basic infrastructure for Annex K/H.323 HTTP transport system.
00227  * Added Call Credit Service Control to display account balances.
00228  *
00229  * Revision 1.57  2002/11/15 05:17:22  robertj
00230  * Added facility redirect support without changing the call token for access
00231  *   to the call. If it gets redirected a new H323Connection object is
00232  *   created but it looks like the same thing to an application.
00233  *
00234  * Revision 1.56  2002/11/13 04:37:23  robertj
00235  * Added ability to get (and set) Q.931 release complete cause codes.
00236  *
00237  * Revision 1.55  2002/11/10 06:17:26  robertj
00238  * Fixed minor documentation errors.
00239  *
00240  * Revision 1.54  2002/11/05 00:24:09  robertj
00241  * Added function to determine if Q.931 CONNECT sent/received.
00242  *
00243  * Revision 1.53  2002/10/31 00:31:47  robertj
00244  * Enhanced jitter buffer system so operates dynamically between minimum and
00245  *   maximum values. Altered API to assure app writers note the change!
00246  *
00247  * Revision 1.52  2002/09/16 01:14:15  robertj
00248  * Added #define so can select if #pragma interface/implementation is used on
00249  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00250  *
00251  * Revision 1.51  2002/09/03 06:19:36  robertj
00252  * Normalised the multi-include header prevention ifdef/define symbol.
00253  *
00254  * Revision 1.50  2002/08/05 10:03:47  robertj
00255  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00256  *
00257  * Revision 1.49  2002/08/05 05:17:37  robertj
00258  * Fairly major modifications to support different authentication credentials
00259  *   in ARQ to the logged in ones on RRQ. For both client and server.
00260  * Various other H.235 authentication bugs and anomalies fixed on the way.
00261  *
00262  * Revision 1.48  2002/07/05 02:22:56  robertj
00263  * Added support for standard and non-standard T.38 mode change.
00264  *
00265  * Revision 1.47  2002/07/04 00:40:31  robertj
00266  * More H.450.11 call intrusion implementation, thanks Aleksandar Todorovic
00267  *
00268  * Revision 1.46  2002/06/22 06:11:30  robertj
00269  * Fixed bug on sometimes missing received endSession causing 10 second
00270  *   timeout in connection clean up.
00271  *
00272  * Revision 1.45  2002/06/22 05:48:38  robertj
00273  * Added partial implementation for H.450.11 Call Intrusion
00274  *
00275  * Revision 1.44  2002/06/13 06:15:19  robertj
00276  * Allowed TransferCall() to be used on H323Connection as well as H323EndPoint.
00277  *
00278  * Revision 1.43  2002/06/05 08:58:58  robertj
00279  * Fixed documentation of remote application name string.
00280  * Added missing virtual keywards on some protocol handler functions.
00281  *
00282  * Revision 1.42  2002/05/29 06:40:29  robertj
00283  * Changed sending of endSession/ReleaseComplete PDU's to occur immediately
00284  *   on call clearance and not wait for background thread to do it.
00285  * Stricter compliance by waiting for reply endSession before closing down.
00286  *
00287  * Revision 1.41  2002/05/29 03:55:17  robertj
00288  * Added protocol version number checking infrastructure, primarily to improve
00289  *   interoperability with stacks that are unforgiving of new features.
00290  *
00291  * Revision 1.40  2002/05/21 09:32:49  robertj
00292  * Added ability to set multiple alias names ona  connection by connection
00293  *   basis, defaults to endpoint list, thanks Artis Kugevics
00294  *
00295  * Revision 1.39  2002/05/15 23:59:33  robertj
00296  * Added memory management of created T.38 and T.120 handlers.
00297  * Improved documentation for use of T.38 and T.120 functions.
00298  * Added ability to initiate a mode change for non-standard T.38
00299  *
00300  * Revision 1.38  2002/05/07 01:31:51  dereks
00301  * Fix typo in documentation.
00302  *
00303  * Revision 1.37  2002/05/03 05:38:15  robertj
00304  * Added Q.931 Keypad IE mechanism for user indications (DTMF).
00305  *
00306  * Revision 1.36  2002/05/02 07:56:24  robertj
00307  * Added automatic clearing of call if no media (RTP data) is transferred in a
00308  *   configurable (default 5 minutes) amount of time.
00309  *
00310  * Revision 1.35  2002/04/25 20:55:25  dereks
00311  * Fix documentation. Thanks Olaf Schulz.
00312  *
00313  * Revision 1.34  2002/04/17 00:50:34  robertj
00314  * Added ability to disable the in band DTMF detection.
00315  *
00316  * Revision 1.33  2002/03/27 06:04:42  robertj
00317  * Added Temporary Failure end code for connection, an application may
00318  *   immediately retry the call if this occurs.
00319  *
00320  * Revision 1.32  2002/02/11 04:20:48  robertj
00321  * Fixed documentation errors, thanks Horacio J. Peņa
00322  *
00323  * Revision 1.31  2002/02/11 04:16:37  robertj
00324  * Fixed bug where could send DRQ if never received an ACF.
00325  *
00326  * Revision 1.30  2002/02/06 06:30:47  craigs
00327  * Fixed problem whereby MSD/TCS was stalled if H245 was included in
00328  * SETUP, but other end did not respond
00329  *
00330  * Revision 1.29  2002/02/04 07:17:52  robertj
00331  * Added H.450.2 Consultation Transfer, thanks Norwood Systems.
00332  *
00333  * Revision 1.28  2002/01/25 05:20:05  robertj
00334  * Moved static strings for enum printing to inside of function, could crash with DLL's
00335  *
00336  * Revision 1.27  2002/01/24 06:29:02  robertj
00337  * Added option to disable H.245 negotiation in SETUP pdu, this required
00338  *   API change so have a bit mask instead of a series of booleans.
00339  *
00340  * Revision 1.26  2002/01/23 12:45:37  rogerh
00341  * Add the DTMF decoder. This identifies DTMF tones in an audio stream.
00342  *
00343  * Revision 1.25  2002/01/23 07:12:48  robertj
00344  * Added hooks for in band DTMF detection. Now need the detector!
00345  *
00346  * Revision 1.24  2002/01/22 22:48:21  robertj
00347  * Fixed RFC2833 support (transmitter) requiring large rewrite
00348  *
00349  * Revision 1.23  2002/01/18 06:02:08  robertj
00350  * Added some H323v4 functions (fastConnectRefused & TCS in SETUP)
00351  *
00352  * Revision 1.22  2002/01/17 07:04:58  robertj
00353  * Added support for RFC2833 embedded DTMF in the RTP stream.
00354  *
00355  * Revision 1.21  2002/01/14 00:05:24  robertj
00356  * Added H.450.6, better H.450.2 error handling and  and Music On Hold.
00357  * Added destExtraCallInfo field for ARQ.
00358  *   Thanks Ben Madsen of Norwood Systems
00359  *
00360  * Revision 1.20  2002/01/10 05:13:50  robertj
00361  * Added support for external RTP stacks, thanks NuMind Software Systems.
00362  *
00363  * Revision 1.19  2002/01/09 00:21:36  robertj
00364  * Changes to support outgoing H.245 RequstModeChange.
00365  *
00366  * Revision 1.18  2001/12/22 03:20:31  robertj
00367  * Added create protocol function to H323Connection.
00368  *
00369  * Revision 1.17  2001/12/22 03:09:36  robertj
00370  * Changed OnRequstModeChange to return ack, then actually do the change.
00371  *
00372  * Revision 1.16  2001/12/22 01:52:54  robertj
00373  * Added more support for H.245 RequestMode operation.
00374  *
00375  * Revision 1.15  2001/12/15 08:09:54  robertj
00376  * Added alerting, connect and end of call times to be sent to RAS server.
00377  *
00378  * Revision 1.14  2001/12/13 10:54:23  robertj
00379  * Added ability to automatically add ACF access token to SETUP pdu.
00380  *
00381  * Revision 1.13  2001/11/01 06:11:54  robertj
00382  * Plugged very small mutex hole that could cause crashes.
00383  *
00384  * Revision 1.12  2001/11/01 00:27:33  robertj
00385  * Added default Fast Start disabled and H.245 tunneling disable flags
00386  *   to the endpoint instance.
00387  *
00388  * Revision 1.11  2001/10/24 00:54:13  robertj
00389  * Made cosmetic changes to H.245 miscellaneous command function.
00390  *
00391  * Revision 1.10  2001/10/23 02:18:06  dereks
00392  * Initial release of CU30 video codec.
00393  *
00394  * Revision 1.9  2001/09/26 06:20:56  robertj
00395  * Fixed properly nesting connection locking and unlocking requiring a quite
00396  *   large change to teh implementation of how calls are answered.
00397  *
00398  * Revision 1.8  2001/09/19 03:30:53  robertj
00399  * Added some support for overlapped dialing, thanks Chris Purvis & Nick Hoath.
00400  *
00401  * Revision 1.7  2001/09/13 06:48:13  robertj
00402  * Added call back functions for remaining Q.931/H.225 messages.
00403  * Added call back to allow modification of Release Complete,thanks Nick Hoath
00404  *
00405  * Revision 1.6  2001/09/12 06:57:58  robertj
00406  * Added support for iNow Access Token from gk, thanks Nick Hoath
00407  *
00408  * Revision 1.5  2001/09/12 06:04:36  robertj
00409  * Added support for sending UUIE's to gk on request, thanks Nick Hoath
00410  *
00411  * Revision 1.4  2001/09/11 01:24:36  robertj
00412  * Added conditional compilation to remove video and/or audio codecs.
00413  *
00414  * Revision 1.3  2001/08/22 06:54:50  robertj
00415  * Changed connection locking to use double mutex to guarantee that
00416  *   no threads can ever deadlock or access deleted connection.
00417  *
00418  * Revision 1.2  2001/08/16 07:49:16  robertj
00419  * Changed the H.450 support to be more extensible. Protocol handlers
00420  *   are now in separate classes instead of all in H323Connection.
00421  *
00422  * Revision 1.1  2001/08/06 03:08:11  robertj
00423  * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files.
00424  *
00425  */
00426 
00427 #ifndef __OPAL_H323CON_H
00428 #define __OPAL_H323CON_H
00429 
00430 #ifdef P_USE_PRAGMA
00431 #pragma interface
00432 #endif
00433 
00434 #ifdef P_DTMF
00435 #include <ptclib/dtmf.h>
00436 #endif
00437 
00438 #include "h323caps.h"
00439 #include "transports.h"
00440 #include "channels.h"
00441 #include "guid.h"
00442 #include "openh323buildopts.h"
00443 #include "h235auth.h"
00444 
00445 #if H323_H224
00446 class OpalH224Handler;
00447 class OpalH281Handler;
00448 #endif
00449 
00450 #ifdef H323_SIGNAL_AGGREGATE
00451 #include <ptclib/sockagg.h>
00452 
00455 class H323AggregatedH2x5Handle : public PAggregatedHandle
00456 {
00457   PCLASSINFO(H323AggregatedH2x5Handle, PAggregatedHandle)
00458   public:
00459     H323AggregatedH2x5Handle(H323Transport & _transport, H323Connection & _connection);
00460     ~H323AggregatedH2x5Handle();
00461 
00462     PAggregatorFDList_t GetFDs();
00463 
00464     BOOL OnRead();
00465     virtual BOOL HandlePDU(BOOL ok, PBYTEArray & pdu) = 0;
00466     PTimeInterval GetTimeout()
00467     { return transport.GetReadTimeout(); }
00468 
00469   protected:
00470     PAggregatorFD fd;
00471     H323Transport & transport;
00472     H323Connection & connection;
00473     PBYTEArray pduBuffer;
00474     PINDEX pduDataLen;
00475 };
00476 
00477 #endif
00478 
00479 #ifdef H323_H248
00480  #include "svcctrl.h"
00481 #endif
00482 
00483 
00484 /* The following classes have forward references to avoid including the VERY
00485    large header files for H225 and H245. If an application requires access
00486    to the protocol classes they can include them, but for simple usage their
00487    inclusion can be avoided.
00488  */
00489 class PPER_Stream;
00490 
00491 class H225_EndpointType;
00492 class H225_TransportAddress;
00493 class H225_ArrayOf_PASN_OctetString;
00494 class H225_ProtocolIdentifier;
00495 class H225_AdmissionRequest;
00496 class H225_AdmissionReject;
00497 class H225_AdmissionConfirm;
00498 class H225_InfoRequestResponse;
00499 class H225_DisengageRequest;
00500 class H225_FeatureSet;
00501 class H225_Setup_UUIE;
00502 class H225_ArrayOf_ServiceControlSession;
00503 class H225_ServiceControlSession_reason;
00504 
00505 class H245_TerminalCapabilitySet;
00506 class H245_TerminalCapabilitySetReject;
00507 class H245_OpenLogicalChannel;
00508 class H245_OpenLogicalChannelAck;
00509 class H245_TransportAddress;
00510 class H245_UserInputIndication;
00511 class H245_RequestMode;
00512 class H245_RequestModeAck;
00513 class H245_RequestModeReject;
00514 class H245_ModeDescription;
00515 class H245_ArrayOf_ModeDescription;
00516 class H245_SendTerminalCapabilitySet;
00517 class H245_MultiplexCapability;
00518 class H245_FlowControlCommand;
00519 class H245_MiscellaneousCommand;
00520 class H245_MiscellaneousIndication;
00521 class H245_JitterIndication;
00522 class H245_ConferenceRequest;
00523 class H245_ConferenceResponse;
00524 class H245_ConferenceCommand;
00525 class H245_ConferenceIndication;
00526 class H245_GenericMessage;
00527 class H245_ArrayOf_GenericParameter;
00528 
00529 class H323SignalPDU;
00530 class H323ControlPDU;
00531 class H323_RTP_UDP;
00532 
00533 class H235Authenticators;
00534 
00535 class H245NegMasterSlaveDetermination;
00536 class H245NegTerminalCapabilitySet;
00537 class H245NegLogicalChannels;
00538 class H245NegRequestMode;
00539 class H245NegRoundTripDelay;
00540 
00541 #ifdef H323_H450
00542 
00543 class H450xDispatcher;
00544 class H4502Handler;
00545 class H4503Handler;
00546 class H4504Handler;
00547 class H4506Handler;
00548 class H45011Handler;
00549 
00550 #endif
00551 
00552 #ifdef H323_T120
00553 class OpalT120Protocol;
00554 #endif
00555 
00556 #ifdef H323_T38
00557 class OpalT38Protocol;
00558 #endif
00559 
00560 #ifdef H323_H224
00561 class OpalH224Handler;
00562 class OpalH281Handler;
00563 #endif
00564 
00565 class OpalRFC2833;
00566 class OpalRFC2833Info;
00567 
00568 #ifdef H323_H460
00569 class H460_FeatureSet;
00570 #endif
00571 
00572 
00574 
00582 class H323Connection : public PObject
00583 {
00584   PCLASSINFO(H323Connection, PObject);
00585 
00586   friend class AggregatedH225Handle;
00587   friend class AggregatedH245Handle;
00588   public:
00591     enum Options {
00592       FastStartOptionDisable       = 0x0001,
00593       FastStartOptionEnable        = 0x0002,
00594       FastStartOptionMask          = 0x0003,
00595 
00596       H245TunnelingOptionDisable   = 0x0004,
00597       H245TunnelingOptionEnable    = 0x0008,
00598       H245TunnelingOptionMask      = 0x000c,
00599 
00600       H245inSetupOptionDisable     = 0x0010,
00601       H245inSetupOptionEnable      = 0x0020,
00602       H245inSetupOptionMask        = 0x0030,
00603 
00604       DetectInBandDTMFOptionDisable= 0x0040,
00605       DetectInBandDTMFOptionEnable = 0x0080,
00606       DetectInBandDTMFOptionMask   = 0x00c0,
00607 
00608 #ifdef H323_RTP_AGGREGATE
00609       RTPAggregationDisable        = 0x0100,
00610       RTPAggregationEnable         = 0x0200,
00611       RTPAggregationMask           = 0x0300,
00612 #endif
00613 
00614 #ifdef H323_SIGNAL_AGGREGATE
00615       SignallingAggregationDisable = 0x0400,
00616       SignallingAggregationEnable  = 0x0800,
00617       SignallingAggregationMask    = 0x0c00
00618 #endif
00619     };
00620 
00623     H323Connection(
00624       H323EndPoint & endpoint,  
00625       unsigned callReference,   
00626       unsigned options = 0      
00627     );
00628 
00631     ~H323Connection();
00632 
00642     BOOL Lock();
00643 
00655     int TryLock();
00656 
00662     void Unlock();
00663 
00670     virtual void OnSendARQ(
00671       H225_AdmissionRequest & arq
00672     );
00673 
00679     virtual void OnReceivedACF(
00680       const H225_AdmissionConfirm & acf
00681     );
00682 
00688     virtual void OnReceivedARJ(
00689       const H225_AdmissionReject & arj
00690     );
00691 
00698     virtual void OnSendIRR(
00699                 H225_InfoRequestResponse & irr
00700         ) const;
00701 
00708     virtual void OnSendDRQ(
00709                 H225_DisengageRequest & drq
00710         ) const;
00711 
00715     virtual void OnEstablished();
00716 
00720     virtual void OnCleared();
00721 
00728     BOOL IsConnected() const { return connectionState == HasExecutedSignalConnect || connectionState == EstablishedConnection; }
00729 
00735     BOOL IsEstablished() const { return connectionState == EstablishedConnection; }
00736 
00741     enum CallEndReason {
00742       EndedByLocalUser,         
00743       EndedByNoAccept,          
00744       EndedByAnswerDenied,      
00745       EndedByRemoteUser,        
00746       EndedByRefusal,           
00747       EndedByNoAnswer,          
00748       EndedByCallerAbort,       
00749       EndedByTransportFail,     
00750       EndedByConnectFail,       
00751       EndedByGatekeeper,        
00752       EndedByNoUser,            
00753       EndedByNoBandwidth,       
00754       EndedByCapabilityExchange,
00755       EndedByCallForwarded,     
00756       EndedBySecurityDenial,    
00757       EndedByLocalBusy,         
00758       EndedByLocalCongestion,   
00759       EndedByRemoteBusy,        
00760       EndedByRemoteCongestion,  
00761       EndedByUnreachable,       
00762       EndedByNoEndPoint,        
00763       EndedByHostOffline,       
00764       EndedByTemporaryFailure,  
00765       EndedByQ931Cause,         
00766       EndedByDurationLimit,     
00767       EndedByInvalidConferenceID, 
00768       EndedByOSPRefusal,          
00769       EndedByInvalidNumberFormat, 
00770       EndedByUnspecifiedProtocolError, 
00771       EndedByNoFeatureSupport,         
00772       NumCallEndReasons
00773     };
00774 #if PTRACING
00775     friend ostream & operator<<(ostream & o, CallEndReason r);
00776 #endif
00777 
00786     CallEndReason GetCallEndReason() const { return callEndReason; }
00787 
00792     virtual void SetCallEndReason(
00793       CallEndReason reason,     
00794       PSyncPoint * sync = NULL  
00795     );
00796 
00802     virtual BOOL ClearCall(
00803       CallEndReason reason = EndedByLocalUser  
00804     );
00805 
00808     virtual BOOL ClearCallSynchronous(
00809       PSyncPoint * sync,
00810       CallEndReason reason = EndedByLocalUser  
00811     );
00812 
00821     virtual void CleanUpOnCallEnd();
00823 
00824 
00829     virtual void AttachSignalChannel(
00830       const PString & token,    
00831       H323Transport * channel,  
00832       BOOL answeringCall        
00833     );
00834 
00837     BOOL WriteSignalPDU(
00838       H323SignalPDU & pdu       
00839     );
00840 
00844     virtual void HandleSignallingChannel();
00845 
00849     virtual BOOL HandleReceivedSignalPDU(BOOL readStatus, H323SignalPDU & pdu);
00850 
00854     virtual BOOL HandleReceivedControlPDU(BOOL readStatus, PPER_Stream & strm);
00855 
00859     virtual BOOL HandleSignalPDU(
00860       H323SignalPDU & pdu       
00861     );
00862 
00866     virtual void HandleTunnelPDU(
00867       H323SignalPDU * txPDU       
00868     );
00869 
00877     virtual BOOL OnReceivedSignalSetup(
00878       const H323SignalPDU & pdu   
00879     );
00880 
00887     virtual BOOL OnReceivedSignalSetupAck(
00888       const H323SignalPDU & pdu   
00889     );
00890 
00897     virtual BOOL OnReceivedSignalInformation(
00898       const H323SignalPDU & pdu   
00899     );
00900 
00909     virtual BOOL OnReceivedCallProceeding(
00910       const H323SignalPDU & pdu   
00911     );
00912 
00921     virtual BOOL OnReceivedProgress(
00922       const H323SignalPDU & pdu   
00923     );
00924 
00931     virtual BOOL OnReceivedAlerting(
00932       const H323SignalPDU & pdu   
00933     );
00934 
00943     virtual BOOL OnReceivedSignalConnect(
00944       const H323SignalPDU & pdu   
00945     );
00946 
00955     virtual BOOL OnReceivedFacility(
00956       const H323SignalPDU & pdu   
00957     );
00958 
00965     virtual BOOL OnReceivedSignalNotify(
00966       const H323SignalPDU & pdu   
00967     );
00968 
00975     virtual BOOL OnReceivedSignalStatus(
00976       const H323SignalPDU & pdu   
00977     );
00978 
00985     virtual BOOL OnReceivedStatusEnquiry(
00986       const H323SignalPDU & pdu   
00987     );
00988 
00993     virtual void OnReceivedReleaseComplete(
00994       const H323SignalPDU & pdu   
00995     );
00996 
01003     virtual BOOL OnUnknownSignalPDU(
01004       const H323SignalPDU & pdu  
01005     );
01006 
01018     virtual BOOL OnIncomingCall(
01019       const H323SignalPDU & setupPDU,   
01020       H323SignalPDU & alertingPDU       
01021     );
01022     virtual BOOL OnIncomingCall(
01023       const H323SignalPDU & setupPDU,   
01024       H323SignalPDU & alertingPDU,      
01025       CallEndReason & reason            
01026     );
01027 
01037     virtual BOOL ForwardCall(
01038       const PString & forwardParty   
01039     );
01040 
01041 #ifdef H323_H450
01042 
01047     void TransferCall(
01048       const PString & remoteParty,   
01049       const PString & callIdentity = PString::Empty()
01051     );
01052 
01057     void ConsultationTransfer(
01058       const PString & primaryCallToken  
01059     );
01060 
01063     virtual void OnReceivedInitiateReturnError();
01064 
01071     virtual void HandleConsultationTransfer(
01072       const PString & callIdentity, 
01074       H323Connection & incoming     
01075     );
01076 
01079     BOOL IsTransferringCall() const;
01080 
01083     BOOL IsTransferredCall() const;
01084 
01089     virtual void HandleTransferCall(
01090       const PString & token,
01091       const PString & identity
01092     );
01093 
01098     int GetCallTransferInvokeId();
01099 
01107     virtual void HandleCallTransferFailure(
01108       const int returnError    
01109     );
01110 
01115     void SetAssociatedCallToken(
01116       const PString & token  
01117     );
01118 
01123     virtual void OnConsultationTransferSuccess(
01124       H323Connection & secondaryCall  
01125     );
01126 
01131      virtual void SetCallLinkage(
01132                 H225_AdmissionRequest & arq   
01133       );
01134 
01139      virtual void GetCallLinkage(
01140                 const H225_AdmissionRequest & arq  
01141         );
01142 
01148     BOOL GetRedirectingNumber(
01149       PString &originalCalledNr,               
01150       PString &lastDivertingNr,
01151       int &divCounter, 
01152       int &originaldivReason,
01153       int &divReason);
01154 
01159     void HoldCall(
01160       BOOL localHold   
01161     );
01162 
01168     void RetrieveCall();
01169 
01176     void SetHoldMedia(
01177       PChannel * audioChannel
01178     );
01179 
01186     void SetVideoHoldMedia(
01187           PChannel * videoChannel
01188         );
01189 
01193     virtual PChannel *  OnCallHold(BOOL IsEncoder,     
01194                                unsigned sessionId,     
01195                                unsigned bufferSize,    
01196                                PChannel * channel);    
01197 
01201     virtual PChannel *  OnCallRetrieve(BOOL IsEncoder,  
01202                                unsigned sessionId,      
01203                                unsigned bufferSize,     
01204                                PChannel * channel);     
01205 
01208     BOOL IsMediaOnHold() const;
01209 
01212     BOOL IsLocalHold() const;
01213 
01216     BOOL IsRemoteHold() const;
01217 
01220     BOOL IsCallOnHold() const;
01221 
01226     virtual void IntrudeCall(
01227       unsigned capabilityLevel
01228     );
01229 
01234     virtual void HandleIntrudeCall(
01235       const PString & token,
01236       const PString & identity
01237     );
01238 
01244     void SetCallIntrusion() { isCallIntrusion = TRUE; }
01245 
01246     BOOL IsCallIntrusion() { return isCallIntrusion; }
01247 
01250     unsigned GetLocalCallIntrusionProtectionLevel() { return callIntrusionProtectionLevel; }
01251 
01255     virtual BOOL GetRemoteCallIntrusionProtectionLevel(
01256       const PString & callToken,
01257       unsigned callIntrusionProtectionLevel
01258     );
01259 
01260     virtual void SetIntrusionImpending();
01261 
01262     virtual void SetForcedReleaseAccepted();
01263 
01264     virtual void SetIntrusionNotAuthorized();
01265 
01272     void SendCallWaitingIndication(
01273       const unsigned nbOfAddWaitingCalls = 0   
01274     );
01275 
01276 #endif // H323_H450
01277 
01278     enum AnswerCallResponse {
01279       AnswerCallNow,               
01280       AnswerCallDenied,            
01281       AnswerCallPending,           
01282       AnswerCallDeferred,          
01283       AnswerCallAlertWithMedia,    
01284       AnswerCallDeferredWithMedia, 
01285       AnswerCallDeniedByInvalidCID, 
01286       NumAnswerCallResponses
01287     };
01288 #if PTRACING
01289     friend ostream & operator<<(ostream & o, AnswerCallResponse s);
01290 #endif
01291 
01318     virtual AnswerCallResponse OnAnswerCall(
01319       const PString & callerName,       
01320       const H323SignalPDU & setupPDU,   
01321       H323SignalPDU & connectPDU        
01322     );
01323 
01334     void AnsweringCall(
01335       AnswerCallResponse response 
01336     );
01337 
01348     virtual CallEndReason SendSignalSetup(
01349       const PString & alias,                
01350       const H323TransportAddress & address  
01351     );
01352 
01364     virtual BOOL OnSendSignalSetup(
01365       H323SignalPDU & setupPDU   
01366     );
01367 
01376     virtual BOOL OnSendCallProceeding(
01377       H323SignalPDU & callProceedingPDU   
01378     );
01379 
01391     virtual BOOL OnSendReleaseComplete(
01392       H323SignalPDU & releaseCompletePDU 
01393     );
01394 
01405     virtual BOOL OnAlerting(
01406       const H323SignalPDU & alertingPDU,  
01407       const PString & user                
01408     );
01409 
01424     virtual BOOL OnInsufficientDigits();
01425 
01438     virtual void SendMoreDigits(
01439       const PString & digits    
01440     );
01441 
01451     virtual BOOL OnOutgoingCall(
01452       const H323SignalPDU & connectPDU   
01453     );
01454 
01466     virtual BOOL SendFastStartAcknowledge(
01467       H225_ArrayOf_PASN_OctetString & array   
01468     );
01469 
01481     virtual BOOL HandleFastStartAcknowledge(
01482       const H225_ArrayOf_PASN_OctetString & array   
01483     );
01484 
01492     virtual BOOL StartControlChannel();
01493 
01505     virtual BOOL StartControlChannel(
01506       const H225_TransportAddress & h245Address   
01507     );
01509 
01516     BOOL WriteControlPDU(
01517       const H323ControlPDU & pdu
01518     );
01519 
01522     virtual BOOL StartControlNegotiations(
01523       BOOL renegotiate = FALSE  
01524     );
01525 
01528     virtual void HandleControlChannel();
01529 
01536     virtual BOOL HandleControlData(
01537       PPER_Stream & strm
01538     );
01539 
01546     virtual BOOL HandleControlPDU(
01547       const H323ControlPDU & pdu
01548     );
01549 
01559     virtual BOOL OnUnknownControlPDU(
01560       const H323ControlPDU & pdu  
01561     );
01562 
01566     virtual BOOL OnH245Request(
01567       const H323ControlPDU & pdu  
01568     );
01569 
01573     virtual BOOL OnH245Response(
01574       const H323ControlPDU & pdu  
01575     );
01576 
01580     virtual BOOL OnH245Command(
01581       const H323ControlPDU & pdu  
01582     );
01583 
01587     virtual BOOL OnH245Indication(
01588       const H323ControlPDU & pdu  
01589     );
01590 
01593     virtual BOOL OnH245_SendTerminalCapabilitySet(
01594       const H245_SendTerminalCapabilitySet & pdu  
01595     );
01596 
01601     virtual BOOL OnH245_FlowControlCommand(
01602       const H245_FlowControlCommand & pdu  
01603     );
01604 
01609     virtual BOOL OnH245_MiscellaneousCommand(
01610       const H245_MiscellaneousCommand & pdu  
01611     );
01612 
01617     virtual BOOL OnH245_MiscellaneousIndication(
01618       const H245_MiscellaneousIndication & pdu  
01619     );
01620 
01625     virtual BOOL OnH245_JitterIndication(
01626       const H245_JitterIndication & pdu  
01627     );
01628 
01631     enum ControlProtocolErrors {
01632       e_MasterSlaveDetermination,
01633       e_CapabilityExchange,
01634       e_LogicalChannel,
01635       e_ModeRequest,
01636       e_RoundTripDelay
01637     };
01638 
01650     virtual BOOL OnControlProtocolError(
01651       ControlProtocolErrors errorSource,  
01652       const void * errorData = NULL       
01653     );
01654 
01662     virtual void OnSendCapabilitySet(
01663       H245_TerminalCapabilitySet & pdu  
01664     );
01665 
01677     virtual BOOL OnReceivedCapabilitySet(
01678       const H323Capabilities & remoteCaps,      
01679       const H245_MultiplexCapability * muxCap,  
01680       H245_TerminalCapabilitySetReject & reject 
01681     );
01682 
01685     virtual void SendCapabilitySet(
01686       BOOL empty  
01687     );
01688 
01697     virtual void OnSetLocalCapabilities();
01698 
01701     BOOL IsH245Master() const;
01702 
01705     void StartRoundTripDelay();
01706 
01709     PTimeInterval GetRoundTripDelay() const;
01711 
01751     virtual void OnSelectLogicalChannels();
01752 
01755     virtual void SelectDefaultLogicalChannel(
01756       unsigned sessionID    
01757     );
01758 
01762     virtual void SelectFastStartChannels(
01763       unsigned sessionID,   
01764       BOOL transmitter,     
01765       BOOL receiver         
01766     );
01767 
01770     void DisableFastStart();
01771 
01786     virtual BOOL OpenLogicalChannel(
01787       const H323Capability & capability,  
01788       unsigned sessionID,                 
01789       H323Channel::Directions dir         
01790     );
01791 
01801     virtual BOOL OnOpenLogicalChannel(
01802       const H245_OpenLogicalChannel & openPDU,  
01803       H245_OpenLogicalChannelAck & ackPDU,      
01804       unsigned & errorCode                      
01805     );
01806 
01814     virtual BOOL OnConflictingLogicalChannel(
01815       H323Channel & channel    
01816     );
01817 
01822     virtual H323Channel * CreateLogicalChannel(
01823       const H245_OpenLogicalChannel & open, 
01824       BOOL startingFast,                    
01825       unsigned & errorCode                  
01826     );
01827 
01863     virtual H323Channel * CreateRealTimeLogicalChannel(
01864       const H323Capability & capability, 
01865       H323Channel::Directions dir,       
01866       unsigned sessionID,                
01867       const H245_H2250LogicalChannelParameters * param,
01869       RTP_QOS * rtpqos = NULL            
01870     );
01871 
01882     virtual BOOL OnCreateLogicalChannel(
01883       const H323Capability & capability,  
01884       H323Channel::Directions dir,        
01885       unsigned & errorCode                
01886     );
01887 
01892     virtual BOOL OnStartLogicalChannel(
01893       H323Channel & channel    
01894     );
01895 
01896 #ifndef NO_H323_AUDIO_CODECS
01897 
01903     virtual BOOL OpenAudioChannel(
01904       BOOL isEncoding,       
01905       unsigned bufferSize,   
01906       H323AudioCodec & codec 
01907     );
01908 #endif
01909 
01910 #ifndef NO_H323_VIDEO
01911 
01917     virtual BOOL OpenVideoChannel(
01918       BOOL isEncoding,       
01919       H323VideoCodec & codec 
01920     );
01921 
01922 #ifdef H323_H239
01923 
01927     virtual BOOL OpenExtendedVideoSession(
01928                     unsigned role,                     
01929                     H323ChannelNumber & channelnum     
01930         );
01931 
01935         virtual void OnReceivedExtendedVideoSession(
01936                    unsigned /*role*/,                           
01937                    const H323ChannelNumber & /*channelnum*/     
01938         ) const {};
01939     
01943     virtual void CloseExtendedVideoSession(
01944        const H323ChannelNumber & num     
01945         );
01946 
01953     virtual BOOL OpenExtendedVideoChannel(
01954       BOOL isEncoding,       
01955       H323VideoCodec & codec 
01956     );
01957 
01958 #endif // H323_H239
01959 
01960 #endif // NO_H323_VIDEO
01961 
01964     virtual void CloseLogicalChannel(
01965       unsigned number,    
01966       BOOL fromRemote     
01967     );
01968 
01971     virtual void CloseLogicalChannelNumber(
01972       const H323ChannelNumber & number    
01973     );
01974 
01977     virtual void CloseAllLogicalChannels(
01978       BOOL fromRemote     
01979     );
01980 
01986     virtual void OnClosedLogicalChannel(
01987       const H323Channel & channel   
01988     );
01989 
01998     virtual BOOL OnClosingLogicalChannel(
01999       H323Channel & channel   
02000     );
02001 
02010     virtual void OnLogicalChannelFlowControl(
02011       H323Channel * channel,   
02012       long bitRateRestriction  
02013     );
02014 
02023     virtual void OnLogicalChannelJitter(
02024       H323Channel * channel,   
02025       DWORD jitter,            
02026       int skippedFrameCount,   
02027       int additionalBuffer     
02028     );
02029 
02032     void SendLogicalChannelMiscCommand(
02033       H323Channel & channel,  
02034       unsigned command        
02035     );
02036 
02040     H323Channel * GetLogicalChannel(
02041       unsigned number,    
02042       BOOL fromRemote     
02043     ) const;
02044 
02050     H323Channel * FindChannel(
02051       unsigned sessionId,   
02052       BOOL fromRemote       
02053     ) const;
02055 
02062     unsigned GetBandwidthUsed() const;
02063 
02069     BOOL UseBandwidth(
02070       unsigned bandwidth,     
02071       BOOL removing           
02072     );
02073 
02076     unsigned GetBandwidthAvailable() const { return bandwidthAvailable; }
02077 
02082     BOOL SetBandwidthAvailable(
02083       unsigned newBandwidth,    
02084       BOOL force = FALSE        
02085     );
02087 
02090     enum SendUserInputModes {
02091       SendUserInputAsQ931,
02092       SendUserInputAsString,
02093       SendUserInputAsTone,
02094       SendUserInputAsInlineRFC2833,
02095       SendUserInputAsSeparateRFC2833,  // Not implemented
02096 #ifdef H323_H249
02097       SendUserInputAsNavigation,
02098       SendUserInputAsSoftkey,
02099       SendUserInputAsPointDevice,
02100       SendUserInputAsModal,
02101 #endif
02102       NumSendUserInputModes
02103     };
02104 #if PTRACING
02105     friend ostream & operator<<(ostream & o, SendUserInputModes m);
02106 #endif
02107 
02110     void SetSendUserInputMode(SendUserInputModes mode);
02111 
02114     SendUserInputModes GetSendUserInputMode() const { return sendUserInputMode; }
02115 
02121     SendUserInputModes GetRealSendUserInputMode() const;
02122 
02136     virtual void SendUserInput(
02137       const PString & value                   
02138     );
02139 
02146     virtual void OnUserInputString(
02147       const PString & value   
02148     );
02149 
02174     virtual void SendUserInputTone(
02175       char tone,                   
02176       unsigned duration = 0,       
02177       unsigned logicalChannel = 0, 
02178       unsigned rtpTimestamp = 0    
02179     );
02180 
02185     virtual void OnUserInputTone(
02186       char tone,               
02187       unsigned duration,       
02188       unsigned logicalChannel, 
02189       unsigned rtpTimestamp    
02190     );
02191 
02195     void SendUserInputHookFlash(
02196       int duration = 500  
02197     ) { SendUserInputTone('!', duration); }
02198 
02205     virtual void SendUserInputIndicationQ931(
02206       const PString & value                   
02207     );
02208 
02215     virtual void SendUserInputIndicationString(
02216       const PString & value                   
02217     );
02218 
02223     virtual void SendUserInputIndicationTone(
02224       char tone,                   
02225       unsigned duration = 0,       
02226       unsigned logicalChannel = 0, 
02227       unsigned rtpTimestamp = 0    
02228     );
02229 
02230 #ifdef H323_H249
02231 
02235         virtual void SendUserInputIndicationNavigate(
02236                 H323_UserInputCapability::NavigateKeyID keyID
02237         );
02238 
02242         virtual void OnUserInputIndicationNavigate(
02243                 const H245_ArrayOf_GenericParameter & contents
02244         );
02245         
02249     virtual void SendUserInputIndicationSoftkey(
02250                 unsigned key, 
02251                 const PString & keyName = PString()
02252         );
02253 
02254     virtual void OnUserInputIndicationSoftkey(
02255                 const H245_ArrayOf_GenericParameter & contents
02256         );
02257 
02261     virtual void SendUserInputIndicationPointDevice(
02262                             unsigned x,              
02263                                                 unsigned y,              
02264                                                 unsigned button=0,       
02265                                                 unsigned buttonstate=0,  
02266                                                 unsigned clickcount=0    
02267     );
02268 
02269     virtual void OnUserInputIndicationPointDevice(
02270                 const H245_ArrayOf_GenericParameter & contents
02271         );
02272         
02276         virtual void SendUserInputIndicationModal();
02277 
02278     virtual void OnUserInputIndicationModal(
02279                 const H245_ArrayOf_GenericParameter & contents
02280         );
02281         
02282 #endif
02283 
02284 
02293     virtual void SendUserInputIndication(
02294       const H245_UserInputIndication & pdu    
02295     );
02296 
02301     virtual void OnUserInputIndication(
02302       const H245_UserInputIndication & pdu  
02303     );
02305 
02311     virtual RTP_Session * GetSession(
02312       unsigned sessionID
02313     ) const;
02314 
02318     virtual H323_RTP_Session * GetSessionCallbacks(
02319       unsigned sessionID
02320     ) const;
02321 
02331     virtual RTP_Session * UseSession(
02332       unsigned sessionID,
02333       const H245_TransportAddress & pdu,
02334       H323Channel::Directions dir,
02335       RTP_QOS * rtpqos = NULL
02336     );
02337 
02341     virtual void ReleaseSession(
02342       unsigned sessionID
02343     );
02344 
02349         virtual BOOL OnReceiveRTPAltInformation(H323_RTP_UDP & rtp, 
02350                             const H245_ArrayOf_GenericInformation & alternate) const;
02351 
02356     virtual BOOL OnSendingRTPAltInformation(const H323_RTP_UDP & rtp,
02357                                         H245_ArrayOf_GenericInformation & alternate) const;
02358 
02359 
02367     virtual void OnRTPStatistics(
02368       const RTP_Session & session   
02369     ) const;
02370 
02377     virtual void OnRTPFinalStatistics(
02378       const RTP_Session & session   
02379     ) const;
02380 
02384     virtual PString GetSessionCodecNames(
02385       unsigned sessionID
02386     ) const;
02387 
02390     BOOL IsBehindNAT() const
02391     { return remoteIsNAT; }
02392 
02395         void SetRemoteNAT()
02396         { remoteIsNAT = TRUE; }
02397 
02400         BOOL HasNATSupport() const
02401         { return NATsupport; }
02402 
02405         void DisableNATSupport()
02406         { NATsupport = FALSE; remoteIsNAT = FALSE; }
02407         
02411         void SetSameNAT() { sameNAT = TRUE; };
02412 
02415         BOOL isSameNAT() { return sameNAT; };
02416 
02422     virtual void SetEndpointTypeInfo(H225_EndpointType & info) const;
02423 
02425 
02443     virtual BOOL RequestModeChange(
02444       const PString & newModes  
02445     );
02446 
02454     virtual BOOL RequestModeChange(
02455       const H245_ArrayOf_ModeDescription & newModes  
02456     );
02457 
02460     virtual BOOL OnRequestModeChange(
02461       const H245_RequestMode & pdu,     
02462       H245_RequestModeAck & ack,        
02463       H245_RequestModeReject & reject,  
02464       PINDEX & selectedMode           
02465     );
02466 
02473     virtual void OnModeChanged(
02474       const H245_ModeDescription & newMode
02475     );
02476 
02481     virtual void OnAcceptModeChange(
02482       const H245_RequestModeAck & pdu  
02483     );
02484 
02489     virtual void OnRefusedModeChange(
02490       const H245_RequestModeReject * pdu  
02491     );
02493 
02494 #ifdef H323_T120
02495 
02509     virtual OpalT120Protocol * CreateT120ProtocolHandler();
02510 #endif
02511 
02512 #ifdef H323_T38
02513 
02525     virtual OpalT38Protocol * CreateT38ProtocolHandler();
02526 
02529     virtual BOOL RequestModeChangeT38(
02530       const char * capabilityNames = "T.38\nT38FaxUDP"
02531     );
02532 #endif
02533 
02534 #ifdef H323_H224
02535 
02547     virtual OpalH224Handler *CreateH224ProtocolHandler(unsigned sessionID);
02548         
02558      virtual OpalH281Handler *CreateH281ProtocolHandler(OpalH224Handler & h224Handler);
02559 #endif
02560 
02570     virtual BOOL GetAdmissionRequestAuthentication(
02571       const H225_AdmissionRequest & arq,  
02572       H235Authenticators & authenticators 
02573     );
02575 
02580     H323EndPoint & GetEndPoint() const { return endpoint; }
02581 
02584     BOOL HadAnsweredCall() const { return callAnswered; }
02585 
02588     BOOL IsGatekeeperRouted() const { return gatekeeperRouted; }
02589 
02593     unsigned GetQ931Cause() const { return q931Cause; }
02594 
02598     void SetQ931Cause(unsigned v) { q931Cause = v; }
02599 
02604     unsigned GetDistinctiveRing() const { return distinctiveRing; }
02605 
02612     void SetDistinctiveRing(unsigned pattern) { distinctiveRing = pattern&7; }
02613 
02616     const PString & GetCallToken() const { return callToken; }
02617 
02620     unsigned GetCallReference() const { return callReference; }
02621 
02624     const OpalGloballyUniqueID & GetCallIdentifier() const { return callIdentifier; }
02625 
02628     const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; }
02629 
02632     const PString & GetLocalPartyName() const { return localPartyName; }
02633 
02636     void SetLocalPartyName(const PString & name);
02637 
02640     void SetDisplayName(const PString & name) { localDisplayName = name; }
02641 
02644     const PString GetDisplayName() const { return localDisplayName; }
02645 
02646     const PStringList & GetLocalAliasNames() const { return localAliasNames; }
02647 
02654     virtual const PString & GetRemotePartyName() const { return remotePartyName; }
02655 
02660     const PString & GetRemotePartyNumber() const { return remotePartyNumber; }
02661 
02668     const PString & GetRemotePartyAddress() const { return remotePartyAddress; }
02669 
02672         const PStringArray & GetRemotePartyAliases() const { return remoteAliasNames; }
02673 
02676     void SetRemotePartyInfo(
02677       const H323SignalPDU & pdu 
02678     );
02679 
02691     const PString & GetRemoteApplication() const { return remoteApplication; }
02692 
02695     void SetRemoteApplication(
02696       const H225_EndpointType & pdu 
02697     );
02698     
02701     const H323Capabilities & GetLocalCapabilities() const { return localCapabilities; }
02702 
02705     const H323Capabilities & GetRemoteCapabilities() const { return remoteCapabilities; }
02706 
02709     unsigned GetRemoteMaxAudioDelayJitter() const { return remoteMaxAudioDelayJitter; }
02710 
02713     const H323Transport * GetSignallingChannel() const { return signallingChannel; }
02714 
02717     unsigned GetSignallingVersion() const { return h225version; }
02718 
02721     const H323Transport & GetControlChannel() const;
02722 
02725     unsigned GetControlVersion() const { return h245version; }
02726 
02729     PTime GetSetupUpTime() const { return setupTime; }
02730 
02733     PTime GetAlertingTime() const { return alertingTime; }
02734 
02738     PTime GetConnectionStartTime() const { return connectedTime; }
02739 
02742     PTime GetConnectionEndTime() const { return callEndTime; }
02743 
02746     PTime GetReverseMediaOpenTime() const { return reverseMediaOpenTime; }
02747 
02751     unsigned GetMinAudioJitterDelay() const { return minAudioJitterDelay; }
02752 
02756     unsigned GetMaxAudioJitterDelay() const { return maxAudioJitterDelay; }
02757 
02760     void SetAudioJitterDelay(
02761       unsigned minDelay,   
02762       unsigned maxDelay    
02763     );
02764 
02767     unsigned GetUUIEsRequested() const { return uuiesRequested; }
02768 
02771     void SetUUIEsRequested(unsigned mask) { uuiesRequested = mask; }
02772 
02775     const PString GetGkAccessTokenOID() const { return gkAccessTokenOID; }
02776 
02779     void SetGkAccessTokenOID(const PString & oid) { gkAccessTokenOID = oid; }
02780 
02783     const PBYTEArray & GetGkAccessTokenData() const { return gkAccessTokenData; }
02784 
02787     void SetDestExtraCallInfo(
02788       const PString & info
02789     ) { destExtraCallInfo = info; }
02790 
02793     void SetRemoteCallWaiting(const unsigned value) { remoteCallWaiting = value; }
02794 
02800     const int GetRemoteCallWaiting() const { return remoteCallWaiting; }
02801 
02806     void SetEnforcedDurationLimit(
02807       unsigned seconds  
02808     );
02809 
02810 #ifdef H323_H460
02811 
02813         void DisableFeatures();
02814 #endif
02815 
02816     virtual BOOL OnSendFeatureSet(unsigned, H225_FeatureSet &) const;
02817 
02818     virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet &) const;
02819 
02821 
02822 #ifndef DISABLE_CALLAUTH
02823 
02827     const H235Authenticators & GetEPAuthenticators() const;
02828 
02833     virtual void SetAuthenticationConnection();
02834 
02839     virtual BOOL OnCallAuthentication(const PString & username, 
02840                                       PString & password);
02841 
02846         virtual BOOL OnEPAuthenticationFailed(H235Authenticator::ValidationResult result) const;
02847 
02851     virtual void OnAuthenticationFinalise(unsigned pdu,PBYTEArray & rawData);
02852 
02855     BOOL HasAuthentication() const
02856        { return hasAuthentication; }
02857 
02860         BOOL HasAuthenticationFailed() 
02861            { return AuthenticationFailed; };
02863 #endif
02864 
02865 #ifdef H323_H248
02866 
02870     BOOL OnSendServiceControlSessions(
02871                  H225_ArrayOf_ServiceControlSession & serviceControl, 
02872                  H225_ServiceControlSession_reason reason           
02873                 ) const;
02874 
02877     void OnReceiveServiceControlSessions(
02878                 const H225_ArrayOf_ServiceControlSession & serviceControl  
02879                 );
02880 
02883     virtual void OnReceiveServiceControl(const PString & amount,    
02884                                          BOOL credit,               
02885                                          const unsigned & timelimit,
02886                                          const PString & url,       
02887                                                                                  const PString & ldapURL,   
02888                                                                              const PString & baseDN     
02889                                                                             );
02890 
02893     virtual BOOL OnSendServiceControl(PString & amount,          
02894                                       BOOL credit,               
02895                                       unsigned & timelimit,      
02896                                       PString & url              
02897                                                                      ) const;
02899 #endif
02900 
02905     virtual void DisableH245inSETUP();
02906 
02909     virtual void SetNonCallConnection();
02910 
02911 #ifdef H323_H460
02912 
02914     virtual H460_FeatureSet * GetFeatureSet();
02915 #endif
02916 
02917 
02918     enum ReleaseSequence {
02919       ReleaseSequenceUnknown,
02920       ReleaseSequence_Local,
02921       ReleaseSequence_Remote
02922     };
02923 
02924     ReleaseSequence GetReleaseSequence() const
02925     { return releaseSequence; }
02926 
02927     virtual BOOL OnHandleConferenceRequest(const H245_ConferenceRequest &)
02928     { return FALSE; }
02929 
02930     virtual BOOL OnHandleConferenceResponse(const H245_ConferenceResponse &)
02931     { return FALSE; }
02932 
02933     virtual BOOL OnHandleConferenceCommand(const H245_ConferenceCommand &)
02934     { return FALSE; }
02935 
02936     virtual BOOL OnHandleConferenceIndication(const H245_ConferenceIndication &)
02937     { return FALSE; }
02938 
02939     enum h245MessageType {
02940       h245request,
02941       h245response,
02942       h245command,
02943           h245indication
02944     };
02945 
02946         virtual BOOL OnHandleH245GenericMessage(h245MessageType, const H245_GenericMessage &)
02947         { return FALSE; }
02948 
02949 #ifdef H323_H230
02950 
02952         BOOL OpenConferenceControlSession(
02953                                         BOOL & chairControl,
02954                                 BOOL & extControls
02955                                                 );
02956 
02957 
02958 #endif
02959 
02960   protected:
02966     virtual void InternalEstablishedConnectionCheck();
02967     BOOL DecodeFastStartCaps(const H225_ArrayOf_PASN_OctetString & fastStartCaps);
02968     BOOL InternalEndSessionCheck(PPER_Stream & strm);
02969     void SetRemoteVersions(const H225_ProtocolIdentifier & id);
02970     void MonitorCallStatus();
02971     PDECLARE_NOTIFIER(OpalRFC2833Info, H323Connection, OnUserInputInlineRFC2833);
02972     PDECLARE_NOTIFIER(H323Codec::FilterInfo, H323Connection, OnUserInputInBandDTMF);
02973 
02974     H323EndPoint & endpoint;
02975     PSyncPoint     * endSync;
02976 
02977     int                  remoteCallWaiting; // Number of call's waiting at the remote endpoint
02978     BOOL                 callAnswered;
02979     BOOL                 gatekeeperRouted;
02980     unsigned             distinctiveRing;
02981     PString              callToken;
02982     unsigned             callReference;
02983     OpalGloballyUniqueID callIdentifier;
02984     OpalGloballyUniqueID conferenceIdentifier;
02985 
02986     PStringList        localAliasNames;
02987     PString            localPartyName;
02988     PString            localDisplayName;
02989     H323Capabilities   localCapabilities; // Capabilities local system supports
02990     PString            remotePartyName;
02991     PString            remotePartyNumber;
02992     PString            remotePartyAddress;
02993         PStringArray       remoteAliasNames;
02994     PString            destExtraCallInfo;
02995     PString            remoteApplication;
02996     H323Capabilities   remoteCapabilities; // Capabilities remote system supports
02997     unsigned           remoteMaxAudioDelayJitter;
02998     PTimer             roundTripDelayTimer;
02999     unsigned           minAudioJitterDelay;
03000     unsigned           maxAudioJitterDelay;
03001     unsigned           bandwidthAvailable;
03002     unsigned           uuiesRequested;
03003     PString            gkAccessTokenOID;
03004     PBYTEArray         gkAccessTokenData;
03005     BOOL               addAccessTokenToSetup;
03006     SendUserInputModes sendUserInputMode;
03007 
03008     H323Transport * signallingChannel;
03009     H323Transport * controlChannel;
03010     BOOL            h245Tunneling;
03011     H323SignalPDU * h245TunnelRxPDU;
03012     H323SignalPDU * h245TunnelTxPDU;
03013     H323SignalPDU * alertingPDU;
03014     H323SignalPDU * connectPDU;
03015 
03016     enum ConnectionStates {
03017       NoConnectionActive,
03018       AwaitingGatekeeperAdmission,
03019       AwaitingTransportConnect,
03020       AwaitingSignalConnect,
03021       AwaitingLocalAnswer,
03022       HasExecutedSignalConnect,
03023       EstablishedConnection,
03024       ShuttingDownConnection,
03025       NumConnectionStates
03026     } connectionState;
03027 
03028     PTime         setupTime;
03029     PTime         alertingTime;
03030     PTime         connectedTime;
03031     PTime         callEndTime;
03032     PTime         reverseMediaOpenTime;
03033     CallEndReason callEndReason;
03034     unsigned      q931Cause;
03035     ReleaseSequence releaseSequence;
03036 
03037     unsigned   h225version;
03038     unsigned   h245version;
03039     BOOL       h245versionSet;
03040     BOOL doH245inSETUP;
03041     BOOL lastPDUWasH245inSETUP;
03042     BOOL detectInBandDTMF;
03043     BOOL mustSendDRQ;
03044     BOOL mediaWaitForConnect;
03045     BOOL transmitterSidePaused;
03046     BOOL earlyStart;
03047 
03048 #ifdef H323_T120
03049     BOOL startT120;
03050 #endif
03051 
03052 #ifdef H323_T38
03053     PString    t38ModeChangeCapabilities;
03054 #endif
03055 
03056 #ifdef H323_H224
03057         BOOL startH224;
03058 #endif
03059 
03060     PSyncPoint digitsWaitFlag;
03061     BOOL       endSessionNeeded;
03062     BOOL       endSessionSent;
03063     PSyncPoint endSessionReceived;
03064     PTimer     enforcedDurationLimit;
03065 
03066 #ifdef H323_H450
03067     // Used as part of a local call hold operation involving MOH
03068     PChannel * holdAudioMediaChannel;
03069     PChannel * holdVideoMediaChannel;
03070     BOOL       isConsultationTransfer;
03071 
03073     BOOL     isCallIntrusion;
03074     unsigned callIntrusionProtectionLevel;
03075 #endif
03076 
03077     RTP_SessionManager rtpSessions;
03078 
03079     enum FastStartStates {
03080       FastStartDisabled,
03081       FastStartInitiate,
03082       FastStartResponse,
03083       FastStartAcknowledged,
03084       NumFastStartStates
03085     };
03086     FastStartStates        fastStartState;
03087     H323LogicalChannelList fastStartChannels;
03088 
03089 #if PTRACING
03090     static const char * const ConnectionStatesNames[NumConnectionStates];
03091     friend ostream & operator<<(ostream & o, ConnectionStates s) { return o << ConnectionStatesNames[s]; }
03092     static const char * const FastStartStateNames[NumFastStartStates];
03093     friend ostream & operator<<(ostream & o, FastStartStates s) { return o << FastStartStateNames[s]; }
03094 #endif
03095 
03096 
03097     // The following pointers are to protocol procedures, they are pointers to
03098     // hide their complexity from the H323Connection classes users.
03099     H245NegMasterSlaveDetermination  * masterSlaveDeterminationProcedure;
03100     H245NegTerminalCapabilitySet     * capabilityExchangeProcedure;
03101     H245NegLogicalChannels           * logicalChannels;
03102     H245NegRequestMode               * requestModeProcedure;
03103     H245NegRoundTripDelay            * roundTripDelayProcedure;
03104 
03105 #ifdef H323_H450
03106     H450xDispatcher                  * h450dispatcher;
03107     H4502Handler                     * h4502handler;
03108     H4503Handler                     * h4503handler;
03109     H4504Handler                     * h4504handler;
03110     H4506Handler                     * h4506handler;
03111     H45011Handler                    * h45011handler;
03112 #endif
03113 
03114     OpalRFC2833                      * rfc2833handler;
03115 
03116 #ifdef H323_T120
03117     OpalT120Protocol                 * t120handler;
03118 #endif
03119 
03120 #ifdef H323_T38
03121     OpalT38Protocol                  * t38handler;
03122 #endif
03123 
03124 #ifdef H323_H224
03125     OpalH224Handler                  * h224handler;
03126     OpalH281Handler                  * h281handler;
03127 #endif
03128 
03129 #ifdef P_DTMF
03130     // The In-Band DTMF detector. This is used inside an audio filter which is
03131     // added to the audio channel.
03132     PDTMFDecoder                     dtmfDecoder;
03133 #endif
03134 
03135     // used to detect remote NAT endpoints
03136     BOOL remoteIsNAT;    
03137         BOOL NATsupport;     
03138         BOOL sameNAT;        
03139 
03140 #ifndef DISABLE_CALLAUTH
03141     BOOL AuthenticationFailed;
03142     BOOL hasAuthentication;
03143     const H235Authenticators  EPAuthenticators;
03144 #endif
03145 
03146 #ifdef H323_AEC
03147         PAec * aec;
03148 #endif
03149 
03150     BOOL IsNonCallConnection; 
03151 
03152   private:
03153     PChannel * SwapHoldMediaChannels(PChannel * newChannel,unsigned sessionId);
03154 
03155     PTimedMutex outerMutex;
03156     PMutex innerMutex;
03157 
03158   public:
03159     BOOL StartHandleControlChannel();
03160     void EndHandleControlChannel();
03161 
03162 #ifdef H323_RTP_AGGREGATE
03163   private:
03164     BOOL useRTPAggregation;
03165 #endif
03166 
03167 #ifdef H323_SIGNAL_AGGREGATE
03168   public:
03169     void AggregateSignalChannel(H323Transport * transport);
03170     void AggregateControlChannel(H323Transport * transport);
03171   protected:
03172     BOOL useSignallingAggregation;
03173     H323AggregatedH2x5Handle * signalAggregator;
03174     H323AggregatedH2x5Handle * controlAggregator;
03175 #endif
03176 
03177 #ifdef H323_H248
03178     PDictionary<POrdinalKey, H323ServiceControlSession> serviceControlSessions;
03179 #endif
03180 
03181 #ifdef H323_H460
03182         BOOL disableH460;
03183         H460_FeatureSet & features;
03184 #endif
03185 
03186 #ifdef H323_H224
03187   OpalH224Handler                 * h224Handler;
03188 #endif
03189 };
03190 
03191 
03192 PLIST(H323ConnectionList, H323Connection);
03193 PDICTIONARY(H323ConnectionDict, PString, H323Connection);
03194 PDICTIONARY(H323CallIdentityDict, PString, H323Connection);
03195 
03196 
03197 #endif // __OPAL_H323CON_H
03198 
03199 

Generated on Thu Oct 25 13:42:26 2007 for h323plus by  doxygen 1.5.2