# 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  * $Revision: 29960 $
    00030  * $Author: rjongbloed $
    00031  * $Date: 2013-06-13 23:26:53 -0500 (Thu, 13 Jun 2013) $
    00032  */
    00033
    00034 #ifndef OPAL_H323_H323CON_H
    00035 #define OPAL_H323_H323CON_H
    00036
    00037 #ifdef P_USE_PRAGMA
    00038 #pragma interface
    00039 #endif
    00040
    00041 #include <opal/buildopts.h>
    00042
    00043 #if OPAL_H323
    00044
    00045 #include <rtp/rtpconn.h>
    00046 #include <opal/guid.h>
    00047 #include <opal/buildopts.h>
    00048 #include <h323/h323caps.h>
    00049 #include <ptclib/dtmf.h>
    00050
    00051
    00052 /* The following classes have forward references to avoid including the VERY
    00053    large header files for H225 and H245. If an application requires access
    00054    to the protocol classes they can include them, but for simple usage their
    00055    inclusion can be avoided.
    00056  */
    00057 class PPER_Stream;
    00058 class PASN_OctetString;
    00059
    00060 class H225_EndpointType;
    00061 class H225_TransportAddress;
    00062 class H225_ArrayOf_PASN_OctetString;
    00063 class H225_ProtocolIdentifier;
    00064 class H225_AdmissionRequest;
    00065 class H225_AdmissionConfirm;
    00066 class H225_AdmissionReject;
    00067 class H225_InfoRequestResponse;
    00068 class H225_DisengageRequest;
    00069 class H225_FeatureSet;
    00070
    00071 class H245_TerminalCapabilitySet;
    00072 class H245_TerminalCapabilitySetReject;
    00073 class H245_OpenLogicalChannel;
    00074 class H245_OpenLogicalChannelAck;
    00075 class H245_TransportAddress;
    00076 class H245_UserInputIndication;
    00077 class H245_RequestMode;
    00078 class H245_RequestModeAck;
    00079 class H245_RequestModeReject;
    00080 class H245_ModeDescription;
    00081 class H245_ArrayOf_ModeDescription;
    00082 class H245_SendTerminalCapabilitySet;
    00083 class H245_MultiplexCapability;
    00084 class H245_FlowControlCommand;
    00085 class H245_MiscellaneousCommand;
    00086 class H245_MiscellaneousIndication;
    00087 class H245_JitterIndication;
    00088 class H245_ArrayOf_GenericParameter;
    00089 class H245_ArrayOf_GenericInformation;
    00090
    00091 class H323SignalPDU;
    00092 class H323ControlPDU;
    00093 class H323EndPoint;
    00094 class H323TransportAddress;
    00095 class H323_RTPChannel;
    00096 typedef OpalMediaSession H323RTPSession;
    00097
    00098 class H235Authenticators;
    00099
    00100 class H245NegMasterSlaveDetermination;
    00101 class H245NegTerminalCapabilitySet;
    00102 class H245NegLogicalChannels;
    00103 class H245NegRequestMode;
    00104 class H245NegRoundTripDelay;
    00105
    00106 class H450xDispatcher;
    00107 class H4502Handler;
    00108 class H4504Handler;
    00109 class H4506Handler;
    00110 class H4507Handler;
    00111 class H45011Handler;
    00112
    00113 class OpalCall;
    00114
    00115 #if OPAL_H460
    00116 class H460_FeatureSet;
    00117 #endif
    00118
    00119
    00122 #define OPAL_OPT_Q931_BEARER_CAPS "Q931-Bearer-Caps"
    00123
    00124
    00126
    00133 class H323Connection : public OpalRTPConnection
    00134 {
    00135   PCLASSINFO(H323Connection, OpalRTPConnection);
    00136
    00137   public:
    00142     H323Connection(
    00143       OpalCall & call,
    00144       H323EndPoint & endpoint,
    00145       const PString & token,
    00146       const PString & alias,
    00147       const H323TransportAddress & address,
    00148       unsigned options = 0,
    00149       OpalConnection::StringOptions * stringOptions = NULL
    00150     );
    00151
    00154     ~H323Connection();
    00156
    00167     virtual bool IsNetworkConnection() const { return true; }
    00168
    00171     virtual PString GetPrefixName() const;
    00172
    00174     virtual void OnApplyStringOptions();
    00175
    00182     virtual PBoolean SetUpConnection();
    00183
    00193     virtual PBoolean SetAlerting(
    00194       const PString & calleeName,
    00195       PBoolean withMedia
    00196     );
    00197
    00202     virtual PBoolean SetConnected();
    00203
    00208     virtual PBoolean SetProgressed();
    00209
    00217     virtual void OnEstablished();
    00218
    00236     virtual void OnReleased();
    00237
    00240     virtual OpalTransportAddress GetRemoteAddress() const { return GetTransport().GetRemoteAddress(); }
    00241
    00246     virtual PString GetDestinationAddress();
    00247
    00261     virtual PString GetAlertingType() const;
    00262
    00276     virtual bool SetAlertingType(const PString & info);
    00277
    00280     unsigned GetProgressIndicator() const { return m_progressIndicator; }
    00281
    00284     void SetProgressIndicator(unsigned indicator) { m_progressIndicator = indicator; }
    00285
    00293     virtual OpalMediaFormatList GetMediaFormats() const;
    00294
    00297     virtual unsigned GetNextSessionID(
    00298       const OpalMediaType & mediaType,
    00299       bool isSource
    00300     );
    00301
    00302 #if OPAL_T38_CAPABILITY
    00303
    00305     virtual bool SwitchFaxMediaStreams(
    00306       bool toT38
    00307     );
    00308 #endif
    00309
    00312     virtual OpalMediaStreamPtr OpenMediaStream(
    00313       const OpalMediaFormat & mediaFormat,
    00314       unsigned sessionID,
    00315       bool isSource
    00316     );
    00317
    00322     virtual void OnClosedMediaStream(
    00323       const OpalMediaStream & stream
    00324     );
    00325
    00335     virtual bool GetMediaTransportAddresses(
    00336       const OpalMediaType & mediaType,
    00337       OpalTransportAddressArray & transports
    00338     ) const;
    00339
    00340 #if OPAL_H239
    00341
    00352     virtual bool RequestPresentationRole(
    00353       bool release
    00354     );
    00355
    00360     virtual bool HasPresentationRole() const;
    00361 #endif // OPAL_H239
    00362
    00363
    00368     void AttachSignalChannel(
    00369       const PString & token,
    00370       H323Transport * channel,
    00371       PBoolean answeringCall
    00372     );
    00373
    00376     PBoolean WriteSignalPDU(
    00377       H323SignalPDU & pdu
    00378     );
    00379
    00383     virtual void HandleSignallingChannel();
    00384
    00388     virtual PBoolean HandleSignalPDU(
    00389       H323SignalPDU & pdu
    00390     );
    00391
    00395     virtual void HandleTunnelPDU(
    00396       H323SignalPDU * txPDU
    00397     );
    00398
    00406     virtual PBoolean OnReceivedSignalSetup(
    00407       const H323SignalPDU & pdu
    00408     );
    00409
    00416     virtual PBoolean OnReceivedSignalSetupAck(
    00417       const H323SignalPDU & pdu
    00418     );
    00419
    00426     virtual PBoolean OnReceivedSignalInformation(
    00427       const H323SignalPDU & pdu
    00428     );
    00429
    00438     virtual PBoolean OnReceivedCallProceeding(
    00439       const H323SignalPDU & pdu
    00440     );
    00441
    00450     virtual PBoolean OnReceivedProgress(
    00451       const H323SignalPDU & pdu
    00452     );
    00453
    00460     virtual PBoolean OnReceivedAlerting(
    00461       const H323SignalPDU & pdu
    00462     );
    00463
    00472     virtual PBoolean OnReceivedSignalConnect(
    00473       const H323SignalPDU & pdu
    00474     );
    00475
    00484     virtual PBoolean OnReceivedFacility(
    00485       const H323SignalPDU & pdu
    00486     );
    00487
    00494     virtual PBoolean OnReceivedSignalNotify(
    00495       const H323SignalPDU & pdu
    00496     );
    00497
    00504     virtual PBoolean OnReceivedSignalStatus(
    00505       const H323SignalPDU & pdu
    00506     );
    00507
    00514     virtual PBoolean OnReceivedStatusEnquiry(
    00515       const H323SignalPDU & pdu
    00516     );
    00517
    00522     virtual void OnReceivedReleaseComplete(
    00523       const H323SignalPDU & pdu
    00524     );
    00525
    00532     virtual PBoolean OnUnknownSignalPDU(
    00533       const H323SignalPDU & pdu
    00534     );
    00535
    00542     virtual void OnSendARQ(
    00543       H225_AdmissionRequest & arq
    00544     );
    00545
    00551     virtual void OnReceivedACF(
    00552       const H225_AdmissionConfirm & acf
    00553     );
    00554
    00560     virtual void OnReceivedARJ(
    00561       const H225_AdmissionReject & arj
    00562     );
    00563
    00570     virtual void OnSendIRR(
    00571       H225_InfoRequestResponse & irr
    00572     ) const;
    00573
    00580     virtual void OnSendDRQ(
    00581       H225_DisengageRequest & drq
    00582     ) const;
    00583
    00595     virtual PBoolean OnIncomingCall(
    00596       const H323SignalPDU & setupPDU,
    00597       H323SignalPDU & alertingPDU
    00598     );
    00599
    00609     virtual PBoolean ForwardCall(
    00610       const PString & forwardParty
    00611     );
    00612
    00619     virtual bool TransferConnection(
    00620       const PString & remoteParty
    00621     );
    00622
    00630     virtual bool Hold(
    00631       bool fromRemote,
    00632       bool placeOnHold
    00633     );
    00634
    00639     virtual bool IsOnHold(
    00640       bool fromRemote
    00641     );
    00642
    00643 #if OPAL_H450
    00644
    00649     bool TransferCall(
    00650       const PString & remoteParty,
    00651       const PString & callIdentity = PString::Empty()
    00653     );
    00654
    00659     void ConsultationTransfer(
    00660       const PString & primaryCallToken
    00661     );
    00662
    00669     virtual void HandleConsultationTransfer(
    00670       const PString & callIdentity,
    00672       H323Connection & incoming
    00673     );
    00674
    00677     PBoolean IsTransferringCall() const;
    00678
    00681     PBoolean IsTransferredCall() const;
    00682
    00687     virtual void HandleTransferCall(
    00688       const PString & token,
    00689       const PString & identity
    00690     );
    00691
    00696     int GetCallTransferInvokeId();
    00697
    00705     virtual void HandleCallTransferFailure(
    00706       const int returnError
    00707     );
    00708
    00713     void SetAssociatedCallToken(
    00714       const PString & token
    00715     );
    00716
    00721     virtual void OnConsultationTransferSuccess(
    00722       H323Connection & secondaryCall
    00723     );
    00724
    00729     virtual void IntrudeCall(
    00730       unsigned capabilityLevel
    00731     );
    00732
    00737     virtual void HandleIntrudeCall(
    00738       const PString & token,
    00739       const PString & identity
    00740     );
    00741
    00747     void SetCallIntrusion() { isCallIntrusion = true; }
    00748
    00749     PBoolean IsCallIntrusion() { return isCallIntrusion; }
    00750
    00753     unsigned GetLocalCallIntrusionProtectionLevel() { return callIntrusionProtectionLevel; }
    00754
    00758     virtual PBoolean GetRemoteCallIntrusionProtectionLevel(
    00759       const PString & callToken,
    00760       unsigned callIntrusionProtectionLevel
    00761     );
    00762
    00763     virtual void SetIntrusionImpending();
    00764
    00765     virtual void SetForcedReleaseAccepted();
    00766
    00767     virtual void SetIntrusionNotAuthorized();
    00768
    00775     void SendCallWaitingIndication(
    00776       const unsigned nbOfAddWaitingCalls = 0
    00777     );
    00778
    00779 #endif
    00780
    00807     virtual AnswerCallResponse OnAnswerCall(
    00808       const PString & callerName,
    00809       const H323SignalPDU & setupPDU,
    00810       H323SignalPDU & connectPDU,
    00811       H323SignalPDU & progressPDU
    00812     );
    00813
    00814     virtual AnswerCallResponse OnAnswerCall(
    00815       const PString & callerName
    00816     );
    00817
    00828     void AnsweringCall(
    00829       AnswerCallResponse response
    00830     );
    00831
    00842     virtual CallEndReason SendSignalSetup(
    00843       const PString & alias,
    00844       const H323TransportAddress & address
    00845     );
    00846
    00858     virtual PBoolean OnSendSignalSetup(
    00859       H323SignalPDU & setupPDU
    00860     );
    00861
    00870     virtual PBoolean OnSendCallProceeding(
    00871       H323SignalPDU & callProceedingPDU
    00872     );
    00873
    00885     virtual PBoolean OnSendReleaseComplete(
    00886       H323SignalPDU & releaseCompletePDU
    00887     );
    00888
    00899     virtual PBoolean OnAlerting(
    00900       const H323SignalPDU & alertingPDU,
    00901       const PString & user
    00902     );
    00903
    00918     virtual PBoolean OnInsufficientDigits();
    00919
    00932     virtual void SendMoreDigits(
    00933       const PString & digits
    00934     );
    00935
    00945     virtual PBoolean OnOutgoingCall(
    00946       const H323SignalPDU & connectPDU
    00947     );
    00948
    00960     virtual PBoolean SendFastStartAcknowledge(
    00961       H225_ArrayOf_PASN_OctetString & array
    00962     );
    00963
    00975     virtual PBoolean HandleFastStartAcknowledge(
    00976       const H225_ArrayOf_PASN_OctetString & array
    00977     );
    00979
    00993     virtual PBoolean CreateOutgoingControlChannel(
    00994       const H225_TransportAddress & h245Address
    00995     );
    00996
    01009     virtual PBoolean CreateIncomingControlChannel(
    01010       H225_TransportAddress & h245Address
    01011     );
    01012
    01017     virtual PBoolean WriteControlPDU(
    01018       const H323ControlPDU & pdu
    01019     );
    01020
    01023     virtual PBoolean StartControlNegotiations();
    01024
    01027     virtual void HandleControlChannel();
    01028
    01035     virtual PBoolean HandleControlData(
    01036       PPER_Stream & strm
    01037     );
    01038
    01045     virtual PBoolean HandleControlPDU(
    01046       const H323ControlPDU & pdu
    01047     );
    01048
    01052     virtual PBoolean HandleReceivedControlPDU(
    01053       PBoolean readStatus,
    01054       PPER_Stream & strm
    01055     );
    01056
    01066     virtual PBoolean OnUnknownControlPDU(
    01067       const H323ControlPDU & pdu
    01068     );
    01069
    01073     virtual PBoolean OnH245Request(
    01074       const H323ControlPDU & pdu
    01075     );
    01076
    01080     virtual PBoolean OnH245Response(
    01081       const H323ControlPDU & pdu
    01082     );
    01083
    01087     virtual PBoolean OnH245Command(
    01088       const H323ControlPDU & pdu
    01089     );
    01090
    01094     virtual PBoolean OnH245Indication(
    01095       const H323ControlPDU & pdu
    01096     );
    01097
    01100     virtual PBoolean OnH245_SendTerminalCapabilitySet(
    01101       const H245_SendTerminalCapabilitySet & pdu
    01102     );
    01103
    01108     virtual PBoolean OnH245_FlowControlCommand(
    01109       const H245_FlowControlCommand & pdu
    01110     );
    01111
    01116     virtual PBoolean OnH245_MiscellaneousCommand(
    01117       const H245_MiscellaneousCommand & pdu
    01118     );
    01119
    01124     virtual PBoolean OnH245_MiscellaneousIndication(
    01125       const H245_MiscellaneousIndication & pdu
    01126     );
    01127
    01132     virtual PBoolean OnH245_JitterIndication(
    01133       const H245_JitterIndication & pdu
    01134     );
    01135
    01136 #if OPAL_H239
    01137
    01139     virtual bool OnH239Message(
    01140       unsigned subMessage,
    01141       const H245_ArrayOf_GenericParameter & params
    01142     );
    01143
    01147     virtual bool OnH239FlowControlRequest(
    01148       unsigned logicalChannel,
    01149       unsigned bitRate
    01150     );
    01151
    01155     virtual bool OnH239FlowControlResponse(
    01156       unsigned logicalChannel,
    01157       bool rejected
    01158     );
    01159
    01163     virtual bool OnH239PresentationRequest(
    01164       unsigned logicalChannel,
    01165       unsigned symmetryBreaking,
    01166       unsigned terminalLabel
    01167     );
    01168
    01174     virtual bool SendH239PresentationRequest(
    01175       unsigned logicalChannel,
    01176       unsigned symmetryBreaking,
    01177       unsigned terminalLabel
    01178     );
    01179
    01183     virtual bool OnH239PresentationResponse(
    01184       unsigned logicalChannel,
    01185       unsigned terminalLabel,
    01186       bool rejected
    01187     );
    01188
    01192     virtual bool OnH239PresentationRelease(
    01193       unsigned logicalChannel,
    01194       unsigned terminalLabel
    01195     );
    01196
    01201     virtual bool SendH239PresentationRelease(
    01202       unsigned logicalChannel,
    01203       unsigned terminalLabel
    01204     );
    01205
    01209     virtual bool OnH239PresentationIndication(
    01210       unsigned logicalChannel,
    01211       unsigned terminalLabel
    01212     );
    01213 #endif // OPAL_H239
    01214
    01217     enum ControlProtocolErrors {
    01218       e_MasterSlaveDetermination,
    01219       e_CapabilityExchange,
    01220       e_LogicalChannel,
    01221       e_ModeRequest,
    01222       e_RoundTripDelay
    01223     };
    01224
    01236     virtual PBoolean OnControlProtocolError(
    01237       ControlProtocolErrors errorSource,
    01238       const void * errorData = NULL
    01239     );
    01240
    01248     virtual void OnSendCapabilitySet(
    01249       H245_TerminalCapabilitySet & pdu
    01250     );
    01251
    01263     virtual PBoolean OnReceivedCapabilitySet(
    01264       const H323Capabilities & remoteCaps,
    01265       const H245_MultiplexCapability * muxCap,
    01266       H245_TerminalCapabilitySetReject & reject
    01267     );
    01268
    01271     virtual bool SendCapabilitySet(
    01272       PBoolean empty
    01273     );
    01274
    01277     virtual bool IsSendingCapabilitySet();
    01278
    01287     virtual void OnSetLocalCapabilities();
    01288
    01292     virtual void OnSendH245_OpenLogicalChannel(
    01293       H245_OpenLogicalChannel & /*open*/,
    01294       PBoolean /*forward*/
    01295     ) { }
    01296
    01299     PBoolean IsH245Master() const;
    01300
    01303     void StartRoundTripDelay();
    01304
    01307     PTimeInterval GetRoundTripDelay() const;
    01309
    01349     virtual void OnSelectLogicalChannels();
    01350
    01353     virtual void SelectDefaultLogicalChannel(
    01354       const OpalMediaType & mediaType,
    01355       unsigned sessionID
    01356     );
    01357
    01361     virtual void SelectFastStartChannels(
    01362       unsigned sessionID,
    01363       PBoolean transmitter,
    01364       PBoolean receiver
    01365     );
    01366
    01370     virtual void OpenFastStartChannel(
    01371       unsigned sessionID,
    01372       H323Channel::Directions direction
    01373     );
    01374
    01389     virtual PBoolean OpenLogicalChannel(
    01390       const H323Capability & capability,
    01391       unsigned sessionID,
    01392       H323Channel::Directions dir
    01393     );
    01394
    01395     virtual void SendFlowControlCommand(
    01396       unsigned channelNumber,
    01397       unsigned newBitRate
    01398     );
    01399
    01409     virtual PBoolean OnOpenLogicalChannel(
    01410       const H245_OpenLogicalChannel & openPDU,
    01411       H245_OpenLogicalChannelAck & ackPDU,
    01412       unsigned & errorCode,
    01413       H323Channel & channel
    01414     );
    01415
    01423     virtual PBoolean OnConflictingLogicalChannel(
    01424       H323Channel & channel
    01425     );
    01426
    01431     virtual H323Channel * CreateLogicalChannel(
    01432       const H245_OpenLogicalChannel & open,
    01433       PBoolean startingFast,
    01434       unsigned & errorCode
    01435     );
    01436
    01471     virtual H323Channel * CreateRealTimeLogicalChannel(
    01472       const H323Capability & capability,
    01473       H323Channel::Directions dir,
    01474       unsigned sessionID,
    01475       const H245_H2250LogicalChannelParameters * param
    01477     );
    01478
    01482     virtual H323_RTPChannel * CreateRTPChannel(
    01483       const H323Capability & capability,
    01484       H323Channel::Directions direction,
    01485       H323RTPSession & rtp
    01486     );
    01487
    01498     virtual PBoolean OnCreateLogicalChannel(
    01499       const H323Capability & capability,
    01500       H323Channel::Directions dir,
    01501       unsigned & errorCode
    01502     );
    01503
    01508     virtual PBoolean OnStartLogicalChannel(
    01509       H323Channel & channel
    01510     );
    01511
    01514     virtual void CloseLogicalChannel(
    01515       unsigned number,
    01516       PBoolean fromRemote
    01517     );
    01518
    01521     virtual void CloseLogicalChannelNumber(
    01522       const H323ChannelNumber & number
    01523     );
    01524
    01527     virtual void CloseAllLogicalChannels(
    01528       PBoolean fromRemote
    01529     );
    01530
    01536     virtual void OnClosedLogicalChannel(
    01537       const H323Channel & channel
    01538     );
    01539
    01548     virtual PBoolean OnClosingLogicalChannel(
    01549       H323Channel & channel
    01550     );
    01551
    01560     virtual void OnLogicalChannelFlowControl(
    01561       H323Channel * channel,
    01562       long bitRateRestriction
    01563     );
    01564
    01573     virtual void OnLogicalChannelJitter(
    01574       H323Channel * channel,
    01575       DWORD jitter,
    01576       int skippedFrameCount,
    01577       int additionalBuffer
    01578     );
    01579
    01583     H323Channel * GetLogicalChannel(
    01584       unsigned number,
    01585       PBoolean fromRemote
    01586     ) const;
    01587
    01593     H323Channel * FindChannel(
    01594       unsigned sessionId,
    01595       PBoolean fromRemote
    01596     ) const;
    01598
    01605     virtual OpalBandwidth GetBandwidthUsed(
    01606       OpalBandwidth::Direction dir
    01607     ) const;
    01609
    01617     virtual SendUserInputModes GetRealSendUserInputMode() const;
    01618
    01632     virtual PBoolean SendUserInputString(
    01633       const PString & value
    01634     );
    01635
    01660     virtual PBoolean SendUserInputTone(
    01661       char tone,
    01662       unsigned duration = 0
    01663     );
    01664
    01671     virtual PBoolean SendUserInputIndicationQ931(
    01672       const PString & value
    01673     );
    01674
    01681     virtual PBoolean SendUserInputIndicationString(
    01682       const PString & value
    01683     );
    01684
    01689     virtual PBoolean SendUserInputIndicationTone(
    01690       char tone,
    01691       unsigned duration = 0,
    01692       unsigned logicalChannel = 0,
    01693       unsigned rtpTimestamp = 0
    01694     );
    01695
    01704     virtual PBoolean SendUserInputIndication(
    01705       const H245_UserInputIndication & pdu
    01706     );
    01707
    01712     virtual void OnUserInputIndication(
    01713       const H245_UserInputIndication & pdu
    01714     );
    01716
    01722     virtual PString GetSessionCodecNames(
    01723       unsigned sessionID
    01724     ) const;
    01725
    01730     virtual void DetermineRTPNAT(
    01731       const PIPSocket::Address & localAddr,
    01732       const PIPSocket::Address & peerAddr,
    01733       const PIPSocket::Address & signalAddr
    01734     );
    01735
    01753     virtual PBoolean RequestModeChange(
    01754       const PString & newModes
    01755     );
    01756
    01764     virtual PBoolean RequestModeChange(
    01765       const H245_ArrayOf_ModeDescription & newModes
    01766     );
    01767
    01770     virtual PBoolean OnRequestModeChange(
    01771       const H245_RequestMode & pdu,
    01772       H245_RequestModeAck & ack,
    01773       H245_RequestModeReject & reject,
    01774       PINDEX & selectedMode
    01775     );
    01776
    01783     virtual void OnModeChanged(
    01784       const H245_ModeDescription & newMode
    01785     );
    01786
    01791     virtual void OnAcceptModeChange(
    01792       const H245_RequestModeAck & pdu
    01793     );
    01794
    01799     virtual void OnRefusedModeChange(
    01800       const H245_RequestModeReject * pdu
    01801     );
    01803
    01811     virtual PBoolean RequestModeChangeT38(
    01812       const char * capabilityNames = "T.38\nT38FaxUDP"
    01813     );
    01814
    01824     virtual PBoolean GetAdmissionRequestAuthentication(
    01825       const H225_AdmissionRequest & arq,
    01826       H235Authenticators & authenticators
    01827     );
    01829
    01834     H323EndPoint & GetEndPoint() const { return endpoint; }
    01835
    01838     PBoolean HadAnsweredCall() const { return !IsOriginating(); }
    01839
    01842     PBoolean IsGatekeeperRouted() const { return gatekeeperRouted; }
    01843
    01848     unsigned GetDistinctiveRing() const { return distinctiveRing; }
    01849
    01856     void SetDistinctiveRing(unsigned pattern) { distinctiveRing = pattern&7; }
    01857
    01861     const PString & GetCallToken() const { return GetToken(); }
    01862
    01865     unsigned GetCallReference() const { return callReference; }
    01866
    01869     inline const OpalGloballyUniqueID & GetCallIdentifier() const
    01870     { return callIdentifier; }
    01871
    01874     virtual PString GetIdentifier() const;
    01875
    01878     const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; }
    01879
    01882     void SetLocalPartyName(const PString & name);
    01883
    01886     const PStringList & GetLocalAliasNames() const { return localAliasNames; }
    01887
    01890     virtual void SetRemotePartyInfo(
    01891       const H323SignalPDU & pdu
    01892     );
    01893
    01896     void SetRemoteApplication(
    01897       const H225_EndpointType & pdu
    01898     );
    01899
    01902     enum ConferenceGoal {
    01903         e_Create,
    01904         e_Invite,
    01905         e_Join
    01906     };
    01907
    01910     ConferenceGoal GetConferenceGoal() { return m_conferenceGoal; }
    01911
    01914     void SetConferenceGoal(ConferenceGoal goal) { m_conferenceGoal = goal; }
    01915
    01918     const H323Capabilities & GetLocalCapabilities() const { return localCapabilities; }
    01919
    01922     const H323Capabilities & GetRemoteCapabilities() const { return remoteCapabilities; }
    01923
    01926     unsigned GetRemoteMaxAudioDelayJitter() const { return remoteMaxAudioDelayJitter; }
    01927
    01930     const H323Transport * GetSignallingChannel() const { return m_signallingChannel; }
    01931
    01934     unsigned GetSignallingVersion() const { return h225version; }
    01935
    01938     const H323Transport & GetControlChannel() const;
    01939
    01942     OpalTransport & GetTransport() const;
    01943
    01946     unsigned GetControlVersion() const { return h245version; }
    01947
    01950     unsigned GetUUIEsRequested() const { return uuiesRequested; }
    01951
    01954     void SetUUIEsRequested(unsigned mask) { uuiesRequested = mask; }
    01955
    01958     const PString GetGkAccessTokenOID() const { return gkAccessTokenOID; }
    01959
    01962     void SetGkAccessTokenOID(const PString & oid) { gkAccessTokenOID = oid; }
    01963
    01966     const PBYTEArray & GetGkAccessTokenData() const { return gkAccessTokenData; }
    01967
    01970     void SetDestExtraCallInfo(
    01971       const PString & info
    01972     ) { destExtraCallInfo = info; }
    01973
    01976     void SetRemotCallWaiting(const unsigned value) { remoteCallWaiting = value; }
    01977
    01983     int GetRemoteCallWaiting() const { return remoteCallWaiting; }
    01984
    01989     void SetEnforcedDurationLimit(
    01990       unsigned seconds
    01991     );
    01993
    01994
    01995 #if OPAL_H239
    01996
    01998     bool GetLocalH239Control() const { return m_h239Control; }
    01999
    02002     void SetLocalH239Control(
    02003       bool on
    02004     ) { m_h239Control = on; }
    02005
    02008     bool GetRemoteH239Control() const;
    02009
    02012     OpalMediaFormatList GetRemoteH239Formats() const;
    02013 #endif
    02014
    02015     virtual PBoolean OnSendFeatureSet(unsigned, H225_FeatureSet &) const;
    02016
    02017     virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet &) const;
    02018
    02019 #if OPAL_H450
    02020
    02024     H4507Handler&  getH4507handler(){return *h4507handler;}
    02025 #endif
    02026
    02027 #if OPAL_H460
    02028
    02030     virtual H460_FeatureSet * GetFeatureSet();
    02031
    02034     void H46019SetCallReceiver();
    02035
    02038     void H46019Enabled();
    02039
    02044     virtual PBoolean OnReceiveOLCGenericInformation(
    02045       unsigned sessionID,
    02046       const H245_ArrayOf_GenericInformation & alternate
    02047     ) const;
    02048
    02052    virtual PBoolean OnSendingOLCGenericInformation(
    02053      const unsigned & sessionID,
    02054      H245_ArrayOf_GenericInformation & gen,
    02055      PBoolean isAck
    02056    ) const;
    02057 #endif
    02058
    02059 #if OPAL_H460_NAT
    02060     virtual PUDPSocket * GetNatSocket(unsigned session, PBoolean rtp);
    02061
    02064     virtual void SetRTPNAT(unsigned sessionid, PUDPSocket * _rtp, PUDPSocket * _rtcp);
    02065
    02066
    02071     class SessionInformation : public PObject
    02072     {
    02073       public:
    02074         SessionInformation(const OpalGloballyUniqueID & id, const PString & token, unsigned session);
    02075
    02076         const PString & GetCallToken();
    02077
    02078         unsigned GetSessionID() const;
    02079
    02080         const OpalGloballyUniqueID & GetCallIdentifer();
    02081
    02082         const PString & GetCUI();
    02083
    02084       protected:
    02085         OpalGloballyUniqueID m_callID;
    02086         PString              m_callToken;
    02087         unsigned             m_sessionID;
    02088         PString              m_CUI;
    02089     };
    02090
    02091     SessionInformation * BuildSessionInformation(unsigned sessionID) const;
    02092
    02093     struct NAT_Sockets
    02094     {
    02095         PUDPSocket * rtp;
    02096         PUDPSocket * rtcp;
    02097     };
    02098 #endif // OPAL_H460_NAT
    02099
    02100
    02106     virtual bool OnMediaCommand(
    02107       OpalMediaStream & stream,
    02108       const OpalMediaCommand & command
    02109     );
    02110
    02113     enum CompatibilityIssues {
    02114       e_NoMultipleTunnelledH245,
    02115       e_BadMasterSlaveConflict,
    02116       e_NoUserInputCapability,
    02117       NumCompatibilityIssues
    02118     };
    02119
    02121     bool HasCompatibilityIssue(
    02122       CompatibilityIssues issue
    02123     ) const;
    02124
    02125     PBoolean StartHandleControlChannel();
    02126     virtual PBoolean OnStartHandleControlChannel();
    02127     void EndHandleControlChannel();
    02128
    02129   protected:
    02135     virtual void InternalEstablishedConnectionCheck();
    02136     PBoolean InternalEndSessionCheck(PPER_Stream & strm);
    02137     void SetRemoteVersions(const H225_ProtocolIdentifier & id);
    02138     void SetBearerCapabilities(H323SignalPDU & pdu) const;
    02139     void MonitorCallStatus();
    02140     PDECLARE_NOTIFIER(PThread, H323Connection, StartOutgoing);
    02141     PDECLARE_NOTIFIER(PThread, H323Connection, NewOutgoingControlChannel);
    02142     PDECLARE_AcceptHandlerNotifier(H323Connection, NewIncomingControlChannel);
    02143
    02144     H323EndPoint & endpoint;
    02145
    02146     H323TransportAddress m_remoteConnectAddress;
    02147     int                  remoteCallWaiting; // Number of call's waiting at the remote endpoint
    02148     bool                 gatekeeperRouted;
    02149     unsigned             distinctiveRing;
    02150     unsigned             callReference;
    02151     unsigned             m_progressIndicator;
    02152     OpalGloballyUniqueID callIdentifier;
    02153     OpalGloballyUniqueID conferenceIdentifier;
    02154
    02155     PString            localDestinationAddress;
    02156     PStringList        localAliasNames;
    02157     H323Capabilities   localCapabilities; // Capabilities local system supports
    02158     PString            destExtraCallInfo;
    02159     H323Capabilities   remoteCapabilities; // Capabilities remote system supports
    02160     unsigned           remoteMaxAudioDelayJitter;
    02161     PTimer             roundTripDelayTimer;
    02162     unsigned           uuiesRequested;
    02163     PString            gkAccessTokenOID;
    02164     PBYTEArray         gkAccessTokenData;
    02165     bool               addAccessTokenToSetup;
    02166
    02167     OpalTransportPtr m_signallingChannel;
    02168     OpalTransportPtr m_controlChannel;
    02169     OpalListener  * controlListener;
    02170     bool            h245Tunneling;
    02171     H323SignalPDU * h245TunnelRxPDU;
    02172     H323SignalPDU * h245TunnelTxPDU;
    02173     H323SignalPDU * setupPDU;
    02174     H323SignalPDU * alertingPDU;
    02175     H323SignalPDU * connectPDU;
    02176     H323SignalPDU * progressPDU;
    02177
    02178     P_DECLARE_TRACED_ENUM(ConnectionStates,
    02179       NoConnectionActive,
    02180       AwaitingGatekeeperAdmission,
    02181       AwaitingTransportConnect,
    02182       AwaitingSignalConnect,
    02183       AwaitingLocalAnswer,
    02184       HasExecutedSignalConnect,
    02185       EstablishedConnection,
    02186       ShuttingDownConnection
    02187     );
    02188     ConnectionStates connectionState;
    02189
    02190     unsigned   h225version;
    02191     unsigned   h245version;
    02192     bool       h245versionSet;
    02193     bool       doH245inSETUP;
    02194     bool       lastPDUWasH245inSETUP;
    02195     bool       m_forceSymmetricTCS;
    02196
    02197     bool       mustSendDRQ;
    02198     bool       mediaWaitForConnect;
    02199     bool       transmitterSidePaused;
    02200     bool       remoteTransmitPaused;
    02201     bool       earlyStart;
    02202     PString    t38ModeChangeCapabilities;
    02203     PSyncPoint digitsWaitFlag;
    02204     bool       endSessionSent;
    02205     bool       endSessionNeeded;
    02206     PSyncPoint endSessionReceived;
    02207     PTimer     enforcedDurationLimit;
    02208     bool       isConsultationTransfer;
    02209
    02210     ConferenceGoal m_conferenceGoal;
    02211
    02212 #if OPAL_H450
    02213
    02214     bool     isCallIntrusion;
    02215     unsigned callIntrusionProtectionLevel;
    02216 #endif
    02217
    02218     P_DECLARE_TRACED_ENUM(FastStartStates,
    02219       FastStartDisabled,
    02220       FastStartInitiate,
    02221       FastStartResponse,
    02222       FastStartAcknowledged
    02223     );
    02224     FastStartStates        m_fastStartState;
    02225     H323LogicalChannelList m_fastStartChannels;
    02226
    02227
    02228     // The following pointers are to protocol procedures, they are pointers to
    02229     // hide their complexity from the H323Connection classes users.
    02230     H245NegMasterSlaveDetermination  * masterSlaveDeterminationProcedure;
    02231     H245NegTerminalCapabilitySet     * capabilityExchangeProcedure;
    02232     H245NegLogicalChannels           * logicalChannels;
    02233     H245NegRequestMode               * requestModeProcedure;
    02234     H245NegRoundTripDelay            * roundTripDelayProcedure;
    02235
    02236 #if OPAL_H239
    02237     bool     m_h239Control;
    02238     unsigned m_h239SymmetryBreaking;
    02239     unsigned m_h239TokenChannel;
    02240     unsigned m_h239TerminalLabel;
    02241     bool     m_h239TokenOwned;
    02242 #endif
    02243
    02244 #if OPAL_H450
    02245     H450xDispatcher * h450dispatcher;
    02246     H4502Handler    * h4502handler;
    02247     H4504Handler    * h4504handler;
    02248     H4506Handler    * h4506handler;
    02249     H4507Handler    * h4507handler;
    02250     H45011Handler   * h45011handler;
    02251 #endif
    02252
    02253 #if OPAL_H460
    02254     bool disableH460;
    02255     H460_FeatureSet * features;
    02256
    02257     bool m_H46019CallReceiver;
    02258     bool m_H46019enabled;
    02259     bool m_h245Connect;
    02260
    02261     bool m_H46024Aenabled;
    02262     bool m_H46024Ainitator;
    02263     PINDEX m_H46024Astate;
    02264
    02265     bool m_H46024Benabled;
    02266     PINDEX m_H46024Bstate;
    02267 #endif
    02268
    02269 #if OPAL_VIDEO
    02270     PSimpleTimer m_h245FastUpdatePictureTimer;
    02271 #endif
    02272
    02273 #if OPAL_H460_NAT
    02274     PMutex NATSocketMutex;
    02275     std::map<unsigned, NAT_Sockets> m_NATSockets;
    02276 #endif // OPAL_H460_NAT
    02277
    02278   private:
    02279     P_REMOVE_VIRTUAL_VOID(CleanUpOnCallEnd());
    02280     P_REMOVE_VIRTUAL_VOID(OnCleared());
    02281     P_REMOVE_VIRTUAL_VOID(OnRTPStatistics(const OpalRTPSession &) const);
    02282     P_REMOVE_VIRTUAL(PBoolean, OnOpenLogicalChannel(const H245_OpenLogicalChannel&,H245_OpenLogicalChannelAck&,unsigned&), false);
    02283     P_REMOVE_VIRTUAL(PBoolean, OnOpenLogicalChannel(const H245_OpenLogicalChannel &, H245_OpenLogicalChannelAck &, unsigned &, const unsigned &), false);
    02284     P_REMOVE_VIRTUAL_VOID(NatDetection(const PIPSocket::Address &, const PIPSocket::Address &));
    02285     P_REMOVE_VIRTUAL(PBoolean, OnNatDetected(), false);
    02286 };
    02287
    02288
    02289 PDICTIONARY(H323CallIdentityDict, PString, H323Connection);
    02290
    02291
    02292 #endif // OPAL_H323
    02293
    02294 #endif // OPAL_H323_H323CON_H
    02295
    02296