diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index a9886dd739a8159032bfe38097e1485f991aceef..5f08b84bb08b427bb39dd0a804bea68b70a7729c 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -2507,11 +2507,11 @@ ManagerImpl::getAccountIdFromNameAndServer(const std::string& userName, const st
     }
   }
 
-  // We failed! Then only match the username
+  // We failed! Then only match the hostname
   for(iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) {
     account = dynamic_cast<SIPAccount *>(iter->second);
     if ( account != NULL ) {
-    	if(account->userMatch(userName))
+    	if(account->hostnameMatch(server))
       		return iter->first;
     }
   }
diff --git a/sflphone-common/src/sipaccount.cpp b/sflphone-common/src/sipaccount.cpp
index b72eb15e0f9bcbb78c60230b0ecddf2b18af0467..31502460a398788f81478dd451fd3f99ea2718f8 100644
--- a/sflphone-common/src/sipaccount.cpp
+++ b/sflphone-common/src/sipaccount.cpp
@@ -87,7 +87,7 @@ void SIPAccount::loadConfig()
 
 bool SIPAccount::fullMatch(const std::string& username, const std::string& hostname)
 {
-  return (username == getUsername() && hostname == getHostname());
+  return (userMatch (username) && hostnameMatch (hostname));
 }
 
 bool SIPAccount::userMatch(const std::string& username)
@@ -95,3 +95,8 @@ bool SIPAccount::userMatch(const std::string& username)
   return (username == getUsername());
 }
 
+bool SIPAccount::hostnameMatch(const std::string& hostname)
+{
+  return (hostname == getHostname());
+}
+
diff --git a/sflphone-common/src/sipaccount.h b/sflphone-common/src/sipaccount.h
index a49af2d00864a29c674a2ac152dcd2663d75620c..a9925d734f8d67a46c4d438fdfd3154a9046594a 100644
--- a/sflphone-common/src/sipaccount.h
+++ b/sflphone-common/src/sipaccount.h
@@ -76,6 +76,7 @@ class SIPAccount : public Account
 
         bool fullMatch(const std::string& username, const std::string& hostname);
         bool userMatch(const std::string& username);
+        bool hostnameMatch(const std::string& hostname);
 
         pjsip_regc* getRegistrationInfo( void ) { return _regc; }
         void setRegistrationInfo( pjsip_regc *regc ) { _regc = regc; }