Main Page | Class Hierarchy | Class List | File List | 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.71 2004/07/13 10:19:40 csoutheren 00031 * Fixed cut & paste errors in comments 00032 * 00033 * Revision 1.70 2004/06/15 03:30:00 csoutheren 00034 * Added OnSendARQ to allow access to the ARQ message before sent by connection 00035 * 00036 * Revision 1.69 2004/04/20 05:24:54 csoutheren 00037 * Added ability to specify Q.931 DisplayName 00038 * 00039 * Revision 1.68 2004/04/13 05:50:50 csoutheren 00040 * Added function to get access to the connection NAT flag 00041 * 00042 * Revision 1.67 2004/04/07 05:31:42 csoutheren 00043 * Added ability to receive calls from endpoints behind NAT firewalls 00044 * 00045 * Revision 1.66 2004/03/04 04:48:29 csoutheren 00046 * Added virtual keyword to allow overring of capability management functions 00047 * Added additional response code needed for MCU 00048 * 00049 * Revision 1.65 2004/02/26 08:32:47 csoutheren 00050 * Added release complete codes for MCU 00051 * 00052 * Revision 1.64 2003/12/28 02:38:14 csoutheren 00053 * Added H323EndPoint::OnOutgoingCall 00054 * 00055 * Revision 1.63 2003/12/14 10:42:29 rjongbloed 00056 * Changes for compilability without video support. 00057 * 00058 * Revision 1.62 2003/10/27 06:03:38 csoutheren 00059 * Added support for QoS 00060 * Thanks to Henry Harrison of AliceStreet 00061 * 00062 * Revision 1.61 2003/10/09 09:47:45 csoutheren 00063 * Fixed problem with re-opening RTP half-channels under unusual 00064 * circumstances. Thanks to Damien Sandras 00065 * 00066 * Revision 1.60 2003/04/30 00:28:50 robertj 00067 * Redesigned the alternate credentials in ARQ system as old implementation 00068 * was fraught with concurrency issues, most importantly it can cause false 00069 * detection of replay attacks taking out an endpoint completely. 00070 * 00071 * Revision 1.59 2003/02/12 23:59:22 robertj 00072 * Fixed adding missing endpoint identifer in SETUP packet when gatekeeper 00073 * routed, pointed out by Stefan Klein 00074 * Also fixed correct rutrn of gk routing in IRR packet. 00075 * 00076 * Revision 1.58 2002/11/27 06:54:52 robertj 00077 * Added Service Control Session management as per Annex K/H.323 via RAS 00078 * only at this stage. 00079 * Added H.248 ASN and very primitive infrastructure for linking into the 00080 * Service Control Session management system. 00081 * Added basic infrastructure for Annex K/H.323 HTTP transport system. 00082 * Added Call Credit Service Control to display account balances. 00083 * 00084 * Revision 1.57 2002/11/15 05:17:22 robertj 00085 * Added facility redirect support without changing the call token for access 00086 * to the call. If it gets redirected a new H323Connection object is 00087 * created but it looks like the same thing to an application. 00088 * 00089 * Revision 1.56 2002/11/13 04:37:23 robertj 00090 * Added ability to get (and set) Q.931 release complete cause codes. 00091 * 00092 * Revision 1.55 2002/11/10 06:17:26 robertj 00093 * Fixed minor documentation errors. 00094 * 00095 * Revision 1.54 2002/11/05 00:24:09 robertj 00096 * Added function to determine if Q.931 CONNECT sent/received. 00097 * 00098 * Revision 1.53 2002/10/31 00:31:47 robertj 00099 * Enhanced jitter buffer system so operates dynamically between minimum and 00100 * maximum values. Altered API to assure app writers note the change! 00101 * 00102 * Revision 1.52 2002/09/16 01:14:15 robertj 00103 * Added #define so can select if #pragma interface/implementation is used on 00104 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00105 * 00106 * Revision 1.51 2002/09/03 06:19:36 robertj 00107 * Normalised the multi-include header prevention ifdef/define symbol. 00108 * 00109 * Revision 1.50 2002/08/05 10:03:47 robertj 00110 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00111 * 00112 * Revision 1.49 2002/08/05 05:17:37 robertj 00113 * Fairly major modifications to support different authentication credentials 00114 * in ARQ to the logged in ones on RRQ. For both client and server. 00115 * Various other H.235 authentication bugs and anomalies fixed on the way. 00116 * 00117 * Revision 1.48 2002/07/05 02:22:56 robertj 00118 * Added support for standard and non-standard T.38 mode change. 00119 * 00120 * Revision 1.47 2002/07/04 00:40:31 robertj 00121 * More H.450.11 call intrusion implementation, thanks Aleksandar Todorovic 00122 * 00123 * Revision 1.46 2002/06/22 06:11:30 robertj 00124 * Fixed bug on sometimes missing received endSession causing 10 second 00125 * timeout in connection clean up. 00126 * 00127 * Revision 1.45 2002/06/22 05:48:38 robertj 00128 * Added partial implementation for H.450.11 Call Intrusion 00129 * 00130 * Revision 1.44 2002/06/13 06:15:19 robertj 00131 * Allowed TransferCall() to be used on H323Connection as well as H323EndPoint. 00132 * 00133 * Revision 1.43 2002/06/05 08:58:58 robertj 00134 * Fixed documentation of remote application name string. 00135 * Added missing virtual keywards on some protocol handler functions. 00136 * 00137 * Revision 1.42 2002/05/29 06:40:29 robertj 00138 * Changed sending of endSession/ReleaseComplete PDU's to occur immediately 00139 * on call clearance and not wait for background thread to do it. 00140 * Stricter compliance by waiting for reply endSession before closing down. 00141 * 00142 * Revision 1.41 2002/05/29 03:55:17 robertj 00143 * Added protocol version number checking infrastructure, primarily to improve 00144 * interoperability with stacks that are unforgiving of new features. 00145 * 00146 * Revision 1.40 2002/05/21 09:32:49 robertj 00147 * Added ability to set multiple alias names ona connection by connection 00148 * basis, defaults to endpoint list, thanks Artis Kugevics 00149 * 00150 * Revision 1.39 2002/05/15 23:59:33 robertj 00151 * Added memory management of created T.38 and T.120 handlers. 00152 * Improved documentation for use of T.38 and T.120 functions. 00153 * Added ability to initiate a mode change for non-standard T.38 00154 * 00155 * Revision 1.38 2002/05/07 01:31:51 dereks 00156 * Fix typo in documentation. 00157 * 00158 * Revision 1.37 2002/05/03 05:38:15 robertj 00159 * Added Q.931 Keypad IE mechanism for user indications (DTMF). 00160 * 00161 * Revision 1.36 2002/05/02 07:56:24 robertj 00162 * Added automatic clearing of call if no media (RTP data) is transferred in a 00163 * configurable (default 5 minutes) amount of time. 00164 * 00165 * Revision 1.35 2002/04/25 20:55:25 dereks 00166 * Fix documentation. Thanks Olaf Schulz. 00167 * 00168 * Revision 1.34 2002/04/17 00:50:34 robertj 00169 * Added ability to disable the in band DTMF detection. 00170 * 00171 * Revision 1.33 2002/03/27 06:04:42 robertj 00172 * Added Temporary Failure end code for connection, an application may 00173 * immediately retry the call if this occurs. 00174 * 00175 * Revision 1.32 2002/02/11 04:20:48 robertj 00176 * Fixed documentation errors, thanks Horacio J. Peņa 00177 * 00178 * Revision 1.31 2002/02/11 04:16:37 robertj 00179 * Fixed bug where could send DRQ if never received an ACF. 00180 * 00181 * Revision 1.30 2002/02/06 06:30:47 craigs 00182 * Fixed problem whereby MSD/TCS was stalled if H245 was included in 00183 * SETUP, but other end did not respond 00184 * 00185 * Revision 1.29 2002/02/04 07:17:52 robertj 00186 * Added H.450.2 Consultation Transfer, thanks Norwood Systems. 00187 * 00188 * Revision 1.28 2002/01/25 05:20:05 robertj 00189 * Moved static strings for enum printing to inside of function, could crash with DLL's 00190 * 00191 * Revision 1.27 2002/01/24 06:29:02 robertj 00192 * Added option to disable H.245 negotiation in SETUP pdu, this required 00193 * API change so have a bit mask instead of a series of booleans. 00194 * 00195 * Revision 1.26 2002/01/23 12:45:37 rogerh 00196 * Add the DTMF decoder. This identifies DTMF tones in an audio stream. 00197 * 00198 * Revision 1.25 2002/01/23 07:12:48 robertj 00199 * Added hooks for in band DTMF detection. Now need the detector! 00200 * 00201 * Revision 1.24 2002/01/22 22:48:21 robertj 00202 * Fixed RFC2833 support (transmitter) requiring large rewrite 00203 * 00204 * Revision 1.23 2002/01/18 06:02:08 robertj 00205 * Added some H323v4 functions (fastConnectRefused & TCS in SETUP) 00206 * 00207 * Revision 1.22 2002/01/17 07:04:58 robertj 00208 * Added support for RFC2833 embedded DTMF in the RTP stream. 00209 * 00210 * Revision 1.21 2002/01/14 00:05:24 robertj 00211 * Added H.450.6, better H.450.2 error handling and and Music On Hold. 00212 * Added destExtraCallInfo field for ARQ. 00213 * Thanks Ben Madsen of Norwood Systems 00214 * 00215 * Revision 1.20 2002/01/10 05:13:50 robertj 00216 * Added support for external RTP stacks, thanks NuMind Software Systems. 00217 * 00218 * Revision 1.19 2002/01/09 00:21:36 robertj 00219 * Changes to support outgoing H.245 RequstModeChange. 00220 * 00221 * Revision 1.18 2001/12/22 03:20:31 robertj 00222 * Added create protocol function to H323Connection. 00223 * 00224 * Revision 1.17 2001/12/22 03:09:36 robertj 00225 * Changed OnRequstModeChange to return ack, then actually do the change. 00226 * 00227 * Revision 1.16 2001/12/22 01:52:54 robertj 00228 * Added more support for H.245 RequestMode operation. 00229 * 00230 * Revision 1.15 2001/12/15 08:09:54 robertj 00231 * Added alerting, connect and end of call times to be sent to RAS server. 00232 * 00233 * Revision 1.14 2001/12/13 10:54:23 robertj 00234 * Added ability to automatically add ACF access token to SETUP pdu. 00235 * 00236 * Revision 1.13 2001/11/01 06:11:54 robertj 00237 * Plugged very small mutex hole that could cause crashes. 00238 * 00239 * Revision 1.12 2001/11/01 00:27:33 robertj 00240 * Added default Fast Start disabled and H.245 tunneling disable flags 00241 * to the endpoint instance. 00242 * 00243 * Revision 1.11 2001/10/24 00:54:13 robertj 00244 * Made cosmetic changes to H.245 miscellaneous command function. 00245 * 00246 * Revision 1.10 2001/10/23 02:18:06 dereks 00247 * Initial release of CU30 video codec. 00248 * 00249 * Revision 1.9 2001/09/26 06:20:56 robertj 00250 * Fixed properly nesting connection locking and unlocking requiring a quite 00251 * large change to teh implementation of how calls are answered. 00252 * 00253 * Revision 1.8 2001/09/19 03:30:53 robertj 00254 * Added some support for overlapped dialing, thanks Chris Purvis & Nick Hoath. 00255 * 00256 * Revision 1.7 2001/09/13 06:48:13 robertj 00257 * Added call back functions for remaining Q.931/H.225 messages. 00258 * Added call back to allow modification of Release Complete,thanks Nick Hoath 00259 * 00260 * Revision 1.6 2001/09/12 06:57:58 robertj 00261 * Added support for iNow Access Token from gk, thanks Nick Hoath 00262 * 00263 * Revision 1.5 2001/09/12 06:04:36 robertj 00264 * Added support for sending UUIE's to gk on request, thanks Nick Hoath 00265 * 00266 * Revision 1.4 2001/09/11 01:24:36 robertj 00267 * Added conditional compilation to remove video and/or audio codecs. 00268 * 00269 * Revision 1.3 2001/08/22 06:54:50 robertj 00270 * Changed connection locking to use double mutex to guarantee that 00271 * no threads can ever deadlock or access deleted connection. 00272 * 00273 * Revision 1.2 2001/08/16 07:49:16 robertj 00274 * Changed the H.450 support to be more extensible. Protocol handlers 00275 * are now in separate classes instead of all in H323Connection. 00276 * 00277 * Revision 1.1 2001/08/06 03:08:11 robertj 00278 * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files. 00279 * 00280 */ 00281 00282 #ifndef __OPAL_H323CON_H 00283 #define __OPAL_H323CON_H 00284 00285 #ifdef P_USE_PRAGMA 00286 #pragma interface 00287 #endif 00288 00289 00290 #include <ptclib/dtmf.h> 00291 #include "h323caps.h" 00292 #include "transports.h" 00293 #include "channels.h" 00294 #include "guid.h" 00295 #include "openh323buildopts.h" 00296 00297 00298 /* The following classes have forward references to avoid including the VERY 00299 large header files for H225 and H245. If an application requires access 00300 to the protocol classes they can include them, but for simple usage their 00301 inclusion can be avoided. 00302 */ 00303 class PPER_Stream; 00304 00305 class H225_EndpointType; 00306 class H225_TransportAddress; 00307 class H225_ArrayOf_PASN_OctetString; 00308 class H225_ProtocolIdentifier; 00309 class H225_AdmissionRequest; 00310 00311 class H245_TerminalCapabilitySet; 00312 class H245_TerminalCapabilitySetReject; 00313 class H245_OpenLogicalChannel; 00314 class H245_OpenLogicalChannelAck; 00315 class H245_TransportAddress; 00316 class H245_UserInputIndication; 00317 class H245_RequestMode; 00318 class H245_RequestModeAck; 00319 class H245_RequestModeReject; 00320 class H245_ModeDescription; 00321 class H245_ArrayOf_ModeDescription; 00322 class H245_SendTerminalCapabilitySet; 00323 class H245_MultiplexCapability; 00324 class H245_FlowControlCommand; 00325 class H245_MiscellaneousCommand; 00326 class H245_MiscellaneousIndication; 00327 class H245_JitterIndication; 00328 00329 class H323SignalPDU; 00330 class H323ControlPDU; 00331 00332 class H235Authenticators; 00333 00334 class H245NegMasterSlaveDetermination; 00335 class H245NegTerminalCapabilitySet; 00336 class H245NegLogicalChannels; 00337 class H245NegRequestMode; 00338 class H245NegRoundTripDelay; 00339 00340 class H450xDispatcher; 00341 class H4502Handler; 00342 class H4504Handler; 00343 class H4506Handler; 00344 class H45011Handler; 00345 00346 class OpalT120Protocol; 00347 class OpalT38Protocol; 00348 class OpalRFC2833; 00349 class OpalRFC2833Info; 00350 00351 00352 00354 00361 class H323Connection : public PObject 00362 { 00363 PCLASSINFO(H323Connection, PObject); 00364 00365 public: 00368 enum Options { 00369 FastStartOptionDisable = 0x0001, 00370 FastStartOptionEnable = 0x0002, 00371 FastStartOptionMask = 0x0003, 00372 00373 H245TunnelingOptionDisable = 0x0004, 00374 H245TunnelingOptionEnable = 0x0008, 00375 H245TunnelingOptionMask = 0x000c, 00376 00377 H245inSetupOptionDisable = 0x0010, 00378 H245inSetupOptionEnable = 0x0020, 00379 H245inSetupOptionMask = 0x0030, 00380 00381 DetectInBandDTMFOptionDisable= 0x0040, 00382 DetectInBandDTMFOptionEnable = 0x0080, 00383 DetectInBandDTMFOptionMask = 0x00c0, 00384 }; 00385 00388 H323Connection( 00389 H323EndPoint & endpoint, 00390 unsigned callReference, 00391 unsigned options = 0 00392 ); 00393 00396 ~H323Connection(); 00397 00407 BOOL Lock(); 00408 00420 int TryLock(); 00421 00427 void Unlock(); 00428 00435 virtual void OnSendARQ( 00436 H225_AdmissionRequest & arq 00437 ); 00438 00442 virtual void OnEstablished(); 00443 00447 virtual void OnCleared(); 00448 00455 BOOL IsConnected() const { return connectionState == HasExecutedSignalConnect || connectionState == EstablishedConnection; } 00456 00462 BOOL IsEstablished() const { return connectionState == EstablishedConnection; } 00463 00468 enum CallEndReason { 00469 EndedByLocalUser, 00470 EndedByNoAccept, 00471 EndedByAnswerDenied, 00472 EndedByRemoteUser, 00473 EndedByRefusal, 00474 EndedByNoAnswer, 00475 EndedByCallerAbort, 00476 EndedByTransportFail, 00477 EndedByConnectFail, 00478 EndedByGatekeeper, 00479 EndedByNoUser, 00480 EndedByNoBandwidth, 00481 EndedByCapabilityExchange, 00482 EndedByCallForwarded, 00483 EndedBySecurityDenial, 00484 EndedByLocalBusy, 00485 EndedByLocalCongestion, 00486 EndedByRemoteBusy, 00487 EndedByRemoteCongestion, 00488 EndedByUnreachable, 00489 EndedByNoEndPoint, 00490 EndedByHostOffline, 00491 EndedByTemporaryFailure, 00492 EndedByQ931Cause, 00493 EndedByDurationLimit, 00494 EndedByInvalidConferenceID, // Call cleared due to invalid conference ID 00495 NumCallEndReasons 00496 }; 00497 #if PTRACING 00498 friend ostream & operator<<(ostream & o, CallEndReason r); 00499 #endif 00500 00509 CallEndReason GetCallEndReason() const { return callEndReason; } 00510 00515 virtual void SetCallEndReason( 00516 CallEndReason reason, 00517 PSyncPoint * sync = NULL 00518 ); 00519 00525 virtual BOOL ClearCall( 00526 CallEndReason reason = EndedByLocalUser 00527 ); 00528 00531 virtual BOOL ClearCallSynchronous( 00532 PSyncPoint * sync, 00533 CallEndReason reason = EndedByLocalUser 00534 ); 00535 00544 virtual void CleanUpOnCallEnd(); 00546 00547 00552 void AttachSignalChannel( 00553 const PString & token, 00554 H323Transport * channel, 00555 BOOL answeringCall 00556 ); 00557 00560 BOOL WriteSignalPDU( 00561 H323SignalPDU & pdu 00562 ); 00563 00567 virtual void HandleSignallingChannel(); 00568 00572 virtual BOOL HandleSignalPDU( 00573 H323SignalPDU & pdu 00574 ); 00575 00579 virtual void HandleTunnelPDU( 00580 H323SignalPDU * txPDU 00581 ); 00582 00590 virtual BOOL OnReceivedSignalSetup( 00591 const H323SignalPDU & pdu 00592 ); 00593 00600 virtual BOOL OnReceivedSignalSetupAck( 00601 const H323SignalPDU & pdu 00602 ); 00603 00610 virtual BOOL OnReceivedSignalInformation( 00611 const H323SignalPDU & pdu 00612 ); 00613 00622 virtual BOOL OnReceivedCallProceeding( 00623 const H323SignalPDU & pdu 00624 ); 00625 00634 virtual BOOL OnReceivedProgress( 00635 const H323SignalPDU & pdu 00636 ); 00637 00644 virtual BOOL OnReceivedAlerting( 00645 const H323SignalPDU & pdu 00646 ); 00647 00656 virtual BOOL OnReceivedSignalConnect( 00657 const H323SignalPDU & pdu 00658 ); 00659 00668 virtual BOOL OnReceivedFacility( 00669 const H323SignalPDU & pdu 00670 ); 00671 00678 virtual BOOL OnReceivedSignalNotify( 00679 const H323SignalPDU & pdu 00680 ); 00681 00688 virtual BOOL OnReceivedSignalStatus( 00689 const H323SignalPDU & pdu 00690 ); 00691 00698 virtual BOOL OnReceivedStatusEnquiry( 00699 const H323SignalPDU & pdu 00700 ); 00701 00706 virtual void OnReceivedReleaseComplete( 00707 const H323SignalPDU & pdu 00708 ); 00709 00716 virtual BOOL OnUnknownSignalPDU( 00717 const H323SignalPDU & pdu 00718 ); 00719 00731 virtual BOOL OnIncomingCall( 00732 const H323SignalPDU & setupPDU, 00733 H323SignalPDU & alertingPDU 00734 ); 00735 00745 virtual BOOL ForwardCall( 00746 const PString & forwardParty 00747 ); 00748 00753 void TransferCall( 00754 const PString & remoteParty, 00755 const PString & callIdentity = PString::Empty() 00757 ); 00758 00763 void ConsultationTransfer( 00764 const PString & primaryCallToken 00765 ); 00766 00773 virtual void HandleConsultationTransfer( 00774 const PString & callIdentity, 00776 H323Connection & incoming 00777 ); 00778 00781 BOOL IsTransferringCall() const; 00782 00785 BOOL IsTransferredCall() const; 00786 00791 virtual void HandleTransferCall( 00792 const PString & token, 00793 const PString & identity 00794 ); 00795 00800 int GetCallTransferInvokeId(); 00801 00809 virtual void HandleCallTransferFailure( 00810 const int returnError 00811 ); 00812 00817 void SetAssociatedCallToken( 00818 const PString & token 00819 ); 00820 00825 virtual void OnConsultationTransferSuccess( 00826 H323Connection & secondaryCall 00827 ); 00828 00833 void HoldCall( 00834 BOOL localHold 00835 ); 00836 00842 void RetrieveCall(); 00843 00850 void SetHoldMedia( 00851 PChannel * audioChannel 00852 ); 00853 00856 BOOL IsMediaOnHold() const; 00857 00860 BOOL IsLocalHold() const; 00861 00864 BOOL IsRemoteHold() const; 00865 00868 BOOL IsCallOnHold() const; 00869 00874 virtual void IntrudeCall( 00875 unsigned capabilityLevel 00876 ); 00877 00882 virtual void HandleIntrudeCall( 00883 const PString & token, 00884 const PString & identity 00885 ); 00886 00892 void SetCallIntrusion() { isCallIntrusion = TRUE; } 00893 00894 BOOL IsCallIntrusion() { return isCallIntrusion; } 00895 00898 unsigned GetLocalCallIntrusionProtectionLevel() { return callIntrusionProtectionLevel; } 00899 00903 virtual BOOL GetRemoteCallIntrusionProtectionLevel( 00904 const PString & callToken, 00905 unsigned callIntrusionProtectionLevel 00906 ); 00907 00908 virtual void SetIntrusionImpending(); 00909 00910 virtual void SetForcedReleaseAccepted(); 00911 00912 virtual void SetIntrusionNotAuthorized(); 00913 00920 void SendCallWaitingIndication( 00921 const unsigned nbOfAddWaitingCalls = 0 00922 ); 00923 00924 enum AnswerCallResponse { 00925 AnswerCallNow, 00926 AnswerCallDenied, 00927 AnswerCallPending, 00928 AnswerCallDeferred, 00929 AnswerCallAlertWithMedia, 00930 AnswerCallDeferredWithMedia, 00931 AnswerCallDeniedByInvalidCID, 00932 NumAnswerCallResponses 00933 }; 00934 #if PTRACING 00935 friend ostream & operator<<(ostream & o, AnswerCallResponse s); 00936 #endif 00937 00964 virtual AnswerCallResponse OnAnswerCall( 00965 const PString & callerName, 00966 const H323SignalPDU & setupPDU, 00967 H323SignalPDU & connectPDU 00968 ); 00969 00980 void AnsweringCall( 00981 AnswerCallResponse response 00982 ); 00983 00994 virtual CallEndReason SendSignalSetup( 00995 const PString & alias, 00996 const H323TransportAddress & address 00997 ); 00998 01010 virtual BOOL OnSendSignalSetup( 01011 H323SignalPDU & setupPDU 01012 ); 01013 01022 virtual BOOL OnSendCallProceeding( 01023 H323SignalPDU & callProceedingPDU 01024 ); 01025 01037 virtual BOOL OnSendReleaseComplete( 01038 H323SignalPDU & releaseCompletePDU 01039 ); 01040 01051 virtual BOOL OnAlerting( 01052 const H323SignalPDU & alertingPDU, 01053 const PString & user 01054 ); 01055 01070 virtual BOOL OnInsufficientDigits(); 01071 01084 virtual void SendMoreDigits( 01085 const PString & digits 01086 ); 01087 01097 virtual BOOL OnOutgoingCall( 01098 const H323SignalPDU & connectPDU 01099 ); 01100 01112 virtual BOOL SendFastStartAcknowledge( 01113 H225_ArrayOf_PASN_OctetString & array 01114 ); 01115 01127 virtual BOOL HandleFastStartAcknowledge( 01128 const H225_ArrayOf_PASN_OctetString & array 01129 ); 01130 01138 virtual BOOL StartControlChannel(); 01139 01151 virtual BOOL StartControlChannel( 01152 const H225_TransportAddress & h245Address 01153 ); 01155 01162 BOOL WriteControlPDU( 01163 const H323ControlPDU & pdu 01164 ); 01165 01168 virtual BOOL StartControlNegotiations(); 01169 01172 virtual void HandleControlChannel(); 01173 01180 virtual BOOL HandleControlData( 01181 PPER_Stream & strm 01182 ); 01183 01190 virtual BOOL HandleControlPDU( 01191 const H323ControlPDU & pdu 01192 ); 01193 01203 virtual BOOL OnUnknownControlPDU( 01204 const H323ControlPDU & pdu 01205 ); 01206 01210 virtual BOOL OnH245Request( 01211 const H323ControlPDU & pdu 01212 ); 01213 01217 virtual BOOL OnH245Response( 01218 const H323ControlPDU & pdu 01219 ); 01220 01224 virtual BOOL OnH245Command( 01225 const H323ControlPDU & pdu 01226 ); 01227 01231 virtual BOOL OnH245Indication( 01232 const H323ControlPDU & pdu 01233 ); 01234 01237 virtual BOOL OnH245_SendTerminalCapabilitySet( 01238 const H245_SendTerminalCapabilitySet & pdu 01239 ); 01240 01245 virtual BOOL OnH245_FlowControlCommand( 01246 const H245_FlowControlCommand & pdu 01247 ); 01248 01253 virtual BOOL OnH245_MiscellaneousCommand( 01254 const H245_MiscellaneousCommand & pdu 01255 ); 01256 01261 virtual BOOL OnH245_MiscellaneousIndication( 01262 const H245_MiscellaneousIndication & pdu 01263 ); 01264 01269 virtual BOOL OnH245_JitterIndication( 01270 const H245_JitterIndication & pdu 01271 ); 01272 01275 enum ControlProtocolErrors { 01276 e_MasterSlaveDetermination, 01277 e_CapabilityExchange, 01278 e_LogicalChannel, 01279 e_ModeRequest, 01280 e_RoundTripDelay 01281 }; 01282 01294 virtual BOOL OnControlProtocolError( 01295 ControlProtocolErrors errorSource, // Source of the proptoerror 01296 const void * errorData = NULL // Data associated with error 01297 ); 01298 01306 virtual void OnSendCapabilitySet( 01307 H245_TerminalCapabilitySet & pdu 01308 ); 01309 01321 virtual BOOL OnReceivedCapabilitySet( 01322 const H323Capabilities & remoteCaps, 01323 const H245_MultiplexCapability * muxCap, 01324 H245_TerminalCapabilitySetReject & reject 01325 ); 01326 01329 virtual void SendCapabilitySet( 01330 BOOL empty 01331 ); 01332 01341 virtual void OnSetLocalCapabilities(); 01342 01345 BOOL IsH245Master() const; 01346 01349 void StartRoundTripDelay(); 01350 01353 PTimeInterval GetRoundTripDelay() const; 01355 01395 virtual void OnSelectLogicalChannels(); 01396 01399 virtual void SelectDefaultLogicalChannel( 01400 unsigned sessionID 01401 ); 01402 01406 virtual void SelectFastStartChannels( 01407 unsigned sessionID, 01408 BOOL transmitter, 01409 BOOL receiver 01410 ); 01411 01426 virtual BOOL OpenLogicalChannel( 01427 const H323Capability & capability, 01428 unsigned sessionID, 01429 H323Channel::Directions dir 01430 ); 01431 01441 virtual BOOL OnOpenLogicalChannel( 01442 const H245_OpenLogicalChannel & openPDU, 01443 H245_OpenLogicalChannelAck & ackPDU, 01444 unsigned & errorCode 01445 ); 01446 01454 virtual BOOL OnConflictingLogicalChannel( 01455 H323Channel & channel 01456 ); 01457 01462 virtual H323Channel * CreateLogicalChannel( 01463 const H245_OpenLogicalChannel & open, 01464 BOOL startingFast, 01465 unsigned & errorCode 01466 ); 01467 01502 virtual H323Channel * CreateRealTimeLogicalChannel( 01503 const H323Capability & capability, 01504 H323Channel::Directions dir, 01505 unsigned sessionID, 01506 const H245_H2250LogicalChannelParameters * param, 01508 RTP_QOS * rtpqos = NULL 01509 ); 01510 01521 virtual BOOL OnCreateLogicalChannel( 01522 const H323Capability & capability, 01523 H323Channel::Directions dir, 01524 unsigned & errorCode 01525 ); 01526 01531 virtual BOOL OnStartLogicalChannel( 01532 H323Channel & channel 01533 ); 01534 01541 virtual BOOL OpenAudioChannel( 01542 BOOL isEncoding, 01543 unsigned bufferSize, 01544 H323AudioCodec & codec 01545 ); 01546 01547 #ifndef NO_H323_VIDEO 01554 virtual BOOL OpenVideoChannel( 01555 BOOL isEncoding, 01556 H323VideoCodec & codec 01557 ); 01558 #endif // NO_H323_VIDEO 01559 01562 virtual void CloseLogicalChannel( 01563 unsigned number, 01564 BOOL fromRemote 01565 ); 01566 01569 virtual void CloseLogicalChannelNumber( 01570 const H323ChannelNumber & number 01571 ); 01572 01575 virtual void CloseAllLogicalChannels( 01576 BOOL fromRemote 01577 ); 01578 01584 virtual void OnClosedLogicalChannel( 01585 const H323Channel & channel 01586 ); 01587 01596 virtual BOOL OnClosingLogicalChannel( 01597 H323Channel & channel 01598 ); 01599 01608 virtual void OnLogicalChannelFlowControl( 01609 H323Channel * channel, 01610 long bitRateRestriction 01611 ); 01612 01621 virtual void OnLogicalChannelJitter( 01622 H323Channel * channel, 01623 DWORD jitter, 01624 int skippedFrameCount, 01625 int additionalBuffer 01626 ); 01627 01630 void SendLogicalChannelMiscCommand( 01631 H323Channel & channel, 01632 unsigned command 01633 ); 01634 01638 H323Channel * GetLogicalChannel( 01639 unsigned number, 01640 BOOL fromRemote 01641 ) const; 01642 01648 H323Channel * FindChannel( 01649 unsigned sessionId, 01650 BOOL fromRemote 01651 ) const; 01653 01660 unsigned GetBandwidthUsed() const; 01661 01667 BOOL UseBandwidth( 01668 unsigned bandwidth, 01669 BOOL removing 01670 ); 01671 01674 unsigned GetBandwidthAvailable() const { return bandwidthAvailable; } 01675 01680 BOOL SetBandwidthAvailable( 01681 unsigned newBandwidth, 01682 BOOL force = FALSE 01683 ); 01685 01688 enum SendUserInputModes { 01689 SendUserInputAsQ931, 01690 SendUserInputAsString, 01691 SendUserInputAsTone, 01692 SendUserInputAsInlineRFC2833, 01693 SendUserInputAsSeparateRFC2833, // Not implemented 01694 NumSendUserInputModes 01695 }; 01696 #if PTRACING 01697 friend ostream & operator<<(ostream & o, SendUserInputModes m); 01698 #endif 01699 01702 void SetSendUserInputMode(SendUserInputModes mode); 01703 01706 SendUserInputModes GetSendUserInputMode() const { return sendUserInputMode; } 01707 01713 SendUserInputModes GetRealSendUserInputMode() const; 01714 01728 virtual void SendUserInput( 01729 const PString & value 01730 ); 01731 01738 virtual void OnUserInputString( 01739 const PString & value 01740 ); 01741 01766 virtual void SendUserInputTone( 01767 char tone, 01768 unsigned duration = 0, 01769 unsigned logicalChannel = 0, 01770 unsigned rtpTimestamp = 0 01771 ); 01772 01777 virtual void OnUserInputTone( 01778 char tone, 01779 unsigned duration, 01780 unsigned logicalChannel, 01781 unsigned rtpTimestamp 01782 ); 01783 01787 void SendUserInputHookFlash( 01788 int duration = 500 01789 ) { SendUserInputTone('!', duration); } 01790 01797 virtual void SendUserInputIndicationQ931( 01798 const PString & value 01799 ); 01800 01807 virtual void SendUserInputIndicationString( 01808 const PString & value 01809 ); 01810 01815 virtual void SendUserInputIndicationTone( 01816 char tone, 01817 unsigned duration = 0, 01818 unsigned logicalChannel = 0, 01819 unsigned rtpTimestamp = 0 01820 ); 01821 01830 virtual void SendUserInputIndication( 01831 const H245_UserInputIndication & pdu 01832 ); 01833 01838 virtual void OnUserInputIndication( 01839 const H245_UserInputIndication & pdu 01840 ); 01842 01848 virtual RTP_Session * GetSession( 01849 unsigned sessionID 01850 ) const; 01851 01855 virtual H323_RTP_Session * GetSessionCallbacks( 01856 unsigned sessionID 01857 ) const; 01858 01868 virtual RTP_Session * UseSession( 01869 unsigned sessionID, 01870 const H245_TransportAddress & pdu, 01871 H323Channel::Directions dir, 01872 RTP_QOS * rtpqos = NULL 01873 ); 01874 01878 virtual void ReleaseSession( 01879 unsigned sessionID 01880 ); 01881 01889 virtual void OnRTPStatistics( 01890 const RTP_Session & session 01891 ) const; 01892 01896 virtual PString GetSessionCodecNames( 01897 unsigned sessionID 01898 ) const; 01899 01902 BOOL IsBehindNAT() const 01903 { return remoteIsNAT; } 01904 01906 01924 virtual BOOL RequestModeChange( 01925 const PString & newModes 01926 ); 01927 01935 virtual BOOL RequestModeChange( 01936 const H245_ArrayOf_ModeDescription & newModes 01937 ); 01938 01941 virtual BOOL OnRequestModeChange( 01942 const H245_RequestMode & pdu, 01943 H245_RequestModeAck & ack, 01944 H245_RequestModeReject & reject, 01945 PINDEX & selectedMode 01946 ); 01947 01954 virtual void OnModeChanged( 01955 const H245_ModeDescription & newMode 01956 ); 01957 01962 virtual void OnAcceptModeChange( 01963 const H245_RequestModeAck & pdu 01964 ); 01965 01970 virtual void OnRefusedModeChange( 01971 const H245_RequestModeReject * pdu 01972 ); 01974 01989 virtual OpalT120Protocol * CreateT120ProtocolHandler(); 01990 02003 virtual OpalT38Protocol * CreateT38ProtocolHandler(); 02004 02007 virtual BOOL RequestModeChangeT38( 02008 const char * capabilityNames = "T.38\nT38FaxUDP" 02009 ); 02010 02020 virtual BOOL GetAdmissionRequestAuthentication( 02021 const H225_AdmissionRequest & arq, 02022 H235Authenticators & authenticators 02023 ); 02025 02030 H323EndPoint & GetEndPoint() const { return endpoint; } 02031 02034 BOOL HadAnsweredCall() const { return callAnswered; } 02035 02038 BOOL IsGatekeeperRouted() const { return gatekeeperRouted; } 02039 02043 unsigned GetQ931Cause() const { return q931Cause; } 02044 02049 unsigned GetDistinctiveRing() const { return distinctiveRing; } 02050 02057 void SetDistinctiveRing(unsigned pattern) { distinctiveRing = pattern&7; } 02058 02061 const PString & GetCallToken() const { return callToken; } 02062 02065 unsigned GetCallReference() const { return callReference; } 02066 02069 const OpalGloballyUniqueID & GetCallIdentifier() const { return callIdentifier; } 02070 02073 const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; } 02074 02077 const PString & GetLocalPartyName() const { return localPartyName; } 02078 02081 void SetLocalPartyName(const PString & name); 02082 02085 void SetDisplayName(const PString & name) { localDisplayName = name; } 02086 02089 const PString GetDisplayName() const { return localDisplayName; } 02090 02091 const PStringList & GetLocalAliasNames() const { return localAliasNames; } 02092 02099 const PString & GetRemotePartyName() const { return remotePartyName; } 02100 02105 const PString & GetRemotePartyNumber() const { return remotePartyNumber; } 02106 02113 const PString & GetRemotePartyAddress() const { return remotePartyAddress; } 02114 02117 void SetRemotePartyInfo( 02118 const H323SignalPDU & pdu 02119 ); 02120 02132 const PString & GetRemoteApplication() const { return remoteApplication; } 02133 02136 void SetRemoteApplication( 02137 const H225_EndpointType & pdu 02138 ); 02139 02142 const H323Capabilities & GetLocalCapabilities() const { return localCapabilities; } 02143 02146 const H323Capabilities & GetRemoteCapabilities() const { return remoteCapabilities; } 02147 02150 unsigned GetRemoteMaxAudioDelayJitter() const { return remoteMaxAudioDelayJitter; } 02151 02154 const H323Transport * GetSignallingChannel() const { return signallingChannel; } 02155 02158 unsigned GetSignallingVersion() const { return h225version; } 02159 02162 const H323Transport & GetControlChannel() const; 02163 02166 unsigned GetControlVersion() const { return h245version; } 02167 02170 PTime GetSetupUpTime() const { return setupTime; } 02171 02174 PTime GetAlertingTime() const { return alertingTime; } 02175 02179 PTime GetConnectionStartTime() const { return connectedTime; } 02180 02183 PTime GetConnectionEndTime() const { return callEndTime; } 02184 02188 unsigned GetMinAudioJitterDelay() const { return minAudioJitterDelay; } 02189 02193 unsigned GetMaxAudioJitterDelay() const { return maxAudioJitterDelay; } 02194 02197 void SetAudioJitterDelay( 02198 unsigned minDelay, // New minimum jitter buffer delay in milliseconds 02199 unsigned maxDelay // New maximum jitter buffer delay in milliseconds 02200 ); 02201 02204 unsigned GetUUIEsRequested() const { return uuiesRequested; } 02205 02208 void SetUUIEsRequested(unsigned mask) { uuiesRequested = mask; } 02209 02212 const PString GetGkAccessTokenOID() const { return gkAccessTokenOID; } 02213 02216 void SetGkAccessTokenOID(const PString & oid) { gkAccessTokenOID = oid; } 02217 02220 const PBYTEArray & GetGkAccessTokenData() const { return gkAccessTokenData; } 02221 02224 void SetDestExtraCallInfo( 02225 const PString & info 02226 ) { destExtraCallInfo = info; } 02227 02230 void SetRemotCallWaiting(const unsigned value) { remoteCallWaiting = value; } 02231 02237 const int GetRemoteCallWaiting() const { return remoteCallWaiting; } 02238 02243 void SetEnforcedDurationLimit( 02244 unsigned seconds 02245 ); 02247 02248 02249 protected: 02255 virtual void InternalEstablishedConnectionCheck(); 02256 BOOL InternalEndSessionCheck(PPER_Stream & strm); 02257 void SetRemoteVersions(const H225_ProtocolIdentifier & id); 02258 void MonitorCallStatus(); 02259 PDECLARE_NOTIFIER(OpalRFC2833Info, H323Connection, OnUserInputInlineRFC2833); 02260 PDECLARE_NOTIFIER(H323Codec::FilterInfo, H323Connection, OnUserInputInBandDTMF); 02261 02262 H323EndPoint & endpoint; 02263 PSyncPoint * endSync; 02264 02265 int remoteCallWaiting; // Number of call's waiting at the remote endpoint 02266 BOOL callAnswered; 02267 BOOL gatekeeperRouted; 02268 unsigned distinctiveRing; 02269 PString callToken; 02270 unsigned callReference; 02271 OpalGloballyUniqueID callIdentifier; 02272 OpalGloballyUniqueID conferenceIdentifier; 02273 02274 PStringList localAliasNames; 02275 PString localPartyName; 02276 PString localDisplayName; 02277 H323Capabilities localCapabilities; // Capabilities local system supports 02278 PString remotePartyName; 02279 PString remotePartyNumber; 02280 PString remotePartyAddress; 02281 PString destExtraCallInfo; 02282 PString remoteApplication; 02283 H323Capabilities remoteCapabilities; // Capabilities remote system supports 02284 unsigned remoteMaxAudioDelayJitter; 02285 PTimer roundTripDelayTimer; 02286 unsigned minAudioJitterDelay; 02287 unsigned maxAudioJitterDelay; 02288 unsigned bandwidthAvailable; 02289 unsigned uuiesRequested; 02290 PString gkAccessTokenOID; 02291 PBYTEArray gkAccessTokenData; 02292 BOOL addAccessTokenToSetup; 02293 SendUserInputModes sendUserInputMode; 02294 02295 H323Transport * signallingChannel; 02296 H323Transport * controlChannel; 02297 BOOL h245Tunneling; 02298 H323SignalPDU * h245TunnelRxPDU; 02299 H323SignalPDU * h245TunnelTxPDU; 02300 H323SignalPDU * alertingPDU; 02301 H323SignalPDU * connectPDU; 02302 02303 enum ConnectionStates { 02304 NoConnectionActive, 02305 AwaitingGatekeeperAdmission, 02306 AwaitingTransportConnect, 02307 AwaitingSignalConnect, 02308 AwaitingLocalAnswer, 02309 HasExecutedSignalConnect, 02310 EstablishedConnection, 02311 ShuttingDownConnection, 02312 NumConnectionStates 02313 } connectionState; 02314 02315 PTime setupTime; 02316 PTime alertingTime; 02317 PTime connectedTime; 02318 PTime callEndTime; 02319 CallEndReason callEndReason; 02320 unsigned q931Cause; 02321 02322 unsigned h225version; 02323 unsigned h245version; 02324 BOOL h245versionSet; 02325 BOOL doH245inSETUP; 02326 BOOL lastPDUWasH245inSETUP; 02327 BOOL detectInBandDTMF; 02328 BOOL mustSendDRQ; 02329 BOOL mediaWaitForConnect; 02330 BOOL transmitterSidePaused; 02331 BOOL earlyStart; 02332 BOOL startT120; 02333 PString t38ModeChangeCapabilities; 02334 PSyncPoint digitsWaitFlag; 02335 BOOL endSessionNeeded; 02336 BOOL endSessionSent; 02337 PSyncPoint endSessionReceived; 02338 PTimer enforcedDurationLimit; 02339 02340 // Used as part of a local call hold operation involving MOH 02341 PChannel * holdMediaChannel; 02342 BOOL isConsultationTransfer; 02343 02345 BOOL isCallIntrusion; 02346 unsigned callIntrusionProtectionLevel; 02347 02348 RTP_SessionManager rtpSessions; 02349 02350 enum FastStartStates { 02351 FastStartDisabled, 02352 FastStartInitiate, 02353 FastStartResponse, 02354 FastStartAcknowledged, 02355 NumFastStartStates 02356 }; 02357 FastStartStates fastStartState; 02358 H323LogicalChannelList fastStartChannels; 02359 02360 #if PTRACING 02361 static const char * const ConnectionStatesNames[NumConnectionStates]; 02362 friend ostream & operator<<(ostream & o, ConnectionStates s) { return o << ConnectionStatesNames[s]; } 02363 static const char * const FastStartStateNames[NumFastStartStates]; 02364 friend ostream & operator<<(ostream & o, FastStartStates s) { return o << FastStartStateNames[s]; } 02365 #endif 02366 02367 02368 // The following pointers are to protocol procedures, they are pointers to 02369 // hide their complexity from the H323Connection classes users. 02370 H245NegMasterSlaveDetermination * masterSlaveDeterminationProcedure; 02371 H245NegTerminalCapabilitySet * capabilityExchangeProcedure; 02372 H245NegLogicalChannels * logicalChannels; 02373 H245NegRequestMode * requestModeProcedure; 02374 H245NegRoundTripDelay * roundTripDelayProcedure; 02375 H450xDispatcher * h450dispatcher; 02376 H4502Handler * h4502handler; 02377 H4504Handler * h4504handler; 02378 H4506Handler * h4506handler; 02379 H45011Handler * h45011handler; 02380 OpalRFC2833 * rfc2833handler; 02381 OpalT120Protocol * t120handler; 02382 OpalT38Protocol * t38handler; 02383 02384 02385 // The In-Band DTMF detector. This is used inside an audio filter which is 02386 // added to the audio channel. 02387 PDTMFDecoder dtmfDecoder; 02388 02389 // used to detect remote NAT endpoints 02390 BOOL remoteIsNAT; 02391 02392 private: 02393 PChannel * SwapHoldMediaChannels(PChannel * newChannel); 02394 02395 PMutex outerMutex; 02396 PMutex innerMutex; 02397 }; 02398 02399 02400 PLIST(H323ConnectionList, H323Connection); 02401 PDICTIONARY(H323ConnectionDict, PString, H323Connection); 02402 PDICTIONARY(H323CallIdentityDict, PString, H323Connection); 02403 02404 02405 #endif // __OPAL_H323CON_H 02406 02407

Generated on Sat Jul 24 17:03:32 2004 for OpenH323 by doxygen 1.3.7