Commit c080c414 authored by Alexandre Savard's avatar Alexandre Savard

[#4220] Fix account mailbox number in config

parent 624ce2c2
......@@ -339,6 +339,14 @@ class Account : public Serializable
_useragent = ua;
}
std::string getMailBox (void) {
return _mailBox;
}
void setMailBox (std::string mb) {
_mailBox = mb;
}
private:
// copy constructor
Account (const Account& rh);
......@@ -436,6 +444,12 @@ class Account : public Serializable
*/
std::string _useragent;
/**
* Account mail box
*/
std::string _mailBox;
};
#endif
......@@ -60,7 +60,7 @@ void IAXAccount::serialize (Conf::YamlEmitter *emitter)
Conf::ScalarNode hostname (Account::_hostname);
Conf::ScalarNode enable (_enabled ? "true" : "false");
Conf::ScalarNode type (Account::_type);
Conf::ScalarNode mailbox ("97");
Conf::ScalarNode mailbox (_mailBox);
Conf::ScalarNode codecs (_codecStr);
Conf::ScalarNode displayName (_displayName);
......@@ -139,7 +139,12 @@ void IAXAccount::unserialize (Conf::MappingNode *map)
val = NULL;
}
// val = (Conf::ScalarNode *)(map->getValue(mailboxKey));
val = (Conf::ScalarNode *) (map->getValue (mailboxKey));
if (val) {
_mailBox = val->getValue();
val = NULL;
}
val = (Conf::ScalarNode *) (map->getValue (codecsKey));
......@@ -192,6 +197,7 @@ void IAXAccount::setAccountDetails (const std::map<std::string, std::string>& de
setHostname (hostname);
setPassword (password);
setEnabled ( (accountEnable.compare ("true") == 0) ? true : false);
setMailBox (mailbox);
std::string displayName;
find_in_map (DISPLAY_NAME, displayName)
......@@ -215,6 +221,7 @@ std::map<std::string, std::string> IAXAccount::getAccountDetails()
a.insert (std::pair<std::string, std::string> (HOSTNAME, getHostname()));
a.insert (std::pair<std::string, std::string> (USERNAME, getUsername()));
a.insert (std::pair<std::string, std::string> (PASSWORD, getPassword()));
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_MAILBOX, getMailBox()));
RegistrationState state = Unregistered;
std::string registrationStateCode;
......
......@@ -177,7 +177,7 @@ void SIPAccount::serialize (Conf::YamlEmitter *emitter)
Conf::ScalarNode port (portstr.str());
Conf::ScalarNode serviceRoute (_serviceRoute);
Conf::ScalarNode mailbox ("97");
Conf::ScalarNode mailbox (_mailBox);
Conf::ScalarNode publishAddr (_publishedIpAddress);
std::stringstream publicportstr;
publicportstr << _publishedPort;
......@@ -339,7 +339,12 @@ void SIPAccount::unserialize (Conf::MappingNode *map)
val = NULL;
}
// val = (Conf::ScalarNode *)(map->getValue(mailboxKey));
val = (Conf::ScalarNode *) (map->getValue (mailboxKey));
if (val) {
_mailBox = val->getValue();
val = NULL;
}
val = (Conf::ScalarNode *) (map->getValue (codecsKey));
......@@ -383,7 +388,6 @@ void SIPAccount::unserialize (Conf::MappingNode *map)
val = NULL;
}
// val = (Conf::ScalarNode *)(map->getValue(mailboxKey));
val = (Conf::ScalarNode *) (map->getValue (publishAddrKey));
if (val) {
......@@ -662,6 +666,7 @@ void SIPAccount::setAccountDetails (const std::map<std::string, std::string>& de
setEnabled ( (accountEnable == "true"));
setRingtonePath (ringtonePath);
setRingtoneEnabled ( (ringtoneEnabled == "true"));
setMailBox (mailbox);
// SIP specific account settings
if (getType() == "SIP") {
......@@ -841,6 +846,9 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails()
a.insert (std::pair<std::string, std::string> (CONFIG_RINGTONE_PATH, getRingtonePath()));
a.insert (std::pair<std::string, std::string> (CONFIG_RINGTONE_ENABLED, getRingtoneEnabled() ? "true" : "false"));
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_MAILBOX, getMailBox()));
RegistrationState state = Unregistered;
std::string registrationStateCode;
std::string registrationStateDescription;
......
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