Skip to content
Snippets Groups Projects
Commit db2b1549 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

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

parent 2cbd6788
No related branches found
No related tags found
No related merge requests found
...@@ -70,6 +70,7 @@ typedef enum RegistrationState { ...@@ -70,6 +70,7 @@ typedef enum RegistrationState {
#define REALM "realm" #define REALM "realm"
#define DEFAULT_REALM "*" #define DEFAULT_REALM "*"
#define LOCAL_INTERFACE "Account.localInterface"
#define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" #define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal"
#define LOCAL_PORT "Account.localPort" #define LOCAL_PORT "Account.localPort"
#define LOCAL_ADDRESS "Account.localAddress" #define LOCAL_ADDRESS "Account.localAddress"
......
...@@ -2266,6 +2266,7 @@ ManagerImpl::initConfigFile (bool load_user_value, std::string alternate) ...@@ -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_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_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> (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> (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> (LOCAL_PORT, DEFAULT_SIP_PORT), IP2IP_PROFILE);
_config.addDefaultValue (std::pair<std::string, std::string> (PUBLISHED_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 ...@@ -3769,6 +3770,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
std::string hostname; std::string hostname;
std::string displayName; std::string displayName;
std::string localInterface;
std::string publishedSameasLocal; std::string publishedSameasLocal;
std::string localAddress; std::string localAddress;
std::string publishedAddress; std::string publishedAddress;
...@@ -3805,6 +3807,10 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma ...@@ -3805,6 +3807,10 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
displayName = iter->second; 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()) { if ( (iter = map_cpy.find (PUBLISHED_SAMEAS_LOCAL)) != map_cpy.end()) {
publishedSameasLocal = iter->second; publishedSameasLocal = iter->second;
} }
...@@ -3935,6 +3941,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma ...@@ -3935,6 +3941,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
setConfig (accountID, HOSTNAME, hostname); setConfig (accountID, HOSTNAME, hostname);
setConfig (accountID, LOCAL_INTERFACE, localInterface);
setConfig (accountID, PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal); setConfig (accountID, PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal);
setConfig (accountID, LOCAL_ADDRESS, localAddress); setConfig (accountID, LOCAL_ADDRESS, localAddress);
setConfig (accountID, PUBLISHED_ADDRESS, publishedAddress); setConfig (accountID, PUBLISHED_ADDRESS, publishedAddress);
......
...@@ -341,8 +341,11 @@ void SIPAccount::loadConfig() ...@@ -341,8 +341,11 @@ void SIPAccount::loadConfig()
// Load network settings // Load network settings
// Local parameters // 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())); setLocalPort (atoi (localPort.c_str()));
// Do not store or use IP address in config as this address may change // Do not store or use IP address in config as this address may change
......
...@@ -201,7 +201,7 @@ class SIPAccount : public Account ...@@ -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 * 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. * 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. * Get the local interface name on which this account is bound.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment