From f3efb5877c541f09890dfb6714a62d721b13c39e Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
Date: Mon, 5 Jul 2010 17:16:43 -0400
Subject: [PATCH] [#3649] Update managerimpl::setaccountdetails

---
 sflphone-common/src/account.h          |   2 +
 sflphone-common/src/managerimpl.cpp    | 362 +++++++++++++------------
 sflphone-common/src/sip/sipaccount.cpp |  29 +-
 sflphone-common/src/sip/sipaccount.h   | 112 ++++++--
 4 files changed, 296 insertions(+), 209 deletions(-)

diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h
index cec37565b1..e2113f2cb2 100644
--- a/sflphone-common/src/account.h
+++ b/sflphone-common/src/account.h
@@ -197,6 +197,8 @@ class Account : public Serializable{
          */
         bool isEnabled() { return _enabled; }
 
+	void setEnabled(bool enabl) { _enabled = enabl; }
+
         /**
          * Get the registration state of the specified link
          * @return RegistrationState	The registration state of underlying VoIPLink
diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index 6dc7f3dfae..bb1325ba6b 100755
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -3334,136 +3334,101 @@ std::map<std::string, std::string> ManagerImpl::getAccountDetails (
 	(accountID == IP2IP_PROFILE) ? a.insert(
 			std::pair<std::string, std::string>(CONFIG_ACCOUNT_ALIAS,
 					DIRECT_IP_CALL)) : a.insert(std::pair<std::string,
-			std::string>(CONFIG_ACCOUNT_ALIAS, getConfigString(accountID,
-			CONFIG_ACCOUNT_ALIAS)));
-
-	a.insert(std::pair<std::string, std::string>(CONFIG_ACCOUNT_ENABLE,
-			getConfigString(accountID, CONFIG_ACCOUNT_ENABLE)));
-	a.insert(std::pair<std::string, std::string>(CONFIG_ACCOUNT_RESOLVE_ONCE,
-			getConfigString(accountID, CONFIG_ACCOUNT_RESOLVE_ONCE)));
-	a.insert(std::pair<std::string, std::string>(CONFIG_ACCOUNT_TYPE,
-			getConfigString(accountID, CONFIG_ACCOUNT_TYPE)));
-	a.insert(std::pair<std::string, std::string>(HOSTNAME, getConfigString(
-			accountID, HOSTNAME)));
-	a.insert(std::pair<std::string, std::string>(USERNAME, getConfigString(
-			accountID, USERNAME)));
-	a.insert(std::pair<std::string, std::string>(ROUTESET, getConfigString(
-			accountID, ROUTESET)));
-	a.insert(std::pair<std::string, std::string>(PASSWORD, getConfigString(
-			accountID, PASSWORD)));
-	a.insert(std::pair<std::string, std::string>(REALM, getConfigString(
-			accountID, REALM)));
-	a.insert(std::pair<std::string, std::string>(USERAGENT, getConfigString(
-			accountID, USERAGENT)));
-	a.insert(std::pair<std::string, std::string>(AUTHENTICATION_USERNAME,
-			getConfigString(accountID, AUTHENTICATION_USERNAME)));
-	a.insert(std::pair<std::string, std::string>(CONFIG_ACCOUNT_MAILBOX,
-			getConfigString(accountID, CONFIG_ACCOUNT_MAILBOX)));
-	a.insert(std::pair<std::string, std::string>(
-			CONFIG_ACCOUNT_REGISTRATION_EXPIRE, getConfigString(accountID,
-					CONFIG_ACCOUNT_REGISTRATION_EXPIRE)));
-	a.insert(std::pair<std::string, std::string>(LOCAL_INTERFACE,
-			getConfigString(accountID, LOCAL_INTERFACE)));
-	a.insert(std::pair<std::string, std::string>(PUBLISHED_SAMEAS_LOCAL,
-			getConfigString(accountID, PUBLISHED_SAMEAS_LOCAL)));
-	a.insert(std::pair<std::string, std::string>(PUBLISHED_ADDRESS,
-			getConfigString(accountID, PUBLISHED_ADDRESS)));
-	a.insert(std::pair<std::string, std::string>(LOCAL_PORT, getConfigString(
-			accountID, LOCAL_PORT)));
-	a.insert(std::pair<std::string, std::string>(PUBLISHED_PORT,
-			getConfigString(accountID, PUBLISHED_PORT)));
-	a.insert(std::pair<std::string, std::string>(DISPLAY_NAME, getConfigString(
-			accountID, DISPLAY_NAME)));
-	a.insert(std::pair<std::string, std::string>(STUN_ENABLE, getConfigString(
-			accountID, STUN_ENABLE)));
-	a.insert(std::pair<std::string, std::string>(STUN_SERVER, getConfigString(
-			accountID, STUN_SERVER)));
-	a.insert(std::pair<std::string, std::string>(ACCOUNT_DTMF_TYPE, getConfigString(
-				accountID, ACCOUNT_DTMF_TYPE)));
-
-	RegistrationState state = Unregistered;
-	std::string registrationStateCode;
-	std::string registrationStateDescription;
-
-	if (account != NULL) {
-		if (accountID == IP2IP_PROFILE) {
-			registrationStateCode = EMPTY_FIELD;
-			registrationStateDescription = "Direct IP call";
-		} else {
-			state = account->getRegistrationState();
-			int code = account->getRegistrationStateDetailed().first;
-			std::stringstream out;
-			out << code;
-			registrationStateCode = out.str();
-			registrationStateDescription
-					= account->getRegistrationStateDetailed().second;
-		}
-	}
+								    std::string>(CONFIG_ACCOUNT_ALIAS, account->getAlias()));
 
-	(accountID == IP2IP_PROFILE) ? a.insert(
-			std::pair<std::string, std::string>(REGISTRATION_STATUS, "READY"))
-			: a.insert(std::pair<std::string, std::string>(REGISTRATION_STATUS,
-					mapStateNumberToString(state)));
-
-	a.insert(std::pair<std::string, std::string>(REGISTRATION_STATE_CODE,
-			registrationStateCode));
-	a.insert(std::pair<std::string, std::string>(
-			REGISTRATION_STATE_DESCRIPTION, registrationStateDescription));
-	a.insert(std::pair<std::string, std::string>(SRTP_KEY_EXCHANGE,
-			getConfigString(accountID, SRTP_KEY_EXCHANGE)));
-	a.insert(std::pair<std::string, std::string>(SRTP_ENABLE, getConfigString(
-			accountID, SRTP_ENABLE)));
-	a.insert(std::pair<std::string, std::string>(SRTP_RTP_FALLBACK,
-			getConfigString(accountID, SRTP_RTP_FALLBACK)));
-	a.insert(std::pair<std::string, std::string>(ZRTP_DISPLAY_SAS,
-			getConfigString(accountID, ZRTP_DISPLAY_SAS)));
-	a.insert(std::pair<std::string, std::string>(ZRTP_DISPLAY_SAS_ONCE,
-			getConfigString(accountID, ZRTP_DISPLAY_SAS_ONCE)));
-	a.insert(std::pair<std::string, std::string>(ZRTP_HELLO_HASH,
-			getConfigString(accountID, ZRTP_HELLO_HASH)));
-	a.insert(std::pair<std::string, std::string>(ZRTP_NOT_SUPP_WARNING,
-			getConfigString(accountID, ZRTP_NOT_SUPP_WARNING)));
-
-	// TLS listener is unique and parameters are modified through IP2IP_PROFILE
-	a.insert(std::pair<std::string, std::string>(TLS_LISTENER_PORT,
-			Manager::instance().getConfigString(IP2IP_PROFILE,
-					TLS_LISTENER_PORT)));
-	a.insert(std::pair<std::string, std::string>(TLS_ENABLE,
-			Manager::instance().getConfigString(accountID, TLS_ENABLE)));
-	a.insert(std::pair<std::string, std::string>(TLS_CA_LIST_FILE,
-			Manager::instance().getConfigString(accountID, TLS_CA_LIST_FILE)));
-	a.insert(
-			std::pair<std::string, std::string>(TLS_CERTIFICATE_FILE,
-					Manager::instance().getConfigString(accountID,
-							TLS_CERTIFICATE_FILE)));
-	a.insert(
-			std::pair<std::string, std::string>(TLS_PRIVATE_KEY_FILE,
-					Manager::instance().getConfigString(accountID,
-							TLS_PRIVATE_KEY_FILE)));
-	a.insert(std::pair<std::string, std::string>(TLS_PASSWORD,
-			Manager::instance().getConfigString(accountID, TLS_PASSWORD)));
-	a.insert(std::pair<std::string, std::string>(TLS_METHOD,
-			Manager::instance().getConfigString(accountID, TLS_METHOD)));
-	a.insert(std::pair<std::string, std::string>(TLS_CIPHERS,
-			Manager::instance().getConfigString(accountID, TLS_CIPHERS)));
-	a.insert(std::pair<std::string, std::string>(TLS_SERVER_NAME,
-			Manager::instance().getConfigString(accountID, TLS_SERVER_NAME)));
-	a.insert(std::pair<std::string, std::string>(TLS_VERIFY_SERVER,
-			Manager::instance().getConfigString(accountID, TLS_VERIFY_SERVER)));
-	a.insert(std::pair<std::string, std::string>(TLS_VERIFY_CLIENT,
-			Manager::instance().getConfigString(accountID, TLS_VERIFY_CLIENT)));
-	a.insert(std::pair<std::string, std::string>(
-			TLS_REQUIRE_CLIENT_CERTIFICATE,
-			Manager::instance().getConfigString(accountID,
-					TLS_REQUIRE_CLIENT_CERTIFICATE)));
-	a.insert(std::pair<std::string, std::string>(TLS_NEGOTIATION_TIMEOUT_SEC,
-			Manager::instance().getConfigString(accountID,
-					TLS_NEGOTIATION_TIMEOUT_SEC)));
-	a.insert(std::pair<std::string, std::string>(TLS_NEGOTIATION_TIMEOUT_MSEC,
-			Manager::instance().getConfigString(accountID,
-					TLS_NEGOTIATION_TIMEOUT_MSEC)));
-
-	return a;
+	  a.insert(std::pair<std::string, std::string>(CONFIG_ACCOUNT_ENABLE, account->isEnabled() ? "true" : "false"));
+	  a.insert(std::pair<std::string, std::string>(CONFIG_ACCOUNT_TYPE, account->getType()));
+	  a.insert(std::pair<std::string, std::string>(HOSTNAME, account->getHostname()));
+	  a.insert(std::pair<std::string, std::string>(USERNAME, account->getUsername()));
+	  a.insert(std::pair<std::string, std::string>(PASSWORD, account->getPassword()));
+
+
+	  // a.insert(std::pair<std::string, std::string>(CONFIG_ACCOUNT_MAILBOX,
+	  // getConfigString(accountID, CONFIG_ACCOUNT_MAILBOX)));
+	  // a.insert(std::pair<std::string, std::string>(DISPLAY_NAME, getConfigString(
+	  // accountID, DISPLAY_NAME)));
+
+	  RegistrationState state = Unregistered;
+	  std::string registrationStateCode;
+	  std::string registrationStateDescription;
+
+	  if (account != NULL) {
+	    if (accountID == IP2IP_PROFILE) {
+	      registrationStateCode = EMPTY_FIELD;
+	      registrationStateDescription = "Direct IP call";
+	    } else {
+	      state = account->getRegistrationState();
+	      int code = account->getRegistrationStateDetailed().first;
+	      std::stringstream out;
+	      out << code;
+	      registrationStateCode = out.str();
+	      registrationStateDescription = account->getRegistrationStateDetailed().second;
+	    }
+	  }
+
+	  (accountID == IP2IP_PROFILE) ? a.insert(
+						    std::pair<std::string, std::string>(REGISTRATION_STATUS, "READY"))
+	    : a.insert(std::pair<std::string, std::string>(REGISTRATION_STATUS,
+							   mapStateNumberToString(state)));
+	    
+	  a.insert(std::pair<std::string, std::string>(REGISTRATION_STATE_CODE,
+						       registrationStateCode));
+	  a.insert(std::pair<std::string, std::string>(REGISTRATION_STATE_DESCRIPTION, registrationStateDescription));
+
+	  // Add sip specific details
+	  if(account->getType().compare("SIP") == 0) {
+
+	    SIPAccount *sipaccount = (SIPAccount *)account;
+	    
+	    a.insert(std::pair<std::string, std::string>(ROUTESET, sipaccount->getRouteSet()));
+	    a.insert(std::pair<std::string, std::string>(CONFIG_ACCOUNT_RESOLVE_ONCE, sipaccount->isResolveOnce() ? "true" : "false"));
+	    // a.insert(std::pair<std::string, std::string>(REALM, account->
+	    a.insert(std::pair<std::string, std::string>(USERAGENT, sipaccount->getUseragent()));
+		     // a.insert(std::pair<std::string, std::string>(AUTHENTICATION_USERNAME, getConfigString(accountID, AUTHENTICATION_USERNAME)));
+	    a.insert(std::pair<std::string, std::string>(CONFIG_ACCOUNT_REGISTRATION_EXPIRE, sipaccount->getRegistrationExpire()));
+	    a.insert(std::pair<std::string, std::string>(LOCAL_INTERFACE, sipaccount->getLocalInterface()));				       
+	    a.insert(std::pair<std::string, std::string>(PUBLISHED_SAMEAS_LOCAL, sipaccount->getPublishedSameasLocal() ? "true" : "false"));
+	    a.insert(std::pair<std::string, std::string>(PUBLISHED_ADDRESS, sipaccount->getPublishedAddress()));
+	    std::stringstream localport;
+	    localport << sipaccount->getLocalPort();
+	    a.insert(std::pair<std::string, std::string>(LOCAL_PORT, localport.str()));
+	    std::stringstream publishedport;
+	    publishedport << sipaccount->getPublishedPort();
+	    a.insert(std::pair<std::string, std::string>(PUBLISHED_PORT, publishedport.str()));
+	    a.insert(std::pair<std::string, std::string>(STUN_ENABLE, sipaccount->isStunEnabled() ? "true" : "false"));
+	    a.insert(std::pair<std::string, std::string>(STUN_SERVER, std::string(sipaccount->getStunServerName().ptr, sipaccount->getStunServerName().slen)));
+	    a.insert(std::pair<std::string, std::string>(ACCOUNT_DTMF_TYPE, (sipaccount->getDtmfType() == 0) ? "0" : "1"));
+
+	    a.insert(std::pair<std::string, std::string>(SRTP_KEY_EXCHANGE, sipaccount->getSrtpKeyExchange()));
+	    a.insert(std::pair<std::string, std::string>(SRTP_ENABLE, sipaccount->getSrtpEnable() ? "true" : "false"));
+	    a.insert(std::pair<std::string, std::string>(SRTP_RTP_FALLBACK, sipaccount->getSrtpFallback() ? "true" : "false"));
+ 
+	    a.insert(std::pair<std::string, std::string>(ZRTP_DISPLAY_SAS, sipaccount->getZrtpDisplaySas() ? "true" : "false"));
+	    a.insert(std::pair<std::string, std::string>(ZRTP_DISPLAY_SAS_ONCE, sipaccount->getZrtpDiaplaySasOnce() ? "true" : "false"));
+	    a.insert(std::pair<std::string, std::string>(ZRTP_HELLO_HASH, sipaccount->getZrtpHelloHash() ? "true" : "false"));
+	    a.insert(std::pair<std::string, std::string>(ZRTP_NOT_SUPP_WARNING, sipaccount->getZrtpNotSuppWarning() ? "true" : "false"));
+	    
+	    // TLS listener is unique and parameters are modified through IP2IP_PROFILE
+	    std::stringstream tlslistenerport;
+	    tlslistenerport << sipaccount->getTlsListenerPort();
+	    a.insert(std::pair<std::string, std::string>(TLS_LISTENER_PORT, tlslistenerport.str()));
+	    a.insert(std::pair<std::string, std::string>(TLS_ENABLE, sipaccount->getTlsEnable()));
+	    a.insert(std::pair<std::string, std::string>(TLS_CA_LIST_FILE, sipaccount->getTlsCaListFile()));
+	    a.insert(std::pair<std::string, std::string>(TLS_CERTIFICATE_FILE, sipaccount->getTlsCertificateFile()));
+	    a.insert(std::pair<std::string, std::string>(TLS_PRIVATE_KEY_FILE, sipaccount->getTlsPrivateKeyFile()));
+	    a.insert(std::pair<std::string, std::string>(TLS_PASSWORD, sipaccount->getTlsPassword()));
+	    a.insert(std::pair<std::string, std::string>(TLS_METHOD, sipaccount->getTlsMethod()));
+	    a.insert(std::pair<std::string, std::string>(TLS_CIPHERS, sipaccount->getTlsCiphers()));
+	    a.insert(std::pair<std::string, std::string>(TLS_SERVER_NAME, sipaccount->getTlsServerName()));
+	    a.insert(std::pair<std::string, std::string>(TLS_VERIFY_SERVER, sipaccount->getTlsVerifyServer() ? "true" : "false"));
+	    a.insert(std::pair<std::string, std::string>(TLS_VERIFY_CLIENT, sipaccount->getTlsVerifyClient() ? "true" : "false"));
+	    a.insert(std::pair<std::string, std::string>(TLS_REQUIRE_CLIENT_CERTIFICATE, sipaccount->getTlsRequireClientCertificate() ? "true" : "false"));
+	    a.insert(std::pair<std::string, std::string>(TLS_NEGOTIATION_TIMEOUT_SEC, sipaccount->getTlsNegotiationTimeoutSec()));
+	    a.insert(std::pair<std::string, std::string>(TLS_NEGOTIATION_TIMEOUT_MSEC, sipaccount->getTlsNegotiationTimeoutMsec()));
+
+	  }
+
+	  return a;
 }
 
 /* Transform digest to string.
@@ -3593,7 +3558,9 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
     // Get the account type
     std::string accountType;
     find_in_map(CONFIG_ACCOUNT_TYPE, accountType)
-    
+
+    Account* account = getAccount(accountID);
+
     std::string alias;
     std::string type;
     std::string hostname;
@@ -3602,7 +3569,6 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
     std::string mailbox;
     std::string accountEnable;
 
-
     // Account setting common to SIP and IAX
     find_in_map(CONFIG_ACCOUNT_ALIAS, alias)
     find_in_map(CONFIG_ACCOUNT_TYPE, type)
@@ -3612,17 +3578,26 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
     find_in_map(CONFIG_ACCOUNT_MAILBOX, mailbox);
     find_in_map(CONFIG_ACCOUNT_ENABLE, accountEnable);
 
-    setConfig(accountID, CONFIG_ACCOUNT_ALIAS, alias);
-    setConfig(accountID, CONFIG_ACCOUNT_TYPE, type);
-    setConfig(accountID, HOSTNAME, hostname);
-    setConfig(accountID, USERNAME, username);
-    setConfig(accountID, PASSWORD, password);
-    setConfig(accountID, CONFIG_ACCOUNT_MAILBOX, mailbox);
-    setConfig(accountID, CONFIG_ACCOUNT_ENABLE, accountEnable);
+    account->setAlias(alias);
+    account->setType(type);
+    account->setUsername(username);
+    account->setHostname(hostname);
+    account->setPassword(password);
+    account->setEnabled((accountEnable.compare("true") == 0) ? true : false);
+
+      // setConfig(accountID, CONFIG_ACCOUNT_ALIAS, alias);
+      // setConfig(accountID, CONFIG_ACCOUNT_TYPE, type);
+      // setConfig(accountID, HOSTNAME, hostname);
+      // setConfig(accountID, USERNAME, username);
+      // setConfig(accountID, PASSWORD, password);
+      // setConfig(accountID, CONFIG_ACCOUNT_MAILBOX, mailbox);
+      // setConfig(accountID, CONFIG_ACCOUNT_ENABLE, accountEnable);
 	       
     // SIP specific account settings
     if(accountType == "SIP") {
 
+      SIPAccount *sipaccount = (SIPAccount *)account;
+
         std::string ua_name;
         std::string realm;
         std::string routeset;
@@ -3678,18 +3653,29 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
 	find_in_map(CONFIG_ACCOUNT_RESOLVE_ONCE, resolveOnce)
 	find_in_map(CONFIG_ACCOUNT_REGISTRATION_EXPIRE, registrationExpire)
 
-	setConfig(accountID, DISPLAY_NAME, displayName);
-	setConfig(accountID, ROUTESET, routeset);
-	setConfig(accountID, LOCAL_INTERFACE, localInterface);
-	setConfig(accountID, PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal);
-	setConfig(accountID, PUBLISHED_ADDRESS, publishedAddress);
-	setConfig(accountID, LOCAL_PORT, localPort);
-	setConfig(accountID, PUBLISHED_PORT, publishedPort);
+	sipaccount->setDisplayName(displayName);
+	sipaccount->setRouteSet(routeset);
+	sipaccount->setLocalInterface(localInterface);
+	sipaccount->setPublishedSameasLocal((publishedSameasLocal.compare("true") == 0) ? true : false);
+	sipaccount->setPublishedAddress(publishedAddress);
+	sipaccount->setLocalPort(atoi(localPort.data()));
+	sipaccount->setPublishedPort(atoi(publishedPort.data()));
+	// sipaccount->setStunServerName
+	sipaccount->setResolveOnce((resolveOnce.compare("true")==0) ? true : false);
+	sipaccount->setRegistrationExpire(registrationExpire);
+
+	// setConfig(accountID, DISPLAY_NAME, displayName);
+	// setConfig(accountID, ROUTESET, routeset);
+	// setConfig(accountID, LOCAL_INTERFACE, localInterface);
+	// setConfig(accountID, PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal);
+	// setConfig(accountID, PUBLISHED_ADDRESS, publishedAddress);
+	// setConfig(accountID, LOCAL_PORT, localPort);
+	// setConfig(accountID, PUBLISHED_PORT, publishedPort);
 	setConfig(accountID, STUN_ENABLE, stunEnable);
 	setConfig(accountID, STUN_SERVER, stunServer);
-	setConfig(accountID, ACCOUNT_DTMF_TYPE, dtmfType);
-	setConfig(accountID, CONFIG_ACCOUNT_RESOLVE_ONCE, resolveOnce);
-        setConfig(accountID, CONFIG_ACCOUNT_REGISTRATION_EXPIRE, registrationExpire);
+	// setConfig(accountID, ACCOUNT_DTMF_TYPE, dtmfType);
+	// setConfig(accountID, CONFIG_ACCOUNT_RESOLVE_ONCE, resolveOnce);
+        // setConfig(accountID, CONFIG_ACCOUNT_REGISTRATION_EXPIRE, registrationExpire);
 
 	// sip credential
 	find_in_map(REALM, realm)
@@ -3697,9 +3683,11 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
 	find_in_map(USERAGENT, ua_name)
 
 	setConfig(accountID, REALM, realm);
-	setConfig(accountID, USERAGENT, ua_name);
+	// setConfig(accountID, USERAGENT, ua_name);
 	setConfig(accountID, AUTHENTICATION_USERNAME, authenticationName);
 
+	sipaccount->setUseragent(ua_name);
+
         // srtp settings
 	find_in_map(SRTP_ENABLE, srtpEnable)
 	find_in_map(SRTP_RTP_FALLBACK, srtpRtpFallback)
@@ -3709,13 +3697,23 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
 	find_in_map(ZRTP_HELLO_HASH, zrtpHelloHash)
 	find_in_map(SRTP_KEY_EXCHANGE, srtpKeyExchange)
 
-	setConfig(accountID, SRTP_ENABLE, srtpEnable);
-	setConfig(accountID, SRTP_RTP_FALLBACK, srtpRtpFallback);
-	setConfig(accountID, ZRTP_DISPLAY_SAS, zrtpDisplaySas);
-	setConfig(accountID, ZRTP_DISPLAY_SAS_ONCE, zrtpDisplaySasOnce);
-	setConfig(accountID, ZRTP_NOT_SUPP_WARNING, zrtpNotSuppWarning);
-	setConfig(accountID, ZRTP_HELLO_HASH, zrtpHelloHash);
-	setConfig(accountID, SRTP_KEY_EXCHANGE, srtpKeyExchange);
+	sipaccount->setSrtpEnable((srtpEnable.compare("true") == 0) ? true : false);
+	sipaccount->setSrtpFallback((srtpRtpFallback.compare("true") == 0) ? true : false);
+	sipaccount->setZrtpDisplaySas((zrtpDisplaySas.compare("true") == 0) ? true : false);
+	sipaccount->setZrtpDiaplaySasOnce((zrtpDisplaySasOnce.compare("true") == 0) ? true : false);
+	sipaccount->setZrtpNotSuppWarning((zrtpNotSuppWarning.compare("true") == 0) ? true : false);
+	sipaccount->setZrtpHelloHash((zrtpHelloHash.compare("true") == 0) ? true : false);
+	// sipaccount->setSrtpKeyExchange((srtpKeyExchange.compare("true") == 0) ? true : false);
+	sipaccount->setSrtpKeyExchange(srtpKeyExchange);
+
+	// setConfig(accountID, SRTP_ENABLE, srtpEnable);
+	// setConfig(accountID, SRTP_RTP_FALLBACK, srtpRtpFallback);
+	// setConfig(accountID, ZRTP_DISPLAY_SAS, zrtpDisplaySas);
+	// setConfig(accountID, ZRTP_DISPLAY_SAS_ONCE, zrtpDisplaySasOnce);
+	// setConfig(accountID, ZRTP_NOT_SUPP_WARNING, zrtpNotSuppWarning);
+	// setConfig(accountID, ZRTP_HELLO_HASH, zrtpHelloHash);
+	// setConfig(accountID, SRTP_KEY_EXCHANGE, srtpKeyExchange);
+
 	
 	// TLS settings
 	// The TLS listener is unique and globally defined through IP2IP_PROFILE
@@ -3737,23 +3735,43 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
 	find_in_map(TLS_NEGOTIATION_TIMEOUT_MSEC, tlsNegotiationTimeoutMsec)
 
 
-	// The TLS listener is unique and globally defined through IP2IP_PROFILE
+
 	if (accountID == IP2IP_PROFILE){
-	    setConfig(accountID, TLS_LISTENER_PORT, tlsListenerPort);
-	}
-	setConfig(accountID, TLS_ENABLE, tlsEnable);
-	setConfig(accountID, TLS_CA_LIST_FILE, tlsCaListFile);
-	setConfig(accountID, TLS_CERTIFICATE_FILE, tlsCertificateFile);
-	setConfig(accountID, TLS_PRIVATE_KEY_FILE, tlsPrivateKeyFile);
-	setConfig(accountID, TLS_PASSWORD, tlsPassword);
-	setConfig(accountID, TLS_METHOD, tlsMethod);
-	setConfig(accountID, TLS_CIPHERS, tlsCiphers);
-	setConfig(accountID, TLS_SERVER_NAME, tlsServerName);
-	setConfig(accountID, TLS_VERIFY_SERVER, tlsVerifyServer);
-	setConfig(accountID, TLS_VERIFY_CLIENT, tlsVerifyClient);
-	setConfig(accountID, TLS_REQUIRE_CLIENT_CERTIFICATE, tlsRequireClientCertificate);
-	setConfig(accountID, TLS_NEGOTIATION_TIMEOUT_SEC, tlsNegotiationTimeoutSec);
-	setConfig(accountID, TLS_NEGOTIATION_TIMEOUT_MSEC,tlsNegotiationTimeoutMsec);
+	  sipaccount->setTlsListenerPort(atoi(tlsListenerPort.data()));
+	}
+	sipaccount->setTlsEnable(tlsEnable);
+	sipaccount->setTlsCaListFile(tlsCaListFile);
+	sipaccount->setTlsCertificateFile(tlsCertificateFile);
+	sipaccount->setTlsPrivateKeyFile(tlsPrivateKeyFile);
+	sipaccount->setTlsPassword(tlsPassword);
+	sipaccount->setTlsMethod(tlsMethod);
+	sipaccount->setTlsCiphers(tlsCiphers);
+	sipaccount->setTlsServerName(tlsServerName);
+	sipaccount->setTlsVerifyServer(tlsVerifyServer.compare("true") ? true : false);
+	sipaccount->setTlsVerifyClient(tlsVerifyServer.compare("true") ? true : false);
+	sipaccount->setTlsRequireClientCertificate(tlsRequireClientCertificate.compare("true") ? true : false);
+	sipaccount->setTlsNegotiationTimeoutSec(tlsNegotiationTimeoutSec);
+	sipaccount->setTlsNegotiationTimeoutMsec(tlsNegotiationTimeoutMsec);
+
+
+
+	// The TLS listener is unique and globally defined through IP2IP_PROFILE
+	// if (accountID == IP2IP_PROFILE){
+	//    setConfig(accountID, TLS_LISTENER_PORT, tlsListenerPort);
+	// }
+	// setConfig(accountID, TLS_ENABLE, tlsEnable);
+	// setConfig(accountID, TLS_CA_LIST_FILE, tlsCaListFile);
+	// setConfig(accountID, TLS_CERTIFICATE_FILE, tlsCertificateFile);
+	// setConfig(accountID, TLS_PRIVATE_KEY_FILE, tlsPrivateKeyFile);
+	// setConfig(accountID, TLS_PASSWORD, tlsPassword);
+	// setConfig(accountID, TLS_METHOD, tlsMethod);
+	// setConfig(accountID, TLS_CIPHERS, tlsCiphers);
+	// setConfig(accountID, TLS_SERVER_NAME, tlsServerName);
+	// setConfig(accountID, TLS_VERIFY_SERVER, tlsVerifyServer);
+	// setConfig(accountID, TLS_VERIFY_CLIENT, tlsVerifyClient);
+	// setConfig(accountID, TLS_REQUIRE_CLIENT_CERTIFICATE, tlsRequireClientCertificate);
+	// setConfig(accountID, TLS_NEGOTIATION_TIMEOUT_SEC, tlsNegotiationTimeoutSec);
+	// setConfig(accountID, TLS_NEGOTIATION_TIMEOUT_MSEC,tlsNegotiationTimeoutMsec);
 
 	if (!getMd5CredentialHashing()) {
 	  setConfig(accountID, PASSWORD, password);
diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp
index c62b79107e..343c014bad 100644
--- a/sflphone-common/src/sip/sipaccount.cpp
+++ b/sflphone-common/src/sip/sipaccount.cpp
@@ -74,11 +74,10 @@ SIPAccount::SIPAccount (const AccountID& accountID)
 	, _stunServer("")
 	, _tlsEnabled(false)
 	, _stunEnabled(false)
-	, _routeset("")
+	  // , _routeSet("")
 	  // , _realm("")
 	, _authenticationUsename("")
-	, _tlsListenerPort("5061")
-	, _dtmfType("")
+	  // , _tlsListenerPort("5061")
 	, _srtpEnabled(false)
 	, _srtpKeyExchange("")
 	, _srtpFallback(false)
@@ -134,7 +133,7 @@ void SIPAccount::unserialize(Conf::MappingNode *map)
   val = (Conf::ScalarNode *)(map->getValue(hostnameKey));
   _hostname = val->getValue();
   val = (Conf::ScalarNode *)(map->getValue(accountEnableKey));
-  _enabled = val->getValue().compare("true") ? true : false;
+  _enabled = (val->getValue().compare("true") == 0) ? true : false;
   //  val = (Conf::ScalarNode *)(map->getValue(mailboxKey));
   
   val = (Conf::ScalarNode *)(map->getValue(codecsKey));
@@ -152,9 +151,9 @@ void SIPAccount::unserialize(Conf::MappingNode *map)
   val = (Conf::ScalarNode *)(map->getValue(publishPortKey));
   _publishedPort = atoi(val->getValue().data());
   val = (Conf::ScalarNode *)(map->getValue(sameasLocalKey));
-  _publishedSameasLocal = val->getValue().compare("true") ? true : false;
+  _publishedSameasLocal = (val->getValue().compare("true") == 0) ? true : false;
   val = (Conf::ScalarNode *)(map->getValue(resolveOnceKey));
-  _resolveOnce = val->getValue().compare("true") ? true : false;
+  _resolveOnce = (val->getValue().compare("true") == 0) ? true : false;
   val = (Conf::ScalarNode *)(map->getValue(dtmfTypeKey));
   // _dtmfType = atoi(val->getValue();
 
@@ -164,23 +163,23 @@ void SIPAccount::unserialize(Conf::MappingNode *map)
   srtpMap = (Conf::MappingNode *)(map->getValue(srtpKey));
 
   val = (Conf::ScalarNode *)(srtpMap->getValue(srtpEnableKey));
-  _srtpEnabled = val->getValue().compare("true") ? true : false;
+  _srtpEnabled = (val->getValue().compare("true") == 0) ? true : false;
   val = (Conf::ScalarNode *)(srtpMap->getValue(keyExchangeKey));
   _srtpKeyExchange = val->getValue();
   val = (Conf::ScalarNode *)(srtpMap->getValue(rtpFallbackKey));
-  _srtpFallback = val->getValue().compare("true") ? true : false;
+  _srtpFallback = (val->getValue().compare("true") == 0) ? true : false;
   
   // get zrtp submap
   zrtpMap = (Conf::MappingNode *)(map->getValue(zrtpKey));
 
   val = (Conf::ScalarNode *)(zrtpMap->getValue(displaySasKey));
-  _zrtpDisplaySas = val->getValue().compare("true") ? true : false;
+  _zrtpDisplaySas = (val->getValue().compare("true") == 0) ? true : false;
   val = (Conf::ScalarNode *)(zrtpMap->getValue(displaySasOnceKey));
-  _zrtpDisplaySasOnce = val->getValue().compare("true") ? true : false;
+  _zrtpDisplaySasOnce = (val->getValue().compare("true") == 0) ? true : false;
   val = (Conf::ScalarNode *)(zrtpMap->getValue(helloHashEnabledKey));
-  _zrtpHelloHash = val->getValue().compare("true") ? true : false;
+  _zrtpHelloHash = (val->getValue().compare("true") == 0) ? true : false;
   val = (Conf::ScalarNode *)(zrtpMap->getValue(notSuppWarningKey));
-  _zrtpNotSuppWarning = val->getValue().compare("true") ? true : false;
+  _zrtpNotSuppWarning = (val->getValue().compare("true") == 0) ? true : false;
 
   // get tls submap
   tlsMap = (Conf::MappingNode *)(map->getValue(tlsKey));
@@ -205,13 +204,13 @@ void SIPAccount::unserialize(Conf::MappingNode *map)
   val = (Conf::ScalarNode *)(tlsMap->getValue(privateKeyKey));
   _tlsPrivateKeyFile = val->getValue();
   val = (Conf::ScalarNode *)(tlsMap->getValue(requireCertifKey));
-  _tlsRequireClientCertificate = val->getValue().compare("true") ? true : false;
+  _tlsRequireClientCertificate = (val->getValue().compare("true") == 0) ? true : false;
   val = (Conf::ScalarNode *)(tlsMap->getValue(serverKey));
   _tlsServerName = val->getValue();
   val = (Conf::ScalarNode *)(tlsMap->getValue(verifyClientKey));
-  _tlsVerifyServer = val->getValue().compare("true") ? true : false;
+  _tlsVerifyServer = (val->getValue().compare("true") == 0) ? true : false;
   val = (Conf::ScalarNode *)(tlsMap->getValue(verifyServerKey));
-  _tlsVerifyClient = val->getValue().compare("true") ? true : false;
+  _tlsVerifyClient = (val->getValue().compare("true") == 0) ? true : false;
 }
 
 
diff --git a/sflphone-common/src/sip/sipaccount.h b/sflphone-common/src/sip/sipaccount.h
index 2f923f3a9d..60f0718393 100644
--- a/sflphone-common/src/sip/sipaccount.h
+++ b/sflphone-common/src/sip/sipaccount.h
@@ -157,6 +157,7 @@ class SIPAccount : public Account
         inline void setAuthenticationUsername(const std::string& username) { _authenticationUsername = username; }
         
         inline bool isResolveOnce(void) { return _resolveOnce; }
+	void setResolveOnce(bool reslv) { _resolveOnce = reslv; }
         
 
 	/**
@@ -242,7 +243,6 @@ class SIPAccount : public Account
          * account is set to OTHER.
          */
         inline bool isStunEnabled(void) { return (_transportType == PJSIP_TRANSPORT_START_OTHER) ? true: false; }
-         
                 
         /*
          * @return pj_str_t "From" uri based on account information.
@@ -375,9 +375,75 @@ class SIPAccount : public Account
         std::string getTransportMapKey(void);
 
         DtmfType getDtmfType(void) { return _dtmfType; }
-
         void setDtmfType(DtmfType type) { _dtmfType = type; }
 
+	std::string getDisplayName(void) { return _displayName; }
+	void setDisplayName(std::string name) { _displayName = name ;}
+
+	bool getSrtpEnable(void) { return _srtpEnabled; }
+	void setSrtpEnable(bool enabl) { _srtpEnabled = enabl; }
+
+	std::string getSrtpKeyExchange(void) { return _srtpKeyExchange; }
+	void setSrtpKeyExchange(std::string key) { _srtpKeyExchange = key; }
+
+	bool getSrtpFallback(void) { return _srtpFallback; }
+	void setSrtpFallback(bool fallback) { _srtpFallback = fallback; }
+	
+	bool getZrtpDisplaySas(void) { return _zrtpDisplaySas; }
+	void setZrtpDisplaySas(bool sas) { _zrtpDisplaySas = sas; }
+
+	bool getZrtpDiaplaySasOnce(void) { return _zrtpDisplaySasOnce; }
+	void setZrtpDiaplaySasOnce(bool sasonce) { _zrtpDisplaySasOnce = sasonce; }
+
+	bool getZrtpNotSuppWarning(void) { return _zrtpDisplaySasOnce; }
+	void setZrtpNotSuppWarning(bool warning) { _zrtpDisplaySasOnce = _zrtpNotSuppWarning; }
+
+	bool getZrtpHelloHash(void) { return _zrtpHelloHash; }
+	void setZrtpHelloHash(bool hellohash) { _zrtpHelloHash = hellohash; }
+	// void setSrtpKeyExchange
+
+	std::string getTlsEnable(void) {return _tlsEnable; }
+	void setTlsEnable(std::string enabl) { _tlsEnable = enabl; }
+
+	std::string getTlsCaListFile(void) { return _tlsCaListFile; }
+	void setTlsCaListFile(std::string calist) { _tlsCaListFile = calist; }
+ 
+	std::string getTlsCertificateFile(void) { return _tlsCertificateFile; }
+	void setTlsCertificateFile(std::string cert) { _tlsCertificateFile = cert; }
+
+	std::string getTlsPrivateKeyFile(void) { return _tlsPrivateKeyFile; }
+	void setTlsPrivateKeyFile(std::string priv) { _tlsPrivateKeyFile = priv; }
+
+	std::string getTlsPassword(void) { return _tlsPassword; }
+	void setTlsPassword(std::string pass) { _tlsPassword = pass; }
+
+	std::string getTlsMethod(void) { return _tlsMethod; }
+	void setTlsMethod(std::string meth) { _tlsMethod = meth; }
+
+	std::string getTlsCiphers(void) { return _tlsCiphers; }
+	void setTlsCiphers(std::string cipher) { _tlsCiphers = cipher; }
+
+	std::string getTlsServerName(void) { return _tlsServerName; }
+	void setTlsServerName(std::string name) { _tlsServerName = name; }
+
+	bool getTlsVerifyServer(void) { return _tlsVerifyServer; }
+	void setTlsVerifyServer(bool verif) { _tlsVerifyServer = verif; }
+
+	bool getTlsVerifyClient(void) { return _tlsVerifyClient; }
+	void setTlsVerifyClient(bool verif) { _tlsVerifyClient = verif; }
+
+	bool getTlsRequireClientCertificate(void) { return _tlsRequireClientCertificate; }
+	void setTlsRequireClientCertificate(bool require) { _tlsRequireClientCertificate = require; }
+
+	std::string getTlsNegotiationTimeoutSec(void) { return _tlsNegotiationTimeoutSec; }
+	void setTlsNegotiationTimeoutSec(std::string timeout) { _tlsNegotiationTimeoutSec = timeout; }
+
+	std::string getTlsNegotiationTimeoutMsec(void) { return _tlsNegotiationTimeoutMsec; }
+	void setTlsNegotiationTimeoutMsec(std::string timeout) { _tlsNegotiationTimeoutMsec = timeout; }
+
+	std::string getUseragent(void) { return _useragent; }
+	void setUseragent(std::string ua) { _useragent = ua; }
+
   private: 
 
         /* Maps a string description of the SSL method 
@@ -477,26 +543,26 @@ class SIPAccount : public Account
         std::string _displayName;
 
 	std::string _tlsEnable;
-	std::string _tlsPortStr;// = Manager::instance().getConfigString(_accountID, TLS_LISTENER_PORT);
-	std::string _tlsCaListFile;//  = Manager::instance().getConfigString (_accountID, TLS_CA_LIST_FILE);
-	std::string _tlsCertificateFile;// = Manager::instance().getConfigString (_accountID, TLS_CERTIFICATE_FILE);
-	std::string _tlsPrivateKeyFile;// = Manager::instance().getConfigString (_accountID, TLS_PRIVATE_KEY_FILE);
-	std::string _tlsPassword;// = Manager::instance().getConfigString (_accountID, TLS_PASSWORD);
-	std::string _tlsMethod;// = Manager::instance().getConfigString (_accountID, TLS_METHOD);
-	std::string _tlsCiphers;// = Manager::instance().getConfigString (_accountID, TLS_CIPHERS);
-	std::string _tlsServerName;// = Manager::instance().getConfigString (_accountID, TLS_SERVER_NAME);
-	bool _tlsVerifyServer;// = Manager::instance().getConfigBool (_accountID, TLS_VERIFY_SERVER);
-	bool _tlsVerifyClient;// = Manager::instance().getConfigBool (_accountID, TLS_VERIFY_CLIENT);
-	bool _tlsRequireClientCertificate;// = Manager::instance().getConfigBool (_accountID, TLS_REQUIRE_CLIENT_CERTIFICATE);
-	std::string _tlsNegotiationTimeoutSec;// = Manager::instance().getConfigString (_accountID, TLS_NEGOTIATION_TIMEOUT_SEC);
-	std::string _tlsNegotiationTimeoutMsec;// = Manager::instance().getConfigString (_accountID, TLS_NEGOTIATION_TIMEOUT_MSEC);
-
-	std::string _stunServer; // = Manager::instance().getConfigString (_accountID, STUN_SERVER);
-
-	bool _tlsEnabled; // = Manager::instance().getConfigBool (_accountID, TLS_ENABLE);
-	bool _stunEnabled; // = Manager::instance().getConfigBool (_accountID, STUN_ENABLE);
-
-	std::string _routeset;
+	std::string _tlsPortStr;
+	std::string _tlsCaListFile;
+	std::string _tlsCertificateFile;
+	std::string _tlsPrivateKeyFile;
+	std::string _tlsPassword;
+	std::string _tlsMethod;
+	std::string _tlsCiphers;
+	std::string _tlsServerName;
+	bool _tlsVerifyServer;
+	bool _tlsVerifyClient;
+	bool _tlsRequireClientCertificate;
+	std::string _tlsNegotiationTimeoutSec;
+	std::string _tlsNegotiationTimeoutMsec;
+
+	std::string _stunServer;
+
+	bool _tlsEnabled;
+	bool _stunEnabled;
+
+	// std::string _routeset;
 
 	// std::string _realm;
 	std::string _authenticationUsename;
@@ -515,6 +581,8 @@ class SIPAccount : public Account
 	bool _zrtpHelloHash;
 	bool _zrtpNotSuppWarning;
 
+	std::string _useragent;
+
 
 };
 
-- 
GitLab