00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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
00052 #if OPAL_HAS_IM
00053 #include <im/t140.h>
00054 #include <im/rfc4103.h>
00055 #include <im/im.h>
00056 #endif
00057
00058 class OpalEndPoint;
00059 class OpalCall;
00060 class OpalSilenceDetector;
00061 class OpalEchoCanceler;
00062 class OpalRFC2833Proto;
00063 class OpalRFC2833Info;
00064 class PURL;
00065
00066
00067 #define OPAL_OPT_AUTO_START "AutoStart"
00068 #define OPAL_OPT_CALL_IDENTIFIER "Call-Identifier"
00069 #define OPAL_OPT_CALLING_PARTY_URL "Calling-Party-URL"
00070 #define OPAL_OPT_CALLING_PARTY_NUMBER "Calling-Party-Number"
00071 #define OPAL_OPT_CALLING_PARTY_NAME "Calling-Party-Name"
00072 #define OPAL_OPT_CALLING_PARTY_DOMAIN "Calling-Party-Domain"
00073 #define OPAL_OPT_CALLING_DISPLAY_NAME "Calling-Display-Name"
00074 #define OPAL_OPT_PRESENTATION_BLOCK "Presentation-Block"
00075 #define OPAL_OPT_ORIGINATOR_ADDRESS "Originator-Address"
00076 #define OPAL_OPT_INTERFACE "Interface"
00077 #define OPAL_OPT_ENABLE_INBAND_DTMF "EnableInbandDTMF"
00078 #define OPAL_OPT_ENABLE_INBAND_DTMF "EnableInbandDTMF"
00079 #define OPAL_OPT_DETECT_INBAND_DTMF "DetectInBandDTMF"
00080 #define OPAL_OPT_SEND_INBAND_DTMF "SendInBandDTMF"
00081 #define OPAL_OPT_DTMF_MULT "dtmfmult"
00082 #define OPAL_OPT_DTMF_DIV "dtmfdiv"
00083 #define OPAL_OPT_DISABLE_JITTER "Disable-Jitter"
00084 #define OPAL_OPT_MAX_JITTER "Max-Jitter"
00085 #define OPAL_OPT_MIN_JITTER "Min-Jitter"
00086 #define OPAL_OPT_RECORD_AUDIO "Record-Audio"
00087 #define OPAL_OPT_ALERTING_TYPE "Alerting-Type"
00088 #define OPAL_OPT_REMOVE_CODEC "Remove-Codec"
00089
00090
00301 class OpalProductInfo
00302 {
00303 public:
00304 OpalProductInfo();
00305
00306 static OpalProductInfo & Default();
00307
00308 friend ostream & operator<<(ostream & strm, const OpalProductInfo & info);
00309 PCaselessString AsString() const;
00310
00311 PCaselessString vendor;
00312 PCaselessString name;
00313 PCaselessString version;
00314 PCaselessString comments;
00315
00316 BYTE t35CountryCode;
00317 BYTE t35Extension;
00318 WORD manufacturerCode;
00319
00320 private:
00321 OpalProductInfo(bool);
00322 };
00323
00324
00342 class OpalConnection : public PSafeObject
00343 {
00344 PCLASSINFO(OpalConnection, PSafeObject);
00345 public:
00350 enum CallEndReasonCodes {
00351 EndedByLocalUser,
00352 EndedByNoAccept,
00353 EndedByAnswerDenied,
00354 EndedByRemoteUser,
00355 EndedByRefusal,
00356 EndedByNoAnswer,
00357 EndedByCallerAbort,
00358 EndedByTransportFail,
00359 EndedByConnectFail,
00360 EndedByGatekeeper,
00361 EndedByNoUser,
00362 EndedByNoBandwidth,
00363 EndedByCapabilityExchange,
00364 EndedByCallForwarded,
00365 EndedBySecurityDenial,
00366 EndedByLocalBusy,
00367 EndedByLocalCongestion,
00368 EndedByRemoteBusy,
00369 EndedByRemoteCongestion,
00370 EndedByUnreachable,
00371 EndedByNoEndPoint,
00372 EndedByHostOffline,
00373 EndedByTemporaryFailure,
00374 EndedByQ931Cause,
00375 EndedByDurationLimit,
00376 EndedByInvalidConferenceID,
00377 EndedByNoDialTone,
00378 EndedByNoRingBackTone,
00379 EndedByOutOfService,
00380 EndedByAcceptingCallWaiting,
00381 EndedByGkAdmissionFailed,
00382 NumCallEndReasons
00383 };
00384
00385 struct CallEndReason {
00386 CallEndReason(
00387 CallEndReasonCodes reason = NumCallEndReasons,
00388 unsigned cause = 0
00389 ) : code(reason), q931(cause) { }
00390 explicit CallEndReason(
00391 long reason
00392 ) : code((CallEndReasonCodes)reason), q931(0) { }
00393
00394 operator CallEndReasonCodes() const { return code; }
00395
00396 CallEndReasonCodes code:8;
00397 unsigned q931:8;
00398 };
00399
00400 #if PTRACING
00401 friend ostream & operator<<(ostream & o, CallEndReason reason);
00402 #endif
00403
00404 enum AnswerCallResponse {
00405 AnswerCallNow,
00406 AnswerCallDenied,
00407 AnswerCallPending,
00408 AnswerCallDeferred,
00409 AnswerCallAlertWithMedia,
00410 AnswerCallDeferredWithMedia,
00411 AnswerCallProgress,
00412 AnswerCallNowAndReleaseCurrent,
00413 NumAnswerCallResponses
00414 };
00415 #if PTRACING
00416 friend ostream & operator<<(ostream & o, AnswerCallResponse s);
00417 #endif
00418
00421 enum Options {
00422 FastStartOptionDisable = 0x0001,
00423 FastStartOptionEnable = 0x0002,
00424 FastStartOptionMask = 0x0003,
00425
00426 H245TunnelingOptionDisable = 0x0004,
00427 H245TunnelingOptionEnable = 0x0008,
00428 H245TunnelingOptionMask = 0x000c,
00429
00430 H245inSetupOptionDisable = 0x0010,
00431 H245inSetupOptionEnable = 0x0020,
00432 H245inSetupOptionMask = 0x0030,
00433
00434 DetectInBandDTMFOptionDisable = 0x0040,
00435 DetectInBandDTMFOptionEnable = 0x0080,
00436 DetectInBandDTMFOptionMask = 0x00c0,
00437
00438 RTPAggregationDisable = 0x0100,
00439 RTPAggregationEnable = 0x0200,
00440 RTPAggregationMask = 0x0300,
00441
00442 SendDTMFAsDefault = 0x0000,
00443 SendDTMFAsString = 0x0400,
00444 SendDTMFAsTone = 0x0800,
00445 SendDTMFAsRFC2833 = 0x0c00,
00446 SendDTMFMask = 0x0c00
00447 };
00448
00449 class StringOptions : public PStringToString
00450 {
00451 public:
00452
00453 PBoolean SetAt(const char * key, const PString & data)
00454 {
00455 return PStringToString::SetAt(PCaselessString(key), data);
00456 }
00457 PBoolean SetAt(const PString & key, const PString & data)
00458 {
00459 return PStringToString::SetAt(PCaselessString(key), data);
00460 }
00461 PBoolean SetAt(const PCaselessString & key, const PString & data)
00462 {
00463 return PStringToString::SetAt(key, data);
00464 }
00465
00466 bool GetBoolean(
00467 const char * key,
00468 bool dflt = false
00469 ) const;
00470 bool GetBoolean(
00471 const PString & key,
00472 bool dflt = false
00473 ) const { return GetBoolean((const char *)key, dflt); }
00474
00475 long GetInteger(
00476 const char * key,
00477 long dflt = 0
00478 ) const;
00479 long GetInteger(
00480 const PString & key,
00481 long dflt = 0
00482 ) const { return GetInteger((const char *)key, dflt); }
00483
00488 void ExtractFromURL(
00489 PURL & url
00490 );
00491 };
00492
00497 OpalConnection(
00498 OpalCall & call,
00499 OpalEndPoint & endpoint,
00500 const PString & token,
00501 unsigned options = 0,
00502 OpalConnection::StringOptions * stringOptions = NULL
00503 );
00504
00507 ~OpalConnection();
00509
00516 void PrintOn(
00517 ostream & strm
00518 ) const;
00520
00537 virtual bool IsNetworkConnection() const = 0;
00538
00542 enum Phases {
00543 UninitialisedPhase,
00544 SetUpPhase,
00545 ProceedingPhase,
00546 AlertingPhase,
00547 ConnectedPhase,
00548 EstablishedPhase,
00549 ForwardingPhase,
00550 ReleasingPhase,
00551 ReleasedPhase,
00552 NumPhases
00553 };
00554
00559 inline Phases GetPhase() const { return phase; }
00560
00565 void SetPhase(
00566 Phases phaseToSet
00567 );
00568
00577 CallEndReason GetCallEndReason() const { return callEndReason; }
00578
00581 static PString GetCallEndReasonText(CallEndReason reason);
00582 PString GetCallEndReasonText() const { return GetCallEndReasonText(callEndReason); }
00583
00586 static void SetCallEndReasonText(CallEndReasonCodes reasonCode, const PString & newText);
00587
00592 virtual void SetCallEndReason(
00593 CallEndReason reason
00594 );
00595
00603 void ClearCall(
00604 CallEndReason reason = EndedByLocalUser
00605 );
00606
00609 virtual void ClearCallSynchronous(
00610 PSyncPoint * sync,
00611 CallEndReason reason = EndedByLocalUser
00612 );
00613
00617 unsigned GetQ931Cause() const { return callEndReason.q931; }
00618
00622 void SetQ931Cause(unsigned v) { callEndReason.q931 = v; }
00623
00630 virtual bool TransferConnection(
00631 const PString & remoteParty
00632 );
00633
00636 virtual bool HoldConnection();
00637
00641 virtual bool RetrieveConnection();
00642
00647 virtual bool IsConnectionOnHold(
00648 bool fromRemote
00649 );
00650
00655 virtual void OnHold(
00656 bool fromRemote,
00657 bool onHold
00658 );
00660
00688 virtual PBoolean OnIncomingConnection(unsigned int options, OpalConnection::StringOptions * stringOptions);
00689
00696 virtual PBoolean SetUpConnection() = 0;
00697
00701 virtual PBoolean OnSetUpConnection();
00702
00703
00718 virtual void OnProceeding();
00719
00730 virtual void OnAlerting();
00731
00742 virtual PBoolean SetAlerting(
00743 const PString & calleeName,
00744 PBoolean withMedia
00745 ) = 0;
00746
00763 virtual AnswerCallResponse OnAnswerCall(
00764 const PString & callerName
00765 );
00766
00777 virtual void AnsweringCall(
00778 AnswerCallResponse response
00779 );
00780
00795 virtual void OnConnected();
00796
00807 virtual PBoolean SetConnected();
00808
00820 virtual void OnEstablished();
00821
00830 virtual void Release(
00831 CallEndReason reason = EndedByLocalUser
00832 );
00833
00851 virtual void OnReleased();
00853
00864 virtual PString GetDestinationAddress();
00865
00875 virtual PBoolean ForwardCall(
00876 const PString & forwardParty
00877 );
00878
00881 PSafePtr<OpalConnection> GetOtherPartyConnection() const;
00882
00885 template <class cls> PSafePtr<cls> GetOtherPartyConnectionAs() const { return PSafePtrCast<OpalConnection, cls>(GetOtherPartyConnection()); }
00887
00896 virtual OpalMediaFormatList GetMediaFormats() const;
00897
00902 virtual OpalMediaFormatList GetLocalMediaFormats();
00903
00916 virtual void AdjustMediaFormats(
00917 bool local,
00918 OpalMediaFormatList & mediaFormats,
00919 OpalConnection * otherConnection
00920 ) const;
00921
00929 virtual unsigned GetNextSessionID(
00930 const OpalMediaType & mediaType,
00931 bool isSource
00932 );
00933
00940 virtual OpalMediaType::AutoStartMode GetAutoStart(
00941 const OpalMediaType & mediaType
00942 ) const;
00943
00946 virtual void AutoStartMediaStreams(
00947 bool force = false
00948 );
00949
00950 #if OPAL_FAX
00951
00953 virtual bool SwitchFaxMediaStreams(
00954 bool enableFax
00955 );
00956
00961 virtual void OnSwitchedFaxMediaStreams(
00962 bool enabledFax
00963 );
00964 #endif
00965
00968 virtual OpalMediaStreamPtr OpenMediaStream(
00969 const OpalMediaFormat & mediaFormat,
00970 unsigned sessionID,
00971 bool isSource
00972 );
00973
00978 virtual bool CloseMediaStream(
00979 unsigned sessionId,
00980 bool source
00981 );
00982
00987 virtual bool CloseMediaStream(
00988 OpalMediaStream & stream
00989 );
00990
00998 bool RemoveMediaStream(
00999 OpalMediaStream & strm
01000 );
01001
01004 virtual void StartMediaStreams();
01005
01008 virtual void CloseMediaStreams();
01009
01012 virtual void PauseMediaStreams(PBoolean paused);
01013
01026 virtual OpalMediaStream * CreateMediaStream(
01027 const OpalMediaFormat & mediaFormat,
01028 unsigned sessionID,
01029 PBoolean isSource
01030 );
01031
01038 OpalMediaStreamPtr GetMediaStream(
01039 const PString & streamID,
01040 bool source
01041 ) const;
01042
01048 OpalMediaStreamPtr GetMediaStream(
01049 unsigned sessionId,
01050 bool source
01051 ) const;
01052
01063 OpalMediaStreamPtr GetMediaStream(
01064 const OpalMediaType & mediaType,
01065 bool source,
01066 OpalMediaStreamPtr previous = NULL
01067 ) const;
01068
01080 virtual PBoolean OnOpenMediaStream(
01081 OpalMediaStream & stream
01082 );
01083
01088 virtual void OnClosedMediaStream(
01089 const OpalMediaStream & stream
01090 );
01091
01100 virtual void OnPatchMediaStream(
01101 PBoolean isSource,
01102 OpalMediaPatch & patch
01103 );
01104
01107 virtual void OnStartMediaPatch(
01108 OpalMediaPatch & patch
01109 );
01110
01113 virtual void OnStopMediaPatch(
01114 OpalMediaPatch & patch
01115 );
01116
01120 PDECLARE_NOTIFIER(OpalMediaCommand, OpalConnection, OnMediaCommand);
01121
01126 virtual void AttachRFC2833HandlerToPatch(PBoolean isSource, OpalMediaPatch & patch);
01127
01133 virtual PBoolean IsMediaBypassPossible(
01134 unsigned sessionID
01135 ) const;
01136
01137 #if OPAL_VIDEO
01138
01140 virtual PBoolean CreateVideoInputDevice(
01141 const OpalMediaFormat & mediaFormat,
01142 PVideoInputDevice * & device,
01143 PBoolean & autoDelete
01144 );
01145
01149 virtual PBoolean CreateVideoOutputDevice(
01150 const OpalMediaFormat & mediaFormat,
01151 PBoolean preview,
01152 PVideoOutputDevice * & device,
01153 PBoolean & autoDelete
01154 );
01155
01158 virtual bool SendVideoUpdatePicture(
01159 unsigned sessionID = 0,
01160 int firstGOB = -1,
01161 int firstMB = -1,
01162 int numBlocks = 0
01163 ) const;
01164 #endif
01165
01168 virtual PBoolean SetAudioVolume(
01169 PBoolean source,
01170 unsigned percentage
01171 );
01172
01176 virtual unsigned GetAudioSignalLevel(
01177 PBoolean source
01178 );
01180
01185 unsigned GetBandwidthAvailable() const { return bandwidthAvailable; }
01186
01191 virtual PBoolean SetBandwidthAvailable(
01192 unsigned newBandwidth,
01193 PBoolean force = PFalse
01194 );
01195
01200 virtual unsigned GetBandwidthUsed() const;
01201
01210 virtual PBoolean SetBandwidthUsed(
01211 unsigned releasedBandwidth,
01212 unsigned requiredBandwidth
01213 );
01215
01218 enum SendUserInputModes {
01219 SendUserInputAsQ931,
01220 SendUserInputAsString,
01221 SendUserInputAsTone,
01222 SendUserInputAsInlineRFC2833,
01223 SendUserInputAsSeparateRFC2833,
01224 SendUserInputAsProtocolDefault,
01225 NumSendUserInputModes
01226 };
01227 #if PTRACING
01228 friend ostream & operator<<(ostream & o, SendUserInputModes m);
01229 #endif
01230
01233 virtual void SetSendUserInputMode(SendUserInputModes mode);
01234
01237 virtual SendUserInputModes GetSendUserInputMode() const { return sendUserInputMode; }
01238
01244 virtual SendUserInputModes GetRealSendUserInputMode() const { return GetSendUserInputMode(); }
01245
01252 virtual PBoolean SendUserInputString(
01253 const PString & value
01254 );
01255
01272 virtual PBoolean SendUserInputTone(
01273 char tone,
01274 unsigned duration = 0
01275 );
01276
01283 virtual void OnUserInputString(
01284 const PString & value
01285 );
01286
01293 virtual void OnUserInputTone(
01294 char tone,
01295 unsigned duration
01296 );
01297
01301 void SendUserInputHookFlash(
01302 unsigned duration = 500
01303 ) { SendUserInputTone('!', duration); }
01304
01307 virtual PString GetUserInput(
01308 unsigned timeout = 30
01309 );
01310
01315 virtual void SetUserInput(
01316 const PString & input
01317 );
01318
01321 virtual PString ReadUserInput(
01322 const char * terminators = "#\r\n",
01323 unsigned lastDigitTimeout = 4,
01324 unsigned firstDigitTimeout = 30
01325 );
01326
01333 virtual PBoolean PromptUserInput(
01334 PBoolean play
01335 );
01337
01342 virtual bool GarbageCollection();
01344
01349 OpalEndPoint & GetEndPoint() const { return endpoint; }
01350
01353 OpalCall & GetCall() const { return ownerCall; }
01354
01357 const PString & GetToken() const { return callToken; }
01358
01361 PBoolean IsOriginating() const { return originating; }
01362
01365 PTime GetSetupUpTime() const { return setupTime; }
01366
01369 PTime GetAlertingTime() const { return alertingTime; }
01370
01373 PTime GetConnectionStartTime() const { return connectedTime; }
01374
01377 PTime GetConnectionEndTime() const { return callEndTime; }
01378
01381 const OpalProductInfo & GetProductInfo() const { return productInfo; }
01382
01385 void SetProductInfo(
01386 const OpalProductInfo & info
01387 ) { productInfo = info; }
01388
01391 virtual PString GetPrefixName() const;
01392
01395 const PString & GetLocalPartyName() const { return localPartyName; }
01396
01399 virtual void SetLocalPartyName(const PString & name);
01400
01403 virtual PString GetLocalPartyURL() const;
01404
01407 const PString & GetDisplayName() const { return displayName; }
01408
01411 void SetDisplayName(const PString & name) { displayName = name; }
01412
01418 virtual bool IsPresentationBlocked() const;
01419
01422 const PString & GetRemotePartyName() const { return remotePartyName; }
01423
01426 void SetRemotePartyName(const PString & name) { remotePartyName = name; }
01427
01436 const PString & GetRemotePartyNumber() const { return remotePartyNumber; }
01437
01443 const PString & GetRemotePartyAddress() const { return remotePartyAddress; }
01444
01447 void SetRemotePartyAddress(const PString & addr) { remotePartyAddress = addr; }
01448
01455 virtual PString GetRemotePartyURL() const;
01456
01457
01458 const PString GetRemotePartyCallbackURL() const { return GetRemotePartyURL(); }
01459
01463 PCaselessString GetRemoteApplication() const { return remoteProductInfo.AsString(); }
01464
01467 const OpalProductInfo & GetRemoteProductInfo() const { return remoteProductInfo; }
01468
01469
01476 const PString & GetCalledPartyName() const { return m_calledPartyName; }
01477
01484 const PString & GetCalledPartyNumber() const { return m_calledPartyNumber; }
01485
01493 virtual PString GetCalledPartyURL();
01494
01495
01496
01497
01498
01499
01500 void CopyPartyNames(const OpalConnection & other);
01501
01502
01516 virtual PString GetAlertingType() const;
01517
01531 virtual bool SetAlertingType(const PString & info);
01532
01533
01537 unsigned GetMinAudioJitterDelay() const { return minAudioJitterDelay; }
01538
01542 unsigned GetMaxAudioJitterDelay() const { return maxAudioJitterDelay; }
01543
01546 void SetAudioJitterDelay(
01547 unsigned minDelay,
01548 unsigned maxDelay
01549 );
01550
01553 OpalSilenceDetector * GetSilenceDetector() const { return silenceDetector; }
01554
01555 #if OPAL_AEC
01556
01558 OpalEchoCanceler * GetEchoCanceler() const { return echoCanceler; }
01559 #endif
01560
01564 virtual PString GetIdentifier() const;
01565
01574 virtual PINDEX GetMaxRtpPayloadSize() const;
01575
01576 virtual OpalTransport & GetTransport() const
01577 { return *(OpalTransport *)NULL; }
01578
01579 PDICTIONARY(MediaAddressesDict, POrdinalKey, OpalTransportAddress);
01580 MediaAddressesDict & GetMediaTransportAddresses()
01581 { return mediaTransportAddresses; }
01582
01583 #if OPAL_STATISTICS
01584
01586 unsigned GetVideoUpdateRequestsSent() const { return m_VideoUpdateRequestsSent; }
01587 #endif
01588
01589
01591 const StringOptions & GetStringOptions() const { return m_connStringOptions; }
01592
01594 void SetStringOptions(
01595 const StringOptions & options,
01596 bool overwrite
01597 );
01598
01599 virtual void ApplyStringOptions(OpalConnection::StringOptions & stringOptions);
01600 virtual void OnApplyStringOptions();
01601
01602 #if OPAL_HAS_MIXER
01603
01604 virtual void EnableRecording();
01605 virtual void DisableRecording();
01606
01607 #endif
01608
01609 #if OPAL_HAS_IM
01610
01613 virtual bool TransmitInternalIM(
01614 const OpalMediaFormat & format,
01615 RTP_IMFrame & body
01616 );
01617
01621 virtual void OnReceiveInternalIM(
01622 const OpalMediaFormat & format,
01623 RTP_IMFrame & body
01624 );
01625
01629 virtual bool TransmitExternalIM(
01630 const OpalMediaFormat & format,
01631 RTP_IMFrame & body
01632 );
01633
01637 virtual bool OnReceiveExternalIM(
01638 const OpalMediaFormat & format,
01639 RTP_IMFrame & body
01640 );
01641
01646 RFC4103Context & GetRFC4103Context(PINDEX i) { return m_rfc4103Context[i]; };
01647
01648 protected:
01649 RFC4103Context m_rfc4103Context[2];
01650
01651 #endif
01652
01653 protected:
01654 void OnConnectedInternal();
01655
01656 PDECLARE_NOTIFIER(PThread, OpalConnection, OnReleaseThreadMain);
01657
01658 #if OPAL_HAS_MIXER
01659 PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnRecordAudio);
01660 #if OPAL_VIDEO
01661 PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnRecordVideo);
01662 #endif
01663 void OnStartRecording(OpalMediaPatch * patch);
01664 void OnStopRecording(OpalMediaPatch * patch);
01665 #endif
01666
01667
01668 OpalCall & ownerCall;
01669 OpalEndPoint & endpoint;
01670
01671 private:
01672 PMutex phaseMutex;
01673 Phases phase;
01674
01675 protected:
01676 PString callToken;
01677 PBoolean originating;
01678 PTime setupTime;
01679 PTime alertingTime;
01680 PTime connectedTime;
01681 PTime callEndTime;
01682 OpalProductInfo productInfo;
01683 PString localPartyName;
01684 PString displayName;
01685 PString remotePartyName;
01686 PString remotePartyURL;
01687 OpalProductInfo remoteProductInfo;
01688 PString remotePartyNumber;
01689 PString remotePartyAddress;
01690 CallEndReason callEndReason;
01691 bool synchronousOnRelease;
01692 PString m_calledPartyNumber;
01693 PString m_calledPartyName;
01694
01695 SendUserInputModes sendUserInputMode;
01696 PString userInputString;
01697 PSyncPoint userInputAvailable;
01698
01699 OpalSilenceDetector * silenceDetector;
01700 #if OPAL_AEC
01701 OpalEchoCanceler * echoCanceler;
01702 #endif
01703
01704 MediaAddressesDict mediaTransportAddresses;
01705 PSafeList<OpalMediaStream> mediaStreams;
01706
01707 unsigned minAudioJitterDelay;
01708 unsigned maxAudioJitterDelay;
01709 unsigned bandwidthAvailable;
01710
01711
01712
01713 #if OPAL_PTLIB_DTMF
01714 PDTMFDecoder m_dtmfDecoder;
01715 bool m_detectInBandDTMF;
01716 unsigned m_dtmfScaleMultiplier;
01717 unsigned m_dtmfScaleDivisor;
01718 PNotifier m_dtmfNotifier;
01719 PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnDetectInBandDTMF);
01720
01721 bool m_sendInBandDTMF;
01722 bool m_installedInBandDTMF;
01723 PDTMFEncoder m_inBandDTMF;
01724 PINDEX m_emittedInBandDTMF;
01725 PMutex m_inBandMutex;
01726 PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnSendInBandDTMF);
01727 #endif
01728
01729 #if PTRACING
01730 friend ostream & operator<<(ostream & o, Phases p);
01731 #endif
01732
01733 StringOptions m_connStringOptions;
01734
01735 #if OPAL_HAS_MIXER
01736 PString m_recordingFilename;
01737 PNotifier m_recordAudioNotifier;
01738 #if OPAL_VIDEO
01739 PNotifier m_recordVideoNotifier;
01740 #endif
01741 #endif
01742
01743 #if OPAL_STATISTICS
01744 unsigned m_VideoUpdateRequestsSent;
01745 #endif
01746
01747 struct AutoStartInfo {
01748 unsigned preferredSessionId;
01749 OpalMediaType::AutoStartMode autoStart;
01750 };
01751
01752 class AutoStartMap : public std::map<OpalMediaType, AutoStartInfo>
01753 {
01754 public:
01755 AutoStartMap();
01756 void Initialise(const OpalConnection::StringOptions & stringOptions);
01757 OpalMediaType::AutoStartMode GetAutoStart(const OpalMediaType & mediaType) const;
01758 void SetAutoStart(const OpalMediaType & mediaType, OpalMediaType::AutoStartMode autoStart);
01759
01760 protected:
01761 bool m_initialised;
01762 PMutex m_mutex;
01763
01764 };
01765 AutoStartMap m_autoStartInfo;
01766
01767 #if OPAL_FAX
01768 enum {
01769 e_NotSwitchingFaxMediaStreams,
01770 e_SwitchingToFaxMediaStreams,
01771 e_SwitchingFromFaxMediaStreams
01772 } m_faxMediaStreamsSwitchState;
01773 #endif
01774
01775 private:
01776 P_REMOVE_VIRTUAL(PBoolean, OnIncomingConnection(unsigned int), false);
01777 P_REMOVE_VIRTUAL(PBoolean, OnIncomingConnection(), false);
01778 P_REMOVE_VIRTUAL(PBoolean, IsConnectionOnHold(), false);
01779 P_REMOVE_VIRTUAL_VOID(OnMediaPatchStart(unsigned, bool));
01780 P_REMOVE_VIRTUAL_VOID(OnMediaPatchStop(unsigned, bool));
01781 P_REMOVE_VIRTUAL_VOID(AdjustMediaFormats(OpalMediaFormatList &) const);
01782 P_REMOVE_VIRTUAL_VOID(AdjustMediaFormats(OpalMediaFormatList &, OpalConnection *) const);
01783 P_REMOVE_VIRTUAL_VOID(PreviewPeerMediaFormats(const OpalMediaFormatList &));
01784 };
01785
01786 #endif // OPAL_OPAL_CONNECTION_H
01787
01788
01789