diff --git a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp
index bd1afcda1a7caebc64c00e59373b00b61a6844a4..c41a2fc07e3422953ea3bae04eddf226c9b7d4b8 100644
--- a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp
+++ b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp
@@ -35,13 +35,12 @@
 #include "AudioSrtpSession.h"
 #include "AudioSymmetricRtpSession.h"
 #include "manager.h"
-#include "account.h"
 #include "sip/sdp.h"
 #include "sip/sipcall.h"
 #include "sip/sipaccount.h"
 #include "sip/SdesNegotiator.h"
 
-#include <assert.h>
+#include <cassert>
 
 namespace sfl
 {
@@ -77,7 +76,7 @@ void AudioRtpFactory::initAudioRtpConfig (SIPCall *ca)
         stop();
     }
 
-    AccountID accountId = Manager::instance().getAccountFromCall (ca->getCallId());
+    AccountID accountId(Manager::instance().getAccountFromCall (ca->getCallId()));
 
     _debug ("AudioRtpFactory: Init rtp session for account %s", accountId.c_str());
 
@@ -87,26 +86,31 @@ void AudioRtpFactory::initAudioRtpConfig (SIPCall *ca)
     if (!account)
         _error ("AudioRtpFactory: Error no account found");
 
-    if (account->getType() == "SIP") {
-        SIPAccount *sipaccount = static_cast<SIPAccount *> (account);
-        _srtpEnabled = sipaccount->getSrtpEnable();
-        std::string tempkey = sipaccount->getSrtpKeyExchange();
+    registerAccount(account, accountId);
+}
 
-        if (tempkey == "sdes")
-            _keyExchangeProtocol = Sdes;
-        else if (tempkey == "zrtp")
-            _keyExchangeProtocol = Zrtp;
-        else
-            _keyExchangeProtocol = Symmetric;
+void AudioRtpFactory::registerAccount(Account * /*account*/, const AccountID & /* id */)
+{
+    _srtpEnabled = false;
+    _keyExchangeProtocol = Symmetric;
+    _helloHashEnabled = false;
+}
 
-        _debug ("AudioRtpFactory: Registered account %s profile selected with key exchange protocol number %d", accountId.c_str(), _keyExchangeProtocol);
-        _helloHashEnabled = sipaccount->getZrtpHelloHash();
-    } else {
-        _srtpEnabled = false;
+
+void AudioRtpFactory::registerAccount(SIPAccount *sipaccount, const AccountID& accountId)
+{
+    _srtpEnabled = sipaccount->getSrtpEnable();
+    std::string tempkey(sipaccount->getSrtpKeyExchange());
+
+    if (tempkey == "sdes")
+        _keyExchangeProtocol = Sdes;
+    else if (tempkey == "zrtp")
+        _keyExchangeProtocol = Zrtp;
+    else
         _keyExchangeProtocol = Symmetric;
-        _helloHashEnabled = false;
-    }
 
+    _debug ("AudioRtpFactory: Registered account %s profile selected with key exchange protocol number %d", accountId.c_str(), _keyExchangeProtocol);
+    _helloHashEnabled = sipaccount->getZrtpHelloHash();
 }
 
 void AudioRtpFactory::initAudioRtpSession (SIPCall * ca)
@@ -160,9 +164,9 @@ void AudioRtpFactory::start (AudioCodec* audiocodec)
 
         case Sdes:
 
