2
2
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
3
3
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
4
4
* Author: Yan Morin <yan.morin@savoirfairelinux.com>
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
8
8
* the Free Software Foundation; either version 3 of the License, or
9
9
* (at your option) any later version.
11
11
* This program is distributed in the hope that it will be useful,
12
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
14
* GNU General Public License for more details.
16
16
* You should have received a copy of the GNU General Public License
17
17
* along with this program; if not, write to the Free Software
18
18
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
122
125
#define TLS_SERVER_NAME "TLS.serverName"
123
126
#define TLS_VERIFY_SERVER "TLS.verifyServer"
124
127
#define TLS_VERIFY_CLIENT "TLS.verifyClient"
125
#define TLS_REQUIRE_CLIENT_CERTIFICATE "TLS.requireClientCertificate"
128
#define TLS_REQUIRE_CLIENT_CERTIFICATE "TLS.requireClientCertificate"
126
129
#define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec"
127
130
#define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec"
129
132
#define REGISTRATION_STATUS "Status"
130
#define REGISTRATION_STATE_CODE "Registration.code"
133
#define REGISTRATION_STATE_CODE "Registration.code"
131
134
#define REGISTRATION_STATE_DESCRIPTION "Registration.description"
137
// General configuration keys for accounts
138
const Conf::Key aliasKey ("alias");
139
const Conf::Key typeKey ("type");
140
const Conf::Key idKey ("id");
141
const Conf::Key usernameKey ("username");
142
const Conf::Key passwordKey ("password");
143
const Conf::Key hostnameKey ("hostname");
144
const Conf::Key accountEnableKey ("enable");
145
const Conf::Key mailboxKey ("mailbox");
147
const Conf::Key codecsKey ("codecs"); // 0/9/110/111/112/
148
const Conf::Key ringtonePathKey ("ringtonePath");
149
const Conf::Key ringtoneEnabledKey ("ringtoneEnabled");
150
const Conf::Key displayNameKey ("displayName");
152
#define find_in_map(X, Y) if((iter = map_cpy.find(X)) != map_cpy.end()) { Y = iter->second; }
154
class Account : public Serializable
138
Account(const AccountID& accountID, std::string type);
159
Account (const AccountID& accountID, std::string type);
141
162
* Virtual destructor
174
216
virtual int unregisterVoIPLink() = 0;
177
* Tell if the account is enable or not.
219
* Tell if the account is enable or not.
178
220
* @return true if enabled
179
221
* false otherwise
181
bool isEnabled() { return _enabled; }
227
void setEnabled (bool enabl) {
184
232
* Get the registration state of the specified link
185
233
* @return RegistrationState The registration state of underlying VoIPLink
187
inline RegistrationState getRegistrationState() { return _registrationState; }
235
inline RegistrationState getRegistrationState() {
236
return _registrationState;
190
240
* Set the registration state of the specified link
191
241
* @param state The registration state of underlying VoIPLink
193
void setRegistrationState( RegistrationState state );
243
void setRegistrationState (RegistrationState state);
196
246
* Set the latest up-to-date state code
197
* for that account. These codes are
247
* for that account. These codes are
198
248
* those used in SIP and IAX (eg. 200, 500 ...)
199
249
* @param state The Code:Description state
202
void setRegistrationStateDetailed(std::pair<int, std::string> state) { _registrationStateDetailed = state; }
252
void setRegistrationStateDetailed (std::pair<int, std::string> state) {
253
_registrationStateDetailed = state;
205
257
* Get the latest up-to-date state code
206
* for that account. These codes are
258
* for that account. These codes are
207
259
* those used in SIP and IAX (eg. 200, 500 ...)
209
261
* @return std::pair<int, std::string> A Code:Description state
211
std::pair<int, std::string> getRegistrationStateDetailed(void) { return _registrationStateDetailed; }
263
std::pair<int, std::string> getRegistrationStateDetailed (void) {
264
return _registrationStateDetailed;
214
268
/* inline functions */
215
269
/* They should be treated like macro definitions by the C++ compiler */
216
inline std::string getUsername( void ) { return _username; }
217
inline void setUsername( std::string username) { _username = username; }
219
inline std::string getHostname( void ) { return _hostname; }
220
inline void setHostname( std::string hostname) { _hostname = hostname; }
222
inline std::string getPassword( void ) { return _password; }
223
inline void setPassword( std::string password ) { _password = password; }
225
inline std::string getAlias( void ) { return _alias; }
226
inline void setAlias( std::string alias ) { _alias = alias; }
228
inline std::string getType( void ) { return _type; }
229
inline void setType( std::string type ) { _type = type; }
232
* Accessor to data structures
233
* @return CodecOrder& The list that reflects the user's choice
235
inline CodecOrder& getActiveCodecs() { return _codecOrder; }
237
void setActiveCodecs (const std::vector <std::string>& list);
270
inline std::string getUsername (void) {
273
inline void setUsername (std::string username) {
274
_username = username;
277
inline std::string getHostname (void) {
280
inline void setHostname (std::string hostname) {
281
_hostname = hostname;
284
inline std::string getPassword (void) {
287
inline void setPassword (std::string password) {
288
_password = password;
291
inline std::string getAlias (void) {
294
inline void setAlias (std::string alias) {
298
inline std::string getType (void) {
301
inline void setType (std::string type) {
306
* Accessor to data structures
307
* @return CodecOrder& The list that reflects the user's choice
309
inline CodecOrder& getActiveCodecs (void) {
312
void setActiveCodecs (const std::vector <std::string>& list);
314
inline std::string getRingtonePath (void) {
315
return _ringtonePath;
317
inline void setRingtonePath (std::string path) {
318
_ringtonePath = path;
321
inline bool getRingtoneEnabled (void) {
322
return _ringtoneEnabled;
324
inline void setRingtoneEnabled (bool enabl) {
325
_ringtoneEnabled = enabl;
328
inline std::string getDisplayName (void) {
331
inline void setDisplayName (std::string name) {
335
std::string getUseragent (void) {
338
void setUseragent (std::string ua) {
342
std::string getMailBox (void) {
346
void setMailBox (std::string mb) {
240
351
// copy constructor
241
Account(const Account& rh);
352
Account (const Account& rh);
243
354
// assignment operator
244
Account& operator=(const Account& rh);
246
void loadAudioCodecs (void);
355
Account& operator= (const Account& rh);
359
void loadAudioCodecs (void);
250
362
* Account ID are assign in constructor and shall not changed
290
402
std::string _type;
293
* The general, protocol neutral registration
405
* The general, protocol neutral registration
294
406
* state of the account
296
408
RegistrationState _registrationState;
299
411
* Details about the registration state.
300
* This is a protocol Code:Description pair.
412
* This is a protocol Code:Description pair.
302
414
std::pair<int, std::string> _registrationStateDetailed;
305
* Vector containing the order of the codecs
307
CodecOrder _codecOrder;
417
* Vector containing the order of the codecs
419
CodecOrder _codecOrder;
422
* List of codec obtained when parsing configuration and used
423
* to generate codec order list
425
std::string _codecStr;
428
* Ringtone .au file used for this account
430
std::string _ringtonePath;
433
* Play ringtone when receiving a call
435
bool _ringtoneEnabled;
438
* Display name when calling
440
std::string _displayName;
443
* Useragent used for registration
445
std::string _useragent;
451
std::string _mailBox;