Revision: 201021 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 10:04:26 +0300
branchRCL_3
changeset 26 822e1f077722
parent 20 a7d1e54a7332
child 32 2cdd984ec527
Revision: 201021 Kit: 2010123
realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h
realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp
realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnmanager.cpp
realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfprofilecontext.cpp
realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/Sipimsprofilecontext.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCacheItem.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp
realtimenetprots/sipfw/ProfileAgent/profile_fsm/inc/sipprflderegisterrequestedstate.h
realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/Sipprflderegisterrequestedstate.cpp
realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/Sipprflregisteredstate.cpp
realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/sipprflregistrationinprogressstate.cpp
realtimenetprots/sipfw/SIP/Codec/src/CSIPAcceptEncodingHeader.cpp
realtimenetprots/sipfw/SIP/Codec/src/SIPSyntaxCheck.cpp
realtimenetprots/sipfw/SIP/Codec/src/SIPSyntaxCheck.h
realtimenetprots/sipfw/SIP/Codec/src/TSIPChar.h
realtimenetprots/sipfw/SIP/Codec/src/TSIPChar.inl
realtimenetprots/sipfw/SIP/ConnectionMgr/src/CTransport.cpp
realtimenetprots/sipfw/SIP/ConnectionMgr/src/TTlsTransTlsConnecting.cpp
realtimenetprots/sipfw/SIP/Group/sipcodec.mmp
sipplugins/sippsystemstatemonitor/src/sipdevicestateaware.cpp
sipplugins/sippsystemstatemonitor/src/sipvpnmonitorao.cpp
--- a/realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h	Wed Jun 09 10:04:26 2010 +0300
@@ -24,10 +24,11 @@
 #include <etelpckt.h>
 #include <es_enum.h>
 #include <es_enum_partner.h>
+#include <centralrepository.h>
 #include "sipapnmanager.h"
 
 // CONSTANTS
-const TInt KSecondaryApnMaxRetryCount = 100;
+const TInt KDBMaxRetryCount = 100;
 
 // FORWARD DECLARATIONS
 class CCommsDatabase;
@@ -107,7 +108,7 @@
         
         void WatchConnectionStatusChange();
         
-        void WatchDatabaseStatusChangeL( TUint32 aIapId );
+        void WatchDatabaseStatusChangeL();
         
         TBool ApnChangeNeededL( const TDesC8& aApn );
         
@@ -153,39 +154,39 @@
 
 		/// 2nd phase constructor
 		void ConstructL();
+		
+		void BlockCellularDataUsageL();
+		
+		void AllowCellularDataUsage();
+
+		
+	    /**
+	    * Rollsback db in case of failure      
+	        * @param aDb 
+	    */
+	    static void RollBackDBTransaction(TAny* aDb);
 
 	private: // Data
 	
-		MSIPApnChangeObserver& iObserver;
-	    
-	    TSipApnMonitoringState iMonitoringState;
-
-		RSocketServ iSocketSrv;
-		
-		RConnection iConnection;
-		
-		TPckgBuf<TConnectionInfo> iConnectionInfo;
-        
-        TNifProgressBuf iProgress;
-        
-        HBufC8* iApnProposal;
-        
-        TUint32 iIapId;
-        
-        CCommsDatabase* iCommsDatabase;
-        
-        TInt iMonitoringRetryCount;
-        
-        HBufC8* iCurrentApn;
-        
-        TBool iApnUseSecureAuthProposal;
-        
-        TBool iIsFailed;
-        
-        TBool iIsFatalFailure;
-        
-        HBufC8* iPrimaryApn;
-        HBufC8* iSecondaryApn;
+		MSIPApnChangeObserver&          iObserver;    
+	    TSipApnMonitoringState          iMonitoringState;
+		RSocketServ                     iSocketSrv;
+		RConnection                     iConnection;
+		TPckgBuf<TConnectionInfo>       iConnectionInfo;
+        TNifProgressBuf                 iProgress;
+        HBufC8*                         iApnProposal;
+        TUint32                         iIapId;
+        CCommsDatabase*                 iCommsDatabase;
+        TInt                            iDBMonitoringRetryCount;
+        HBufC8*                         iCurrentApn;
+        TBool                           iApnUseSecureAuthProposal;
+        TBool                           iIsFailed;
+        TBool                           iIsFatalFailure;
+        HBufC8*                         iPrimaryApn;
+        HBufC8*                         iSecondaryApn;
+        CRepository*                    iRepository;
+        TInt                            iCurrentUsageStatus;
+        TBool                           iCellularDataBlocked;
         
 #ifdef CPPUNIT_TEST	
 	    friend class CSIPApnManagerTest;
