OPAL  Version 3.10.4
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: 26728 $
00030  * $Author: rjongbloed $
00031  * $Date: 2011-12-01 22:59:14 -0600 (Thu, 01 Dec 2011) $
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 <opal/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 
00090 class H323SignalPDU;
00091 class H323ControlPDU;
00092 class H323EndPoint;
00093 class H323TransportAddress;
00094 
00095 class H235Authenticators;
00096 
00097 class H245NegMasterSlaveDetermination;
00098 class H245NegTerminalCapabilitySet;
00099 class H245NegLogicalChannels;
00100 class H245NegRequestMode;
00101 class H245NegRoundTripDelay;
00102 
00103 class H450xDispatcher;
00104 class H4502Handler;
00105 class H4504Handler;
00106 class H4506Handler;
00107 class H4507Handler;
00108 class H45011Handler;
00109 
00110 class OpalCall;
00111 
00112 #if OPAL_H460
00113 class H460_FeatureSet;
00114 #endif
00115 
00116 
00119 #define OPAL_OPT_Q931_BEARER_CAPS "Q931-Bearer-Caps"
00120 
00121 
00123 
00130 class H323Connection : public OpalRTPConnection
00131 {
00132   PCLASSINFO(H323Connection, OpalRTPConnection);
00133 
00134   public:
00139     H323Connection(
00140       OpalCall & call,                         
00141       H323EndPoint & endpoint,                 
00142       const PString & token,                   
00143       const PString & alias,                   
00144       const H323TransportAddress & address,    
00145       unsigned options = 0,                    
00146       OpalConnection::StringOptions * stringOptions = NULL 
00147     );
00148 
00151     ~H323Connection();
00153 
00164     virtual bool IsNetworkConnection() const { return true; }
00165 
00168     virtual PString GetPrefixName() const;
00169 
00171     virtual void OnApplyStringOptions();
00172 
00179     virtual PBoolean SetUpConnection();
00180 
00190     virtual PBoolean SetAlerting(
00191       const PString & calleeName,   
00192       PBoolean withMedia                
00193     );
00194 
00199     virtual PBoolean SetConnected();
00200 
00205     virtual PBoolean SetProgressed();
00206     
00214     virtual void OnEstablished();
00215 
00233     virtual void OnReleased();
00234 
00239     virtual PString GetDestinationAddress();
00240 
00254     virtual PString GetAlertingType() const;
00255 
00269     virtual bool SetAlertingType(const PString & info);
00270 
00273     unsigned GetProgressIndicator() const { return m_progressIndicator; }
00274 
00277     void SetProgressIndicator(unsigned indicator) { m_progressIndicator = indicator; }
00278 
00286     virtual OpalMediaFormatList GetMediaFormats() const;
00287 
00290     virtual unsigned GetNextSessionID(
00291       const OpalMediaType & mediaType,   
00292       bool isSource                      
00293     );
00294 
00295 #if OPAL_FAX
00296 
00298     virtual bool SwitchFaxMediaStreams(
00299       bool enableFax  
00300     );
00301 #endif
00302 
00305     virtual OpalMediaStreamPtr OpenMediaStream(
00306       const OpalMediaFormat & mediaFormat, 
00307       unsigned sessionID,                  
00308       bool isSource                        
00309     );
00310     
00315     virtual bool CloseMediaStream(
00316       OpalMediaStream & stream  
00317     );
00318 
00323     virtual PBoolean GetMediaInformation(
00324       unsigned sessionID,     
00325       MediaInformation & info 
00326     ) const;
00328 
00333     void AttachSignalChannel(
00334       const PString & token,    
00335       H323Transport * channel,  
00336       PBoolean answeringCall        
00337     );
00338 
00341     PBoolean WriteSignalPDU(
00342       H323SignalPDU & pdu       
00343     );
00344 
00348     virtual void HandleSignallingChannel();
00349 
00353     virtual PBoolean HandleSignalPDU(
00354       H323SignalPDU & pdu       
00355     );
00356 
00360     virtual void HandleTunnelPDU(
00361       H323SignalPDU * txPDU       
00362     );
00363 
00371     virtual PBoolean OnReceivedSignalSetup(
00372       const H323SignalPDU & pdu   
00373     );
00374 
00381     virtual PBoolean OnReceivedSignalSetupAck(
00382       const H323SignalPDU & pdu   
00383     );
00384 
00391     virtual PBoolean OnReceivedSignalInformation(
00392       const H323SignalPDU & pdu   
00393     );
00394 
00403     virtual PBoolean OnReceivedCallProceeding(
00404       const H323SignalPDU & pdu   
00405     );
00406 
00415     virtual PBoolean OnReceivedProgress(
00416       const H323SignalPDU & pdu   
00417     );
00418 
00425     virtual PBoolean OnReceivedAlerting(
00426       const H323SignalPDU & pdu   
00427     );
00428 
00437     virtual PBoolean OnReceivedSignalConnect(
00438       const H323SignalPDU & pdu   
00439     );
00440 
00449     virtual PBoolean OnReceivedFacility(
00450       const H323SignalPDU & pdu   
00451     );
00452 
00459     virtual PBoolean OnReceivedSignalNotify(
00460       const H323SignalPDU & pdu   
00461     );
00462 
00469     virtual PBoolean OnReceivedSignalStatus(
00470       const H323SignalPDU & pdu   
00471     );
00472 
00479     virtual PBoolean OnReceivedStatusEnquiry(
00480       const H323SignalPDU & pdu   
00481     );
00482 
00487     virtual void OnReceivedReleaseComplete(
00488       const H323SignalPDU & pdu   
00489     );
00490 
00497     virtual PBoolean OnUnknownSignalPDU(
00498       const H323SignalPDU & pdu  
00499     );
00500 
00507     virtual void OnSendARQ(
00508       H225_AdmissionRequest & arq
00509     );
00510 
00516     virtual void OnReceivedACF(
00517       const H225_AdmissionConfirm & acf
00518     );
00519 
00525     virtual void OnReceivedARJ(
00526       const H225_AdmissionReject & arj
00527     );
00528 
00535     virtual void OnSendIRR(
00536       H225_InfoRequestResponse & irr
00537     ) const;
00538 
00545     virtual void OnSendDRQ(
00546       H225_DisengageRequest & drq
00547     ) const;
00548 
00560     virtual PBoolean OnIncomingCall(
00561       const H323SignalPDU & setupPDU,   
00562       H323SignalPDU & alertingPDU       
00563     );
00564 
00574     virtual PBoolean ForwardCall(
00575       const PString & forwardParty   
00576     );
00577 
00584     virtual bool TransferConnection(
00585       const PString & remoteParty   
00586     );
00587 
00595     virtual bool Hold(
00596       bool fromRemote,  
00597       bool placeOnHold  
00598     );
00599 
00604     virtual bool IsOnHold(
00605       bool fromRemote  
00606     );
00607 
00608 #if OPAL_H450
00609 
00614     bool TransferCall(
00615       const PString & remoteParty,   
00616       const PString & callIdentity = PString::Empty()
00618     );
00619 
00624     void ConsultationTransfer(
00625       const PString & primaryCallToken  
00626     );
00627 
00634     virtual void HandleConsultationTransfer(
00635       const PString & callIdentity, 
00637       H323Connection & incoming     
00638     );
00639 
00642     PBoolean IsTransferringCall() const;
00643 
00646     PBoolean IsTransferredCall() const;
00647 
00652     virtual void HandleTransferCall(
00653       const PString & token,
00654       const PString & identity
00655     );
00656 
00661     int GetCallTransferInvokeId();
00662 
00670     virtual void HandleCallTransferFailure(
00671       const int returnError    
00672     );
00673 
00678     void SetAssociatedCallToken(
00679       const PString & token  
00680     );
00681 
00686     virtual void OnConsultationTransferSuccess(
00687       H323Connection & secondaryCall  
00688     );
00689 
00694     bool HoldCall(
00695       PBoolean localHold   
00696     );
00697 
00703     bool RetrieveCall();
00704 
00711     void SetHoldMedia(
00712       PChannel * audioChannel
00713     );
00714 
00717     PBoolean IsMediaOnHold() const;
00718 
00721     PBoolean IsLocalHold() const;
00722 
00725     PBoolean IsRemoteHold() const;
00726 
00729     PBoolean IsCallOnHold() const;
00730 
00735     virtual void IntrudeCall(
00736       unsigned capabilityLevel
00737     );
00738 
00743     virtual void HandleIntrudeCall(
00744       const PString & token,
00745       const PString & identity
00746     );
00747 
00753     void SetCallIntrusion() { isCallIntrusion = true; }
00754 
00755     PBoolean IsCallIntrusion() { return isCallIntrusion; }
00756 
00759     unsigned GetLocalCallIntrusionProtectionLevel() { return callIntrusionProtectionLevel; }
00760 
00764     virtual PBoolean GetRemoteCallIntrusionProtectionLevel(
00765       const PString & callToken,
00766       unsigned callIntrusionProtectionLevel
00767     );
00768 
00769     virtual void SetIntrusionImpending();
00770 
00771     virtual void SetForcedReleaseAccepted();
00772 
00773     virtual void SetIntrusionNotAuthorized();
00774 
00781     void SendCallWaitingIndication(
00782       const unsigned nbOfAddWaitingCalls = 0   
00783     );
00784 
00785 #endif
00786 
00813     virtual AnswerCallResponse OnAnswerCall(
00814       const PString & callerName,       
00815       const H323SignalPDU & setupPDU,   
00816       H323SignalPDU & connectPDU,       
00817       H323SignalPDU & progressPDU       
00818     );
00819     
00820     virtual AnswerCallResponse OnAnswerCall(
00821       const PString & callerName        
00822     );
00823 
00834     void AnsweringCall(
00835       AnswerCallResponse response 
00836     );
00837 
00848     virtual CallEndReason SendSignalSetup(
00849       const PString & alias,                
00850       const H323TransportAddress & address  
00851     );
00852 
00864     virtual PBoolean OnSendSignalSetup(
00865       H323SignalPDU & setupPDU   
00866     );
00867 
00876     virtual PBoolean OnSendCallProceeding(
00877       H323SignalPDU & callProceedingPDU   
00878     );
00879 
00891     virtual PBoolean OnSendReleaseComplete(
00892       H323SignalPDU & releaseCompletePDU 
00893     );
00894 
00905     virtual PBoolean OnAlerting(
00906       const H323SignalPDU & alertingPDU,  
00907       const PString & user                
00908     );
00909 
00924     virtual PBoolean OnInsufficientDigits();
00925 
00938     virtual void SendMoreDigits(
00939       const PString & digits    
00940     );
00941 
00951     virtual PBoolean OnOutgoingCall(
00952       const H323SignalPDU & connectPDU   
00953     );
00954 
00966     virtual PBoolean SendFastStartAcknowledge(
00967       H225_ArrayOf_PASN_OctetString & array   
00968     );
00969 
00981     virtual PBoolean HandleFastStartAcknowledge(
00982       const H225_ArrayOf_PASN_OctetString & array   
00983     );
00985 
00999     virtual PBoolean CreateOutgoingControlChannel(
01000       const H225_TransportAddress & h245Address   
01001     );
01002 
01015     virtual PBoolean CreateIncomingControlChannel(
01016       H225_TransportAddress & h245Address  
01017     );
01018 
01023     virtual PBoolean WriteControlPDU(
01024       const H323ControlPDU & pdu
01025     );
01026 
01029     virtual PBoolean StartControlNegotiations();
01030 
01033     virtual void HandleControlChannel();
01034 
01041     virtual PBoolean HandleControlData(
01042       PPER_Stream & strm
01043     );
01044 
01051     virtual PBoolean HandleControlPDU(
01052       const H323ControlPDU & pdu
01053     );
01054 
01064     virtual PBoolean OnUnknownControlPDU(
01065       const H323ControlPDU & pdu  
01066     );
01067 
01071     virtual PBoolean OnH245Request(
01072       const H323ControlPDU & pdu  
01073     );
01074 
01078     virtual PBoolean OnH245Response(
01079       const H323ControlPDU & pdu  
01080     );
01081 
01085     virtual PBoolean OnH245Command(
01086       const H323ControlPDU & pdu  
01087     );
01088 
01092     virtual PBoolean OnH245Indication(
01093       const H323ControlPDU & pdu  
01094     );
01095 
01098     virtual PBoolean OnH245_SendTerminalCapabilitySet(
01099       const H245_SendTerminalCapabilitySet & pdu  
01100     );
01101 
01106     virtual PBoolean OnH245_FlowControlCommand(
01107       const H245_FlowControlCommand & pdu  
01108     );
01109 
01114     virtual PBoolean OnH245_MiscellaneousCommand(
01115       const H245_MiscellaneousCommand & pdu  
01116     );
01117 
01122     virtual PBoolean OnH245_MiscellaneousIndication(
01123       const H245_MiscellaneousIndication & pdu  
01124     );
01125 
01130     virtual PBoolean OnH245_JitterIndication(
01131       const H245_JitterIndication & pdu  
01132     );
01133 
01134 #if OPAL_H239
01135 
01137     virtual bool OnH239Message(
01138       unsigned subMessage,
01139       const H245_ArrayOf_GenericParameter & params
01140     );
01141 
01145     virtual bool OnH239FlowControlRequest(
01146       unsigned logicalChannel,
01147       unsigned bitRate
01148     );
01149 
01153     virtual bool OnH239FlowControlResponse(
01154       unsigned logicalChannel,
01155       bool rejected
01156     );
01157 
01161     virtual bool OnH239PresentationRequest(
01162       unsigned logicalChannel,
01163       unsigned symmetryBreaking,
01164       unsigned terminalLabel
01165     );
01166 
01172     virtual bool SendH239PresentationRequest(
01173       unsigned logicalChannel,
01174       unsigned symmetryBreaking,
01175       unsigned terminalLabel
01176     );
01177 
01181     virtual bool OnH239PresentationResponse(
01182       unsigned logicalChannel,
01183       unsigned terminalLabel,
01184       bool rejected
01185     );
01186 
01190     virtual bool OnH239PresentationRelease(
01191       unsigned logicalChannel,
01192       unsigned terminalLabel
01193     );
01194 
01199     virtual bool SendH239PresentationRelease(
01200       unsigned logicalChannel,
01201       unsigned terminalLabel
01202     );
01203 
01207     virtual bool OnH239PresentationIndication(
01208       unsigned logicalChannel,
01209       unsigned terminalLabel
01210     );
01211 #endif
01212 
01215     enum ControlProtocolErrors {
01216       e_MasterSlaveDetermination,
01217       e_CapabilityExchange,
01218       e_LogicalChannel,
01219       e_ModeRequest,
01220       e_RoundTripDelay
01221     };
01222 
01234     virtual PBoolean OnControlProtocolError(
01235       ControlProtocolErrors errorSource,  
01236       const void * errorData = NULL       
01237     );
01238 
01246     virtual void OnSendCapabilitySet(
01247       H245_TerminalCapabilitySet & pdu  
01248     );
01249 
01261     virtual PBoolean OnReceivedCapabilitySet(
01262       const H323Capabilities & remoteCaps,      
01263       const H245_MultiplexCapability * muxCap,  
01264       H245_TerminalCapabilitySetReject & reject 
01265     );
01266 
01269     virtual bool SendCapabilitySet(
01270       PBoolean empty  
01271     );
01272 
01275     virtual bool IsSendingCapabilitySet();
01276 
01285     virtual void OnSetLocalCapabilities();
01286 
01289     PBoolean IsH245Master() const;
01290 
01293     void StartRoundTripDelay();
01294 
01297     PTimeInterval GetRoundTripDelay() const;
01299 
01339     virtual void OnSelectLogicalChannels();
01340 
01343     virtual void SelectDefaultLogicalChannel(
01344       const OpalMediaType & mediaType,  
01345       unsigned sessionID                
01346     );
01347 
01351     virtual void SelectFastStartChannels(
01352       unsigned sessionID,   
01353       PBoolean transmitter,     
01354       PBoolean receiver         
01355     );
01356 
01360     virtual void StartFastStartChannel(
01361       unsigned sessionID,               
01362       H323Channel::Directions direction 
01363     );
01364 
01379     virtual PBoolean OpenLogicalChannel(
01380       const H323Capability & capability,  
01381       unsigned sessionID,                 
01382       H323Channel::Directions dir         
01383     );
01384     
01385     virtual void SendFlowControlCommand(
01386       unsigned channelNumber,
01387       unsigned newBitRate
01388     );
01389     
01399     virtual PBoolean OnOpenLogicalChannel(
01400       const H245_OpenLogicalChannel & openPDU,  
01401       H245_OpenLogicalChannelAck & ackPDU,      
01402       unsigned & errorCode                      
01403     );
01404 
01412     virtual PBoolean OnConflictingLogicalChannel(
01413       H323Channel & channel    
01414     );
01415 
01420     virtual H323Channel * CreateLogicalChannel(
01421       const H245_OpenLogicalChannel & open, 
01422       PBoolean startingFast,                    
01423       unsigned & errorCode                  
01424     );
01425 
01460     virtual H323Channel * CreateRealTimeLogicalChannel(
01461       const H323Capability & capability, 
01462       H323Channel::Directions dir,       
01463       unsigned sessionID,                
01464       const H245_H2250LogicalChannelParameters * param,
01466       RTP_QOS * rtpqos = NULL            
01467     );
01468     
01472     virtual H323_RTPChannel * CreateRTPChannel(
01473       const H323Capability & capability,
01474       H323Channel::Directions direction,
01475       RTP_Session & rtp
01476     );
01477 
01488     virtual PBoolean OnCreateLogicalChannel(
01489       const H323Capability & capability,  
01490       H323Channel::Directions dir,        
01491       unsigned & errorCode                
01492     );
01493 
01498     virtual PBoolean OnStartLogicalChannel(
01499       H323Channel & channel    
01500     );
01501 
01504     virtual void CloseLogicalChannel(
01505       unsigned number,    
01506       PBoolean fromRemote     
01507     );
01508 
01511     virtual void CloseLogicalChannelNumber(
01512       const H323ChannelNumber & number    
01513     );
01514 
01517     virtual void CloseAllLogicalChannels(
01518       PBoolean fromRemote     
01519     );
01520 
01526     virtual void OnClosedLogicalChannel(
01527       const H323Channel & channel   
01528     );
01529 
01538     virtual PBoolean OnClosingLogicalChannel(
01539       H323Channel & channel   
01540     );
01541 
01550     virtual void OnLogicalChannelFlowControl(
01551       H323Channel * channel,   
01552       long bitRateRestriction  
01553     );
01554 
01563     virtual void OnLogicalChannelJitter(
01564       H323Channel * channel,   
01565       DWORD jitter,            
01566       int skippedFrameCount,   
01567       int additionalBuffer     
01568     );
01569 
01573     H323Channel * GetLogicalChannel(
01574       unsigned number,    
01575       PBoolean fromRemote     
01576     ) const;
01577 
01583     H323Channel * FindChannel(
01584       unsigned sessionId,   
01585       PBoolean fromRemote       
01586     ) const;
01588 
01595     virtual PBoolean SetBandwidthAvailable(
01596       unsigned newBandwidth,    
01597       PBoolean force = false        
01598     );
01599 
01604     virtual unsigned GetBandwidthUsed() const;
01606 
01614     virtual SendUserInputModes GetRealSendUserInputMode() const;
01615 
01629     virtual PBoolean SendUserInputString(
01630       const PString & value                   
01631     );
01632 
01657     virtual PBoolean SendUserInputTone(
01658       char tone,             
01659       unsigned duration = 0  
01660     );
01661 
01668     virtual PBoolean SendUserInputIndicationQ931(
01669       const PString & value                   
01670     );
01671 
01678     virtual PBoolean SendUserInputIndicationString(
01679       const PString & value                   
01680     );
01681 
01686     virtual PBoolean SendUserInputIndicationTone(
01687       char tone,                   
01688       unsigned duration = 0,       
01689       unsigned logicalChannel = 0, 
01690       unsigned rtpTimestamp = 0    
01691     );
01692 
01701     virtual PBoolean SendUserInputIndication(
01702       const H245_UserInputIndication & pdu    
01703     );
01704 
01709     virtual void OnUserInputIndication(
01710       const H245_UserInputIndication & pdu  
01711     );
01713 
01719     virtual H323_RTP_Session * GetSessionCallbacks(
01720       unsigned sessionID
01721     ) const;
01722 
01728     virtual RTP_Session * UseSession(
01729       const OpalTransport & transport,
01730                    unsigned sessionID,
01731       const OpalMediaType & mediatype,  
01732                   RTP_QOS * rtpqos = NULL
01733     );
01734 
01742     virtual void OnRTPStatistics(
01743       const RTP_Session & session   
01744     ) const;
01745 
01749     virtual PString GetSessionCodecNames(
01750       unsigned sessionID
01751     ) const;
01752 
01754 
01772     virtual PBoolean RequestModeChange(
01773       const PString & newModes  
01774     );
01775 
01783     virtual PBoolean RequestModeChange(
01784       const H245_ArrayOf_ModeDescription & newModes  
01785     );
01786 
01789     virtual PBoolean OnRequestModeChange(
01790       const H245_RequestMode & pdu,     
01791       H245_RequestModeAck & ack,        
01792       H245_RequestModeReject & reject,  
01793       PINDEX & selectedMode           
01794     );
01795 
01802     virtual void OnModeChanged(
01803       const H245_ModeDescription & newMode
01804     );
01805 
01810     virtual void OnAcceptModeChange(
01811       const H245_RequestModeAck & pdu  
01812     );
01813 
01818     virtual void OnRefusedModeChange(
01819       const H245_RequestModeReject * pdu  
01820     );
01822 
01830     virtual PBoolean RequestModeChangeT38(
01831       const char * capabilityNames = "T.38\nT38FaxUDP"
01832     );
01833 
01843     virtual PBoolean GetAdmissionRequestAuthentication(
01844       const H225_AdmissionRequest & arq,  
01845       H235Authenticators & authenticators 
01846     );
01848 
01853     H323EndPoint & GetEndPoint() const { return endpoint; }
01854 
01857     PBoolean HadAnsweredCall() const { return !originating; }
01858 
01861     PBoolean IsGatekeeperRouted() const { return gatekeeperRouted; }
01862 
01867     unsigned GetDistinctiveRing() const { return distinctiveRing; }
01868 
01875     void SetDistinctiveRing(unsigned pattern) { distinctiveRing = pattern&7; }
01876 
01880     const PString & GetCallToken() const { return GetToken(); }
01881 
01884     unsigned GetCallReference() const { return callReference; }
01885 
01888     inline const OpalGloballyUniqueID & GetCallIdentifier() const 
01889     { return callIdentifier; }
01890 
01893     virtual PString GetIdentifier() const;
01894 
01897     const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; }
01898 
01901     void SetLocalPartyName(const PString & name);
01902 
01905     const PStringList & GetLocalAliasNames() const { return localAliasNames; }
01906 
01909     virtual void SetRemotePartyInfo(
01910       const H323SignalPDU & pdu 
01911     );
01912 
01915     void SetRemoteApplication(
01916       const H225_EndpointType & pdu 
01917     );
01918     
01923     PString GetRemotePartyURL() const;
01924     
01927     const H323Capabilities & GetLocalCapabilities() const { return localCapabilities; }
01928 
01931     const H323Capabilities & GetRemoteCapabilities() const { return remoteCapabilities; }
01932 
01935     unsigned GetRemoteMaxAudioDelayJitter() const { return remoteMaxAudioDelayJitter; }
01936 
01939     const H323Transport * GetSignallingChannel() const { return signallingChannel; }
01940 
01943     unsigned GetSignallingVersion() const { return h225version; }
01944 
01947     const H323Transport & GetControlChannel() const;
01948 
01951     OpalTransport & GetTransport() const;
01952 
01955     unsigned GetControlVersion() const { return h245version; }
01956 
01959     unsigned GetUUIEsRequested() const { return uuiesRequested; }
01960 
01963     void SetUUIEsRequested(unsigned mask) { uuiesRequested = mask; }
01964 
01967     const PString GetGkAccessTokenOID() const { return gkAccessTokenOID; }
01968 
01971     void SetGkAccessTokenOID(const PString & oid) { gkAccessTokenOID = oid; }
01972 
01975     const PBYTEArray & GetGkAccessTokenData() const { return gkAccessTokenData; }
01976 
01979     void SetDestExtraCallInfo(
01980       const PString & info
01981     ) { destExtraCallInfo = info; }
01982 
01985     void SetRemotCallWaiting(const unsigned value) { remoteCallWaiting = value; }
01986 
01992     int GetRemoteCallWaiting() const { return remoteCallWaiting; }
01993 
01998     void SetEnforcedDurationLimit(
01999       unsigned seconds  
02000     );
02002     
02003 #if OPAL_H239
02004 
02006     bool GetLocalH239Control() const { return m_h239Control; }
02007 
02010     void SetLocalH239Control(
02011       bool on   
02012     ) { m_h239Control = on; }
02013 
02016     bool GetRemoteH239Control() const;
02017 
02020     OpalMediaFormatList GetRemoteH239Formats() const;
02021 #endif
02022 
02023     virtual PBoolean OnSendFeatureSet(unsigned, H225_FeatureSet &) const;
02024     
02025     virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet &) const;
02026 
02027 #if OPAL_H460
02028 
02030     virtual H460_FeatureSet * GetFeatureSet();
02031 #endif
02032 
02033     
02034 #if OPAL_H450
02035 
02039     H4507Handler&  getH4507handler(){return *h4507handler;}
02040 #endif
02041 
02047     virtual bool OnMediaCommand(
02048       OpalMediaStream & stream,         
02049       const OpalMediaCommand & command  
02050     );
02051     
02052   protected:
02058     virtual void InternalEstablishedConnectionCheck();
02059     PBoolean InternalEndSessionCheck(PPER_Stream & strm);
02060     void SetRemoteVersions(const H225_ProtocolIdentifier & id);
02061     void MonitorCallStatus();
02062     PDECLARE_NOTIFIER(PThread, H323Connection, StartOutgoing);
02063     PDECLARE_NOTIFIER(PThread, H323Connection, NewOutgoingControlChannel);
02064     PDECLARE_NOTIFIER(PThread, H323Connection, NewIncomingControlChannel);
02065 
02066     H323EndPoint & endpoint;
02067 
02068     H323TransportAddress m_remoteConnectAddress;
02069     int                  remoteCallWaiting; // Number of call's waiting at the remote endpoint
02070     PBoolean                 gatekeeperRouted;
02071     unsigned             distinctiveRing;
02072     unsigned             callReference;
02073     unsigned             m_progressIndicator;
02074     OpalGloballyUniqueID callIdentifier;
02075     OpalGloballyUniqueID conferenceIdentifier;
02076 
02077     PString            localDestinationAddress;
02078     PStringList        localAliasNames;
02079     H323Capabilities   localCapabilities; // Capabilities local system supports
02080     PString            destExtraCallInfo;
02081     H323Capabilities   remoteCapabilities; // Capabilities remote system supports
02082     unsigned           remoteMaxAudioDelayJitter;
02083     PTimer             roundTripDelayTimer;
02084     WORD               maxAudioDelayJitter;
02085     unsigned           uuiesRequested;
02086     PString            gkAccessTokenOID;
02087     PBYTEArray         gkAccessTokenData;
02088     PBoolean               addAccessTokenToSetup;
02089 
02090     H323Transport * signallingChannel;
02091     H323Transport * controlChannel;
02092     OpalListener  * controlListener;
02093     PBoolean            h245Tunneling;
02094     H323SignalPDU * h245TunnelRxPDU;
02095     H323SignalPDU * h245TunnelTxPDU;
02096     H323SignalPDU * setupPDU;
02097     H323SignalPDU * alertingPDU;
02098     H323SignalPDU * connectPDU;
02099     H323SignalPDU * progressPDU;
02100 
02101     enum ConnectionStates {
02102       NoConnectionActive,
02103       AwaitingGatekeeperAdmission,
02104       AwaitingTransportConnect,
02105       AwaitingSignalConnect,
02106       AwaitingLocalAnswer,
02107       HasExecutedSignalConnect,
02108       EstablishedConnection,
02109       ShuttingDownConnection,
02110       NumConnectionStates
02111     } connectionState;
02112 
02113     unsigned   h225version;
02114     unsigned   h245version;
02115     PBoolean       h245versionSet;
02116     PBoolean doH245inSETUP;
02117     PBoolean lastPDUWasH245inSETUP;
02118 
02119     PBoolean mustSendDRQ;
02120     PBoolean mediaWaitForConnect;
02121     PBoolean transmitterSidePaused;
02122     bool     remoteTransmitPaused;
02123     PBoolean earlyStart;
02124     PString    t38ModeChangeCapabilities;
02125     PSyncPoint digitsWaitFlag;
02126     PBoolean       endSessionNeeded;
02127     PSyncPoint endSessionReceived;
02128     PTimer     enforcedDurationLimit;
02129 
02130     // Used as part of a local call hold operation involving MOH
02131     PChannel * holdMediaChannel;
02132     PBoolean       isConsultationTransfer;
02133 
02135     PBoolean     isCallIntrusion;
02136     unsigned callIntrusionProtectionLevel;
02137 
02138     enum FastStartStates {
02139       FastStartDisabled,
02140       FastStartInitiate,
02141       FastStartResponse,
02142       FastStartAcknowledged,
02143       NumFastStartStates
02144     };
02145     FastStartStates        fastStartState;
02146     H323LogicalChannelList fastStartChannels;
02147     OpalMediaStreamPtr     fastStartMediaStream;
02148     
02149 #if PTRACING
02150     static const char * GetConnectionStatesName(ConnectionStates s);
02151     friend ostream & operator<<(ostream & o, ConnectionStates s) { return o << GetConnectionStatesName(s); }
02152     static const char * GetFastStartStateName(FastStartStates s);
02153     friend ostream & operator<<(ostream & o, FastStartStates s) { return o << GetFastStartStateName(s); }
02154 #endif
02155 
02156 
02157     // The following pointers are to protocol procedures, they are pointers to
02158     // hide their complexity from the H323Connection classes users.
02159     H245NegMasterSlaveDetermination  * masterSlaveDeterminationProcedure;
02160     H245NegTerminalCapabilitySet     * capabilityExchangeProcedure;
02161     H245NegLogicalChannels           * logicalChannels;
02162     H245NegRequestMode               * requestModeProcedure;
02163     H245NegRoundTripDelay            * roundTripDelayProcedure;
02164 
02165 #if OPAL_H239
02166     bool m_h239Control;
02167 #endif
02168 
02169 #if OPAL_H450
02170     H450xDispatcher * h450dispatcher;
02171     H4502Handler    * h4502handler;
02172     H4504Handler    * h4504handler;
02173     H4506Handler    * h4506handler;
02174     H4507Handler    * h4507handler;
02175     H45011Handler   * h45011handler;
02176 #endif
02177 
02178 #if OPAL_H460
02179     H460_FeatureSet * features;
02180 #endif
02181 
02182   private:
02183     PChannel * SwapHoldMediaChannels(PChannel * newChannel);
02184 
02185     P_REMOVE_VIRTUAL_VOID(CleanUpOnCallEnd());
02186     P_REMOVE_VIRTUAL_VOID(OnCleared());
02187 };
02188 
02189 
02190 PDICTIONARY(H323CallIdentityDict, PString, H323Connection);
02191 
02192 
02193 #endif // OPAL_H323
02194 
02195 #endif // OPAL_H323_H323CON_H
02196 
02197