OPAL  Version 3.12.9
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: 30972 $
31  * $Author: rjongbloed $
32  * $Date: 2013-11-26 10:02:24 +1100 (Tue, 26 Nov 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 
85 #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 
1715 
1722  virtual PString GetRemotePartyURL() const;
1723 
1729  virtual PString GetRemoteIdentity() const { return GetRemotePartyURL(); }
1730 
1731  // Deprecated - backward compatibility only
1732  P_DEPRECATED PString GetRemotePartyAddress() const { return GetRemotePartyURL(); }
1733 
1734  // Deprecated - backward compatibility only
1735  P_DEPRECATED const PString GetRemotePartyCallbackURL() const { return GetRemotePartyURL(); }
1736 
1740  PCaselessString GetRemoteApplication() const { return remoteProductInfo.AsString(); }
1741 
1745 
1749  const PString & GetRedirectingParty() const { return m_redirectingParty; }
1750 
1754  void SetRedirectingParty(const PString & party) { m_redirectingParty = party; }
1755 
1762  const PString & GetCalledPartyName() const { return m_calledPartyName; }
1763 
1770  const PString & GetCalledPartyNumber() const { return m_calledPartyNumber; }
1771 
1779  virtual PString GetCalledPartyURL();
1780 
1781  /* Internal function to copy party names from "network" connection to
1782  "non-network" connection such as OpalPCSSConnection. This allows
1783  the non-network GetRemoteAddress() function and its ilk to return
1784  the intuitive value, i.e. the value from the OTHER connection.
1785  */
1786  void CopyPartyNames(const OpalConnection & other);
1787 
1788 
1802  virtual PString GetAlertingType() const;
1803 
1817  virtual bool SetAlertingType(const PString & info);
1818 
1826  virtual PString GetCallInfo() const;
1827 
1831  unsigned GetMinAudioJitterDelay() const { return m_minAudioJitterDelay; }
1832 
1836  unsigned GetMaxAudioJitterDelay() const { return m_maxAudioJitterDelay; }
1837 
1840  void SetAudioJitterDelay(
1841  unsigned minDelay,
1842  unsigned maxDelay
1843  );
1844 
1848 
1849 #if OPAL_AEC
1850 
1852  OpalEchoCanceler * GetEchoCanceler() const { return echoCanceler; }
1853 #endif
1854 
1858  virtual PString GetIdentifier() const;
1859 
1868  virtual PINDEX GetMaxRtpPayloadSize() const;
1869 
1870 #if OPAL_STATISTICS
1871 
1874 #endif
1875 
1876 
1878  const StringOptions & GetStringOptions() const { return m_stringOptions; }
1880 
1882  void SetStringOptions(
1883  const StringOptions & options,
1884  bool overwrite
1885  );
1886 
1888  virtual void OnApplyStringOptions();
1889 
1890 #if OPAL_HAS_MIXER
1891 
1892  virtual void EnableRecording();
1893  virtual void DisableRecording();
1894 
1895 #endif
1896 
1897  protected:
1898  void OnConnectedInternal();
1899  void InternalSetAsOriginating();
1900 
1901  void InternalOnReleased();
1902 
1903 #if OPAL_HAS_MIXER
1905 #if OPAL_VIDEO
1907 #endif
1908  void OnStartRecording(OpalMediaPatch * patch);
1909  void OnStopRecording(OpalMediaPatch * patch);
1910 #endif
1911 
1912  // Member variables
1915 
1916  private:
1917  PMutex m_phaseMutex;
1918  Phases m_phase;
1919 
1920  protected:
1921  PString callToken;
1922  PBoolean m_originating;
1925  PString displayName;
1934 
1935  SendUserInputModes sendUserInputMode;
1938 
1940 #if OPAL_AEC
1941  OpalEchoCanceler * echoCanceler;
1942 #endif
1944 
1946  PSafeList<OpalMediaStream> mediaStreams;
1947 
1952 
1953  // The In-Band DTMF detector. This is used inside an audio filter which is
1954  // added to the audio channel.
1955 #if OPAL_PTLIB_DTMF
1956  PDTMFDecoder m_dtmfDecoder;
1957  bool m_detectInBandDTMF;
1958  unsigned m_dtmfScaleMultiplier;
1959  unsigned m_dtmfScaleDivisor;
1960  PNotifier m_dtmfDetectNotifier;
1961  PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnDetectInBandDTMF);
1962 
1963  bool m_sendInBandDTMF;
1964  OpalMediaFormat m_dtmfSendFormat;
1965  PBYTEArray m_inBandDTMF;
1966  PINDEX m_emittedInBandDTMF;
1967  PMutex m_inBandMutex;
1968  PNotifier m_dtmfSendNotifier;
1969  PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnSendInBandDTMF);
1970 #endif
1971 
1973 
1974 #if OPAL_HAS_MIXER
1977 #if OPAL_VIDEO
1979 #endif
1980 #endif
1981 
1982 #if OPAL_STATISTICS
1984 #endif
1985 
1986  struct AutoStartInfo {
1987  unsigned preferredSessionId; // preferred session ID (only used for originating)
1988  OpalMediaType::AutoStartMode autoStart;// Mode for this session when the call is started
1989  };
1990 
1991  class AutoStartMap : public std::map<OpalMediaType, AutoStartInfo>
1992  {
1993  public:
1994  AutoStartMap();
1995  void Initialise(const OpalConnection::StringOptions & stringOptions);
1996  OpalMediaType::AutoStartMode GetAutoStart(const OpalMediaType & mediaType) const;
1997 
1998  protected:
1999  void SetAutoStart(const PString & mediaType, OpalMediaType::AutoStartMode autoStart);
2000 
2001  PMutex m_mutex;
2002  };
2004 
2005 #if OPAL_SCRIPT
2006  PString m_scriptTableName;
2007  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptRelease);
2008  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptSetOption);
2009  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptGetLocalPartyURL);
2010  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptGetRemotePartyURL);
2011  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptGetCalledPartyURL);
2012  PDECLARE_ScriptFunctionNotifier(OpalConnection, ScriptGetRedirectingParty);
2013 #endif // OPAL_SCRIPT
2014 
2015  // A version of PTime where default constructor creates invalid times
2016  class ZeroTime : public PTime
2017  {
2018  public:
2019  ZeroTime() : PTime(0) { }
2020  };
2021  ZeroTime m_phaseTime[NumPhases];
2022 
2023  std::vector<bool> m_mediaSessionFailed;
2024 
2025 
2026  private:
2027  P_REMOVE_VIRTUAL(PBoolean, OnIncomingConnection(unsigned int), false);
2028  P_REMOVE_VIRTUAL(PBoolean, OnIncomingConnection(), false);
2029  P_REMOVE_VIRTUAL(PBoolean, IsConnectionOnHold(), false);
2030  P_REMOVE_VIRTUAL_VOID(OnMediaPatchStart(unsigned, bool));
2031  P_REMOVE_VIRTUAL_VOID(OnMediaPatchStop(unsigned, bool));
2032  P_REMOVE_VIRTUAL_VOID(AdjustMediaFormats(OpalMediaFormatList &) const);
2033  P_REMOVE_VIRTUAL_VOID(AdjustMediaFormats(OpalMediaFormatList &, OpalConnection *) const);
2034  P_REMOVE_VIRTUAL_VOID(AdjustMediaFormats(bool,OpalMediaFormatList &,OpalConnection *) const);
2035  P_REMOVE_VIRTUAL_VOID(PreviewPeerMediaFormats(const OpalMediaFormatList &));
2036  P_REMOVE_VIRTUAL(bool, HoldConnection(), false);
2037  P_REMOVE_VIRTUAL(bool, RetrieveConnection(), false);
2038  P_REMOVE_VIRTUAL(bool, IsConnectionOnHold(bool), false);
2039  P_REMOVE_VIRTUAL_VOID(ApplyStringOptions(OpalConnection::StringOptions &));
2040  P_REMOVE_VIRTUAL(PBoolean, IsMediaBypassPossible(unsigned) const, false);
2041  P_REMOVE_VIRTUAL(bool, OnTransferNotify(const PStringToString &), false);
2042  P_REMOVE_VIRTUAL(OpalMediaSession *, CreateMediaSession(unsigned, const OpalMediaType &), NULL);
2043  P_REMOVE_VIRTUAL(PBoolean, SetBandwidthAvailable(unsigned, PBoolean), false);
2044  P_REMOVE_VIRTUAL(unsigned, GetBandwidthUsed() const, 0);
2045  P_REMOVE_VIRTUAL(PBoolean, SetBandwidthUsed(unsigned, unsigned), false);
2046  P_REMOVE_VIRTUAL_VOID(OnSwitchedFaxMediaStreams(bool));
2047  P_REMOVE_VIRTUAL(bool, CloseMediaStream(OpalMediaStream &),false);
2048 };
2049 
2050 #endif // OPAL_OPAL_CONNECTION_H
2051 
2052 
2053 // End of File ///////////////////////////////////////////////////////////////