--- a/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -19,6 +19,8 @@
 #include <commsdattypesv1_1.h>
 #include <commdb.h>
 #include <commsdat.h>
+#include <cmgenconnsettings.h>
+#include <cmmanagerkeys.h>
 #include "sipapnconfigurationhandler.h"
 #include "SipProfileLog.h"
 
@@ -58,17 +60,15 @@
 	{
 	PROFILE_DEBUG1( 
 	        "CSIPApnConfigurationHandler::~CSIPApnConfigurationHandler()" )
-	
+	        
 	Cancel();
 	iConnection.Close();
 	iSocketSrv.Close();
-	
 	delete iApnProposal;
 	delete iCurrentApn;
-	
     delete iPrimaryApn;
     delete iSecondaryApn;
-    
+    delete iRepository;
 	delete iCommsDatabase;
 	
 	PROFILE_DEBUG1( 
@@ -105,7 +105,7 @@
         return;
         }
     
-    iMonitoringRetryCount = 0;
+    iDBMonitoringRetryCount = 0;
     
     ChangeApnIfNotInUseL( aAllowAsync );
         
@@ -285,6 +285,11 @@
     PROFILE_DEBUG3( 
             "CSIPApnConfigurationHandler::RunError() err", aError );
     
+    if(iCellularDataBlocked)
+        {
+        AllowCellularDataUsage();
+        }
+    
     if ( aError != KErrNoMemory && aError != KErrNone )
         {
         iObserver.ApnChanged( *iApnProposal, iIapId, aError );
@@ -307,7 +312,8 @@
 	CActiveScheduler::Add( this );
 	iIapId = aIapId;
 	iIsFailed = EFalse;
-	iIsFatalFailure = EFalse; 
+	iIsFatalFailure = EFalse;
+	iCellularDataBlocked = EFalse;
 	}
 
 // -----------------------------------------------------------------------------
@@ -320,7 +326,7 @@
 	        "CSIPApnConfigurationHandler::ConstructL()" )
 	
 	User::LeaveIfError( iSocketSrv.Connect() );
-	
+	iRepository = CRepository::NewL( KCRUidCmManager );
 	PROFILE_DEBUG1( 
 	        "CSIPApnConfigurationHandler::ConstructL() exit" )
 	}
@@ -426,7 +432,7 @@
 // CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL
 // -----------------------------------------------------------------------------
 //	
-void CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL( TUint32 aIapId )
+void CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL()
     {
     PROFILE_DEBUG1( 
             "CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL()" )
@@ -436,22 +442,26 @@
     if ( !iCommsDatabase )
         {
         PROFILE_DEBUG1( 
-                "CSIPApnConfigurationHandler::   create commsdb" )
+                "CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL create commsdb" )
         iCommsDatabase = CCommsDatabase::NewL();
         }
     
     PROFILE_DEBUG1( 
-            "CSIPApnConfigurationHandler::   request notification" )
+            "CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL request notification" )
     
     // Start monitoring for db events, there will be lots of them pouring in
     // as there's no filtering feature. We are interested only in
     // unlocked events.    
+
+    if(iDBMonitoringRetryCount > KDBMaxRetryCount)
+        {
+        PROFILE_DEBUG1("CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL max retries reached!" )       
+        User::Leave( KErrAbort );
+        }
+    
     User::LeaveIfError( iCommsDatabase->RequestNotification( iStatus ) );