-        	if(localContext && remoteContext) {
-        		static_cast<AudioSrtpSession *> (_rtpSession)->restoreCryptoContext(localContext, remoteContext);
-        	}
+            if(localContext && remoteContext) {
+                static_cast<AudioSrtpSession *> (_rtpSession)->restoreCryptoContext(localContext, remoteContext);
+            }
 
             if (static_cast<AudioSrtpSession *> (_rtpSession)->startRtpThread (audiocodec) != 0) {
                 throw AudioRtpFactoryException ("AudioRtpFactory: Error: Failed to start AudioSRtpSession thread");
@@ -203,8 +207,8 @@ void AudioRtpFactory::stop (void)
         switch (_rtpSessionType) {
 
             case Sdes:
-            	localContext = static_cast<AudioSrtpSession *> (_rtpSession)->_localCryptoCtx;
-            	remoteContext = static_cast<AudioSrtpSession *> (_rtpSession)->_remoteCryptoCtx;
+                localContext = static_cast<AudioSrtpSession *> (_rtpSession)->_localCryptoCtx;
+                remoteContext = static_cast<AudioSrtpSession *> (_rtpSession)->_remoteCryptoCtx;
                 static_cast<AudioSrtpSession *> (_rtpSession)->stopRtpThread();
                 break;
 
@@ -258,18 +262,18 @@ void AudioRtpFactory::updateSessionMedia (AudioCodec *audiocodec)
     }
 
     switch (_rtpSessionType) {
-    case Sdes:
-    	static_cast<AudioSrtpSession *> (_rtpSession)->updateSessionMedia (audiocodec);
-    	break;
-    case Symmetric:
-    	static_cast<AudioSymmetricRtpSession *> (_rtpSession)->updateSessionMedia (audiocodec);
-    	break;
-    case Zrtp:
-    	static_cast<AudioZrtpSession *> (_rtpSession)->updateSessionMedia (audiocodec);
-    	break;
-    default:
-    	_debug("AudioRtpFactory: Unknown session type");
-    	break;
+        case Sdes:
+            static_cast<AudioSrtpSession *> (_rtpSession)->updateSessionMedia (audiocodec);
+            break;
+        case Symmetric:
+            static_cast<AudioSymmetricRtpSession *> (_rtpSession)->updateSessionMedia (audiocodec);
+            break;
+        case Zrtp:
+            static_cast<AudioZrtpSession *> (_rtpSession)->updateSessionMedia (audiocodec);
+            break;
+        default:
+            _debug("AudioRtpFactory: Unknown session type");
+            break;
     }
 }
 
diff --git a/sflphone-common/src/audio/audiortp/AudioRtpFactory.h b/sflphone-common/src/audio/audiortp/AudioRtpFactory.h
index f49c8692ea0d016ace7592e467e9eff41fc77c00..b1fb1f0a6f8d6eda34b3ecf30bd984f430799a6e 100644
--- a/sflphone-common/src/audio/audiortp/AudioRtpFactory.h
+++ b/sflphone-common/src/audio/audiortp/AudioRtpFactory.h
@@ -33,13 +33,15 @@
 
 #include <stdexcept>
 #include <cc++/thread.h>
+#include "account.h" // for typedef of AccountID (std::string)
 #include <ccrtp/CryptoContext.h>
 
 #include "sip/SdesNegotiator.h"
-#include "audio/codecs/audiocodec.h"
 
 class SdesNegotiator;
 class SIPCall;
