1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/signaling/include/CallControlManager.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,129 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#pragma once 1.9 + 1.10 +#include "CC_Common.h" 1.11 + 1.12 +#include "CC_Observer.h" 1.13 +#include "ECC_Observer.h" 1.14 +#include "ECC_Types.h" 1.15 + 1.16 +#include <string> 1.17 +#include <vector> 1.18 + 1.19 +/** 1.20 + * @mainpage Enhanced Call Control 1.21 + * 1.22 + * @section intro_sec Introduction 1.23 + * This wraps and aggregates the SIPCC and CTI call control stacks, media stacks, and various additional 1.24 + * components and glue necessary to start, configure and run them, and presents a high-level C++ API 1.25 + * for connection, device selection and status, and call control. 1.26 + * 1.27 + * @section main_outline Outline 1.28 + * @li The main entry point is CSF::CallControlManager, which is used to configure and start a 1.29 + * call control stack. 1.30 + * @li Configuration and events are raised to the CSF::ECC_Observer interface. 1.31 + * @li Call Control is performed via CSF::CC_Device, CSF::CC_Line and CSF::CC_Call. 1.32 + * @li Call Control events are raised to the CSF::CC_Observer interface. 1.33 + * @li Audio/Video device selection and global media configuration is performed via CSF::AudioControl 1.34 + * and CSF::VideoControl. Per-call media operations (mute, volume, etc) are integrated onto 1.35 + * the CSF::CC_Call and CSF::CC_CallInfo interfaces. 1.36 + */ 1.37 + 1.38 +namespace CSF 1.39 +{ 1.40 + DECLARE_NS_PTR(CallControlManager) 1.41 + /** 1.42 + * CallControlManager 1.43 + * 1.44 + * The class is partitioned into several blocks of functionality: 1.45 + * - Create/Destroy - Initialisation and clean shutdown. 1.46 + * Destroy is optional if the destructor is used properly. 1.47 + * - Observer - Register for events when any state changes. Optional but strongly advised. 1.48 + * 1.49 + * Methods are generally synchronous (at present). 1.50 + */ 1.51 + class ECC_API CallControlManager 1.52 + { 1.53 + public: 1.54 + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CallControlManager) 1.55 + /** 1.56 + * Use create() to create a CallControlManager instance. 1.57 + * 1.58 + * CallControlManager cleans up its resources in its destructor, implicitly disconnect()in if required. 1.59 + * Use the destroy() method if you need to force a cleanup earlier. It is a bad idea to continue using 1.60 + * CallControlManager or any of its related objects after destroy(). 1.61 + */ 1.62 + static CallControlManagerPtr create(); 1.63 + virtual bool destroy() = 0; 1.64 + 1.65 + virtual ~CallControlManager(); 1.66 + 1.67 + /** 1.68 + CC_Observer is for core call control events (on CC_Device, CC_Line and CC_Call). 1.69 + ECC_Observer is for "value add" features of CallControlManager. 1.70 + 1.71 + Client can add multiple observers if they have different Observer objects that handle 1.72 + different event scenarios, but generally it's probably sufficient to only register one observer. 1.73 + 1.74 + @param[in] observer - This is a pointer to a CC_Observer-derived class that the client 1.75 + must instantiate to receive notifications on this client object. 1.76 + */ 1.77 + virtual void addCCObserver ( CC_Observer * observer ) = 0; 1.78 + virtual void removeCCObserver ( CC_Observer * observer ) = 0; 1.79 + 1.80 + virtual void addECCObserver ( ECC_Observer * observer ) = 0; 1.81 + virtual void removeECCObserver ( ECC_Observer * observer ) = 0; 1.82 + 1.83 + virtual void setMultiClusterMode(bool allowMultipleClusters) = 0; 1.84 + virtual void setSIPCCLoggingMask(const cc_int32_t mask) = 0; 1.85 + virtual void setAuthenticationString(const std::string &authString) = 0; 1.86 + virtual void setSecureCachePath(const std::string &secureCachePath) = 0; 1.87 + 1.88 + // Add local codecs 1.89 + virtual void setAudioCodecs(int codecMask) = 0; 1.90 + virtual void setVideoCodecs(int codecMask) = 0; 1.91 + 1.92 + virtual bool registerUser(const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain) = 0; 1.93 + virtual bool disconnect() = 0; 1.94 + virtual std::string getPreferredDeviceName() = 0; 1.95 + virtual std::string getPreferredLineDN() = 0; 1.96 + virtual ConnectionStatusEnum::ConnectionStatus getConnectionStatus() = 0; 1.97 + virtual std::string getCurrentServer() = 0; 1.98 + 1.99 + /* P2P MODE */ 1.100 + virtual bool startP2PMode(const std::string& user) = 0; 1.101 + 1.102 + /* SDP MODE */ 1.103 + virtual bool startSDPMode() = 0; 1.104 + 1.105 + /** 1.106 + * Obtain the device object, from which call control can be done. 1.107 + * getAvailablePhoneDetails lists all known devices which the user is likely to be able to control. 1.108 + */ 1.109 + virtual CC_DevicePtr getActiveDevice() = 0; 1.110 + virtual PhoneDetailsVtrPtr getAvailablePhoneDetails() = 0; 1.111 + virtual PhoneDetailsPtr getAvailablePhoneDetails(const std::string& deviceName) = 0; 1.112 + 1.113 + /** 1.114 + * Obtain the audio/video object, from which video setup can be done. 1.115 + * This relates to global tuning, device selection, preview window positioning, etc, not to 1.116 + * per-call settings or control. 1.117 + * 1.118 + * These objects are unavailable except while in softphone mode. 1.119 + */ 1.120 + virtual VideoControlPtr getVideoControl() = 0; 1.121 + virtual AudioControlPtr getAudioControl() = 0; 1.122 + 1.123 + virtual bool setProperty(ConfigPropertyKeysEnum::ConfigPropertyKeys key, std::string& value) = 0; 1.124 + virtual std::string getProperty(ConfigPropertyKeysEnum::ConfigPropertyKeys key) = 0; 1.125 + 1.126 + protected: 1.127 + CallControlManager() {} 1.128 + private: 1.129 + CallControlManager(const CallControlManager&); 1.130 + CallControlManager& operator=(const CallControlManager&); 1.131 + }; 1.132 +} //end namespace CSF