diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h index c7c0424537f609aeac731477fb35c3763897fe33..22dc6341b7c73ca5898111493ab124886bff3402 100644 --- a/sflphone-common/src/account.h +++ b/sflphone-common/src/account.h @@ -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" diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index a409aa5a6dc9c5bd1d213f0af4daa28fe1562d12..29dcc62fd96cae5c4712ff7ca0c7a2036fdcbfaf 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -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); diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index 8c624d036b649449aa04531b60ade0130e8359ff..60085f54afaabd1d57dd11f725dbd0f5c0deadfc 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -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 diff --git a/sflphone-common/src/sip/sipaccount.h b/sflphone-common/src/sip/sipaccount.h index db4dbb17ff1a0459792e09c8bcecaffa695f19be..855fbe39e4872c539ed30c49b3156730645c6500 100644 --- a/sflphone-common/src/sip/sipaccount.h +++ b/sflphone-common/src/sip/sipaccount.h @@ -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.