OPAL  Version 3.12.5
connection.h
Go to the documentation of this file.
1 /*
2  * connection.h
3  *
4  * Telephony connection abstraction
5  *
6  * Open Phone Abstraction Library (OPAL)
7  * Formally known as the Open H323 project.
8  *
9  * Copyright (c) 2001 Equivalence Pty. Ltd.
10  *
11  * The contents of this file are subject to the Mozilla Public License
12  * Version 1.0 (the "License"); you may not use this file except in
13  * compliance with the License. You may obtain a copy of the License at
14  * http://www.mozilla.org/MPL/
15  *
16  * Software distributed under the License is distributed on an "AS IS"
17  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18  * the License for the specific language governing rights and limitations
19  * under the License.
20  *
21  * The Original Code is Open Phone Abstraction Library.
22  *
23  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24  *
25  * Contributor(s): Post Increment
26  * Portions of this code were written with the assistance of funding from
27  * US Joint Forces Command Joint Concept Development & Experimentation (J9)
28  * http://www.jfcom.mil/about/abt_j9.htm
29  *
30  * $Revision: 30182 $
31  * $Author: rjongbloed $
32  * $Date: 2013-07-28 22:20:46 -0500 (Sun, 28 Jul 2013) $
33  */
34 
35 #ifndef OPAL_OPAL_CONNECTION_H
36 #define OPAL_OPAL_CONNECTION_H
37 
38 #ifdef P_USE_PRAGMA
39 #pragma interface
40 #endif
41 
42 #include <opal/buildopts.h>
43 
44 #include <opal/mediafmt.h>
45 #include <opal/mediastrm.h>
46 #include <opal/guid.h>
47 #include <opal/transports.h>
48 #include <ptclib/dtmf.h>
49 #include <ptlib/safecoll.h>
50 #include <rtp/rtp.h>
51 
52 #if OPAL_SCRIPT
53 // Inside #if so does not force loading of factories when statically linked.
54 #include <ptclib/script.h>
55 #endif
56 
57 
58 class OpalEndPoint;
59 class OpalCall;
62 class OpalEchoCanceler;
63 class OpalRFC2833Proto;
64 class OpalRFC2833Info;
65 class PURL;
66 
67 
68 #define OPAL_URL_PARAM_PREFIX "OPAL-"
69 
70 #define OPAL_OPT_AUTO_START "AutoStart"
71 #define OPAL_OPT_CALL_IDENTIFIER "Call-Identifier"
72 #define OPAL_OPT_CALLING_PARTY_URL "Calling-Party-URL"
73 #define OPAL_OPT_CALLING_PARTY_NUMBER "Calling-Party-Number"
74 #define OPAL_OPT_CALLING_PARTY_NAME "Calling-Party-Name"
75 #define OPAL_OPT_CALLING_PARTY_DOMAIN "Calling-Party-Domain"
76 #define OPAL_OPT_CALLING_DISPLAY_NAME "Calling-Display-Name"
77 #define OPAL_OPT_CALLED_PARTY_NAME "Called-Party-Name"
78 #define OPAL_OPT_CALLED_DISPLAY_NAME "Called-Display-Name"
79 #define OPAL_OPT_REDIRECTING_PARTY "Redirecting-Party"
80 #define OPAL_OPT_PRESENTATION_BLOCK "Presentation-Block"
81 #define OPAL_OPT_ORIGINATOR_ADDRESS "Originator-Address"
82 #define OPAL_OPT_INTERFACE "Interface"
83 #define OPAL_OPT_USER_INPUT_MODE "User-Input-Mode"
84 #define OPAL_OPT_ENABLE_INBAND_DTMF "EnableInbandDTMF"
86 #define OPAL_OPT_ENABLE_INBAND_DTMF "EnableInbandDTMF"
87 #define OPAL_OPT_DETECT_INBAND_DTMF "DetectInBandDTMF"
88 #define OPAL_OPT_SEND_INBAND_DTMF "SendInBandDTMF"
89 #define OPAL_OPT_DTMF_MULT "dtmfmult"
90 #define OPAL_OPT_DTMF_DIV "dtmfdiv"
91 #define OPAL_OPT_DISABLE_JITTER "Disable-Jitter"
92 #define OPAL_OPT_MAX_JITTER "Max-Jitter"
93 #define OPAL_OPT_MIN_JITTER "Min-Jitter"
94 #define OPAL_OPT_RECORD_AUDIO "Record-Audio"
95 #define OPAL_OPT_ALERTING_TYPE "Alerting-Type"
96 #define OPAL_OPT_REMOVE_CODEC "Remove-Codec"
97 
98 
102 #define OPAL_OPT_SILENCE_DETECT_MODE "Silence-Detect"
103 
104 
124 #define OPAL_OPT_VIDUP_METHODS "Video-Update-Picture-Method"
125 #define OPAL_OPT_VIDUP_METHOD_OOB 1
126 #define OPAL_OPT_VIDUP_METHOD_RTCP 2
127 #define OPAL_OPT_VIDUP_METHOD_PLI 4
128 #define OPAL_OPT_VIDUP_METHOD_FIR 8
129 #define OPAL_OPT_VIDUP_METHOD_DEFAULT 3
130 
131 
132 
346 {
347  public:
348  OpalProductInfo();
349 
350  static OpalProductInfo & Default();
351 
352  friend ostream & operator<<(ostream & strm, const OpalProductInfo & info);
353 
357  PCaselessString AsString() const;
358 
359  PCaselessString vendor;
360  PCaselessString name;
361  PCaselessString version;
362  PCaselessString comments;
363 
367 
368  private:
369  OpalProductInfo(bool);
370 };
371 
372 
390 class OpalConnection : public PSafeObject
391 {
392  PCLASSINFO(OpalConnection, PSafeObject);
393  public:
398  P_DECLARE_TRACED_ENUM_EX(CallEndReasonCodes,NumCallEndReasons,
399  EndedByLocalUser,0,
400  EndedByNoAccept,
401  EndedByAnswerDenied,
402  EndedByRemoteUser,
403  EndedByRefusal,
404  EndedByNoAnswer,
405  EndedByCallerAbort,
406  EndedByTransportFail,
407  EndedByConnectFail,
408  EndedByGatekeeper,
409  EndedByNoUser,
410  EndedByNoBandwidth,
411  EndedByCapabilityExchange,
412  EndedByCallForwarded,
413  EndedBySecurityDenial,
414  EndedByLocalBusy,
415  EndedByLocalCongestion,
416  EndedByRemoteBusy,
417  EndedByRemoteCongestion,
418  EndedByUnreachable,
419  EndedByNoEndPoint,
420  EndedByHostOffline,
421  EndedByTemporaryFailure,
422  EndedByQ931Cause,
423  EndedByDurationLimit,
424  EndedByInvalidConferenceID,
425  EndedByNoDialTone,
426  EndedByNoRingBackTone,
427  EndedByOutOfService,
428  EndedByAcceptingCallWaiting,
429  EndedByGkAdmissionFailed,
430  EndedByMediaFailed,
431  EndedByCallCompletedElsewhere,
432  EndedByCertificateAuthority,
433  EndedByIllegalAddress
434  );
435 
436  struct CallEndReason {
438  CallEndReasonCodes reason = NumCallEndReasons,
439  unsigned cause = 0
440  ) : code(reason), q931(cause) { }
441  explicit CallEndReason(
442  long reason
443  ) : code((CallEndReasonCodes)(reason&0xff)), q931((reason>>8)&0xff) { }
444 
445  __inline operator CallEndReasonCodes() const { return code; }
446 
447  __inline int AsInteger() const { return code|(q931<<8); }
448 
449  CallEndReasonCodes code:8; // Normalised OPAL code
450  unsigned q931:8; // PSTN Interworking code, actually Q.850
451  };
452 
453 #if PTRACING
454  friend ostream & operator<<(ostream & o, CallEndReason reason);
455 #endif
456 
457  P_DECLARE_TRACED_ENUM(AnswerCallResponse,
458  AnswerCallNow,
459  AnswerCallDenied,
460  AnswerCallPending,
461  AnswerCallDeferred,
462  AnswerCallAlertWithMedia,
463  AnswerCallDeferredWithMedia,
464  AnswerCallProgress,
465  AnswerCallNowAndReleaseCurrent
466  );
467 
470  enum Options {
471  FastStartOptionDisable = 0x0001, // H.323 specific
474 
475  H245TunnelingOptionDisable = 0x0004, // H.323 specific
478 
479  H245inSetupOptionDisable = 0x0010, // H.323 specific
482 
483  DetectInBandDTMFOptionDisable = 0x0040, // SIP and H.323
486 
487  RTPAggregationDisable = 0x0100, // SIP and H.323
490 
491  SendDTMFAsDefault = 0x0000, // SIP and H.323
493  SendDTMFAsTone = 0x0800,
495  SendDTMFMask = 0x0c00
496  };
497 
498  class StringOptions : public PStringOptions
499  {
500  public:
505  void ExtractFromURL(
506  PURL & url
507  );
508 
514  void ExtractFromString(
515  PString & str
516  );
517  };
518 
524  OpalCall & call,
526  const PString & token,
527  unsigned options = 0,
528  OpalConnection::StringOptions * stringOptions = NULL
529  );
530 
533  ~OpalConnection();
535 
542  void PrintOn(
543  ostream & strm
544  ) const;
546 
563  virtual bool IsNetworkConnection() const = 0;
564 
568  P_DECLARE_TRACED_ENUM(Phases,
569  UninitialisedPhase,
570  SetUpPhase,
571  ProceedingPhase,
572  AlertingPhase,
573  ConnectedPhase,
574  EstablishedPhase,
575  ForwardingPhase,
576  ReleasingPhase,
577  ReleasedPhase
578  );
579 
584  __inline Phases GetPhase() const { return m_phase; }
585 
587  __inline bool IsEstablished() const { return m_phase == EstablishedPhase; }
588 
590  __inline bool IsReleased() const { return m_phase >= ReleasingPhase; }
591 
596  void SetPhase(
597  Phases phaseToSet
598  );
599 
609 
612  static PString GetCallEndReasonText(CallEndReason reason);
614 
617  static void SetCallEndReasonText(CallEndReasonCodes reasonCode, const PString & newText);
618 
623  virtual void SetCallEndReason(
624  CallEndReason reason
625  );
626 
636  void ClearCall(
637  CallEndReason reason = EndedByLocalUser,
638  PSyncPoint * sync = NULL
639  );
640 
645  virtual void ClearCallSynchronous(
646  PSyncPoint * sync,
647  CallEndReason reason = EndedByLocalUser
648  );
649 
653  unsigned GetQ931Cause() const { return callEndReason.q931; }
654 
658  void SetQ931Cause(unsigned v) { callEndReason.q931 = v; }
659 
666  virtual bool TransferConnection(
667  const PString & remoteParty
668  );
669 
677  virtual bool Hold(
678  bool fromRemote,
679  bool placeOnHold
680  );
681 
686  virtual bool IsOnHold(
687  bool fromRemote
688  );
689 
694  virtual void OnHold(
695  bool fromRemote,
696  bool onHold
697  );
699 
727  virtual PBoolean OnIncomingConnection(unsigned int options, OpalConnection::StringOptions * stringOptions);
728 
736  virtual PBoolean SetUpConnection();
737 
741  virtual PBoolean OnSetUpConnection();
742 
743 
758  virtual void OnProceeding();
759 
770  virtual void OnAlerting();
771 
782  virtual PBoolean SetAlerting(
783  const PString & calleeName,
784  PBoolean withMedia
785  );
786 
803  virtual AnswerCallResponse OnAnswerCall(
804  const PString & callerName
805  );
806 
817  virtual void AnsweringCall(
818  AnswerCallResponse response
819  );
820 
835  virtual void OnConnected();
836 
847  virtual PBoolean SetConnected();
848 
860  virtual void OnEstablished();
861 
909  virtual bool OnTransferNotify(
910  const PStringToString & info,
911  const OpalConnection * transferringConnection
913  );
914 
923  virtual void Release(
924  CallEndReason reason = EndedByLocalUser,
925  bool synchronous = false
926  );
927 
945  virtual void OnReleased();
947 
958  virtual PString GetDestinationAddress();
959 
969  virtual PBoolean ForwardCall(
970  const PString & forwardParty
971  );
972 
975  PSafePtr<OpalConnection> GetOtherPartyConnection() const;
976 
979  template <class cls> PSafePtr<cls> GetOtherPartyConnectionAs() const { return PSafePtrCast<OpalConnection, cls>(GetOtherPartyConnection()); }
981 
990  virtual OpalMediaFormatList GetMediaFormats() const;
991 
997 
1011  virtual void AdjustMediaFormats(
1012  bool local,
1013  const OpalConnection * otherConnection,
1014  OpalMediaFormatList & mediaFormats
1015  ) const;
1016 
1024  virtual unsigned GetNextSessionID(
1025  const OpalMediaType & mediaType,
1026  bool isSource
1027  );
1028 
1032  virtual bool RequireSymmetricMediaStreams() const;
1033 
1040  virtual OpalMediaType::AutoStartMode GetAutoStart(
1041  const OpalMediaType & mediaType
1042  ) const;
1043 
1046  virtual void AutoStartMediaStreams(
1047  bool transfer = false
1048  );
1049 
1050 #if OPAL_T38_CAPABILITY
1051 
1053  virtual bool SwitchFaxMediaStreams(
1054  bool toT38
1055  );
1056 
1061  virtual void OnSwitchedFaxMediaStreams(
1062  bool toT38,
1063  bool success
1064  );
1065 
1070  virtual bool OnSwitchingFaxMediaStreams(
1071  bool toT38
1072  );
1073 #endif // OPAL_T38_CAPABILITY
1074 
1078  const OpalMediaFormat & mediaFormat,
1079  unsigned sessionID,
1080  bool isSource
1081  );
1082 
1085  bool CloseMediaStream(
1086  unsigned sessionId,
1087  bool source
1088  );
1089 
1097  bool RemoveMediaStream(
1098  OpalMediaStream & strm
1099  );
1100 
1103  virtual void StartMediaStreams();
1104 
1107  virtual void CloseMediaStreams();
1108 
1111  virtual void PauseMediaStreams(
1112  bool paused
1113  );
1114 
1117  virtual void OnPauseMediaStream(
1118  OpalMediaStream & strm,
1119  bool paused
1120  );
1121 
1135  const OpalMediaFormat & mediaFormat,
1136  unsigned sessionID,
1137  PBoolean isSource
1138  );
1139 
1147  const PString & streamID,
1148  bool source
1149  ) const;
1150 
1157  unsigned sessionId,
1158  bool source
1159  ) const;
1160 
1172  const OpalMediaType & mediaType,
1173  bool source,
1174  OpalMediaStreamPtr previous = NULL
1175  ) const;
1176 
1188  virtual PBoolean OnOpenMediaStream(
1189  OpalMediaStream & stream
1190  );
1191 
1196  virtual void OnClosedMediaStream(
1197  const OpalMediaStream & stream
1198  );
1199 
1208  virtual void OnPatchMediaStream(
1209  PBoolean isSource,
1210  OpalMediaPatch & patch
1211  );
1212 
1217  virtual void OnStartMediaPatch(
1218  OpalMediaPatch & patch
1219  );
1220 
1225  virtual void OnStopMediaPatch(
1226  OpalMediaPatch & patch
1227  );
1228 
1244  virtual bool OnMediaFailed(
1245  unsigned sessionId,
1246  bool source
1247  );
1248 
1251  bool AllMediaFailed() const;
1252 
1258  virtual bool OnMediaCommand(
1259  OpalMediaStream & stream,
1260  const OpalMediaCommand & command
1261  );
1262 
1268  virtual bool ExecuteMediaCommand(
1269  const OpalMediaCommand & command,
1270  unsigned sessionID = 0,
1271  const OpalMediaType & mediaType = OpalMediaType()
1272  ) const;
1273 
1274 #if P_NAT
1275  // Get Nat Method in use
1276  virtual PNatMethod * GetNatMethod(
1277  const PIPSocket::Address & remoteAddress = PIPSocket::GetDefaultIpAny()
1278  ) const;
1279 #endif
1280 
1290  virtual bool GetMediaTransportAddresses(
1291  const OpalMediaType & mediaType,
1292  OpalTransportAddressArray & transports
1293  ) const;
1294 
1295 #if OPAL_VIDEO
1296 
1298  virtual PBoolean CreateVideoInputDevice(
1299  const OpalMediaFormat & mediaFormat,
1300  PVideoInputDevice * & device,
1301  PBoolean & autoDelete
1302  );
1303 
1307  virtual PBoolean CreateVideoOutputDevice(
1308  const OpalMediaFormat & mediaFormat,
1309  PBoolean preview,
1310  PVideoOutputDevice * & device,
1311  PBoolean & autoDelete
1312  );
1313 
1316  virtual bool ChangeVideoInputDevice(
1317  const PVideoDevice::OpenArgs & device,
1318  unsigned sessionID = 0
1319  );
1320 
1324  virtual bool ChangeVideoOutputDevice(
1325  const PVideoDevice::OpenArgs & device,
1326  unsigned sessionID = 0,
1327  bool preview = false
1328  );
1329 
1335  virtual bool SendVideoUpdatePicture(
1336  unsigned sessionID = 0,
1337  bool force = false
1338  ) const;
1339  void SendVideoUpdatePictureCallback(unsigned sessionID, bool force) { SendVideoUpdatePicture(sessionID, force); }
1340 
1345  virtual void OnRxIntraFrameRequest(
1346  const OpalMediaSession & session,
1347  bool force
1348  );
1349 #endif
1350 
1354  virtual PBoolean SetAudioVolume(
1355  PBoolean source,
1356  unsigned percentage
1357  );
1358 
1362  virtual PBoolean GetAudioVolume(
1363  PBoolean source,
1364  unsigned & percentage
1365  );
1366 
1369  virtual bool SetAudioMute(
1370  bool source,
1371  bool mute
1372  );
1373 
1376  virtual bool GetAudioMute(
1377  bool source,
1378  bool & mute
1379  );
1380 
1384  virtual unsigned GetAudioSignalLevel(
1385  PBoolean source
1386  );
1388 
1395  ) const;
1396 
1399  virtual bool SetBandwidthAvailable(
1401  OpalBandwidth availableBandwidth
1402  );
1403 
1407  virtual bool SetBandwidthAllocated(
1409  OpalBandwidth newBandwidth
1410  );
1411 
1418  ) const;
1419 
1428  virtual bool SetBandwidthUsed(
1430  OpalBandwidth releasedBandwidth,
1431  OpalBandwidth requiredBandwidth
1432  );
1434 
1437  P_DECLARE_TRACED_ENUM(SendUserInputModes,
1438  SendUserInputAsQ931,
1439  SendUserInputAsString,
1440  SendUserInputAsTone,
1441  SendUserInputAsRFC2833,
1442  SendUserInputAsInlineRFC2833 = SendUserInputAsRFC2833, // For backward compatibility
1443  SendUserInputInBand,
1444  SendUserInputAsProtocolDefault
1445  );
1446 
1449  virtual void SetSendUserInputMode(SendUserInputModes mode);
1450 
1453  virtual SendUserInputModes GetSendUserInputMode() const { return sendUserInputMode; }
1454 
1460  virtual SendUserInputModes GetRealSendUserInputMode() const { return GetSendUserInputMode(); }
1461 
1468  virtual PBoolean SendUserInputString(
1469  const PString & value
1470  );
1471 
1488  virtual PBoolean SendUserInputTone(
1489  char tone,
1490  unsigned duration = 0
1491  );
1492 
1499  virtual void OnUserInputString(
1500  const PString & value
1501  );
1502  void OnUserInputStringCallback(PString value) { OnUserInputString(value); }
1503 
1510  virtual void OnUserInputTone(
1511  char tone,
1512  unsigned duration
1513  );
1514 
1519  unsigned duration = 500
1520  ) { SendUserInputTone('!', duration); }
1521 
1524  virtual PString GetUserInput(
1525  unsigned timeout = 30
1526  );
1527 
1532  virtual void SetUserInput(
1533  const PString & input
1534  );
1535 
1538  virtual PString ReadUserInput(
1539  const char * terminators = "YX#\r\n",
1540  unsigned lastDigitTimeout = 4,
1541  unsigned firstDigitTimeout = 30
1542  );
1543 
1550  virtual PBoolean PromptUserInput(
1551  PBoolean play
1552  );
1554 
1568  virtual bool GetConferenceState(
1569  OpalConferenceState * state
1570  ) const;
1571 
1584  virtual bool RequestPresentationRole(
1585  bool release
1586  );
1587 
1595  virtual bool OnChangedPresentationRole(
1596  const PString & newChairURI,
1597  bool request
1598  );
1599 
1604  virtual bool HasPresentationRole() const;
1605 
1610  virtual bool GarbageCollection();
1612 
1617  OpalEndPoint & GetEndPoint() const { return endpoint; }
1618 
1621  OpalCall & GetCall() const { return ownerCall; }
1622 
1625  const PString & GetToken() const { return callToken; }
1626 
1629  PBoolean IsOriginating() const { return m_originating; }
1630 
1633  const PTime & GetPhaseTime(Phases phase) const { return m_phaseTime[phase]; }
1634 
1637  const PTime & GetSetupUpTime() const { return m_phaseTime[SetUpPhase]; }
1638 
1641  const PTime & GetAlertingTime() const { return m_phaseTime[AlertingPhase]; }
1642 
1647  const PTime & GetConnectionStartTime() const { return m_phaseTime[ConnectedPhase]; }
1648 
1651  const PTime & GetConnectionEndTime() const { return m_phaseTime[ReleasingPhase]; }
1652 
1655  const OpalProductInfo & GetProductInfo() const { return productInfo; }
1656 
1660  const OpalProductInfo & info
1661  ) { productInfo = info; }
1662 
1665  virtual PString GetPrefixName() const;
1666 
1669  const PString & GetLocalPartyName() const { return localPartyName; }
1670 
1673  virtual void SetLocalPartyName(const PString & name);
1674 
1677  virtual PString GetLocalPartyURL() const;
1678 
1681  const PString & GetDisplayName() const { return displayName; }
1682 
1685  void SetDisplayName(const PString & name) { displayName = name; }
1686 
1692  virtual bool IsPresentationBlocked() const;
1693 
1696  const PString & GetRemotePartyName() const { return remotePartyName; }
1697 
1700  void SetRemotePartyName(const PString & name) { remotePartyName = name; }
1701 
1710  const PString & GetRemotePartyNumber() const { return remotePartyNumber; }
1711 
1712  // Deprecated - backward compatibility only
1713  P_DEPRECATED PString GetRemotePartyAddress() const { return GetRemotePartyURL(); }
1714 
1721  virtual PString GetRemotePartyURL() const;
1722 
1726  const PString & GetRedirectingParty() const { return m_redirectingParty; }
1727 
1731  void SetRedirectingParty(const PString & party) { m_redirectingParty = party; }
1732 
1733  // Deprecated - backward compatibility only
1734  P_DEPRECATED const PString GetRemotePartyCallbackURL() const { return GetRemotePartyURL(); }
1735 
1739  PCaselessString GetRemoteApplication() const { return remoteProductInfo.AsString(); }
1740 
1744 
1748 
1755  const PString & GetCalledPartyName() const { return m_calledPartyName; }
1756 
1763  const PString & GetCalledPartyNumber() const { return m_calledPartyNumber; }
1764 
1772  virtual PString GetCalledPartyURL();
1773 
1774  /* Internal function to copy party names from "network" connection to
1775  "non-network" connection such as OpalPCSSConnection. This allows
1776  the non-network GetRemoteAddress() function and its ilk to return
1777  the intuitive value, i.e. the value from the OTHER connection.
1778  */
1779  void CopyPartyNames(const OpalConnection & other);
1780 
1781 
1795  virtual PString GetAlertingType() const;
1796 
1810  virtual bool SetAlertingType(const PString & info);
1811 
1819  virtual PString GetCallInfo() const;
1820 
1824  unsigned GetMinAudioJitterDelay() const { return m_minAudioJitterDelay; }
1825 
1829  unsigned GetMaxAudioJitterDelay() const { return m_maxAudioJitterDelay; }
1830 
1833  void SetAudioJitterDelay(
1834  unsigned minDelay,
1835  unsigned maxDelay
1836  );
1837 
1841 
1842 #if OPAL_AEC
1843 
1845  OpalEchoCanceler * GetEchoCanceler() const { return echoCanceler; }
1846 #endif
1847 
1851  virtual PString GetIdentifier() const;
1852 
1861  virtual PINDEX GetMaxRtpPayloadSize() const;
1862 
1863 #if OPAL_STATISTICS
1864 
1867 #endif
1868 
1869 
1871  const StringOptions & GetStringOptions() const { return m_stringOptions; }
1873 
1875  void SetStringOptions(
1876  const StringOptions & options,
1877  bool overwrite
1878  );
1879 
1881  virtual void OnApplyStringOptions();
1882 
1883 #if OPAL_HAS_MIXER
1884 
1885  virtual void EnableRecording();
1886  virtual void DisableRecording();
1887 
1888 #endif
1889 
1890  protected:
1891  void OnConnectedInternal();
1892  void InternalSetAsOriginating();
1893 
1894  void InternalOnReleased();
1895 
1896 #if OPAL_HAS_MIXER
1898 #if OPAL_VIDEO
1900 #endif
1901  void OnStartRecording(OpalMediaPatch * patch);
1902  void OnStopRecording(OpalMediaPatch * patch);
1903 #endif
1904 
1905  // Member variables
1908 
1909  private:
1910  PMutex m_phaseMutex;
1911  Phases m_phase;
1912 
1913  protected:
1914  PString callToken;
1915  PBoolean m_originating;
1918  PString displayName;
1927 
1928  SendUserInputModes sendUserInputMode;
1931 
1933 #if OPAL_AEC
1934  OpalEchoCanceler * echoCanceler;
1935 #endif
1937 
1939  PSafeList<OpalMediaStream> mediaStreams;
1940 
1945 
1946  // The In-Band DTMF detector. This is used inside an audio filter which is
1947  // added to the audio channel.
1948 #if OPAL_PTLIB_DTMF
1949  PDTMFDecoder m_dtmfDecoder;
1950  bool m_detectInBandDTMF;
1951  unsigned m_dtmfScaleMultiplier;
1952  unsigned m_dtmfScaleDivisor;
1953  PNotifier m_dtmfDetectNotifier;
1954  PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnDetectInBandDTMF);
1955 
1956  bool m_sendInBandDTMF;
1957  OpalMediaFormat m_dtmfSendFormat;
1958  PBYTEArray m_inBandDTMF;
1959  PINDEX m_emittedInBandDTMF;
1960  PMutex m_inBandMutex;
1961  PNotifier m_dtmfSendNotifier;
1962  PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnSendInBandDTMF);
1963 #endif
1964 
1966 
1967 #if OPAL_HAS_MIXER
1970 #if OPAL_VIDEO
1972 #endif
1973 #endif
1974 
1975 #if OPAL_STATISTICS
1977 #endif
1978 
1979  struct AutoStartInfo {
1980  unsigned preferredSessionId; // preferred session ID (only used for originating)
1981  OpalMediaType::AutoStartMode autoStart;// Mode for this session when the call is started
1982  };
1983 
1984  class AutoStartMap : public std::map<OpalMediaType, AutoStartInfo>
1985  {
1986  public:
1987  AutoStartMap();
1988  void Initialise(const OpalConnection::StringOptions & stringOptions);
1989  OpalMediaType::AutoStartMode GetAutoStart(const OpalMediaType & mediaType) const;
1990  void SetAutoStart(const OpalMediaType & mediaType, OpalMediaType::AutoStartMode autoStart);
1991 
1992  protected:
1994  PMutex m_mutex;
1995 
1996  };
1998 
1999 #if OPAL_SCRIPT
2000  PString m_scriptTableName;
2001  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptRelease);
2002  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptSetOption);
2003  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptGetLocalPartyURL);
2004  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptGetRemotePartyURL);
2005  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptGetCalledPartyURL);
2006  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptGetRedirectingParty);
2007 #endif // OPAL_SCRIPT
2008 
2009  // A version of PTime where default constructor creates invalid times
2010  class ZeroTime : public PTime
2011  {
2012  public:
2013  ZeroTime() : PTime(0) { }
2014  };
2015  ZeroTime m_phaseTime[NumPhases];
2016 
2017  std::vector<bool> m_mediaSessionFailed;
2018 
2019 
2020  private:
2021  P_REMOVE_VIRTUAL(PBoolean, OnIncomingConnection(unsigned int), false);
2022  P_REMOVE_VIRTUAL(PBoolean, OnIncomingConnection(), false);
2023  P_REMOVE_VIRTUAL(PBoolean, IsConnectionOnHold(), false);
2024  P_REMOVE_VIRTUAL_VOID(OnMediaPatchStart(unsigned, bool));
2025  P_REMOVE_VIRTUAL_VOID(OnMediaPatchStop(unsigned, bool));
2026  P_REMOVE_VIRTUAL_VOID(AdjustMediaFormats(OpalMediaFormatList &) const);
2027  P_REMOVE_VIRTUAL_VOID(AdjustMediaFormats(OpalMediaFormatList &, OpalConnection *) const);
2028  P_REMOVE_VIRTUAL_VOID(AdjustMediaFormats(bool,OpalMediaFormatList &,OpalConnection *) const);
2029  P_REMOVE_VIRTUAL_VOID(PreviewPeerMediaFormats(const OpalMediaFormatList &));
2030  P_REMOVE_VIRTUAL(bool, HoldConnection(), false);
2031  P_REMOVE_VIRTUAL(bool, RetrieveConnection(), false);
2032  P_REMOVE_VIRTUAL(bool, IsConnectionOnHold(bool), false);
2033  P_REMOVE_VIRTUAL_VOID(ApplyStringOptions(OpalConnection::StringOptions &));
2034  P_REMOVE_VIRTUAL(PBoolean, IsMediaBypassPossible(unsigned) const, false);
2035  P_REMOVE_VIRTUAL(bool, OnTransferNotify(const PStringToString &), false);
2036  P_REMOVE_VIRTUAL(OpalMediaSession *, CreateMediaSession(unsigned, const OpalMediaType &), NULL);
2037  P_REMOVE_VIRTUAL(PBoolean, SetBandwidthAvailable(unsigned, PBoolean), false);
2038  P_REMOVE_VIRTUAL(unsigned, GetBandwidthUsed() const, 0);
2039  P_REMOVE_VIRTUAL(PBoolean, SetBandwidthUsed(unsigned, unsigned), false);
2040  P_REMOVE_VIRTUAL_VOID(OnSwitchedFaxMediaStreams(bool));
2041  P_REMOVE_VIRTUAL(bool, CloseMediaStream(OpalMediaStream &),false);
2042 };
2043 
2044 #endif // OPAL_OPAL_CONNECTION_H
2045 
2046 
2047 // End of File ///////////////////////////////////////////////////////////////