Commit c669fb7f authored by Alexandre Savard's avatar Alexandre Savard

[#3649] Move getAccountDetails setAccountDetails in account class

parent 30fe5778
......@@ -39,6 +39,7 @@ Account::Account (const AccountID& accountID, std::string type) :
, _enabled (false)
, _type (type)
, _codecOrder ()
, _startupCodecStr("")
{
setRegistrationState (Unregistered);
}
......@@ -72,17 +73,16 @@ void Account::setRegistrationState (RegistrationState state) {
void Account::loadAudioCodecs (void) {
// if the user never set the codec list, use the default configuration for this account
if (Manager::instance ().getConfigString (_accountID, "ActiveCodecs") == "") {
if(_startupCodecStr == "") {
_info ("Account: use the default order");
Manager::instance ().getCodecDescriptorMap ().setDefaultOrder();
}
// else retrieve the one set in the user config file
else {
std::vector<std::string> active_list = Manager::instance ().retrieveActiveCodecs();
// This property is now set per account basis
std::string s = Manager::instance ().getConfigString (_accountID, "ActiveCodecs");
setActiveCodecs (Manager::instance ().unserialize (s));
// std::string s = Manager::instance ().getConfigString (_accountID, "ActiveCodecs");
setActiveCodecs (Manager::instance ().unserialize (_startupCodecStr));
}
}
......
......@@ -144,6 +144,8 @@ const Conf::Key mailboxKey("mailbox");
const Conf::Key codecsKey("codecs"); // 0/9/110/111/112/
#define find_in_map(X, Y) if((iter = map_cpy.find(X)) != map_cpy.end()) { Y = iter->second; }
class Account : public Serializable{
public:
......@@ -159,6 +161,11 @@ class Account : public Serializable{
virtual void unserialize(Conf::MappingNode *map) = 0;
virtual void setAccountDetails(const std::map<std::string, std::string>& details) = 0;
virtual std::map<std::string, std::string> getAccountDetails() = 0;
/**
* Load the settings for this account.
*/
......@@ -247,13 +254,13 @@ class Account : public Serializable{
inline std::string getType( void ) { return _type; }
inline void setType( std::string type ) { _type = type; }
/**
* Accessor to data structures
* @return CodecOrder& The list that reflects the user's choice
*/
inline CodecOrder& getActiveCodecs() { return _codecOrder; }
void setActiveCodecs (const std::vector <std::string>& list);
/**
* Accessor to data structures
* @return CodecOrder& The list that reflects the user's choice
*/
inline CodecOrder& getActiveCodecs() { return _codecOrder; }
void setActiveCodecs (const std::vector <std::string>& list);
private:
// copy constructor
......@@ -262,7 +269,7 @@ class Account : public Serializable{
// assignment operator
Account& operator=(const Account& rh);
void loadAudioCodecs (void);
void loadAudioCodecs (void);
protected:
/**
......@@ -320,10 +327,16 @@ class Account : public Serializable{
*/
std::pair<int, std::string> _registrationStateDetailed;
/**
* Vector containing the order of the codecs
*/
CodecOrder _codecOrder;
/**
* Vector containing the order of the codecs
*/
CodecOrder _codecOrder;
/**
* List of codec obtained when parsing configuration and used
* to generate codec order list, should not be used elsewhere.
*/
std::string _startupCodecStr;
};
......
......@@ -57,6 +57,19 @@ void IAXAccount::unserialize(Conf::MappingNode *map)
}
void IAXAccount::setAccountDetails(const std::map<std::string, std::string>& details)
{
}
std::map<std::string, std::string> IAXAccount::getAccountDetails()
{
std::map<std::string, std::string> a;
return a;
}
void IAXAccount::setVoIPLink()
{
......
......@@ -48,6 +48,10 @@ class IAXAccount : public Account
virtual void unserialize(Conf::MappingNode *map);
void setAccountDetails(const std::map<std::string, std::string>& details);
std::map<std::string, std::string> getAccountDetails();
void setVoIPLink ();
/**
......
This diff is collapsed.
......@@ -1057,6 +1057,14 @@ class ManagerImpl {
ost::Mutex* getAudioLayerMutex() { return &_audiolayer_mutex; }
/**
* Helper function that creates an MD5 Hash from the credential
* information provided as parameters. The hash is computed as
* MD5(username ":" realm ":" password).
*
*/
std::string computeMd5HashFromCredential(const std::string& username, const std::string& password, const std::string& realm);
private:
/* Transform digest to string.
* output must be at least PJSIP_MD5STRLEN+1 bytes.
......@@ -1067,14 +1075,6 @@ class ManagerImpl {
*/
void digest2str(const unsigned char digest[], char *output);
/**
* Helper function that creates an MD5 Hash from the credential
* information provided as parameters. The hash is computed as
* MD5(username ":" realm ":" password).
*
*/
std::string computeMd5HashFromCredential(const std::string& username, const std::string& password, const std::string& realm);
/**
* Check if a process is running with the system command
*
......
This diff is collapsed.
......@@ -174,6 +174,10 @@ class SIPAccount : public Account
virtual void unserialize(Conf::MappingNode *map);
virtual void setAccountDetails(const std::map<std::string, std::string>& details);
virtual std::map<std::string, std::string> getAccountDetails();
/**
* Set route header to appears in sip messages for this account
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment