diff --git a/src/account.h b/src/account.h
index faf33dc162725e39c3dd4ad23985c0bb207b83c3..97e0b2bb3cbfa8510a03e675f0f8578a392d5a50 100644
--- a/src/account.h
+++ b/src/account.h
@@ -96,6 +96,8 @@ class Account{
          */
         inline VoIPLink* getVoIPLink() { return _link; }
 
+        inline void setVoIPLink (VoIPLink *link) { _link = link; }
+
         /**
          * Register the underlying VoIPLink. Launch the event listener.
          * This should update the getRegistrationState() return value.
diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index d1d579930e04618150417d26582aad664b01cd17..2650b48edad521407c70c2c22ba697397b81d23f 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -1409,9 +1409,14 @@ int ManagerImpl::isStunEnabled (void)
 
 void ManagerImpl::enableStun (void)
 {
-  ( getConfigInt( SIGNALISATION , STUN_ENABLE ) == STUN_ENABLED )? setConfig(SIGNALISATION , STUN_ENABLE , NO_STR ) : setConfig( SIGNALISATION , STUN_ENABLE , YES_STR );
+    /* Update the config */
+    ( getConfigInt( SIGNALISATION , STUN_ENABLE ) == STUN_ENABLED )? setConfig(SIGNALISATION , STUN_ENABLE , NO_STR ) : setConfig( SIGNALISATION , STUN_ENABLE , YES_STR );
+
+    /* Restart PJSIP */
+    this->restartPJSIP (); 
 }
 
+
     int
 ManagerImpl::getVolumeControls( void )
 {
@@ -1946,6 +1951,7 @@ void ManagerImpl::setAccountDetails( const std::string& accountID, const std::ma
     setConfig(accountID, CONFIG_ACCOUNT_MAILBOX,(*details.find(CONFIG_ACCOUNT_MAILBOX)).second);
   
     // SIP SPECIFIC
+    /*
     if (accountType == "SIP") {
     
         link =  Manager::instance().getAccountLink( accountID );
@@ -1967,8 +1973,8 @@ void ManagerImpl::setAccountDetails( const std::string& accountID, const std::ma
         {
             link->setStunServer("");
         }
-        //restartPjsip();
-    }
+        restartPJSIP();
+    }*/
 
     saveConfig();
   
@@ -2233,6 +2239,26 @@ AccountMap ManagerImpl::getSipAccountMap( void )
     return sipaccounts;
 }
 
+void ManagerImpl::restartPJSIP (void)
+{
+    SIPVoIPLink *siplink;
+
+    /* First unregister all SIP accounts */
+    this->unregisterCurSIPAccounts();
+    /* Terminate and initialize the PJSIP library */
+    siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ());
+    if (siplink) 
+    {
+        siplink->terminate ();
+        _debug ("*************************************************Terminate done\n");
+        //siplink = SIPVoIPLink::instance("");
+        siplink->init ();
+    }
+    _debug("***************************************************Init Done\n");
+    /* Then register all enabled SIP accounts */
+    //this->registerCurSIPAccounts(siplink);
+}
+
 VoIPLink* ManagerImpl::getAccountLink(const AccountID& accountID)
 {
   Account* acc = getAccount(accountID);
@@ -2242,6 +2268,23 @@ VoIPLink* ManagerImpl::getAccountLink(const AccountID& accountID)
   return 0;
 }
 