-    
     SetActive();
-    
-    iIapId = aIapId;
-        
+          
     SetMonitoringState( EMonitoringDatabase );
     
     PROFILE_DEBUG1( 
@@ -542,7 +552,7 @@
         
             __ASSERT_ALWAYS( aAllowAsync, User::Leave( KErrInUse ) );
         
-            WatchDatabaseStatusChangeL( iIapId );
+            WatchDatabaseStatusChangeL();
             }
         else 
             {
@@ -570,8 +580,12 @@
     
    	using namespace CommsDat;
 	
-	CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+	CMDBSession* db = CMDBSession::NewL( KCDVersion1_1 );
     CleanupStack::PushL( db );
+    
+	db->OpenTransactionL();
+    CleanupStack::PushL(TCleanupItem(RollBackDBTransaction, db));
+    
     // Set attributes so that also protected iaps can be accessed
     db->SetAttributeMask( ECDHidden | ECDProtectedWrite ); 
 
@@ -647,9 +661,19 @@
     db->ClearAttributeMask( ECDHidden | ECDProtectedWrite );
     
     CleanupStack::PopAndDestroy( iapRecord );
+    
+    db->CommitTransactionL();
+    
+	CleanupStack::Pop(); //cleanup item
+	
     CleanupStack::PopAndDestroy( db );
     
-    SendApnChangedNotificationL( aApn );
+    if (iCellularDataBlocked)
+        {
+        AllowCellularDataUsage();
+        }  
+    
+    SendApnChangedNotificationL( aApn );        
     
     PROFILE_DEBUG1( 
             "CSIPApnConfigurationHandler::ChangeApnL(), exit" )
@@ -701,10 +725,10 @@
 void CSIPApnConfigurationHandler::ConnectionMonitoringCompletedL( TInt aError )
     {
 	PROFILE_DEBUG3( 
-	        "CSIPApnConfigurationHandler::   progress.err",
+	        "CSIPApnConfigurationHandler::ConnectionMonitoringCompletedL   progress.err",
 	        iProgress().iError );
 	PROFILE_DEBUG3( 
-	        "CSIPApnConfigurationHandler::   progress.stage",
+	        "CSIPApnConfigurationHandler::ConnectionMonitoringCompletedL   progress.stage",
 	        iProgress().iStage );
 	                
     if ( !aError )
@@ -748,30 +772,19 @@
         {
         // Changing may be now possible, if not, db notifications or connection
         // monitoring is re-enabled inside following method
+        PROFILE_DEBUG1("DatabaseMonitoringCompletedL::DatabaseMonitoringCompletedL BlockCellularDataUsageL" );
+        BlockCellularDataUsageL();
         apnChanged = ChangeApnIfNotInUseL();
         }
     else
         {
-        WatchDatabaseStatusChangeL( iIapId );
+        iDBMonitoringRetryCount++;
+        WatchDatabaseStatusChangeL();        
         }
     
-    // Have some safety limit for monitoring as it's not guaranteed that
-    // db lock is ever released -> avoid unnecessary battery consumption    
-    if ( !apnChanged )
+    if(apnChanged)
         {
-        iMonitoringRetryCount++;
-        PROFILE_DEBUG3( 
-                "DatabaseMonitoringCompletedL::   retrycount",
-                iMonitoringRetryCount );
-        
-        if ( iMonitoringRetryCount > KSecondaryApnMaxRetryCount )
-            {
-            PROFILE_DEBUG1( 
-                "CSIPApnConfigurationHandler::   max retries reached!" )
-            Cancel();
-            
-            User::Leave( KErrAbort );
-            }
+        iDBMonitoringRetryCount = 0;
         }
     }
 
@@ -902,4 +915,40 @@
         }
     }
 
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::BlockCellularDataUsageL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::BlockCellularDataUsageL()
+    {
+    PROFILE_DEBUG1("DatabaseMonitoringCompletedL::BlockCellularDataUsageL Enter" );
+    //Current Usage Status;
+    iRepository->Get( KCurrentCellularDataUsage, iCurrentUsageStatus );
+    iRepository->Set( KCurrentCellularDataUsage, ECmCellularDataUsageDisabled );
+    iCellularDataBlocked = ETrue;
+    PROFILE_DEBUG1("DatabaseMonitoringCompletedL::BlockCellularDataUsageL Exit" );
+    }
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::AllowCellularDataUsage
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::AllowCellularDataUsage()
+    {
+    PROFILE_DEBUG1("DatabaseMonitoringCompletedL::AllowCellularDataUsage Enter" );
+    iRepository->Set( KCurrentCellularDataUsage, iCurrentUsageStatus );
+    iDBMonitoringRetryCount = 0;
+    iCellularDataBlocked = EFalse;
+    PROFILE_DEBUG1("DatabaseMonitoringCompletedL::AllowCellularDataUsage Exit" );
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::RollBackDBTransaction
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::RollBackDBTransaction(TAny* aDb)
+    {
+    CMDBSession* db = static_cast<CMDBSession*>(aDb);
+    TRAP_IGNORE(db->RollbackTransactionL());
+    }
+
 // End of file
--- a/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnmanager.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnmanager.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -216,7 +216,7 @@
     {
     TBool isIapGPRS(EFalse);          
     using namespace CommsDat;        
-    CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    CMDBSession* db = CMDBSession::NewL( KCDVersion1_1 );
     CleanupStack::PushL( db );
     // Set any attributes if any
     db->SetAttributeMask( ECDHidden );    
--- a/realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfprofilecontext.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfprofilecontext.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -494,11 +494,11 @@
 	return (aError == K503ServiceUnavailable || 
 	        aError == K408TimeOut ||
 	        aError == K500ServerInternalError ||
-		    aError == KErrSIPOutboundProxyNotResponding || 
 		    aError == KErrTimedOut ||
 		    ((aError == KErrSIPResolvingFailure || 
 		      aError == KErrSIPTransportFailure ||
-		      aError == KErrSIPICMPFailure) && 
+		      aError == KErrSIPICMPFailure ||
+		      aError == KErrSIPOutboundProxyNotResponding ) && 
 			 iConnection.State() != CSIPConnection::ESuspended));
 	}
 
