[#2623] Add local interface field in account configuration file

This commit is contained in:
Alexandre Savard
2010-01-04 12:20:18 -05:00
parent 2cbd678837
commit db2b154978
4 changed files with 13 additions and 2 deletions

View File

@ -70,6 +70,7 @@ typedef enum RegistrationState {
#define REALM "realm"
#define DEFAULT_REALM "*"
#define LOCAL_INTERFACE "Account.localInterface"
#define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal"
#define LOCAL_PORT "Account.localPort"
#define LOCAL_ADDRESS "Account.localAddress"

View File

@ -2266,6 +2266,7 @@ ManagerImpl::initConfigFile (bool load_user_value, std::string alternate)
_config.addDefaultValue (std::pair<std::string, std::string> (TLS_REQUIRE_CLIENT_CERTIFICATE, TRUE_STR), IP2IP_PROFILE);
_config.addDefaultValue (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_SEC, "2"), IP2IP_PROFILE);
_config.addDefaultValue (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_MSEC, "0"), IP2IP_PROFILE);
_config.addDefaultValue (std::pair<std::string, std::string> (LOCAL_INTERFACE, "default"), IP2IP_PROFILE);
_config.addDefaultValue (std::pair<std::string, std::string> (PUBLISHED_SAMEAS_LOCAL, TRUE_STR), IP2IP_PROFILE);
_config.addDefaultValue (std::pair<std::string, std::string> (LOCAL_PORT, DEFAULT_SIP_PORT), IP2IP_PROFILE);
_config.addDefaultValue (std::pair<std::string, std::string> (PUBLISHED_PORT, DEFAULT_SIP_PORT), IP2IP_PROFILE);
@ -3769,6 +3770,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
std::string hostname;
std::string displayName;
std::string localInterface;
std::string publishedSameasLocal;
std::string localAddress;
std::string publishedAddress;
@ -3805,6 +3807,10 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
displayName = iter->second;
}
if ( (iter = map_cpy.find (LOCAL_INTERFACE)) != map_cpy.end()) {
localInterface = iter->second;
}
if ( (iter = map_cpy.find (PUBLISHED_SAMEAS_LOCAL)) != map_cpy.end()) {
publishedSameasLocal = iter->second;
}
@ -3935,6 +3941,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
setConfig (accountID, HOSTNAME, hostname);
setConfig (accountID, LOCAL_INTERFACE, localInterface);
setConfig (accountID, PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal);
setConfig (accountID, LOCAL_ADDRESS, localAddress);
setConfig (accountID, PUBLISHED_ADDRESS, publishedAddress);

View File

@ -341,8 +341,11 @@ void SIPAccount::loadConfig()
// Load network settings
// Local parameters
std::string localPort = Manager::instance().getConfigString (_accountID, LOCAL_PORT);
// Load local interface
setLocalInterface(Manager::instance().getConfigString (_accountID, LOCAL_INTERFACE));
std::string localPort = Manager::instance().getConfigString (_accountID, LOCAL_PORT);
setLocalPort (atoi (localPort.c_str()));
// Do not store or use IP address in config as this address may change

View File

@ -201,7 +201,7 @@ class SIPAccount : public Account
* that the account is bound to the ANY interafec (0.0.0.0). This method should be
* when binding the account to a new sip transport only.
*/
inline voidsetLocalInterface(const std::string interface&) {_interface = interface;}
inline void setLocalInterface(const std::string& interface) {_interface = interface;}
/**
* Get the local interface name on which this account is bound.