+VoIPLink* ManagerImpl::getSIPAccountLink()
+{
+    /* We are looking for the first SIP account we met because all the SIP accounts have the same voiplink */
+    Account *account;
+    AccountMap::iterator iter;
+    for(iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) {
+        account = iter->second;
+        if( account->getType() == "sip" ){
+            return account->getVoIPLink();
+        }
+    }
+    return NULL;
+}
+
+
+
+
 pjsip_regc 
 *getSipRegcFromID(const AccountID& id UNUSED)
 {
@@ -2254,32 +2297,35 @@ pjsip_regc
 
 void ManagerImpl::unregisterCurSIPAccounts()
 {
-  AccountMap::iterator iter = _accountMap.begin();
-  while( iter != _accountMap.end() ) {
-    if ( iter->second) {
-        std::string p =  Manager::instance().getConfigString( iter->first , CONFIG_ACCOUNT_TYPE );
-      if ( iter->second->isEnabled() && p == "SIP") {
-	// NOW
-	iter->second->unregisterVoIPLink();
-      }
-    }
+    Account *current;
+
+    AccountMap::iterator iter = _accountMap.begin();
+    while( iter != _accountMap.end() ) {
+        current = iter->second;
+        if (current) {
+            if ( current->isEnabled() && current->getType() == "sip") {
+	            current->unregisterVoIPLink();
+            }
+        }
     iter++;
-  }
+    }
 }
 
-void ManagerImpl::registerCurSIPAccounts()
+void ManagerImpl::registerCurSIPAccounts(VoIPLink *link)
 {
-  AccountMap::iterator iter = _accountMap.begin();
-  while( iter != _accountMap.end() ) {
-    if ( iter->second) {
-        std::string p =  Manager::instance().getConfigString( iter->first , CONFIG_ACCOUNT_TYPE );
-      if ( iter->second->isEnabled() && p == "SIP") {
-	// NOW
-	iter->second->registerVoIPLink();
-      }
-    }
+    Account *current;
+  
+    AccountMap::iterator iter = _accountMap.begin();
+    while( iter != _accountMap.end() ) {
+        current = iter->second;
+        if (current) {
+            if ( current->isEnabled() && current->getType() == "sip") {
+                current->setVoIPLink(link);
+	            current->registerVoIPLink();
+            }
+        }
     iter++;
-  }    
+    }    
 }
 
 #ifdef TEST
diff --git a/src/managerimpl.h b/src/managerimpl.h
index cc3411f3ade26470030f558b6cba32e18795bfdd..45471b7b211e5b23a93d2c40d74eceb958cbd85a 100644
--- a/src/managerimpl.h
+++ b/src/managerimpl.h
@@ -789,11 +789,11 @@ class ManagerImpl {
      * @param void
      * @return void
      */
-    void restartPjsip();
+    void restartPJSIP( );
 
     void unregisterCurSIPAccounts();
     
-    void registerCurSIPAccounts();
+    void registerCurSIPAccounts(VoIPLink *link);
     
     /**
      * Returns a map with only the existing SIP accounts
@@ -1014,6 +1014,8 @@ public:
      */
     VoIPLink* getAccountLink(const AccountID& accountID);
 
+    VoIPLink* getSIPAccountLink (void);
+
     AccountID getAccountIdFromNameAndServer(const std::string& userName, const std::string& server);
 
     int getSipPort();
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index 52e31d4350cfa41b5eb63a6f8f2f427fe69659fb..912af6a423394d203dc2d7b23cab70936d91f269 100644
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -152,9 +152,6 @@ SIPVoIPLink* SIPVoIPLink::_instance = NULL;
     // to get random number for RANDOM_PORT
     srand (time(NULL));
 
-    /* Instanciate the C++ thread */
-    _evThread = new EventThread(this);
-
     /* Start pjsip initialization step */
     init();
 }
@@ -187,6 +184,10 @@ bool SIPVoIPLink::init()
 {
     if(initDone())
         return false;
+    
+    /* Instanciate the C++ thread */
+    _evThread = new EventThread(this);
+
     /* Initialize the pjsip library */
     pjsip_init();
     initDone(true);
@@ -197,7 +198,9 @@ bool SIPVoIPLink::init()
     void 
 SIPVoIPLink::terminate()
 {
-    delete _evThread; _evThread = NULL;
+    if (_evThread){
+        delete _evThread; _evThread = NULL;
+    }
 
     /* Clean shutdown of pjsip library */
     if( initDone() )
@@ -228,6 +231,7 @@ SIPVoIPLink::terminateSIPCall()
     void
 SIPVoIPLink::getEvent()
 {
+    _debug("a");
     // We have to register the external thread so it could access the pjsip framework
     if(!pj_thread_is_registered())
         pj_thread_register( NULL, desc, &thread );
@@ -235,6 +239,7 @@ SIPVoIPLink::getEvent()
     // PJSIP polling
     pj_time_val timeout = {0, 10};
     pjsip_endpt_handle_events( _endpt, &timeout);
+    
 }
 
 int SIPVoIPLink::sendRegister( AccountID id )
@@ -1287,8 +1292,39 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
         return returnValue;
     }
 
+    void SIPVoIPLink::busy_sleep(unsigned msec)
+    {
+#if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0
+    /* Ideally we shouldn't call pj_thread_sleep() and rather
+     * CActiveScheduler::WaitForAnyRequest() here, but that will
+     * drag in Symbian header and it doesn't look pretty.
+     */
+        pj_thread_sleep(msec);
+#else
+        pj_time_val timeout, now, tv;
+
+        pj_gettimeofday(&timeout);
+        timeout.msec += msec;
+        pj_time_val_normalize(&timeout);
+
+        tv.sec = 0;
+        tv.msec = 10;
+        pj_time_val_normalize(&tv);
+    
+        do {
+            pjsip_endpt_handle_events(_endpt, &tv);
+            pj_gettimeofday(&now);
+        } while (PJ_TIME_VAL_LT(now, timeout));
+#endif
+}    
+
     bool SIPVoIPLink::pjsip_shutdown( void )
     {
+        /*if (_endpt) {
+            _debug("UserAgent: Shutting down...\n");
+            busy_sleep(1000);
+        }*/
+
         /* Destroy endpoint. */
         if (_endpt) {
             pjsip_endpt_destroy(_endpt);
diff --git a/src/sipvoiplink.h b/src/sipvoiplink.h
index 03b12e6c38ba2d0dc8eae5dd73f3a9a9916f5720..27ef2095fc29826ddbceae10e55b717bf69e3eaf 100644
--- a/src/sipvoiplink.h
+++ b/src/sipvoiplink.h
@@ -284,6 +284,7 @@ class SIPVoIPLink : public VoIPLink
         /* The singleton instance */
         static SIPVoIPLink* _instance;
 
+        void busy_sleep(unsigned msec);
         int getModId();
 
         /**