|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #pragma once |
|
6 |
|
7 #include "CC_Common.h" |
|
8 |
|
9 #include "CC_Observer.h" |
|
10 #include "ECC_Observer.h" |
|
11 #include "ECC_Types.h" |
|
12 |
|
13 #include <string> |
|
14 #include <vector> |
|
15 |
|
16 /** |
|
17 * @mainpage Enhanced Call Control |
|
18 * |
|
19 * @section intro_sec Introduction |
|
20 * This wraps and aggregates the SIPCC and CTI call control stacks, media stacks, and various additional |
|
21 * components and glue necessary to start, configure and run them, and presents a high-level C++ API |
|
22 * for connection, device selection and status, and call control. |
|
23 * |
|
24 * @section main_outline Outline |
|
25 * @li The main entry point is CSF::CallControlManager, which is used to configure and start a |
|
26 * call control stack. |
|
27 * @li Configuration and events are raised to the CSF::ECC_Observer interface. |
|
28 * @li Call Control is performed via CSF::CC_Device, CSF::CC_Line and CSF::CC_Call. |
|
29 * @li Call Control events are raised to the CSF::CC_Observer interface. |
|
30 * @li Audio/Video device selection and global media configuration is performed via CSF::AudioControl |
|
31 * and CSF::VideoControl. Per-call media operations (mute, volume, etc) are integrated onto |
|
32 * the CSF::CC_Call and CSF::CC_CallInfo interfaces. |
|
33 */ |
|
34 |
|
35 namespace CSF |
|
36 { |
|
37 DECLARE_NS_PTR(CallControlManager) |
|
38 /** |
|
39 * CallControlManager |
|
40 * |
|
41 * The class is partitioned into several blocks of functionality: |
|
42 * - Create/Destroy - Initialisation and clean shutdown. |
|
43 * Destroy is optional if the destructor is used properly. |
|
44 * - Observer - Register for events when any state changes. Optional but strongly advised. |
|
45 * |
|
46 * Methods are generally synchronous (at present). |
|
47 */ |
|
48 class ECC_API CallControlManager |
|
49 { |
|
50 public: |
|
51 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CallControlManager) |
|
52 /** |
|
53 * Use create() to create a CallControlManager instance. |
|
54 * |
|
55 * CallControlManager cleans up its resources in its destructor, implicitly disconnect()in if required. |
|
56 * Use the destroy() method if you need to force a cleanup earlier. It is a bad idea to continue using |
|
57 * CallControlManager or any of its related objects after destroy(). |
|
58 */ |
|
59 static CallControlManagerPtr create(); |
|
60 virtual bool destroy() = 0; |
|
61 |
|
62 virtual ~CallControlManager(); |
|
63 |
|
64 /** |
|
65 CC_Observer is for core call control events (on CC_Device, CC_Line and CC_Call). |
|
66 ECC_Observer is for "value add" features of CallControlManager. |
|
67 |
|
68 Client can add multiple observers if they have different Observer objects that handle |
|
69 different event scenarios, but generally it's probably sufficient to only register one observer. |
|
70 |
|
71 @param[in] observer - This is a pointer to a CC_Observer-derived class that the client |
|
72 must instantiate to receive notifications on this client object. |
|
73 */ |
|
74 virtual void addCCObserver ( CC_Observer * observer ) = 0; |
|
75 virtual void removeCCObserver ( CC_Observer * observer ) = 0; |
|
76 |
|
77 virtual void addECCObserver ( ECC_Observer * observer ) = 0; |
|
78 virtual void removeECCObserver ( ECC_Observer * observer ) = 0; |
|
79 |
|
80 virtual void setMultiClusterMode(bool allowMultipleClusters) = 0; |
|
81 virtual void setSIPCCLoggingMask(const cc_int32_t mask) = 0; |
|
82 virtual void setAuthenticationString(const std::string &authString) = 0; |
|
83 virtual void setSecureCachePath(const std::string &secureCachePath) = 0; |
|
84 |
|
85 // Add local codecs |
|
86 virtual void setAudioCodecs(int codecMask) = 0; |
|
87 virtual void setVideoCodecs(int codecMask) = 0; |
|
88 |
|
89 virtual bool registerUser(const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain) = 0; |
|
90 virtual bool disconnect() = 0; |
|
91 virtual std::string getPreferredDeviceName() = 0; |
|
92 virtual std::string getPreferredLineDN() = 0; |
|
93 virtual ConnectionStatusEnum::ConnectionStatus getConnectionStatus() = 0; |
|
94 virtual std::string getCurrentServer() = 0; |
|
95 |
|
96 /* P2P MODE */ |
|
97 virtual bool startP2PMode(const std::string& user) = 0; |
|
98 |
|
99 /* SDP MODE */ |
|
100 virtual bool startSDPMode() = 0; |
|
101 |
|
102 /** |
|
103 * Obtain the device object, from which call control can be done. |
|
104 * getAvailablePhoneDetails lists all known devices which the user is likely to be able to control. |
|
105 */ |
|
106 virtual CC_DevicePtr getActiveDevice() = 0; |
|
107 virtual PhoneDetailsVtrPtr getAvailablePhoneDetails() = 0; |
|
108 virtual PhoneDetailsPtr getAvailablePhoneDetails(const std::string& deviceName) = 0; |
|
109 |
|
110 /** |
|
111 * Obtain the audio/video object, from which video setup can be done. |
|
112 * This relates to global tuning, device selection, preview window positioning, etc, not to |
|
113 * per-call settings or control. |
|
114 * |
|
115 * These objects are unavailable except while in softphone mode. |
|
116 */ |
|
117 virtual VideoControlPtr getVideoControl() = 0; |
|
118 virtual AudioControlPtr getAudioControl() = 0; |
|
119 |
|
120 virtual bool setProperty(ConfigPropertyKeysEnum::ConfigPropertyKeys key, std::string& value) = 0; |
|
121 virtual std::string getProperty(ConfigPropertyKeysEnum::ConfigPropertyKeys key) = 0; |
|
122 |
|
123 protected: |
|
124 CallControlManager() {} |
|
125 private: |
|
126 CallControlManager(const CallControlManager&); |
|
127 CallControlManager& operator=(const CallControlManager&); |
|
128 }; |
|
129 } //end namespace CSF |