2
* Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
3
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 3 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
* Additional permission under GNU GPL version 3 section 7:
20
* If you modify this program, or any covered work, by linking or
21
* combining it with the OpenSSL project's OpenSSL library (or a
22
* modified version of that library), containing parts covered by the
23
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
24
* grants you additional permission to convey the resulting work.
25
* Corresponding Source for a non-source form of such a combination
26
* shall include the source code for the parts of OpenSSL used as well
27
* as that of the covered work.
31
#include "client/configurationmanager.h"
33
typedef struct configurationmanager_callback
35
void (*on_accounts_changed)(void);
36
void (*on_account_state_changed)(const std::string& accountID, const int32_t& state);
37
void (*on_account_state_changed_with_code)(const std::string& accountID, const std::string& state, const int32_t& code);
38
} configurationmanager_callback_t;
41
class ConfigurationCallback {
43
virtual ~ConfigurationCallback() {}
44
virtual void on_accounts_changed(void) {}
45
virtual void on_account_state_changed(const std::string& accountID, const int32_t& state) {}
46
virtual void on_account_state_changed_with_code(const std::string& accountID, const std::string& state, const int32_t& code) {}
49
static ConfigurationCallback *registeredConfigurationCallbackObject = NULL;
51
void on_accounts_changed_wrapper (void) {
52
registeredConfigurationCallbackObject->on_accounts_changed();
55
void on_account_state_changed_wrapper (const std::string& accountID, const int32_t& state) {
56
registeredConfigurationCallbackObject->on_account_state_changed(accountID, state);
59
void on_account_state_changed_with_code_wrapper (const std::string& accountID, const std::string& state, const int32_t& code) {
60
registeredConfigurationCallbackObject->on_account_state_changed_with_code(accountID, state, code);
63
static struct configurationmanager_callback wrapper_configurationcallback_struct = {
64
&on_accounts_changed_wrapper,
65
&on_account_state_changed_wrapper,
66
&on_account_state_changed_with_code_wrapper
69
void setConfigurationCallbackObject(ConfigurationCallback *callback) {
70
registeredConfigurationCallbackObject = callback;
75
%feature("director") ConfigurationCallback;
77
class ConfigurationManager {
79
std::map< std::string, std::string > getAccountDetails(const std::string& accountID);
80
void setAccountDetails(const std::string& accountID, const std::map< std::string, std::string >& details);
81
std::map<std::string, std::string> getAccountTemplate();
82
std::string addAccount(const std::map< std::string, std::string >& details);
83
void removeAccount(const std::string& accountID);
84
std::vector< std::string > getAccountList();
85
void sendRegister(const std::string& accountID, const bool& enable);
86
void registerAllAccounts(void);
88
std::map< std::string, std::string > getTlsSettingsDefault();
90
std::vector< int32_t > getAudioCodecList();
91
std::vector< std::string > getSupportedTlsMethod();
92
std::vector< std::string > getAudioCodecDetails(const int32_t& payload);
93
std::vector< int32_t > getActiveAudioCodecList(const std::string& accountID);
95
void setActiveAudioCodecList(const std::vector< std::string >& list, const std::string& accountID);
97
std::vector< std::string > getAudioPluginList();
98
void setAudioPlugin(const std::string& audioPlugin);
99
std::vector< std::string > getAudioOutputDeviceList();
100
void setAudioOutputDevice(const int32_t& index);
101
void setAudioInputDevice(const int32_t& index);
102
void setAudioRingtoneDevice(const int32_t& index);
103
std::vector< std::string > getAudioInputDeviceList();
104
std::vector< std::string > getCurrentAudioDevicesIndex();
105
int32_t getAudioDeviceIndex(const std::string& name);
106
std::string getCurrentAudioOutputPlugin();
107
bool getNoiseSuppressState();
108
void setNoiseSuppressState(const bool& state);
110
void setAgcState(const bool& state);
112
void muteDtmf(const bool& mute);
113
bool isCaptureMuted();
114
void muteCapture(const bool& mute);
115
bool isPlaybackMuted();
116
void mutePlayback(const bool& mute);
117
void setVolume(const std::string& device, const double& value);
118
double getVolume(const std::string& device);
120
std::map<std::string, std::string> getRingtoneList();
122
std::string getAudioManager();
123
void setAudioManager(const std::string& api);
125
int32_t isIax2Enabled();
126
std::string getRecordPath();
127
void setRecordPath(const std::string& recPath);
128
bool getIsAlwaysRecording();
129
void setIsAlwaysRecording(const bool& rec);
131
void setHistoryLimit(const int32_t& days);
132
int32_t getHistoryLimit();
135
void setAccountsOrder(const std::string& order);
137
std::map<std::string, std::string> getHookSettings();
138
void setHookSettings(const std::map<std::string, std::string>& settings);
140
std::vector<std::map<std::string, std::string> > getHistory();
142
std::map<std::string, std::string> getTlsSettings();
143
void setTlsSettings(const std::map< std::string, std::string >& details);
144
std::map< std::string, std::string > getIp2IpDetails();
146
std::vector< std::map< std::string, std::string > > getCredentials(const std::string& accountID);
147
void setCredentials(const std::string& accountID, const std::vector< std::map< std::string, std::string > >& details);
149
std::string getAddrFromInterfaceName(const std::string& interface);
151
std::vector<std::string> getAllIpInterface();
152
std::vector<std::string> getAllIpInterfaceByName();
154
std::map<std::string, std::string> getShortcuts();
155
void setShortcuts(const std::map<std::string, std::string> &shortcutsMap);
158
class ConfigurationCallback {
160
virtual ~ConfigurationCallback();
161
virtual void on_accounts_changed(void);
162
virtual void on_account_state_changed(const std::string& accountID, const int32_t& state);
163
virtual void on_account_state_changed_with_code(const std::string& accountID, const std::string& state, const int32_t& code);
166
static ConfigurationCallback *registeredConfigurationCallbackObject = NULL;
168
void setConfigurationCallbackObject(ConfigurationCallback *callback) {
169
registeredConfigurationCallbackObject = callback;