diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp index 80479a3245d3c0d1155d69f2233f70e96c47ab88..c6b107ed4b50049ac6ff4df8658c02b09999b1cc 100644 --- a/daemon/src/account.cpp +++ b/daemon/src/account.cpp @@ -67,14 +67,13 @@ using std::string; using std::vector; -Account::Account(const string &accountID, const string &type) : +Account::Account(const string &accountID) : accountID_(accountID) , username_() , hostname_() , alias_() , enabled_(true) , autoAnswerEnabled_(false) - , type_(type) , registrationState_(UNREGISTERED) , audioCodecList_() , videoCodecList_() diff --git a/daemon/src/account.h b/daemon/src/account.h index 4f636a7729dffd4be8f6aeda5726f71625c2c69d..71bf9c0bf7ea0e69bff1318af43f68804990aee0 100644 --- a/daemon/src/account.h +++ b/daemon/src/account.h @@ -57,7 +57,7 @@ class Account : public Serializable { public: - Account(const std::string& accountID, const std::string &type); + Account(const std::string& accountID); /** * Virtual destructor @@ -252,12 +252,6 @@ class Account : public Serializable { /* If true, automatically answer calls to this account */ bool autoAnswerEnabled_; - /* - * The account type - * IAX2 or SIP - */ - std::string type_; - /* * The general, protocol neutral registration * state of the account diff --git a/daemon/src/iax/iaxaccount.cpp b/daemon/src/iax/iaxaccount.cpp index e27d4f7504825ab0e2590d33ba40145c9a8511e3..6010d3b4ee9cfcbd63f5d4e1d3fb1d9a08e7a892 100644 --- a/daemon/src/iax/iaxaccount.cpp +++ b/daemon/src/iax/iaxaccount.cpp @@ -43,8 +43,10 @@ #include "config/yamlnode.h" #include "config/yamlemitter.h" +const char * const IAXAccount::ACCOUNT_TYPE = "IAX"; + IAXAccount::IAXAccount(const std::string& accountID) - : Account(accountID, "iax2"), password_(), link_(accountID) + : Account(accountID), password_(), link_(accountID) {} void IAXAccount::serialize(Conf::YamlEmitter &emitter) @@ -57,7 +59,7 @@ void IAXAccount::serialize(Conf::YamlEmitter &emitter) Conf::ScalarNode alias(alias_); Conf::ScalarNode hostname(hostname_); Conf::ScalarNode enable(enabled_); - Conf::ScalarNode type(type_); + Conf::ScalarNode type(ACCOUNT_TYPE); Conf::ScalarNode mailbox(mailBox_); Conf::ScalarNode codecs(audioCodecStr_); @@ -85,7 +87,6 @@ void IAXAccount::serialize(Conf::YamlEmitter &emitter) void IAXAccount::unserialize(const Conf::YamlNode &map) { map.getValue(ALIAS_KEY, &alias_); - map.getValue(TYPE_KEY, &type_); map.getValue(USERNAME_KEY, &username_); map.getValue(PASSWORD_KEY, &password_); map.getValue(HOSTNAME_KEY, &hostname_); @@ -102,7 +103,6 @@ void IAXAccount::setAccountDetails(std::map<std::string, std::string> details) { // Account setting common to SIP and IAX alias_ = details[CONFIG_ACCOUNT_ALIAS]; - type_ = details[CONFIG_ACCOUNT_TYPE]; username_ = details[CONFIG_ACCOUNT_USERNAME]; hostname_ = details[CONFIG_ACCOUNT_HOSTNAME]; password_ = details[CONFIG_ACCOUNT_PASSWORD]; @@ -119,7 +119,7 @@ std::map<std::string, std::string> IAXAccount::getAccountDetails() const a[CONFIG_ACCOUNT_ID] = accountID_; a[CONFIG_ACCOUNT_ALIAS] = alias_; a[CONFIG_ACCOUNT_ENABLE] = enabled_ ? "true" : "false"; - a[CONFIG_ACCOUNT_TYPE] = type_; + a[CONFIG_ACCOUNT_TYPE] = ACCOUNT_TYPE; a[CONFIG_ACCOUNT_HOSTNAME] = hostname_; a[CONFIG_ACCOUNT_USERNAME] = username_; a[CONFIG_ACCOUNT_PASSWORD] = password_; diff --git a/daemon/src/iax/iaxaccount.h b/daemon/src/iax/iaxaccount.h index aa0a8f15345fdbf77a2b1f508aca46fb0e76010c..d5fbb71108da783100affa9cf3096de84a0dac00 100644 --- a/daemon/src/iax/iaxaccount.h +++ b/daemon/src/iax/iaxaccount.h @@ -67,6 +67,7 @@ class IAXAccount : public Account { std::string password_; IAXVoIPLink link_; virtual VoIPLink* getVoIPLink(); + static const char * const ACCOUNT_TYPE; }; #endif diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp index 195b7c11bf3d942326259dc198c1f3ff0aeac06d..0101dc188505d79794264a5b4d4db05e350f145a 100644 --- a/daemon/src/sip/sipaccount.cpp +++ b/daemon/src/sip/sipaccount.cpp @@ -54,6 +54,7 @@ const char * const SIPAccount::IP2IP_PROFILE = "IP2IP"; const char * const SIPAccount::OVERRTP_STR = "overrtp"; const char * const SIPAccount::SIPINFO_STR = "sipinfo"; +const char * const SIPAccount::ACCOUNT_TYPE = "SIP"; namespace { const int MIN_REGISTRATION_TIME = 60; @@ -63,7 +64,7 @@ namespace { } SIPAccount::SIPAccount(const std::string& accountID) - : Account(accountID, "SIP") + : Account(accountID) , transport_(NULL) , credentials_() , regc_(NULL) @@ -139,7 +140,7 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter) ScalarNode hostname(Account::hostname_); ScalarNode enable(enabled_); ScalarNode autoAnswer(autoAnswerEnabled_); - ScalarNode type(Account::type_); + ScalarNode type(ACCOUNT_TYPE); std::stringstream registrationExpireStr; registrationExpireStr << registrationExpire_; ScalarNode expire(registrationExpireStr.str()); @@ -310,7 +311,6 @@ void SIPAccount::unserialize(const Conf::YamlNode &mapNode) using std::string; mapNode.getValue(ALIAS_KEY, &alias_); - mapNode.getValue(TYPE_KEY, &type_); mapNode.getValue(USERNAME_KEY, &username_); if (not isIP2IP()) mapNode.getValue(HOSTNAME_KEY, &hostname_); mapNode.getValue(ACCOUNT_ENABLE_KEY, &enabled_); @@ -469,7 +469,6 @@ void SIPAccount::setAccountDetails(std::map<std::string, std::string> details) { // Account setting common to SIP and IAX alias_ = details[CONFIG_ACCOUNT_ALIAS]; - type_ = details[CONFIG_ACCOUNT_TYPE]; username_ = details[CONFIG_ACCOUNT_USERNAME]; hostname_ = details[CONFIG_ACCOUNT_HOSTNAME]; enabled_ = details[CONFIG_ACCOUNT_ENABLE] == TRUE_STR; @@ -548,7 +547,7 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const a[CONFIG_ACCOUNT_ENABLE] = enabled_ ? TRUE_STR : FALSE_STR; a[CONFIG_ACCOUNT_AUTOANSWER]= autoAnswerEnabled_ ? TRUE_STR : FALSE_STR; - a[CONFIG_ACCOUNT_TYPE] = type_; + a[CONFIG_ACCOUNT_TYPE] = ACCOUNT_TYPE; a[CONFIG_ACCOUNT_HOSTNAME] = hostname_; a[CONFIG_ACCOUNT_USERNAME] = username_; diff --git a/daemon/src/sip/sipaccount.h b/daemon/src/sip/sipaccount.h index a8160c219fbe141efbf3755e7b32de9315787434..e837b048e49405324d478652d3ff1a2244a80692 100644 --- a/daemon/src/sip/sipaccount.h +++ b/daemon/src/sip/sipaccount.h @@ -104,6 +104,7 @@ class SIPAccount : public Account { static const char * const IP2IP_PROFILE; static const char * const OVERRTP_STR; static const char * const SIPINFO_STR; + static const char * const ACCOUNT_TYPE; /** * Constructor