+class Account;
+class SIPAccount;
 
 /*
 namespace sfl
@@ -56,6 +58,7 @@ namespace sfl
 class AudioZrtpSession;
 class AudioSrtpSession;
 class AudioSymmetricRtpSession;
+class AudioCodec;
 
 // Possible kind of rtp session
 typedef enum RtpMethod {
@@ -200,6 +203,8 @@ class AudioRtpFactory
         void sendDtmfDigit (int digit);
 
     private:
+        void registerAccount(Account *account, const AccountID &id);
+        void registerAccount(SIPAccount *account, const AccountID &id);
         void * _rtpSession;
         RtpMethod _rtpSessionType;
         ost::Mutex _audioRtpThreadMutex;
diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp
index e1614fce3160d8760eaf3df7ce4dd7441566a999..7c77b5ebb6e50ce5805cb60c9d7f0131ffda6ec8 100644
--- a/sflphone-common/src/sip/sipaccount.cpp
+++ b/sflphone-common/src/sip/sipaccount.cpp
@@ -661,157 +661,154 @@ void SIPAccount::setAccountDetails (const std::map<std::string, std::string>& de
     setMailBox (mailbox);
 
     // SIP specific account settings
-    if (getType() == "SIP") {
-
-        std::string ua_name;
-        std::string realm;
-        std::string routeset;
-        std::string authenticationName;
-
-        std::string resolveOnce;
-        std::string registrationExpire;
-
-        std::string displayName;
-        std::string localInterface;
-        std::string publishedSameasLocal;
-        std::string localAddress;
-        std::string publishedAddress;
-        std::string localPort;
-        std::string publishedPort;
-        std::string stunEnable;
-        std::string stunServer;
-        std::string dtmfType;
-        std::string srtpEnable;
-        std::string srtpRtpFallback;
-        std::string zrtpDisplaySas;
-        std::string zrtpDisplaySasOnce;
-        std::string zrtpNotSuppWarning;
-        std::string zrtpHelloHash;
-        std::string srtpKeyExchange;
-
-        std::string tlsListenerPort;
-        std::string tlsEnable;
-        std::string tlsCaListFile;
-        std::string tlsCertificateFile;
-        std::string tlsPrivateKeyFile;
-        std::string tlsPassword;
-        std::string tlsMethod;
-        std::string tlsCiphers;
-        std::string tlsServerName;
-        std::string tlsVerifyServer;
-        std::string tlsVerifyClient;
-        std::string tlsRequireClientCertificate;
-        std::string tlsNegotiationTimeoutSec;
-        std::string tlsNegotiationTimeoutMsec;
-
-        // general sip settings
-        find_in_map (DISPLAY_NAME, displayName)
-        find_in_map (ROUTESET, routeset)
-        find_in_map (LOCAL_INTERFACE, localInterface)
-        find_in_map (PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal)
-        find_in_map (PUBLISHED_ADDRESS, publishedAddress)
-        find_in_map (LOCAL_PORT, localPort)
-        find_in_map (PUBLISHED_PORT, publishedPort)
-        find_in_map (STUN_ENABLE, stunEnable)
-        find_in_map (STUN_SERVER, stunServer)
-        find_in_map (ACCOUNT_DTMF_TYPE, dtmfType)
-        find_in_map (CONFIG_ACCOUNT_RESOLVE_ONCE, resolveOnce)
-        find_in_map (CONFIG_ACCOUNT_REGISTRATION_EXPIRE, registrationExpire)
-
-        setDisplayName (displayName);
-        setServiceRoute (routeset);
-        setLocalInterface (localInterface);
-        setPublishedSameasLocal (publishedSameasLocal == "true");
-        setPublishedAddress (publishedAddress);
-        setLocalPort (atoi (localPort.data()));
-        setPublishedPort (atoi (publishedPort.data()));
-        setStunServer (stunServer);
-        setStunEnabled (stunEnable == "true");
-        setDtmfType ( (dtmfType == "overrtp") ? OVERRTP : SIPINFO);
-
-        setResolveOnce (resolveOnce == "true");
-        setRegistrationExpire (registrationExpire);
-
-        // sip credential
-        find_in_map (REALM, realm)
-        find_in_map (AUTHENTICATION_USERNAME, authenticationName)
-        find_in_map (USERAGENT, ua_name)
-
-        setUseragent (ua_name);
-
-        // srtp settings
-        find_in_map (SRTP_ENABLE, srtpEnable)
-        find_in_map (SRTP_RTP_FALLBACK, srtpRtpFallback)
-        find_in_map (ZRTP_DISPLAY_SAS, zrtpDisplaySas)
-        find_in_map (ZRTP_DISPLAY_SAS_ONCE, zrtpDisplaySasOnce)
-        find_in_map (ZRTP_NOT_SUPP_WARNING, zrtpNotSuppWarning)
-        find_in_map (ZRTP_HELLO_HASH, zrtpHelloHash)
-        find_in_map (SRTP_KEY_EXCHANGE, srtpKeyExchange)
-
-        setSrtpEnable (srtpEnable == "true");
-        setSrtpFallback (srtpRtpFallback == "true");
-        setZrtpDisplaySas (zrtpDisplaySas == "true");
-        setZrtpDiaplaySasOnce (zrtpDisplaySasOnce == "true");
-        setZrtpNotSuppWarning (zrtpNotSuppWarning == "true");
-        setZrtpHelloHash (zrtpHelloHash == "true");
-        setSrtpKeyExchange (srtpKeyExchange);
-
-        // TLS settings
-        // The TLS listener is unique and globally defined through IP2IP_PROFILE
-        if (_accountID == IP2IP_PROFILE) {
-            find_in_map (TLS_LISTENER_PORT, tlsListenerPort)
-        }
-
-        find_in_map (TLS_ENABLE, tlsEnable)
-        find_in_map (TLS_CA_LIST_FILE, tlsCaListFile)
-        find_in_map (TLS_CERTIFICATE_FILE, tlsCertificateFile)
-        find_in_map (TLS_PRIVATE_KEY_FILE, tlsPrivateKeyFile)
-        find_in_map (TLS_PASSWORD, tlsPassword)
-        find_in_map (TLS_METHOD, tlsMethod)
-        find_in_map (TLS_CIPHERS, tlsCiphers)
-        find_in_map (TLS_SERVER_NAME, tlsServerName)
-        find_in_map (TLS_VERIFY_SERVER, tlsVerifyServer)
-        find_in_map (TLS_VERIFY_CLIENT, tlsVerifyClient)
-        find_in_map (TLS_REQUIRE_CLIENT_CERTIFICATE, tlsRequireClientCertificate)
-        find_in_map (TLS_NEGOTIATION_TIMEOUT_SEC, tlsNegotiationTimeoutSec)
-        find_in_map (TLS_NEGOTIATION_TIMEOUT_MSEC, tlsNegotiationTimeoutMsec)
+    std::string ua_name;
+    std::string realm;
+    std::string routeset;
+    std::string authenticationName;
+
+    std::string resolveOnce;
+    std::string registrationExpire;
+
+    std::string displayName;
+    std::string localInterface;
+    std::string publishedSameasLocal;
+    std::string localAddress;
+    std::string publishedAddress;
+    std::string localPort;
+    std::string publishedPort;
+    std::string stunEnable;
+    std::string stunServer;
+    std::string dtmfType;
+    std::string srtpEnable;
+    std::string srtpRtpFallback;
+    std::string zrtpDisplaySas;
+    std::string zrtpDisplaySasOnce;
+    std::string zrtpNotSuppWarning;
+    std::string zrtpHelloHash;
+    std::string srtpKeyExchange;
+
+    std::string tlsListenerPort;
+    std::string tlsEnable;
+    std::string tlsCaListFile;
+    std::string tlsCertificateFile;
+    std::string tlsPrivateKeyFile;
+    std::string tlsPassword;
+    std::string tlsMethod;
+    std::string tlsCiphers;
+    std::string tlsServerName;
+    std::string tlsVerifyServer;
+    std::string tlsVerifyClient;
+    std::string tlsRequireClientCertificate;
+    std::string tlsNegotiationTimeoutSec;
+    std::string tlsNegotiationTimeoutMsec;
+
+    // general sip settings
+    find_in_map (DISPLAY_NAME, displayName)
+    find_in_map (ROUTESET, routeset)
+    find_in_map (LOCAL_INTERFACE, localInterface)
+    find_in_map (PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal)
+    find_in_map (PUBLISHED_ADDRESS, publishedAddress)
+    find_in_map (LOCAL_PORT, localPort)
+    find_in_map (PUBLISHED_PORT, publishedPort)
+    find_in_map (STUN_ENABLE, stunEnable)
+    find_in_map (STUN_SERVER, stunServer)
+    find_in_map (ACCOUNT_DTMF_TYPE, dtmfType)
+    find_in_map (CONFIG_ACCOUNT_RESOLVE_ONCE, resolveOnce)
+    find_in_map (CONFIG_ACCOUNT_REGISTRATION_EXPIRE, registrationExpire)
+
+    setDisplayName (displayName);
+    setServiceRoute (routeset);
+    setLocalInterface (localInterface);
+    setPublishedSameasLocal (publishedSameasLocal == "true");
+    setPublishedAddress (publishedAddress);
+    setLocalPort (atoi (localPort.data()));
+    setPublishedPort (atoi (publishedPort.data()));
+    setStunServer (stunServer);
+    setStunEnabled (stunEnable == "true");
+    setDtmfType ( (dtmfType == "overrtp") ? OVERRTP : SIPINFO);
+
+    setResolveOnce (resolveOnce == "true");
+    setRegistrationExpire (registrationExpire);
+
+    // sip credential
+    find_in_map (REALM, realm)
+    find_in_map (AUTHENTICATION_USERNAME, authenticationName)
+    find_in_map (USERAGENT, ua_name)
+
+    setUseragent (ua_name);
+
+    // srtp settings
+    find_in_map (SRTP_ENABLE, srtpEnable)
+    find_in_map (SRTP_RTP_FALLBACK, srtpRtpFallback)
+    find_in_map (ZRTP_DISPLAY_SAS, zrtpDisplaySas)
+    find_in_map (ZRTP_DISPLAY_SAS_ONCE, zrtpDisplaySasOnce)
+    find_in_map (ZRTP_NOT_SUPP_WARNING, zrtpNotSuppWarning)
+    find_in_map (ZRTP_HELLO_HASH, zrtpHelloHash)
+    find_in_map (SRTP_KEY_EXCHANGE, srtpKeyExchange)
+
+    setSrtpEnable (srtpEnable == "true");
+    setSrtpFallback (srtpRtpFallback == "true");
+    setZrtpDisplaySas (zrtpDisplaySas == "true");
+    setZrtpDiaplaySasOnce (zrtpDisplaySasOnce == "true");
+    setZrtpNotSuppWarning (zrtpNotSuppWarning == "true");
+    setZrtpHelloHash (zrtpHelloHash == "true");
+    setSrtpKeyExchange (srtpKeyExchange);
+
+    // TLS settings
+    // The TLS listener is unique and globally defined through IP2IP_PROFILE
+    if (_accountID == IP2IP_PROFILE) {
+        find_in_map (TLS_LISTENER_PORT, tlsListenerPort)
+    }
+
+    find_in_map (TLS_ENABLE, tlsEnable)
+    find_in_map (TLS_CA_LIST_FILE, tlsCaListFile)
+    find_in_map (TLS_CERTIFICATE_FILE, tlsCertificateFile)
+    find_in_map (TLS_PRIVATE_KEY_FILE, tlsPrivateKeyFile)
+    find_in_map (TLS_PASSWORD, tlsPassword)
+    find_in_map (TLS_METHOD, tlsMethod)
+    find_in_map (TLS_CIPHERS, tlsCiphers)
+    find_in_map (TLS_SERVER_NAME, tlsServerName)
+    find_in_map (TLS_VERIFY_SERVER, tlsVerifyServer)
+    find_in_map (TLS_VERIFY_CLIENT, tlsVerifyClient)
+    find_in_map (TLS_REQUIRE_CLIENT_CERTIFICATE, tlsRequireClientCertificate)
+    find_in_map (TLS_NEGOTIATION_TIMEOUT_SEC, tlsNegotiationTimeoutSec)
+    find_in_map (TLS_NEGOTIATION_TIMEOUT_MSEC, tlsNegotiationTimeoutMsec)
 
         if (_accountID == IP2IP_PROFILE) {
             setTlsListenerPort (atoi (tlsListenerPort.data()));
         }
 
-        setTlsEnable (tlsEnable);
-        setTlsCaListFile (tlsCaListFile);
-        setTlsCertificateFile (tlsCertificateFile);
-        setTlsPrivateKeyFile (tlsPrivateKeyFile);
-        setTlsPassword (tlsPassword);
-        setTlsMethod (tlsMethod);
-        setTlsCiphers (tlsCiphers);
-        setTlsServerName (tlsServerName);
-        setTlsVerifyServer (tlsVerifyServer == "true");
-        setTlsVerifyClient (tlsVerifyServer == "true");
-        setTlsRequireClientCertificate (tlsRequireClientCertificate == "true");
-        setTlsNegotiationTimeoutSec (tlsNegotiationTimeoutSec);
-        setTlsNegotiationTimeoutMsec (tlsNegotiationTimeoutMsec);
-
-        if (!Manager::instance().preferences.getMd5Hash()) {
-            setPassword (password);
-        } else {
-            // Make sure not to re-hash the password field if
-            // it is already saved as a MD5 Hash.
-            // TODO: This test is weak. Fix this.
-            if ( (password.compare (getPassword()) != 0)) {
-                _debug ("SipAccount: Password sent and password from config are different. Re-hashing");
-                std::string hash;
-
-                if (authenticationName.empty()) {
-                    hash = Manager::instance().computeMd5HashFromCredential (username, password, realm);
-                } else {
-                    hash = Manager::instance().computeMd5HashFromCredential (authenticationName, password, realm);
-                }
-
-                setPassword (hash);
+    setTlsEnable (tlsEnable);
+    setTlsCaListFile (tlsCaListFile);
+    setTlsCertificateFile (tlsCertificateFile);
+    setTlsPrivateKeyFile (tlsPrivateKeyFile);
+    setTlsPassword (tlsPassword);
+    setTlsMethod (tlsMethod);
+    setTlsCiphers (tlsCiphers);
+    setTlsServerName (tlsServerName);
+    setTlsVerifyServer (tlsVerifyServer == "true");
+    setTlsVerifyClient (tlsVerifyServer == "true");
+    setTlsRequireClientCertificate (tlsRequireClientCertificate == "true");
+    setTlsNegotiationTimeoutSec (tlsNegotiationTimeoutSec);
+    setTlsNegotiationTimeoutMsec (tlsNegotiationTimeoutMsec);
+
+    if (!Manager::instance().preferences.getMd5Hash()) {
+        setPassword (password);
+    } else {
+        // Make sure not to re-hash the password field if
+        // it is already saved as a MD5 Hash.
+        // TODO: This test is weak. Fix this.
+        if ( (password.compare (getPassword()) != 0)) {
+            _debug ("SipAccount: Password sent and password from config are different. Re-hashing");
+            std::string hash;
+
+            if (authenticationName.empty()) {
+                hash = Manager::instance().computeMd5HashFromCredential (username, password, realm);
+            } else {
+                hash = Manager::instance().computeMd5HashFromCredential (authenticationName, password, realm);
             }
+
+            setPassword (hash);
         }
     }
 }
@@ -823,8 +820,8 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
     a.insert (std::pair<std::string, std::string> (ACCOUNT_ID, _accountID));
     // The IP profile does not allow to set an alias
     (_accountID == IP2IP_PROFILE) ?
-    a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, IP2IP_PROFILE)) :
-    a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getAlias()));
+        a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, IP2IP_PROFILE)) :
+        a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getAlias()));
 
     a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ENABLE, isEnabled() ? "true" : "false"));
     a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_TYPE, getType()));
@@ -857,67 +854,61 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
 
 
     (_accountID == IP2IP_PROFILE) ?
-    a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, "READY")) :
-    a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, Manager::instance().mapStateNumberToString (state)));
+        a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, "READY")) :
+        a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, Manager::instance().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 (getType() == "SIP") {
-
-        a.insert (std::pair<std::string, std::string> (ROUTESET, getServiceRoute()));
-        a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_RESOLVE_ONCE, isResolveOnce() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (REALM, _realm));
-        a.insert (std::pair<std::string, std::string> (USERAGENT, getUseragent()));
-
-        a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_REGISTRATION_EXPIRE, getRegistrationExpire()));
-        a.insert (std::pair<std::string, std::string> (LOCAL_INTERFACE, getLocalInterface()));
-        a.insert (std::pair<std::string, std::string> (PUBLISHED_SAMEAS_LOCAL, getPublishedSameasLocal() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (PUBLISHED_ADDRESS, getPublishedAddress()));
-
-        std::stringstream localport;
-        localport << getLocalPort();
-        a.insert (std::pair<std::string, std::string> (LOCAL_PORT, localport.str()));
-        std::stringstream publishedport;
-        publishedport << getPublishedPort();
-        a.insert (std::pair<std::string, std::string> (PUBLISHED_PORT, publishedport.str()));
-        a.insert (std::pair<std::string, std::string> (STUN_ENABLE, isStunEnabled() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (STUN_SERVER, getStunServer()));
-        a.insert (std::pair<std::string, std::string> (ACCOUNT_DTMF_TYPE, (getDtmfType() == OVERRTP) ? "overrtp" : "sipinfo"));
-
-        a.insert (std::pair<std::string, std::string> (SRTP_KEY_EXCHANGE, getSrtpKeyExchange()));
-        a.insert (std::pair<std::string, std::string> (SRTP_ENABLE, getSrtpEnable() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (SRTP_RTP_FALLBACK, getSrtpFallback() ? "true" : "false"));
-
-        a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS, getZrtpDisplaySas() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS_ONCE, getZrtpDiaplaySasOnce() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (ZRTP_HELLO_HASH, getZrtpHelloHash() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (ZRTP_NOT_SUPP_WARNING, getZrtpNotSuppWarning() ? "true" : "false"));
-
-        // TLS listener is unique and parameters are modified through IP2IP_PROFILE
-        std::stringstream tlslistenerport;
-        tlslistenerport << getTlsListenerPort();
-        a.insert (std::pair<std::string, std::string> (TLS_LISTENER_PORT, tlslistenerport.str()));
-        a.insert (std::pair<std::string, std::string> (TLS_ENABLE, getTlsEnable()));
-        a.insert (std::pair<std::string, std::string> (TLS_CA_LIST_FILE, getTlsCaListFile()));
-        a.insert (std::pair<std::string, std::string> (TLS_CERTIFICATE_FILE, getTlsCertificateFile()));
-        a.insert (std::pair<std::string, std::string> (TLS_PRIVATE_KEY_FILE, getTlsPrivateKeyFile()));
-        a.insert (std::pair<std::string, std::string> (TLS_PASSWORD, getTlsPassword()));
-        a.insert (std::pair<std::string, std::string> (TLS_METHOD, getTlsMethod()));
-        a.insert (std::pair<std::string, std::string> (TLS_CIPHERS, getTlsCiphers()));
-        a.insert (std::pair<std::string, std::string> (TLS_SERVER_NAME, getTlsServerName()));
-        a.insert (std::pair<std::string, std::string> (TLS_VERIFY_SERVER, getTlsVerifyServer() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (TLS_VERIFY_CLIENT, getTlsVerifyClient() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (TLS_REQUIRE_CLIENT_CERTIFICATE, getTlsRequireClientCertificate() ? "true" : "false"));
-        a.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_SEC, getTlsNegotiationTimeoutSec()));
-        a.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_MSEC, getTlsNegotiationTimeoutMsec()));
-
-    }
+    a.insert (std::pair<std::string, std::string> (ROUTESET, getServiceRoute()));
+    a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_RESOLVE_ONCE, isResolveOnce() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (REALM, _realm));
+    a.insert (std::pair<std::string, std::string> (USERAGENT, getUseragent()));
+
+    a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_REGISTRATION_EXPIRE, getRegistrationExpire()));
+    a.insert (std::pair<std::string, std::string> (LOCAL_INTERFACE, getLocalInterface()));
+    a.insert (std::pair<std::string, std::string> (PUBLISHED_SAMEAS_LOCAL, getPublishedSameasLocal() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (PUBLISHED_ADDRESS, getPublishedAddress()));
+
+    std::stringstream localport;
+    localport << getLocalPort();
+    a.insert (std::pair<std::string, std::string> (LOCAL_PORT, localport.str()));
+    std::stringstream publishedport;
+    publishedport << getPublishedPort();
+    a.insert (std::pair<std::string, std::string> (PUBLISHED_PORT, publishedport.str()));
+    a.insert (std::pair<std::string, std::string> (STUN_ENABLE, isStunEnabled() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (STUN_SERVER, getStunServer()));
+    a.insert (std::pair<std::string, std::string> (ACCOUNT_DTMF_TYPE, (getDtmfType() == OVERRTP) ? "overrtp" : "sipinfo"));
+
+    a.insert (std::pair<std::string, std::string> (SRTP_KEY_EXCHANGE, getSrtpKeyExchange()));
+    a.insert (std::pair<std::string, std::string> (SRTP_ENABLE, getSrtpEnable() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (SRTP_RTP_FALLBACK, getSrtpFallback() ? "true" : "false"));
+
+    a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS, getZrtpDisplaySas() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS_ONCE, getZrtpDiaplaySasOnce() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (ZRTP_HELLO_HASH, getZrtpHelloHash() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (ZRTP_NOT_SUPP_WARNING, getZrtpNotSuppWarning() ? "true" : "false"));
+
+    // TLS listener is unique and parameters are modified through IP2IP_PROFILE
+    std::stringstream tlslistenerport;
+    tlslistenerport << getTlsListenerPort();
+    a.insert (std::pair<std::string, std::string> (TLS_LISTENER_PORT, tlslistenerport.str()));
+    a.insert (std::pair<std::string, std::string> (TLS_ENABLE, getTlsEnable()));
+    a.insert (std::pair<std::string, std::string> (TLS_CA_LIST_FILE, getTlsCaListFile()));
+    a.insert (std::pair<std::string, std::string> (TLS_CERTIFICATE_FILE, getTlsCertificateFile()));
+    a.insert (std::pair<std::string, std::string> (TLS_PRIVATE_KEY_FILE, getTlsPrivateKeyFile()));
+    a.insert (std::pair<std::string, std::string> (TLS_PASSWORD, getTlsPassword()));
+    a.insert (std::pair<std::string, std::string> (TLS_METHOD, getTlsMethod()));
+    a.insert (std::pair<std::string, std::string> (TLS_CIPHERS, getTlsCiphers()));
+    a.insert (std::pair<std::string, std::string> (TLS_SERVER_NAME, getTlsServerName()));
+    a.insert (std::pair<std::string, std::string> (TLS_VERIFY_SERVER, getTlsVerifyServer() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (TLS_VERIFY_CLIENT, getTlsVerifyClient() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (TLS_REQUIRE_CLIENT_CERTIFICATE, getTlsRequireClientCertificate() ? "true" : "false"));
+    a.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_SEC, getTlsNegotiationTimeoutSec()));
+    a.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_MSEC, getTlsNegotiationTimeoutMsec()));
 
     return a;
-
 }
 
 
@@ -1039,14 +1030,14 @@ int SIPAccount::registerVoIPLink()
 
     try {
         // In our definition of the
-    	// ip2ip profile (aka Direct IP Calls),
-    	// no registration should be performed
-    	if (_accountID != IP2IP_PROFILE) {
-    		_link->sendRegister (_accountID);
-    	}
+        // ip2ip profile (aka Direct IP Calls),
+        // no registration should be performed
+        if (_accountID != IP2IP_PROFILE) {
+            _link->sendRegister (_accountID);
+        }
     }
     catch(VoipLinkException &e) {
-    	_error("SIPAccount: %s", e.what());
+        _error("SIPAccount: %s", e.what());
     }
 
     return SUCCESS;
@@ -1059,12 +1050,12 @@ int SIPAccount::unregisterVoIPLink()
     }
 
     try {
-    	_link->sendUnregister (_accountID);
+        _link->sendUnregister (_accountID);
         setRegistrationInfo (NULL);
     }
     catch(VoipLinkException &e) {
-    	_error("SIPAccount: %s", e.what());
-    	return false;
+        _error("SIPAccount: %s", e.what());
+        return false;
     }
 
     return true;
@@ -1258,11 +1249,11 @@ std::string SIPAccount::getFromUri (void) const
 
     int len = pj_ansi_snprintf (uri, PJSIP_MAX_URL_SIZE,
 
-                                "<%s%s@%s%s>",
-                                scheme.c_str(),
-                                username.c_str(),
-                                hostname.c_str(),
-                                transport.c_str());
+            "<%s%s@%s%s>",
+            scheme.c_str(),
+            username.c_str(),
+            hostname.c_str(),
+            transport.c_str());
 
     return std::string (uri, len);
 }
@@ -1297,12 +1288,12 @@ std::string SIPAccount::getToUri (const std::string& username) const
 
     int len = pj_ansi_snprintf (uri, PJSIP_MAX_URL_SIZE,
 
-                                "<%s%s%s%s%s>",
-                                scheme.c_str(),
-                                username.c_str(),
-                                (hostname.empty()) ? "" : "@",
-                                hostname.c_str(),
-                                transport.c_str());
+            "<%s%s%s%s%s>",
+            scheme.c_str(),
+            username.c_str(),
+            (hostname.empty()) ? "" : "@",
+            hostname.c_str(),
+            transport.c_str());
 
     return std::string (uri, len);
 }
@@ -1326,10 +1317,10 @@ std::string SIPAccount::getServerUri (void) const
     }
 
     int len = pj_ansi_snprintf (uri, PJSIP_MAX_URL_SIZE,
-                                "<%s%s%s>",
-                                scheme.c_str(),
-                                hostname.c_str(),
-                                transport.c_str());
+            "<%s%s%s>",
+            scheme.c_str(),
+            hostname.c_str(),
+            transport.c_str());
 
     return std::string (uri, len);
 }
@@ -1359,17 +1350,17 @@ std::string SIPAccount::getContactHeader (const std::string& address, const std:
 
     int len = pj_ansi_snprintf (contact, PJSIP_MAX_URL_SIZE,
 
-                                "%s%s<%s%s%s%s%s%s:%d%s>",
-                                _displayName.c_str(),
-                                (_displayName.empty() ? "" : " "),
-                                scheme.c_str(),
-                                _username.c_str(),
-                                (_username.empty() ? "":"@"),
-                                beginquote,
-                                address.c_str(),
-                                endquote,
-                                atoi (port.c_str()),
-                                transport.c_str());
+            "%s%s<%s%s%s%s%s%s:%d%s>",
+            _displayName.c_str(),
+            (_displayName.empty() ? "" : " "),
+            scheme.c_str(),
+            _username.c_str(),
+            (_username.empty() ? "":"@"),
+            beginquote,
+            address.c_str(),
+            endquote,
+            atoi (port.c_str()),
+            transport.c_str());
 
     return std::string (contact, len);
 }