connection.h

Go to the documentation of this file.
00001 /*
00002  * connection.h
00003  *
00004  * Telephony connection abstraction
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  * Formally known as the Open H323 project.
00008  *
00009  * Copyright (c) 2001 Equivalence Pty. Ltd.
00010  *
00011  * The contents of this file are subject to the Mozilla Public License
00012  * Version 1.0 (the "License"); you may not use this file except in
00013  * compliance with the License. You may obtain a copy of the License at
00014  * http://www.mozilla.org/MPL/
00015  *
00016  * Software distributed under the License is distributed on an "AS IS"
00017  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00018  * the License for the specific language governing rights and limitations
00019  * under the License.
00020  *
00021  * The Original Code is Open Phone Abstraction Library.
00022  *
00023  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00024  *
00025  * Contributor(s): Post Increment
00026  *     Portions of this code were written with the assistance of funding from
00027  *     US Joint Forces Command Joint Concept Development & Experimentation (J9)
00028  *     http://www.jfcom.mil/about/abt_j9.htm
00029  *
00030  * $Revision: 23187 $
00031  * $Author: rjongbloed $
00032  * $Date: 2009-07-31 00:24:18 +0000 (Fri, 31 Jul 2009) $
00033  */
00034 
00035 #ifndef OPAL_OPAL_CONNECTION_H
00036 #define OPAL_OPAL_CONNECTION_H
00037 
00038 #ifdef P_USE_PRAGMA
00039 #pragma interface
00040 #endif
00041 
00042 #include <opal/buildopts.h>
00043 
00044 #include <opal/mediafmt.h>
00045 #include <opal/mediastrm.h>
00046 #include <opal/guid.h>
00047 #include <opal/transports.h>
00048 #include <ptclib/dtmf.h>
00049 #include <ptlib/safecoll.h>
00050 #include <rtp/rtp.h>
00051 #include <im/t140.h>
00052 
00053 class OpalEndPoint;
00054 class OpalCall;
00055 class OpalSilenceDetector;
00056 class OpalEchoCanceler;
00057 class OpalRFC2833Proto;
00058 class OpalRFC2833Info;
00059 class PURL;
00060 
00061 
00062 #define OPAL_OPT_AUTO_START           "AutoStart"             
00063 #define OPAL_OPT_CALL_IDENTIFIER      "Call-Identifier"       
00064 #define OPAL_OPT_CALLING_PARTY_URL    "Calling-Party-URL"     
00065 #define OPAL_OPT_CALLING_PARTY_NUMBER "Calling-Party-Number"  
00066 #define OPAL_OPT_CALLING_PARTY_NAME   "Calling-Party-Name"    
00067 #define OPAL_OPT_CALLING_PARTY_DOMAIN "Calling-Party-Domain"  
00068 #define OPAL_OPT_CALLING_DISPLAY_NAME "Calling-Display-Name"  
00069 #define OPAL_OPT_ORIGINATOR_ADDRESS   "Originator-Address"    
00070 #define OPAL_OPT_INTERFACE            "Interface"             
00071 #define OPAL_OPT_ENABLE_INBAND_DTMF   "EnableInbandDTMF"      
00072 #define OPAL_OPT_ENABLE_INBAND_DTMF   "EnableInbandDTMF"      
00073 #define OPAL_OPT_DETECT_INBAND_DTMF   "DetectInBandDTMF"      
00074 #define OPAL_OPT_SEND_INBAND_DTMF     "SendInBandDTMF"        
00075 #define OPAL_OPT_DTMF_MULT            "dtmfmult"
00076 #define OPAL_OPT_DTMF_DIV             "dtmfdiv"
00077 #define OPAL_OPT_DISABLE_JITTER       "Disable-Jitter"        
00078 #define OPAL_OPT_MAX_JITTER           "Max-Jitter"            
00079 #define OPAL_OPT_MIN_JITTER           "Min-Jitter"            
00080 #define OPAL_OPT_RECORD_AUDIO         "Record-Audio"          
00081 #define OPAL_OPT_ALERTING_TYPE        "Alerting-Type"         
00082 #define OPAL_OPT_REMOVE_CODEC         "Remove-Codec"          
00083 
00084 
00296 class OpalProductInfo
00297 {
00298   public:
00299     OpalProductInfo();
00300 
00301     static OpalProductInfo & Default();
00302 
00303     PCaselessString AsString() const;
00304 
00305     PString vendor;
00306     PString name;
00307     PString version;
00308     PString comments;
00309     BYTE    t35CountryCode;
00310     BYTE    t35Extension;
00311     WORD    manufacturerCode;
00312 };
00313 
00314 
00332 class OpalConnection : public PSafeObject
00333 {
00334     PCLASSINFO(OpalConnection, PSafeObject);
00335   public:
00340     enum CallEndReasonCodes {
00341       EndedByLocalUser,            
00342       EndedByNoAccept,             
00343       EndedByAnswerDenied,         
00344       EndedByRemoteUser,           
00345       EndedByRefusal,              
00346       EndedByNoAnswer,             
00347       EndedByCallerAbort,          
00348       EndedByTransportFail,        
00349       EndedByConnectFail,          
00350       EndedByGatekeeper,           
00351       EndedByNoUser,               
00352       EndedByNoBandwidth,          
00353       EndedByCapabilityExchange,   
00354       EndedByCallForwarded,        
00355       EndedBySecurityDenial,       
00356       EndedByLocalBusy,            
00357       EndedByLocalCongestion,      
00358       EndedByRemoteBusy,           
00359       EndedByRemoteCongestion,     
00360       EndedByUnreachable,          
00361       EndedByNoEndPoint,           
00362       EndedByHostOffline,          
00363       EndedByTemporaryFailure,     
00364       EndedByQ931Cause,            
00365       EndedByDurationLimit,        
00366       EndedByInvalidConferenceID,  
00367       EndedByNoDialTone,           
00368       EndedByNoRingBackTone,       
00369       EndedByOutOfService,         
00370       EndedByAcceptingCallWaiting, 
00371       NumCallEndReasons
00372     };
00373 
00374     struct CallEndReason {
00375       CallEndReason(
00376         CallEndReasonCodes reason = NumCallEndReasons,
00377         unsigned cause = 0
00378       ) : code(reason), q931(cause) { }
00379 
00380       operator CallEndReasonCodes() const { return code; }
00381 
00382       CallEndReasonCodes code:8; // Normalised OPAL code
00383       unsigned           q931:8; // PSTN Interworking code, actually Q.850
00384     };
00385 
00386 #if PTRACING
00387     friend ostream & operator<<(ostream & o, CallEndReason reason);
00388 #endif
00389 
00390     enum AnswerCallResponse {
00391       AnswerCallNow,               
00392       AnswerCallDenied,            
00393       AnswerCallPending,           
00394       AnswerCallDeferred,          
00395       AnswerCallAlertWithMedia,    
00396       AnswerCallDeferredWithMedia, 
00397       AnswerCallProgress,          
00398       AnswerCallNowAndReleaseCurrent, 
00399       NumAnswerCallResponses
00400     };
00401 #if PTRACING
00402     friend ostream & operator<<(ostream & o, AnswerCallResponse s);
00403 #endif
00404 
00407     enum Options {
00408       FastStartOptionDisable       = 0x0001,   // H.323 specific
00409       FastStartOptionEnable        = 0x0002,
00410       FastStartOptionMask          = 0x0003,
00411 
00412       H245TunnelingOptionDisable   = 0x0004,   // H.323 specific
00413       H245TunnelingOptionEnable    = 0x0008,
00414       H245TunnelingOptionMask      = 0x000c,
00415 
00416       H245inSetupOptionDisable     = 0x0010,   // H.323 specific
00417       H245inSetupOptionEnable      = 0x0020,
00418       H245inSetupOptionMask        = 0x0030,
00419 
00420       DetectInBandDTMFOptionDisable = 0x0040,  // SIP and H.323
00421       DetectInBandDTMFOptionEnable  = 0x0080,
00422       DetectInBandDTMFOptionMask    = 0x00c0,
00423 
00424       RTPAggregationDisable        = 0x0100,   // SIP and H.323
00425       RTPAggregationEnable         = 0x0200,
00426       RTPAggregationMask           = 0x0300,
00427 
00428       SendDTMFAsDefault            = 0x0000,   // SIP and H.323
00429       SendDTMFAsString             = 0x0400,
00430       SendDTMFAsTone               = 0x0800,
00431       SendDTMFAsRFC2833            = 0x0c00,
00432       SendDTMFMask                 = 0x0c00
00433     };
00434 
00435     class StringOptions : public PStringToString 
00436     {
00437       public:
00438         // Make sure the key set in a StringOptions is caseless
00439         PBoolean SetAt(const char * key, const PString & data)
00440         {
00441           return PStringToString::SetAt(PCaselessString(key), data);
00442         }
00443         PBoolean SetAt(const PString & key, const PString & data)
00444         {
00445           return PStringToString::SetAt(PCaselessString(key), data);
00446         }
00447         PBoolean SetAt(const PCaselessString & key, const PString & data)
00448         {
00449           return PStringToString::SetAt(key, data);
00450         }
00451 
00456         void ExtractFromURL(
00457           PURL & url
00458         );
00459     };
00460 
00465     OpalConnection(
00466       OpalCall & call,                         
00467       OpalEndPoint & endpoint,                 
00468       const PString & token,                   
00469       unsigned options = 0,                    
00470       OpalConnection::StringOptions * stringOptions = NULL     
00471     );  
00472 
00475     ~OpalConnection();
00477 
00484     void PrintOn(
00485       ostream & strm    
00486     ) const;
00488 
00505     virtual bool IsNetworkConnection() const = 0;
00506 
00510     enum Phases {
00511       UninitialisedPhase,   
00512       SetUpPhase,           
00513       ProceedingPhase,      
00514       AlertingPhase,        
00515       ConnectedPhase,       
00516       EstablishedPhase,     
00517       ForwardingPhase,      
00518       ReleasingPhase,       
00519       ReleasedPhase,        
00520       NumPhases             
00521     };
00522 
00527     inline Phases GetPhase() const { return phase; }
00528 
00533     void SetPhase(
00534       Phases phaseToSet  
00535     );
00536 
00545     CallEndReason GetCallEndReason() const { return callEndReason; }
00546 
00549     static PString GetCallEndReasonText(CallEndReason reason);
00550     PString GetCallEndReasonText() const { return GetCallEndReasonText(callEndReason); }
00551 
00554     static void SetCallEndReasonText(CallEndReasonCodes reasonCode, const PString & newText);
00555 
00560     virtual void SetCallEndReason(
00561       CallEndReason reason        
00562     );
00563 
00571     void ClearCall(
00572       CallEndReason reason = EndedByLocalUser 
00573     );
00574 
00577     virtual void ClearCallSynchronous(
00578       PSyncPoint * sync,
00579       CallEndReason reason = EndedByLocalUser  
00580     );
00581 
00585     unsigned GetQ931Cause() const { return callEndReason.q931; }
00586 
00590     void SetQ931Cause(unsigned v) { callEndReason.q931 = v; }
00591 
00598     virtual bool TransferConnection(
00599       const PString & remoteParty   
00600     );
00601     
00604     virtual bool HoldConnection();
00605 
00609     virtual bool RetrieveConnection();
00610 
00613     virtual PBoolean IsConnectionOnHold();
00614 
00619     virtual void OnHold(
00620       bool fromRemote,               
00621       bool onHold                    
00622     );
00624 
00652     virtual PBoolean OnIncomingConnection(unsigned int options, OpalConnection::StringOptions * stringOptions);
00653 
00660     virtual PBoolean SetUpConnection() = 0;
00661 
00665     virtual PBoolean OnSetUpConnection();
00666 
00667     
00682     virtual void OnProceeding();
00683 
00694     virtual void OnAlerting();
00695 
00706     virtual PBoolean SetAlerting(
00707       const PString & calleeName,   
00708       PBoolean withMedia                
00709     ) = 0;
00710 
00727     virtual AnswerCallResponse OnAnswerCall(
00728       const PString & callerName        
00729     );
00730 
00741     virtual void AnsweringCall(
00742       AnswerCallResponse response 
00743     );
00744 
00759     virtual void OnConnected();
00760 
00771     virtual PBoolean SetConnected();
00772 
00784     virtual void OnEstablished();
00785 
00794     virtual void Release(
00795       CallEndReason reason = EndedByLocalUser 
00796     );
00797 
00815     virtual void OnReleased();
00817 
00828     virtual PString GetDestinationAddress();
00829 
00839     virtual PBoolean ForwardCall(
00840       const PString & forwardParty   
00841     );
00842 
00845     PSafePtr<OpalConnection> GetOtherPartyConnection() const;
00846 
00849     template <class cls> PSafePtr<cls> GetOtherPartyConnectionAs() const { return PSafePtrCast<OpalConnection, cls>(GetOtherPartyConnection()); }
00851 
00860     virtual OpalMediaFormatList GetMediaFormats() const;
00861 
00866     virtual OpalMediaFormatList GetLocalMediaFormats();
00867 
00876     virtual void AdjustMediaFormats(
00877       OpalMediaFormatList & mediaFormats  
00878     ) const;
00879 
00887     virtual unsigned GetNextSessionID(
00888       const OpalMediaType & mediaType,   
00889       bool isSource                      
00890     );
00891 
00898     virtual OpalMediaType::AutoStartMode GetAutoStart(
00899       const OpalMediaType & mediaType  
00900     ) const;
00901 
00904     virtual void AutoStartMediaStreams(
00905       bool force = false 
00906     );
00907 
00908 #if OPAL_FAX
00909 
00911     virtual bool SwitchFaxMediaStreams(
00912       bool enableFax  
00913     );
00914 #endif
00915 
00918     virtual OpalMediaStreamPtr OpenMediaStream(
00919       const OpalMediaFormat & mediaFormat, 
00920       unsigned sessionID,                  
00921       bool isSource                        
00922     );
00923 
00928     virtual bool CloseMediaStream(
00929       unsigned sessionId,  
00930       bool source          
00931     );
00932 
00937     virtual bool CloseMediaStream(
00938       OpalMediaStream & stream  
00939     );
00940 
00948     bool RemoveMediaStream(
00949       OpalMediaStream & strm     // media stream to remove
00950     );
00951 
00954     virtual void StartMediaStreams();
00955     
00958     virtual void CloseMediaStreams();
00959     
00962     virtual void PauseMediaStreams(PBoolean paused);
00963 
00976     virtual OpalMediaStream * CreateMediaStream(
00977       const OpalMediaFormat & mediaFormat, 
00978       unsigned sessionID,                  
00979       PBoolean isSource                        
00980     );
00981 
00985     OpalMediaStreamPtr GetMediaStream(
00986       const PString & streamID,  
00987       bool source                
00988     ) const;
00989 
00995     OpalMediaStreamPtr GetMediaStream(
00996       unsigned sessionId,  
00997       bool source          
00998     ) const;
00999 
01007     OpalMediaStreamPtr GetMediaStream(
01008       const OpalMediaType & mediaType,    
01009       bool source,                        
01010       OpalMediaStreamPtr previous = NULL  
01011     ) const;
01012 
01024     virtual PBoolean OnOpenMediaStream(
01025       OpalMediaStream & stream    
01026     );
01027 
01032     virtual void OnClosedMediaStream(
01033       const OpalMediaStream & stream     
01034     );
01035     
01040     virtual void OnPatchMediaStream(
01041       PBoolean isSource,
01042       OpalMediaPatch & patch    
01043     );
01044         
01047     virtual void OnMediaPatchStart(
01048       unsigned sessionId, 
01049           bool isSource
01050     );
01051 
01054     virtual void OnMediaPatchStop(
01055       unsigned sessionId, 
01056           bool isSource
01057     );
01058 
01062     PDECLARE_NOTIFIER(OpalMediaCommand, OpalConnection, OnMediaCommand);
01063 
01068     virtual void AttachRFC2833HandlerToPatch(PBoolean isSource, OpalMediaPatch & patch);
01069 
01075     virtual PBoolean IsMediaBypassPossible(
01076       unsigned sessionID                  
01077     ) const;
01078 
01079 #if OPAL_VIDEO
01080 
01082     virtual PBoolean CreateVideoInputDevice(
01083       const OpalMediaFormat & mediaFormat,  
01084       PVideoInputDevice * & device,         
01085       PBoolean & autoDelete                     
01086     );
01087 
01091     virtual PBoolean CreateVideoOutputDevice(
01092       const OpalMediaFormat & mediaFormat,  
01093       PBoolean preview,                         
01094       PVideoOutputDevice * & device,        
01095       PBoolean & autoDelete                     
01096     );
01097 #endif 
01098 
01101     virtual PBoolean SetAudioVolume(
01102       PBoolean source,                  
01103       unsigned percentage           
01104     );
01105 
01109     virtual unsigned GetAudioSignalLevel(
01110       PBoolean source                   
01111     );
01113 
01118     unsigned GetBandwidthAvailable() const { return bandwidthAvailable; }
01119 
01124     virtual PBoolean SetBandwidthAvailable(
01125       unsigned newBandwidth,    
01126       PBoolean force = PFalse        
01127     );
01128 
01133     virtual unsigned GetBandwidthUsed() const;
01134 
01143     virtual PBoolean SetBandwidthUsed(
01144       unsigned releasedBandwidth,   
01145       unsigned requiredBandwidth    
01146     );
01148 
01151     enum SendUserInputModes {
01152       SendUserInputAsQ931,
01153       SendUserInputAsString,
01154       SendUserInputAsTone,
01155       SendUserInputAsInlineRFC2833,
01156       SendUserInputAsSeparateRFC2833,  // Not implemented
01157       SendUserInputAsProtocolDefault,
01158       NumSendUserInputModes
01159     };
01160 #if PTRACING
01161     friend ostream & operator<<(ostream & o, SendUserInputModes m);
01162 #endif
01163 
01166     virtual void SetSendUserInputMode(SendUserInputModes mode);
01167 
01170     virtual SendUserInputModes GetSendUserInputMode() const { return sendUserInputMode; }
01171 
01177     virtual SendUserInputModes GetRealSendUserInputMode() const { return GetSendUserInputMode(); }
01178 
01185     virtual PBoolean SendUserInputString(
01186       const PString & value                   
01187     );
01188 
01205     virtual PBoolean SendUserInputTone(
01206       char tone,        
01207       unsigned duration = 0  
01208     );
01209 
01216     virtual void OnUserInputString(
01217       const PString & value   
01218     );
01219 
01226     virtual void OnUserInputTone(
01227       char tone,
01228       unsigned duration
01229     );
01230 
01234     void SendUserInputHookFlash(
01235       unsigned duration = 500  
01236     ) { SendUserInputTone('!', duration); }
01237 
01240     virtual PString GetUserInput(
01241       unsigned timeout = 30   
01242     );
01243 
01248     virtual void SetUserInput(
01249       const PString & input     
01250     );
01251 
01254     virtual PString ReadUserInput(
01255       const char * terminators = "#\r\n", 
01256       unsigned lastDigitTimeout = 4,      
01257       unsigned firstDigitTimeout = 30     
01258     );
01259 
01266     virtual PBoolean PromptUserInput(
01267       PBoolean play   
01268     );
01270 
01275     virtual bool GarbageCollection();
01277 
01282     OpalEndPoint & GetEndPoint() const { return endpoint; }
01283     
01286     OpalCall & GetCall() const { return ownerCall; }
01287 
01290     const PString & GetToken() const { return callToken; }
01291 
01294     PBoolean IsOriginating() const { return originating; }
01295 
01298     PTime GetSetupUpTime() const { return setupTime; }
01299 
01302     PTime GetAlertingTime() const { return alertingTime; }
01303 
01306     PTime GetConnectionStartTime() const { return connectedTime; }
01307 
01310     PTime GetConnectionEndTime() const { return callEndTime; }
01311 
01314     const OpalProductInfo & GetProductInfo() const { return productInfo; }
01315 
01318     void SetProductInfo(
01319       const OpalProductInfo & info
01320     ) { productInfo = info; }
01321 
01324     virtual PString GetPrefixName() const;
01325 
01328     const PString & GetLocalPartyName() const { return localPartyName; }
01329 
01332     virtual void SetLocalPartyName(const PString & name);
01333 
01336     virtual PString GetLocalPartyURL() const;
01337 
01340     const PString & GetDisplayName() const { return displayName; }
01341 
01344     void SetDisplayName(const PString & name) { displayName = name; }
01345 
01348     const PString & GetRemotePartyName() const { return remotePartyName; }
01349 
01352     void SetRemotePartyName(const PString & name) { remotePartyName = name; }
01353 
01362     const PString & GetRemotePartyNumber() const { return remotePartyNumber; }
01363 
01369     const PString & GetRemotePartyAddress() const { return remotePartyAddress; }
01370 
01373     void SetRemotePartyAddress(const PString & addr) { remotePartyAddress = addr; }
01374 
01381     virtual PString GetRemotePartyURL() const;
01382 
01383     // Deprecated - backward compatibility only
01384     const PString GetRemotePartyCallbackURL() const { return GetRemotePartyURL(); }
01385 
01389     PCaselessString GetRemoteApplication() const { return remoteProductInfo.AsString(); }
01390 
01393     const OpalProductInfo & GetRemoteProductInfo() const { return remoteProductInfo; }
01394 
01395 
01402     const PString & GetCalledPartyName() const { return m_calledPartyName; }
01403 
01410     const PString & GetCalledPartyNumber() const { return m_calledPartyNumber; }
01411 
01419     virtual PString GetCalledPartyURL();
01420 
01421     /* Internal function to copy party names from "network" connection to
01422        "non-network" connection such as OpalPCSSConnection. This allows
01423        the non-network GetRemoteAddress() function and its ilk to return
01424        the intuitive value, i.e. the value from the OTHER connection.
01425      */
01426     void CopyPartyNames(const OpalConnection & other);
01427 
01428 
01442     virtual PString GetAlertingType() const;
01443 
01457     virtual bool SetAlertingType(const PString & info);
01458 
01459 
01463     unsigned GetMinAudioJitterDelay() const { return minAudioJitterDelay; }
01464 
01468     unsigned GetMaxAudioJitterDelay() const { return maxAudioJitterDelay; }
01469 
01472     void SetAudioJitterDelay(
01473       unsigned minDelay,   
01474       unsigned maxDelay    
01475     );
01476 
01479     OpalSilenceDetector * GetSilenceDetector() const { return silenceDetector; }
01480     
01483     OpalEchoCanceler * GetEchoCanceler() const { return echoCanceler; }
01484 
01488     virtual PString GetIdentifier() const;
01489 
01498     virtual PINDEX GetMaxRtpPayloadSize() const;
01499 
01500     virtual OpalTransport & GetTransport() const
01501     { return *(OpalTransport *)NULL; }
01502 
01503     PDICTIONARY(MediaAddressesDict, POrdinalKey, OpalTransportAddress);
01504     MediaAddressesDict & GetMediaTransportAddresses()
01505     { return mediaTransportAddresses; }
01506 
01507 #if OPAL_STATISTICS
01508 
01510     unsigned GetVideoUpdateRequestsSent() const { return m_VideoUpdateRequestsSent; }
01511 #endif
01512 
01513 
01515     const StringOptions & GetStringOptions() const { return m_connStringOptions; }
01516 
01518     void SetStringOptions(
01519       const StringOptions & options,
01520       bool overwrite
01521     );
01522 
01523     virtual void ApplyStringOptions(OpalConnection::StringOptions & stringOptions);
01524     virtual void OnApplyStringOptions();
01525 
01526     virtual void PreviewPeerMediaFormats(const OpalMediaFormatList & fmts);
01527 
01528     virtual void EnableRecording();
01529     virtual void DisableRecording();
01530 
01531 #if OPAL_HAS_IM
01532 
01535     virtual bool TransmitInternalIM(
01536       const OpalMediaFormat & format, 
01537       RTP_DataFrame & body
01538     );
01539 
01543     virtual void OnReceiveInternalIM(
01544       const OpalMediaFormat & format, 
01545       RTP_DataFrame & body
01546     );
01547 
01551     virtual bool TransmitExternalIM(
01552       const OpalMediaFormat & format, 
01553       RTP_DataFrame & body
01554     );
01555 
01559     virtual bool OnReceiveExternalIM(
01560       const OpalMediaFormat & format, 
01561       RTP_DataFrame & body
01562     );
01563 
01564 #endif
01565 
01566   protected:
01567     void OnConnectedInternal();
01568 
01569     PDECLARE_NOTIFIER(PThread, OpalConnection, OnReleaseThreadMain);
01570     PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnRecordAudio);
01571     PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnRecordVideo);
01572     void OnStartRecording(OpalMediaPatch * patch);
01573     void OnStopRecording(OpalMediaPatch * patch);
01574 
01575   // Member variables
01576     OpalCall             & ownerCall;
01577     OpalEndPoint         & endpoint;
01578 
01579   private:
01580     PMutex               phaseMutex;
01581     Phases               phase;
01582 
01583   protected:
01584     PString              callToken;
01585     PBoolean             originating;
01586     PTime                setupTime;
01587     PTime                alertingTime;
01588     PTime                connectedTime;
01589     PTime                callEndTime;
01590     OpalProductInfo      productInfo;
01591     PString              localPartyName;
01592     PString              displayName;
01593     PString              remotePartyName;
01594     OpalProductInfo      remoteProductInfo;
01595     PString              remotePartyNumber;
01596     PString              remotePartyAddress;
01597     CallEndReason        callEndReason;
01598     bool                 synchronousOnRelease;
01599     PString              m_calledPartyNumber;
01600     PString              m_calledPartyName;
01601 
01602     SendUserInputModes    sendUserInputMode;
01603     PString               userInputString;
01604     PSyncPoint            userInputAvailable;
01605 
01606     OpalSilenceDetector * silenceDetector;
01607     OpalEchoCanceler    * echoCanceler;
01608 
01609     MediaAddressesDict         mediaTransportAddresses;
01610     PSafeList<OpalMediaStream> mediaStreams;
01611 
01612     unsigned            minAudioJitterDelay;
01613     unsigned            maxAudioJitterDelay;
01614     unsigned            bandwidthAvailable;
01615 
01616     // The In-Band DTMF detector. This is used inside an audio filter which is
01617     // added to the audio channel.
01618 #if OPAL_PTLIB_DTMF
01619     PDTMFDecoder m_dtmfDecoder;
01620     bool         m_detectInBandDTMF;
01621     unsigned     m_dtmfScaleMultiplier;
01622     unsigned     m_dtmfScaleDivisor;
01623     PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnDetectInBandDTMF);
01624 
01625     bool         m_sendInBandDTMF;
01626     bool         m_installedInBandDTMF;
01627     PDTMFEncoder m_inBandDTMF;
01628     PINDEX       m_emittedInBandDTMF;
01629     PMutex       m_inBandMutex;
01630     PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnSendInBandDTMF);
01631 #endif
01632 
01633 #if PTRACING
01634     friend ostream & operator<<(ostream & o, Phases p);
01635 #endif
01636 
01637     StringOptions m_connStringOptions;
01638 
01639     PString       m_recordingFilename;
01640     PNotifier     m_recordAudioNotifier;
01641     PNotifier     m_recordVideoNotifier;
01642 
01643 #if OPAL_STATISTICS
01644     unsigned m_VideoUpdateRequestsSent;
01645 #endif
01646 
01647     struct AutoStartInfo {
01648       unsigned preferredSessionId;  // preferred session ID (only used for originating)
01649       OpalMediaType::AutoStartMode autoStart;// Mode for this session when the call is started
01650     };
01651 
01652     class AutoStartMap : public std::map<OpalMediaType, AutoStartInfo>
01653     {
01654       public:
01655         AutoStartMap();
01656         void Initialise(const OpalConnection::StringOptions & stringOptions);
01657         OpalMediaType::AutoStartMode GetAutoStart(const OpalMediaType & mediaType) const;
01658         void SetAutoStart(const OpalMediaType & mediaType, OpalMediaType::AutoStartMode autoStart);
01659 
01660       protected:
01661         bool m_initialised;
01662         PMutex m_mutex;
01663 
01664     };
01665     AutoStartMap m_autoStartInfo;
01666 
01667   private:
01668     P_REMOVE_VIRTUAL(PBoolean, OnIncomingConnection(unsigned int), false);
01669     P_REMOVE_VIRTUAL(PBoolean, OnIncomingConnection(), false);
01670 };
01671 
01672 #endif // OPAL_OPAL_CONNECTION_H
01673 
01674 
01675 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Aug 3 20:49:45 2009 for OPAL by  doxygen 1.5.1