realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileStateUnregistered.cpp
branchRCL_3
changeset 2 1e1cc61f56c3
parent 0 307788aac0a8
child 12 a7d1e54a7332
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileStateUnregistered.cpp	Fri Feb 19 23:10:33 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileStateUnregistered.cpp	Fri Mar 12 15:44:11 2010 +0200
@@ -27,6 +27,7 @@
 #include "sipplugindirector.h"
 #include "sipalrmonitor.h"
 #include "SipProfileLog.h"
+#include <featmgr.h>
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -110,16 +111,19 @@
 	if (aItem.IsActiveState())
 		{
 		aItem.SendUnregisteredStatusEventL();
-
-		if (aItem.IsReferred() && !aItem.IsShutdownInitiated() && !aItem.IsRfsInprogress())
-			{
-			aItem.ClearOldProfile();
-			aItem.StartRegisterL(*iWaitForIAP, *iRegInProg, getIap);
-			// CSIPProfileCacheItem::MonitorSnapL stops ALR monitor later if
-			// updating SNAP.			
-			return;
-			}
-		}
+		TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+                                && aItem.IsVpnInUse());
+		
+        if ( aItem.IsReferred() && !aItem.IsShutdownInitiated() &&
+                !aItem.IsRfsInprogress() && !isVpnInUse)
+            {
+            aItem.ClearOldProfile();
+            aItem.StartRegisterL(*iWaitForIAP, *iRegInProg, getIap);
+            // CSIPProfileCacheItem::MonitorSnapL stops ALR monitor later if
+            // updating SNAP.           
+            return;
+            }
+        }
 	// Stay unregistered, no need to monitor SNAP
 	aItem.StopSnapMonitoring();
 	iPluginDirector.TerminateHandling(aItem.UsedProfile());
@@ -228,12 +232,15 @@
 	__ASSERT_ALWAYS(
 		iPluginDirector.State(state, aItem.Profile()) == KErrNotFound ||
 		state == CSIPConcreteProfile::EUnregistered, User::Leave(KErrArgument));
-
-	if (aItem.IsReferred() && !aItem.IsShutdownInitiated())
-		{
-		aItem.StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue);
-		}
-	}
+        TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+                             && aItem.IsVpnInUse());
+        
+        if (aItem.IsReferred() && !aItem.IsShutdownInitiated() 
+                      && !aItem.IsRfsInprogress() && !isVpnInUse)
+            {
+            aItem.StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue);
+            }	
+        }
 
 // -----------------------------------------------------------------------------
 // CSIPProfileStateUnregistered::ErrorOccurred