--- a/realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/Sipimsprofilecontext.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/Sipimsprofilecontext.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -785,12 +785,12 @@
 	        aError == K408TimeOut ||
 	        aError == K480TemporarilyUnavailable ||
 	        aError == K500ServerInternalError ||
-	        aError == K504ServerTimeOut ||
-		    aError == KErrSIPOutboundProxyNotResponding || 
+	        aError == K504ServerTimeOut || 
 		    aError == KErrTimedOut ||
 		    ((aError == KErrSIPResolvingFailure || 
 		      aError == KErrSIPTransportFailure ||
-		      aError == KErrSIPICMPFailure) && 
+		      aError == KErrSIPICMPFailure ||
+		      aError == KErrSIPOutboundProxyNotResponding ) && 
 			 iConnection.State() != CSIPConnection::ESuspended));
 	}
 
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCacheItem.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCacheItem.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -571,6 +571,7 @@
 void CSIPProfileCacheItem::VpnInUse(TBool aStatus)
     {
     iIsVpnInUse = aStatus;
+    iCurrentState->ShutdownInitiated(*this);
     }
 
 // -----------------------------------------------------------------------------
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -475,11 +475,11 @@
                 TBool waitForDeregistration = EFalse;
                 for (TInt i = 0; i < iProfileCache.Count(); i++)
                     {
-                    iProfileCache[i]->OfflineInitiated(ETrue);
                     CSIPConcreteProfile::TStatus status;
                     iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
                     if(status != CSIPConcreteProfile::EUnregistered)
-                        waitForDeregistration = ETrue;            
+                        waitForDeregistration = ETrue;   
+                    iProfileCache[i]->OfflineInitiated(ETrue);
                     }
                 if(!waitForDeregistration)
                     {
@@ -515,11 +515,11 @@
 	        TBool waitForDeregistration = EFalse;
 	        for (TInt i = 0; i < iProfileCache.Count(); i++)         
 	            {
-	            iProfileCache[i]->RfsInprogress(ETrue);
 	            CSIPConcreteProfile::TStatus status;
 	            iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
 	            if (status != CSIPConcreteProfile::EUnregistered)
 	                waitForDeregistration = ETrue;
+	            iProfileCache[i]->RfsInprogress(ETrue);
 	            }      
 	        if(!waitForDeregistration)
 	            {
@@ -564,12 +564,11 @@
             TBool waitForDeregistration = EFalse;
             for (TInt i = 0; i < iProfileCache.Count(); i++)
                 {
-                iProfileCache[i]->VpnInUse( ETrue );
-                iProfileCache[i]->ShutdownInitiated();
                 CSIPConcreteProfile::TStatus status;
                 iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
                 if (status != CSIPConcreteProfile::EUnregistered)
                     waitForDeregistration = ETrue;
+                iProfileCache[i]->VpnInUse( ETrue );
                 }
             if (!waitForDeregistration)
                 {
--- a/realtimenetprots/sipfw/ProfileAgent/profile_fsm/inc/sipprflderegisterrequestedstate.h	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/profile_fsm/inc/sipprflderegisterrequestedstate.h	Wed Jun 09 10:04:26 2010 +0300
@@ -14,7 +14,7 @@
 * Description:
 * Name        : sipprflderegisterrequestedstate.h
 * Part of     : sip profile fsm 
-* Version     : %version: 2.1.1 %
+* Version     : %version: 2.1.2 %
 *
 */
 
@@ -72,6 +72,13 @@
 		
 		CSIPConcreteProfile::TStatus ConcreteProfileState() const;
 		
+		/* DeRegister requested
+		 * update on multiple profile issue, when update on the previous profile is pending.
+		 * 07 May 2010    
+		 * */
+		void DeregisterL(
+		            MSIPProfileContext& aContext);
+		
 		/**
 		* Moves back the profile to "Registered" state
 		* @param aContext a profile context
--- a/realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/Sipprflderegisterrequestedstate.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/Sipprflderegisterrequestedstate.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -14,7 +14,7 @@
 // Name        : sipprflderegisterrequestedstate.cpp
 // Part of     : sip profile fsm
 // implementation
-// Version     : %version: 2.1.1 %
+// Version     : %version: 2.1.2 %
 //
 
 
@@ -98,6 +98,41 @@
 	}
 
 // -----------------------------------------------------------------------------
+// CSIPPrflDeregisterRequestedState::DeregisterL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSIPPrflDeregisterRequestedState::DeregisterL(
+    MSIPProfileContext& aContext)
+    {
+    __ASSERT_DEBUG(aContext.Profile()!=0, User::Invariant());
+    __ASSERT_DEBUG(aContext.Registration()!=0, User::Invariant());
+    if (aContext.Connection().State()==CSIPConnection::EActive)
+        {
+        if (iUser.AddProfileIntoQueue(*aContext.Profile())) //compares the registrar of the present profile with the other profiles existing in the connection context array.
+            {
+            iUser.DeregisterProfileL(*aContext.Profile()); 
+            
+            } 
+        else
+            {
+            CSIPMessageElements* elements = 
+                aContext.CreateDeRegisterElementsL();
+            CleanupStack::PushL(elements);
+            CSIPClientTransaction* tx = 
+                aContext.Registration()->DeregisterL(elements);
+            CleanupStack::Pop(elements);
+            aContext.SetTransaction(tx);
+            aContext.SetNextState(*iDeregistrationInProgressState);
+            }
+        }
+    aContext.AgentObserver().SIPProfileStatusEvent(
+    *aContext.Profile(),
+    aContext.Registration()->ContextId());
+    }
+
+
+// -----------------------------------------------------------------------------
 // CSIPPrflDeregisterRequestedState::ErrorOccured()
 // This can happen if the de-register was reguested while the connection is
 // suspended (registered->de-register requested). SIP stack has removed
--- a/realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/Sipprflregisteredstate.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/Sipprflregisteredstate.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -14,7 +14,7 @@
 // Name        : sipprflregisteredstate.cpp
 // Part of     : sip profile fsm
 // implementation
-// Version     : %version: 2.1.2 %
+// Version     : %version: 2.1.3 %
 //
 
 
@@ -370,7 +370,8 @@
         }
     else if ((aError == KErrSIPTransportFailure || 
          aError == KErrSIPResolvingFailure ||
-		 aError == KErrSIPICMPFailure) && 
+		 aError == KErrSIPICMPFailure ||
+		 aError == KErrSIPOutboundProxyNotResponding ) && 
         aContext.Connection().State() == CSIPConnection::ESuspended)
         {
         //registration was dropped due to the expired 
--- a/realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/sipprflregistrationinprogressstate.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/sipprflregistrationinprogressstate.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -14,7 +14,7 @@
 // Name        : sipprflregistrationinprogressstate.cpp
 // Part of     : sip profile fsm
 // implementation
-// Version     : %version: 2.1.1 %
+// Version     : %version: 2.1.2 %
 //
 
 
@@ -174,7 +174,8 @@
 		}
 	else if ((aError == KErrSIPTransportFailure || 
 	     aError == KErrSIPResolvingFailure ||
-		 aError == KErrSIPICMPFailure) && 
+		 aError == KErrSIPICMPFailure ||
+		 aError == KErrSIPOutboundProxyNotResponding ) && 
 	    aContext.Connection().State()==CSIPConnection::ESuspended)
 		{
 		//registration failed due to the suspended connection, re-try later
--- a/realtimenetprots/sipfw/SIP/Codec/src/CSIPAcceptEncodingHeader.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/Codec/src/CSIPAcceptEncodingHeader.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -28,6 +28,7 @@
 #include "sipstrconsts.h"
 #include "sipcodecutils.h"
 #include "_sipcodecdefs.h"
+#include <featdiscovery.h>
 
 
 // ----------------------------------------------------------------------------
@@ -161,10 +162,19 @@
 	{
 	HBufC8* tmp = aCodings.AllocLC();
 	tmp->Des().Trim();
-	if (tmp->Length() > 0 && !SIPSyntaxCheck::Token(*tmp))
+	//Allowing '/' token for interoperability issues
+	RArray<TSIPChar> array;
+	if(CFeatureDiscovery::IsFeatureSupportedL(TUid::Uid(KFeatureIdFfSipApnSwitching)))
+	    {
+        array.Append('/');
+	    }
+	
+	if (tmp->Length() > 0 && !SIPSyntaxCheck::Token(*tmp,&array))
         {
+        array.Close();
         User::Leave(KErrSipCodecAcceptEncodingHeader);
 	    }
+	array.Close();
 	CleanupStack::Pop(tmp);
 	delete iCodings;
 	iCodings = tmp;
--- a/realtimenetprots/sipfw/SIP/Codec/src/SIPSyntaxCheck.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/Codec/src/SIPSyntaxCheck.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -20,7 +20,6 @@
 
 
 #include "SIPSyntaxCheck.h"
-#include "TSIPChar.h"
 #include "sipcodecerr.h"
 #include <uriutils.h>
 
@@ -31,8 +30,9 @@
 // SIPSyntaxCheck::Token
 // -----------------------------------------------------------------------------
 //
-TBool SIPSyntaxCheck::Token (const TDesC8& aValue)
+TBool SIPSyntaxCheck::Token (const TDesC8& aValue, RArray<TSIPChar>* aArray)
 	{
+	
 	if (aValue.Length() == 0) 
 		{
 		return EFalse;
@@ -41,7 +41,7 @@
 	TSIPChar sipChr = lex.Get();
 	while (sipChr)
 		{
-		if (!sipChr.IsTokenChar()) 
+		if (!sipChr.IsTokenChar( aArray ) )
 			{
 			return EFalse;
 			}
--- a/realtimenetprots/sipfw/SIP/Codec/src/SIPSyntaxCheck.h	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/Codec/src/SIPSyntaxCheck.h	Wed Jun 09 10:04:26 2010 +0300
@@ -31,6 +31,7 @@
 #define SIPSYNTAXCHECK_H
 
 #include "siphostport.h"
+#include "TSIPChar.h"
 #include <e32std.h>
 
 
@@ -39,7 +40,7 @@
 	{
 public:
 
-	static TBool Token (const TDesC8& aValue);
+	static TBool Token (const TDesC8& aValue , RArray<TSIPChar>* aArray = NULL );
 	static TBool AlphaMaxSize8 (const TDesC8& aValue);
 	static TBool Host (const TDesC8& aValue);
 	static TBool Word (const TDesC8& aValue);
--- a/realtimenetprots/sipfw/SIP/Codec/src/TSIPChar.h	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/Codec/src/TSIPChar.h	Wed Jun 09 10:04:26 2010 +0300
@@ -45,7 +45,7 @@
 	inline TBool IsReserved() const;
 	inline TBool IsUnreserved() const;
 	inline TBool IsMark() const;
-	inline TBool IsTokenChar() const;
+	inline TBool IsTokenChar(RArray<TSIPChar>* aArray = NULL) const;
 	inline TBool IsSeparator() const;
 	inline TBool IsWordChar() const;
 	inline TBool IsQuotedPairChar() const;
--- a/realtimenetprots/sipfw/SIP/Codec/src/TSIPChar.inl	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/Codec/src/TSIPChar.inl	Wed Jun 09 10:04:26 2010 +0300
@@ -112,20 +112,33 @@
 // TSIPChar::IsTokenChar
 // -----------------------------------------------------------------------------
 //
-inline TBool TSIPChar::IsTokenChar () const
+inline TBool TSIPChar::IsTokenChar (RArray<TSIPChar>* aArray) const
 	{
 	if (IsAlphaDigit()) 
 		{
 		return ETrue;
 		}
-	TSIPChar val = *this;
-	if (val == '-' || val == '.' || val == '!' || val == '%' || val == '*' ||
+	   TInt length= 0;
+	   TSIPChar val = *this;
+	   //Allowing '/' token for interoperability issues
+	   if (aArray)
+	       length = aArray->Count();   
+	   if(length)
+	       {
+	       for (TInt i =0; i<length;i++)
+	           {
+	           if(val == aArray->operator [](i))
+	           return ETrue;
+	           }
+	       } 
+	   if (val == '-' || val == '.' || val == '!' || val == '%' || val == '*' ||
 		val == '_' || val == '+' || val == '\'' || val == '~' || val == '`')
-		{
-		return ETrue;
-		}
-	return EFalse;
-	}
+	       {
+	       return ETrue;
+	       }
+	  
+	   return EFalse;
+	 }
 
 // -----------------------------------------------------------------------------
 // TSIPChar::IsSeparator
--- a/realtimenetprots/sipfw/SIP/ConnectionMgr/src/CTransport.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/ConnectionMgr/src/CTransport.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -1459,11 +1459,23 @@
                 if ( Protocol() == KProtocolTls )
                     {
                     RStringF tls = SIPStrings::StringF( SipStrConsts::ETLS );
-                    // SIP-URI with transport=TLS must not use sips scheme
-                    uri.SIPURI()->SetSIPS( transportParam != tls );
+                    // SIP Scheme in Contact header should be same as From Header
+                    CURIContainer& FromUri = (((aMessage->From())->SIPAddress()).URI());
+                    if(FromUri.IsSIPURI())
+                        {
+                        CSIPURI* FromSIPUri =FromUri.SIPURI();
+                        if(FromSIPUri->IsSIPSURI())
+                            {
+                            uri.SIPURI()->SetSIPS( ETrue );
+                            }
+                        else
+                            {
+                            uri.SIPURI()->SetSIPS( EFalse );
+                            }
+                        }                    
                     if(transportParam == tls)
                         {
-                        uri.SIPURI()->SetSIPS(EFalse);
+                        //uri.SIPURI()->SetSIPS(EFalse);
                         //Delete the param transport=tls from the URI as it is deprecated in RFC 3261
                         uri.SIPURI()->DeleteParam(SIPStrings::StringF( SipStrConsts::ETransport ));
                         }
--- a/realtimenetprots/sipfw/SIP/ConnectionMgr/src/TTlsTransTlsConnecting.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/ConnectionMgr/src/TTlsTransTlsConnecting.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -22,8 +22,10 @@
 #include "TTlsTransTlsConnecting.h"
 #include "MTlsTransStateOwner.h"
 
-
-const TInt KConnectTLSTimeout = 10000; // 10 seconds
+// SIP layer waits 30 seconds for TLS Handshake to happen, if the timer
+// fires and negotiation does not happen, it cancels the handshake assuming
+// some problem while handshaking.
+const TInt KConnectTLSTimeout = 30000; // 30 seconds
 
 // -----------------------------------------------------------------------------
 // TTlsTransTlsConnecting::EnterL
--- a/realtimenetprots/sipfw/SIP/Group/sipcodec.mmp	Tue May 25 13:04:58 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/Group/sipcodec.mmp	Wed Jun 09 10:04:26 2010 +0300
@@ -135,7 +135,8 @@
 LIBRARY       estor.lib
 LIBRARY       charconv.lib
 LIBRARY       inetprotutil.lib
-
+LIBRARY       featdiscovery.lib
+ 
 VENDORID 0x70000001
 
 CAPABILITY All -Tcb
--- a/sipplugins/sippsystemstatemonitor/src/sipdevicestateaware.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/sipplugins/sippsystemstatemonitor/src/sipdevicestateaware.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -219,8 +219,11 @@
     if( iObservers.Count() == iCount)
         {
         iGuardTimer->Cancel();
-        iStateAwareSession.AcknowledgeStateNotification(KErrNone);        
-        iCount = 0;        
+        if(iState == CSipSystemStateMonitor::ESystemOffline)
+            {
+            iStateAwareSession.AcknowledgeStateNotification(KErrNone);        
+            iCount = 0;
+            }
         }	
     }
 
@@ -231,7 +234,10 @@
 void CSipDeviceStateAware::EventProcessingCompleted()
     {
     iGuardTimer->Cancel();
-    iStateAwareSession.AcknowledgeStateNotification(KErrNone);   
-    iCount = 0;
+    if(iState == CSipSystemStateMonitor::ESystemOffline)
+        {
+        iStateAwareSession.AcknowledgeStateNotification(KErrNone);   
+        iCount = 0;
+        }
     }
 
--- a/sipplugins/sippsystemstatemonitor/src/sipvpnmonitorao.cpp	Tue May 25 13:04:58 2010 +0300
+++ b/sipplugins/sippsystemstatemonitor/src/sipvpnmonitorao.cpp	Wed Jun 09 10:04:26 2010 +0300
@@ -191,9 +191,11 @@
     // SIP deregistration has been completed. Stop the guard timer and tell
     // the VPN client about it.
     iGuardTimer->Cancel();
-
-    iProperty.Set( KPSVpnSipUid, KVpnSipState, ESipDeregisterCompleted );
-    iCount = 0;
+    if (iState == CSipSystemStateMonitor::EVpnInitiating)
+        {
+        iProperty.Set( KPSVpnSipUid, KVpnSipState, ESipDeregisterCompleted );
+        iCount = 0;
+        }
     }
 
 // -----------------------------------------------------------------------------