Bugfixes and added new tests opencode
authorivan.fildichev@opencode.com
Thu, 04 Nov 2010 20:30:45 +0200
branchopencode
changeset 85 96b4f933d69a
parent 81 7f379d8ed02d
child 87 434681fe53c8
Bugfixes and added new tests
telephonyserver/etelmultimode/CETEL/mm_messaging.cpp
telephonyserver/etelmultimode/DTsy/mmtsymessaging.cpp
telephonyserver/etelserverandcore/SETEL/ET_CORE.CPP
telephonyserver/etelserverandcore/SETEL/ET_PHONE.CPP
telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmussdtsy.cpp
telephonyserverplugins/common_tsy/test/component/inc/cctsyussdmessagingfu.h
telephonyserverplugins/common_tsy/test/component/scripts/te_ctsycomponent_ussdmessaging_individual.script
telephonyserverplugins/common_tsy/test/component/src/cctsyussdmessagingfu.cpp
telephonyserverplugins/common_tsy/test/component/ussdtestclient/inc/ussdtestclient.h
telephonyserverplugins/common_tsy/test/component/ussdtestclient/src/ussdtestclient.cpp
--- a/telephonyserver/etelmultimode/CETEL/mm_messaging.cpp	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserver/etelmultimode/CETEL/mm_messaging.cpp	Thu Nov 04 20:30:45 2010 +0200
@@ -1208,7 +1208,7 @@
 	{
 	aReqStatus = KErrArgument;
 	return;
-	}
+	}	
 	Set(EMobileUssdMessagingSendMessageDefaultHandler, aReqStatus, aMsgData, aMsgAttributes); 	
 	}
 
--- a/telephonyserver/etelmultimode/DTsy/mmtsymessaging.cpp	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserver/etelmultimode/DTsy/mmtsymessaging.cpp	Thu Nov 04 20:30:45 2010 +0200
@@ -1567,11 +1567,11 @@
 		break;
 //
 // Flow Controlled Services
-//
+//	
+	case EMobileUssdMessagingSendMessageDefaultHandler:
 	case EMobileUssdMessagingSendMessage:
 	case EMobileUssdMessagingSendMessageNoFdnCheck:
-	case EMobileUssdMessagingSendRelease:
-	case EMobileUssdMessagingSendMessageDefaultHandler:
+	case EMobileUssdMessagingSendRelease:	
 		ret=KReqModeFlowControlObeyed;
 		break;
 
@@ -1744,8 +1744,7 @@
 		{
 		LOGTEXT(_L8("CUssdMessagingDMmTsy::ReceiveMessage called"));
 		RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* attsPckg = REINTERPRET_CAST(RMobileUssdMessaging::TMobileUssdAttributesV1Pckg*,aMsgAttributes);
-		RMobileUssdMessaging::TMobileUssdAttributesV1& atts = (*attsPckg)();
-
+		RMobileUssdMessaging::TMobileUssdAttributesV1& atts = (*attsPckg)();		
 		*aMsgData = DMMTSY_USSD_MESSAGE_PDU;
 
 		atts.iFlags = DMMTSY_USSD_ATTRIBUTE_FLAGS;
@@ -1771,7 +1770,7 @@
 	LOGTEXT(_L8("CUssdMessagingDMmTsy::SendMessage called"));
 	RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* attsPckg = REINTERPRET_CAST(RMobileUssdMessaging::TMobileUssdAttributesV1Pckg*,aMsgAttributes);
 	RMobileUssdMessaging::TMobileUssdAttributesV1& atts = (*attsPckg)();
-		
+	
 	if (atts.iFlags != DMMTSY_USSD_ATTRIBUTE_FLAGS || 
 		atts.iFormat != DMMTSY_USSD_ATTRIBUTE_FORMAT ||
 		atts.iType != DMMTSY_USSD_ATTRIBUTE_TYPE ||
@@ -1784,16 +1783,16 @@
 
 TInt CUssdMessagingDMmTsy::SendMessageDefaultHandler(const TTsyReqHandle aTsyReqHandle, TDesC8* aMsgData, TDesC8* aMsgAttributes)
 	{
-	LOGTEXT(_L8("CUssdMessagingDMmTsy::SendMessage called"));
+	LOGTEXT(_L8("CUssdMessagingDMmTsy::SendMessageDefaultHandler called"));
 	RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* attsPckg = REINTERPRET_CAST(RMobileUssdMessaging::TMobileUssdAttributesV1Pckg*,aMsgAttributes);
 	RMobileUssdMessaging::TMobileUssdAttributesV1& atts = (*attsPckg)();
-		
+	
 	if (atts.iFlags != DMMTSY_USSD_ATTRIBUTE_FLAGS || 
 		atts.iFormat != DMMTSY_USSD_ATTRIBUTE_FORMAT ||
 		atts.iType != DMMTSY_USSD_ATTRIBUTE_TYPE ||
 		atts.iDcs != DMMTSY_USSD_ATTRIBUTE_DCS)
-		ReqCompleted(aTsyReqHandle,KErrCorrupt);
-	else
+		ReqCompleted(aTsyReqHandle,KErrCorrupt);		
+	else	
 		iPhone->AddDelayedReq(aTsyReqHandle,this);
 	return KErrNone;
 	}
--- a/telephonyserver/etelserverandcore/SETEL/ET_CORE.CPP	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserver/etelserverandcore/SETEL/ET_CORE.CPP	Thu Nov 04 20:30:45 2010 +0200
@@ -1056,16 +1056,17 @@
 
 CReqEntry* CPhoneBase::FindByIpcAndSecureId(const TInt aIpc, const TSecureId aSid)
 //
-//	Finds an active request by both IPC and by the TSecureId it was placed on
+//	Finds an active request by both IPC and by the TSecureId
 //
 	{
 	CReqEntry* reqEntry;
 	TDblQueIter<CReqEntry> iter(iReqActiveList);
 	while(reqEntry = iter++, reqEntry!=NULL)
-		{
-		if(reqEntry->iFunction==aIpc && reqEntry->iMessage.SecureId()==aSid
-			&& EFalse != reqEntry->iPlacedRequest)	
+		{		
+		if(reqEntry->iFunction==aIpc && reqEntry->iMessage.SecureId()==aSid)			
+			{			
 			return reqEntry;
+			}
 		}
 	return NULL;
 	}
--- a/telephonyserver/etelserverandcore/SETEL/ET_PHONE.CPP	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserver/etelserverandcore/SETEL/ET_PHONE.CPP	Thu Nov 04 20:30:45 2010 +0200
@@ -1229,7 +1229,7 @@
 			
 		if (!nextPostedReqEntry)
 			// then we don't want to post any other client's requests in place of this one
-			{
+			{			
 			nextPostedReqEntry = PhoneOwner()->FindNonCancelledClientReq(updatedReqEntry->iSession,updatedReqEntry->iMessage.Int3(),ipc);
 			__ASSERT_DEBUG(updatedReqEntry!=nextPostedReqEntry, Fault(EEtelFaultCancelErrorWithoutCancelled));
 			if (nextPostedReqEntry==NULL && reqMode&KReqModeRePostImmediately)
@@ -1251,7 +1251,12 @@
 	if (reqMode & KReqModeRePostImmediately)
 		{
 		// this will destroy the reqEntry if an error occurred.
-		UpdateAndCompleteIfNecessary(updatedReqEntry,error);	
+		if(!IsSessionReserved())
+			//when there is an ongoing MO session we must ensure
+			//that the message is deliver only to the session owner
+			{
+			UpdateAndCompleteIfNecessary(updatedReqEntry,error);
+			}
 		}														
 	else
 		{
@@ -1299,7 +1304,6 @@
 		// Session in progress.
         return KErrPermissionDenied;
         }
-
 	return iDeliveryObject->DeliverReqL(PhoneOwner()->ReqActiveList(), aUpdatedReqEntry, aReqMode, aIpc, aError);
     }
 	
@@ -1307,23 +1311,50 @@
     {
 	CReqEntry* reqEntry;
 	TDblQueIter<CReqEntry> iter(PhoneOwner()->ReqActiveList());
-	while(reqEntry = iter++, reqEntry!=NULL)
+	if(!IsSessionReserved())//network initiated dialogue
 		{
-		if(reqEntry->iFunction==aIpc 
-			&& reqEntry->iTelObject==aUpdatedReqEntry->iTelObject 
-			&& reqEntry->iBuffer->Size()==aUpdatedReqEntry->iBuffer->Size()
-			/*&& IsSessionOwner(reqEntry)*/)    
+		while(reqEntry = iter++, reqEntry!=NULL)
 			{
-			if (aUpdatedReqEntry != reqEntry)
-				{
-				// Copy data from the 'placed' request to the one
-				// that is owned by the client.
-				PhoneOwner()->UpdateBuffer(aUpdatedReqEntry,reqEntry);
+				//loop through all interested clients which are not session owners
+			if(reqEntry->iFunction==aIpc 
+				&& reqEntry->iTelObject==aUpdatedReqEntry->iTelObject 
+				&& reqEntry->iBuffer->Size()==aUpdatedReqEntry->iBuffer->Size()
+				/*&& IsSessionOwner(reqEntry)*/)
+				{			
+				if (aUpdatedReqEntry != reqEntry)
+					{
+					// Copy data from the 'placed' request to the one
+					// that is owned by the client.				
+					PhoneOwner()->UpdateBuffer(aUpdatedReqEntry,reqEntry);
+					}
+				OfferToClient(reqEntry, aUpdatedReqEntry, aReqMode, aError);
+				RepostRequest(aUpdatedReqEntry, aError);
 				}
-			OfferToClient(reqEntry, aUpdatedReqEntry, aReqMode, aError);
-			RepostRequest(aUpdatedReqEntry, aError);
+			}		
+		}   	
+	else//mobile originated dialogue -> the session is reserved and message must be passed 
+		//only to the session owner		
+		{
+		while(reqEntry = iter++, reqEntry!=NULL)
+			{
+			if(reqEntry->iFunction==aIpc 
+				&& reqEntry->iTelObject==aUpdatedReqEntry->iTelObject 
+				&& reqEntry->iBuffer->Size()==aUpdatedReqEntry->iBuffer->Size()
+				&& IsSessionOwner(reqEntry))  
+				//TODO uncommented IsSessionOwner(reqEntry) to make sure
+				//request is delievered to the session owner(sometimes the default handler)
+				{			
+				if (aUpdatedReqEntry != reqEntry)
+					{
+					// Copy data from the 'placed' request to the one
+					// that is owned by the client.				
+					PhoneOwner()->UpdateBuffer(aUpdatedReqEntry,reqEntry);
+					}
+				OfferToClient(reqEntry, aUpdatedReqEntry, aReqMode, aError);
+				RepostRequest(aUpdatedReqEntry, aError);
+				}
 			}
-		}   
+		}
 	}
 	
 void CTelObject::OfferToClient(CReqEntry* aReqEntry,CReqEntry* aUpdatedReqEntry,const TReqMode aReqMode,const TInt aError)
@@ -1397,13 +1428,11 @@
 // Note that once a session has an owner the reserved state is irrelevant.
 EXPORT_C void CTelObject::SetSessionOwnerByTsyHandleAndIpc(const TTsyReqHandle aTsyReqHandle, TInt aIpc)
     {
-	
+	//these are used to fall back to original client if the default handler was not found
     TInt owningsession = PhoneOwner()->FindSessionByTsyHandle( aTsyReqHandle );
     TInt owningsubsession = PhoneOwner()->FindSubSessionByTsyHandle( aTsyReqHandle );
-    
         
-    if((NULL != aIpc) && 
-    (iDeliveryObject->GetReqMode() == (KReqModeSessionBased | KReqModeTransferToDefaultHandler)))
+    if((NULL != aIpc))
     // transfer to default handler
     	{
     	CReqEntry* reqEntry = PhoneOwner()->FindByIpcAndSecureId(aIpc, KUssdDefaultClientSid);
@@ -1413,7 +1442,7 @@
     		owningsubsession = reqEntry->iMessage.Int3();    		
     		}
     	}
-    iDeliveryObject->iSessionOwner = TPhoneClientId(owningsession, owningsubsession);
+    iDeliveryObject->iSessionOwner = TPhoneClientId(owningsession, owningsubsession);    
     }
 
 // Can be used by the TSY to set the session owner to the current request.
--- a/telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmussdtsy.cpp	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmussdtsy.cpp	Thu Nov 04 20:30:45 2010 +0200
@@ -195,7 +195,7 @@
             }
             break;
         case EMobileUssdMessagingSendMessageDefaultHandler: 
-			{
+			{			
 			iUssdNoFdnCheckFlag = EUssdNoFdnCheckNotUsed;
 			iSendToDefaultHandler = ETrue;
 			ret = SendMessageL( 
@@ -563,7 +563,7 @@
             TDes8* unpackedReceiveUssdMessagePtr = NULL;
             RMobileUssdMessaging::TMobileUssdAttributesV1* unpackedReceiveUssdMessageAttributesPtr = NULL;            
             aDataPackage->UnPackData (&unpackedReceiveUssdMessagePtr, &unpackedReceiveUssdMessageAttributesPtr);
-                                  
+                    
             if(iReceiveUssdMessagePtr->MaxLength() >= unpackedReceiveUssdMessagePtr->Length())
                	{             
 				*iReceiveUssdMessagePtr = *unpackedReceiveUssdMessagePtr;
@@ -572,7 +572,7 @@
             else
             	{            	
             	aError = KErrArgument;
-            	}               
+            	}
 			}
         ReqCompleted( reqHandle, aError );
         }
@@ -623,12 +623,10 @@
         		}
         	else //default handler 
 				{
-					ret = iMmPhone->MessageManager()->HandleRequestL( 
+				ret = iMmPhone->MessageManager()->HandleRequestL( 
 						EMobileUssdMessagingSendMessageDefaultHandler, &package );            
 				}      	
             }
-        
-            
         iSsTransactionOngoing = ETrue;        
         }
 
@@ -762,7 +760,7 @@
     	else// default handler
     		{
     		reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
-    		        		EMultimodeUssdSendMessageDefaultHandler );
+    		        		EMultimodeUssdSendMessageDefaultHandler );    		
     		}
         // If the session is already in progress then no session management
         // action is required. Otherwise we either promote the reserved
@@ -776,8 +774,10 @@
             		SetSessionOwnerByTsyHandle( reqHandle );
             		}
             	else // default handler
-            		{            		
-            		SetSessionOwnerByTsyHandleAndIpc( reqHandle, EMultimodeUssdSendMessageDefaultHandler );
+            		{    
+            		//this function call will transfer received message to the 
+            		//default handler which already has EMobileUssdMessagingReceiveMessage request.
+            		SetSessionOwnerByTsyHandleAndIpc( reqHandle, EMobileUssdMessagingReceiveMessage );
             		}
                 }
             else
--- a/telephonyserverplugins/common_tsy/test/component/inc/cctsyussdmessagingfu.h	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserverplugins/common_tsy/test/component/inc/cctsyussdmessagingfu.h	Thu Nov 04 20:30:45 2010 +0200
@@ -134,11 +134,16 @@
 	void TestAcceptRejectMisuse0001L();
 	void TestAcceptRejectMisuse0002L();
 	void TestMultipleIncomingUssdMessages0001L();	
-
+	void TestSendMessageDefaultHandlerWithTestClient0001L();
+	void TestSendMessageDefaultHandlerWithTestClient0002L();
+	void TestSendMessageDefaultHandlerWithTestClient0003L();
+	void TestSendMessageDefaultHandlerWithTestClient0004L();
+		
 private:
 	static TInt TestReceiveMessage(TAny* aThreadData);
 	static void CompleteMockRequestL(RBuf8& aData, TInt aMsgType, RMockLtsy& aMockLTSY);
 	void TestReceiveMessageWithTestClientL(RArray<TUssdClientTestData> & aClientTestData, TBool aRandomLoopingTest=EFalse);
+	
 	}; // class CCTsyUssdMessagingFU
 
 
--- a/telephonyserverplugins/common_tsy/test/component/scripts/te_ctsycomponent_ussdmessaging_individual.script	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserverplugins/common_tsy/test/component/scripts/te_ctsycomponent_ussdmessaging_individual.script	Thu Nov 04 20:30:45 2010 +0200
@@ -23,6 +23,51 @@
 RUN_PROGRAM -1 setcap ussdtestclient.exe FFFFFFFE -SID 55555555 ussdtestclient_normal.exe
 RUN_PROGRAM -1 setcap ussdtestclient.exe FFFFFFFE -SID 22222222 ussdtestclient_default.exe
 
+START_TESTCASE BA-CTSY-USSDM-USMDH-0001
+//!@SYMTestCaseID BA-CTSY-USSDM-USMDH-0001
+//!@SYMComponent telephony_ctsy
+//!@SYMTestCaseDesc Test support in CTSY for RMobileUssdMessaging::SendMessageDefaultHandler
+//!@SYMTestPriority High
+//!@SYMTestActions Invokes RMobileUssdMessaging::SendMessageDefaultHandler
+//!@SYMTestExpectedResults Pass
+//!@SYMTestType CT
+RUN_TEST_STEP 100 te_ctsy_component TEFUnit.CCTsyUssdMessagingFU.TestSendMessageDefaultHandlerWithTestClient0001L
+END_TESTCASE BA-CTSY-USSDM-USMDH-0001
+
+START_TESTCASE BA-CTSY-USSDM-USMDH-0002
+//!@SYMTestCaseID BA-CTSY-USSDM-USMDH-0002
+//!@SYMComponent telephony_ctsy
+//!@SYMTestCaseDesc Test support in CTSY for RMobileUssdMessaging::SendMessageDefaultHandler
+//!@SYMTestPriority High
+//!@SYMTestActions Invokes RMobileUssdMessaging::SendMessageDefaultHandler
+//!@SYMTestExpectedResults Pass
+//!@SYMTestType CT
+RUN_TEST_STEP 100 te_ctsy_component TEFUnit.CCTsyUssdMessagingFU.TestSendMessageDefaultHandlerWithTestClient0002L
+END_TESTCASE BA-CTSY-USSDM-USMDH-0002
+
+START_TESTCASE BA-CTSY-USSDM-USMDH-0003
+//!@SYMTestCaseID BA-CTSY-USSDM-USMDH-0003
+//!@SYMComponent telephony_ctsy
+//!@SYMTestCaseDesc Test support in CTSY for RMobileUssdMessaging::SendMessageDefaultHandler
+//!@SYMTestPriority High
+//!@SYMTestActions Invokes RMobileUssdMessaging::SendMessageDefaultHandler
+//!@SYMTestExpectedResults Pass
+//!@SYMTestType CT
+RUN_TEST_STEP 100 te_ctsy_component TEFUnit.CCTsyUssdMessagingFU.TestSendMessageDefaultHandlerWithTestClient0003L
+END_TESTCASE BA-CTSY-USSDM-USMDH-0003
+
+START_TESTCASE BA-CTSY-USSDM-USMDH-0004
+//!@SYMTestCaseID BA-CTSY-USSDM-USMDH-0004
+//!@SYMComponent telephony_ctsy
+//!@SYMTestCaseDesc Test support in CTSY for RMobileUssdMessaging::SendMessageDefaultHandler
+//!@SYMTestPriority High
+//!@SYMTestActions Invokes RMobileUssdMessaging::SendMessageDefaultHandler
+//!@SYMTestExpectedResults Pass
+//!@SYMTestType CT
+RUN_TEST_STEP 100 te_ctsy_component TEFUnit.CCTsyUssdMessagingFU.TestSendMessageDefaultHandlerWithTestClient0004L
+END_TESTCASE BA-CTSY-USSDM-USMDH-0004
+
+
 START_TESTCASE BA-CTSY-USSDM-UNNR-0001
 //!@SYMTestCaseID BA-CTSY-USSDM-UNNR-0001
 //!@SYMComponent telephony_ctsy
--- a/telephonyserverplugins/common_tsy/test/component/src/cctsyussdmessagingfu.cpp	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserverplugins/common_tsy/test/component/src/cctsyussdmessagingfu.cpp	Thu Nov 04 20:30:45 2010 +0200
@@ -99,6 +99,10 @@
 	ADD_TEST_STEP_ISO_CPP(CCTsyUssdMessagingFU, TestAcceptRejectMisuse0001L);
 	ADD_TEST_STEP_ISO_CPP(CCTsyUssdMessagingFU, TestAcceptRejectMisuse0002L);
 	ADD_TEST_STEP_ISO_CPP(CCTsyUssdMessagingFU, TestMultipleIncomingUssdMessages0001L);
+	ADD_TEST_STEP_ISO_CPP(CCTsyUssdMessagingFU, TestSendMessageDefaultHandlerWithTestClient0001L);
+	ADD_TEST_STEP_ISO_CPP(CCTsyUssdMessagingFU, TestSendMessageDefaultHandlerWithTestClient0002L);
+	ADD_TEST_STEP_ISO_CPP(CCTsyUssdMessagingFU, TestSendMessageDefaultHandlerWithTestClient0003L);	
+	ADD_TEST_STEP_ISO_CPP(CCTsyUssdMessagingFU, TestSendMessageDefaultHandlerWithTestClient0004L);
 	END_SUITE;
 	
 	}
@@ -5043,8 +5047,7 @@
         return;
         }
     
-    iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data, 15);
-
+   iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data, 15);
     User::WaitForAnyRequest();
     
     // Wait for any clients given a timeout
@@ -5617,3 +5620,616 @@
 	
 	}
 	
+
+/**
+@SYMTestCaseID BA-CTSY-USSDM-USMDH-0001
+@SYMComponent telephony_ctsy
+@SYMTestCaseDesc Test support in CTSY client requests to RMobileUssdMessaging::SendMessage with default handler
+@SYMTestPriority High
+@SYMTestActions Invokes request to RMobileUssdMessaging::SendMessage with EMobileUssdMessagingSendMessageDefaultHandler option
+@SYMTestExpectedResults Pass
+@SYMTestType CT
+*/
+void CCTsyUssdMessagingFU::TestSendMessageDefaultHandlerWithTestClient0001L()
+    {	
+	OpenEtelServerL(EUseExtendedError);
+	CleanupStack::PushL(TCleanupItem(Cleanup,this));
+	OpenPhoneL();
+
+	RBuf8 data;
+	CleanupClosePushL(data);
+
+	RArray<TUssdClientTestData> data1;
+	RMobileUssdMessaging ussdMessaging;
+	TInt ret = ussdMessaging.Open(iPhone);
+	ASSERT_EQUALS(KErrNone, ret);
+	CleanupClosePushL(ussdMessaging);
+	
+	TRequestStatus requestStatus;
+
+	TUint32 flags = 100;
+	RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified;
+	RMobileUssdMessaging::TMobileUssdMessageType type  = RMobileUssdMessaging::EUssdMORequest;
+	TUint8 dcs = 200;
+
+	//-------------------------------------------------------------------------
+	// function parameters
+
+	RMobileUssdMessaging::TMobileUssdAttributesV1 attributes;
+	TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes);
+	
+	attributes.iFlags  = flags;
+	attributes.iFormat = format;
+	attributes.iType   = type;
+	attributes.iDcs   = dcs;
+	
+	TName name = _L("Name1");
+	TPckg<TName> msgData(name);
+
+	//-------------------------------------------------------------------------
+
+	TMockLtsyData2<TName, RMobileUssdMessaging::TMobileUssdAttributesV1> 
+		mockData2(name, attributes);
+	mockData2.SerialiseL(data);	
+	//-------------------------------------------------------------------------
+	RBuf8 data2;
+	CleanupClosePushL(data2);
+	//-------------------------------------------------------------------------	
+	RMobileUssdMessaging::TMobileUssdAttributesV1 completeAttributes;
+	completeAttributes.iFlags  = flags;
+	completeAttributes.iFormat = format;
+	completeAttributes.iType   = type;
+	completeAttributes.iDcs    = dcs;
+	TBuf8<KMaxName> completeName = _L8("Name2");
+	TMockLtsyData2<TBuf8<KMaxName>, RMobileUssdMessaging::TMobileUssdAttributesV1> 
+											mockData3(completeName, completeAttributes);
+	mockData3.SerialiseL(data2);
+	//-------------------------------------------------------------------------	
+	data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"), _L("-R -M"), KErrNone, EExitKill, KErrNone)); //Default
+	const TInt numClients = data1.Count();
+	RProcess* proc = new RProcess[numClients];
+	TRequestStatus* req = new TRequestStatus[numClients];
+	
+	for (TInt i=0; i<numClients; ++i)
+		{
+		TInt err = proc[i].Create(data1[i].iExe, data1[i].iClientParams);
+		// If a client isn't created properly, we need to clean up previously created ones here
+		if (err != KErrNone)
+			{
+			for (TInt c=0; c<i-1; ++c)
+				{
+				proc[c].Kill(KErrNone);
+				proc[c].Close();
+				}
+			}
+		// Fail the test if any client has not been created properly
+		ASSERT_EQUALS(err, KErrNone);
+		}
+	// All processes created successfully, start their execution
+	for (TInt i = 0; i < numClients; i++)
+		{
+		proc[i].Logon(req[i]);
+		proc[i].Resume();
+		// Pause here so that clients register in the order specified (i.e. As ordered in the array)
+		// Resolves timing issues in WDP/SMP.
+		User::After(500000);
+		}
+	//-------------------------------------------------------------------------
+	
+	iMockLTSY.ExpectL(EMobileUssdMessagingSendMessageDefaultHandler, data);
+	iMockLTSY.CompleteL(EMobileUssdMessagingSendMessageDefaultHandler, KErrNone);
+		
+	ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler);	
+	User::WaitForRequest(requestStatus);        
+	AssertMockLtsyStatusL();
+	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
+	//---------------------------------------------------------------------------
+		
+	iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data2, 15);
+	User::After(5 * 1000000);
+	
+	for (TInt i = 0; i < numClients; i++)
+		{
+		TRequestStatus status = req[i];
+		TExitType exit = proc[i].ExitType();
+		TInt reason = proc[i].ExitReason();
+		
+		// Kill/Close the clients before doing assert
+		proc[i].Kill(KErrNone);
+		proc[i].Close();
+
+		const TBool checkRequestStatus = status.Int() == data1[i].iReqStatus;
+		const TBool checkExitType = exit == data1[i].iExitType;
+		TBool checkExitReason = ETrue;
+		if (data1[i].iExitType == EExitKill)
+			{
+			checkExitReason = reason == data1[i].iExitReason;
+			}
+
+		if (!checkRequestStatus || !checkExitType || !checkExitReason)
+			{
+			// Some useful output in case of a failed test
+			INFO_PRINTF2(_L("Client[%d] returned unexpected results:"),i);
+			if (!checkRequestStatus)
+				INFO_PRINTF3(_L("  [RequestStatus] Expected: %d , Actual: %d"),data1[i].iReqStatus,status.Int());
+			if (!checkExitType)
+				INFO_PRINTF3(_L("  [ExitType]      Expected: %d , Actual: %d"),data1[i].iExitType,exit);
+			if (!checkExitReason)
+				INFO_PRINTF3(_L("  [ExitReason]    Expected: %d , Actual: %d"),data1[i].iExitReason,reason);
+			for (TInt c=i+1; c<numClients; ++c)
+				{
+				proc[c].Kill(KErrNone);
+				proc[c].Close();
+				}
+			ASSERT_TRUE(checkRequestStatus);
+			ASSERT_TRUE(checkExitType);
+			ASSERT_TRUE(checkExitReason);
+			}
+		}	
+	//---------------------------------------------------------------------------
+	data1.Close();
+	CleanupStack::PopAndDestroy(4, this); // data, data2, this, ussdMessaging
+    }
+
+
+
+/**
+@SYMTestCaseID BA-CTSY-USSDM-USMDH-0002
+@SYMComponent telephony_ctsy
+@SYMTestCaseDesc Test support in CTSY client requests to RMobileUssdMessaging::SendMessage with two default clients
+@SYMTestPriority High
+@SYMTestActions Invokes request to RMobileUssdMessaging::SendMessage with EMobileUssdMessagingSendMessageDefaultHandler option
+@SYMTestExpectedResults Pass
+@SYMTestType CT
+*/
+void CCTsyUssdMessagingFU::TestSendMessageDefaultHandlerWithTestClient0002L()
+    {	
+	
+	OpenEtelServerL(EUseExtendedError);
+	CleanupStack::PushL(TCleanupItem(Cleanup,this));
+	OpenPhoneL();
+
+	RBuf8 data;
+	CleanupClosePushL(data);
+
+	RArray<TUssdClientTestData> data1;
+	RMobileUssdMessaging ussdMessaging;
+	TInt ret = ussdMessaging.Open(iPhone);
+	ASSERT_EQUALS(KErrNone, ret);
+	CleanupClosePushL(ussdMessaging);
+	
+	TRequestStatus requestStatus;
+
+	TUint32 flags = 100;
+	RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified;
+	RMobileUssdMessaging::TMobileUssdMessageType type  = RMobileUssdMessaging::EUssdMORequest;
+	TUint8 dcs = 200;
+
+	//-------------------------------------------------------------------------
+	// function parameters
+
+	RMobileUssdMessaging::TMobileUssdAttributesV1 attributes;
+	TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes);
+	
+	attributes.iFlags  = flags;
+	attributes.iFormat = format;
+	attributes.iType   = type;
+	attributes.iDcs   = dcs;
+	
+	TName name = _L("Name1");
+	TPckg<TName> msgData(name);
+
+	//-------------------------------------------------------------------------
+
+	TMockLtsyData2<TName, RMobileUssdMessaging::TMobileUssdAttributesV1> 
+		mockData2(name, attributes);
+	mockData2.SerialiseL(data);	
+	//-------------------------------------------------------------------------
+	RBuf8 data2;
+	CleanupClosePushL(data2);
+	//-------------------------------------------------------------------------	
+	RMobileUssdMessaging::TMobileUssdAttributesV1 completeAttributes;
+	completeAttributes.iFlags  = flags;
+	completeAttributes.iFormat = format;
+	completeAttributes.iType   = type;
+	completeAttributes.iDcs    = dcs;
+	TBuf8<KMaxName> completeName = _L8("Name2");
+	TMockLtsyData2<TBuf8<KMaxName>, RMobileUssdMessaging::TMobileUssdAttributesV1> 
+											mockData3(completeName, completeAttributes);
+	mockData3.SerialiseL(data2);
+	//-------------------------------------------------------------------------	
+	data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"), _L("-R -M"), KErrNone, EExitKill, KErrNone)); //Default
+	data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"),_L("-R -M"), KRequestPending, EExitPending, KErrNone)); //Second default client
+	const TInt numClients = data1.Count();
+	RProcess* proc = new RProcess[numClients];
+	TRequestStatus* req = new TRequestStatus[numClients];
+	
+	for (TInt i=0; i<numClients; ++i)
+		{
+		TInt err = proc[i].Create(data1[i].iExe, data1[i].iClientParams);
+		// If a client isn't created properly, we need to clean up previously created ones here
+		if (err != KErrNone)
+			{
+			for (TInt c=0; c<i-1; ++c)
+				{
+				proc[c].Kill(KErrNone);
+				proc[c].Close();
+				}
+			}
+		// Fail the test if any client has not been created properly
+		ASSERT_EQUALS(err, KErrNone);
+		}
+	// All processes created successfully, start their execution
+	for (TInt i = 0; i < numClients; i++)
+		{
+		proc[i].Logon(req[i]);
+		proc[i].Resume();
+		// Pause here so that clients register in the order specified (i.e. As ordered in the array)
+		// Resolves timing issues in WDP/SMP.
+		User::After(500000);
+		}
+	//-------------------------------------------------------------------------
+	
+	iMockLTSY.ExpectL(EMobileUssdMessagingSendMessageDefaultHandler, data);
+	iMockLTSY.CompleteL(EMobileUssdMessagingSendMessageDefaultHandler, KErrNone);
+		
+	ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler);	
+	User::WaitForRequest(requestStatus);        
+	AssertMockLtsyStatusL();
+	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
+	//---------------------------------------------------------------------------
+		
+	iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data2, 15);
+	User::After(5 * 1000000);
+	
+	for (TInt i = 0; i < numClients; i++)
+		{
+		TRequestStatus status = req[i];
+		TExitType exit = proc[i].ExitType();
+		TInt reason = proc[i].ExitReason();
+		
+		// Kill/Close the clients before doing assert
+		proc[i].Kill(KErrNone);
+		proc[i].Close();
+
+		const TBool checkRequestStatus = status.Int() == data1[i].iReqStatus;
+		const TBool checkExitType = exit == data1[i].iExitType;
+		TBool checkExitReason = ETrue;
+		if (data1[i].iExitType == EExitKill)
+			{
+			checkExitReason = reason == data1[i].iExitReason;
+			}
+
+		if (!checkRequestStatus || !checkExitType || !checkExitReason)
+			{
+			// Some useful output in case of a failed test
+			INFO_PRINTF2(_L("Client[%d] returned unexpected results:"),i);
+			if (!checkRequestStatus)
+				INFO_PRINTF3(_L("  [RequestStatus] Expected: %d , Actual: %d"),data1[i].iReqStatus,status.Int());
+			if (!checkExitType)
+				INFO_PRINTF3(_L("  [ExitType]      Expected: %d , Actual: %d"),data1[i].iExitType,exit);
+			if (!checkExitReason)
+				INFO_PRINTF3(_L("  [ExitReason]    Expected: %d , Actual: %d"),data1[i].iExitReason,reason);
+			for (TInt c=i+1; c<numClients; ++c)
+				{
+				proc[c].Kill(KErrNone);
+				proc[c].Close();
+				}
+			ASSERT_TRUE(checkRequestStatus);
+			ASSERT_TRUE(checkExitType);
+			ASSERT_TRUE(checkExitReason);
+			}
+		}	
+	//---------------------------------------------------------------------------
+	data1.Close();
+	CleanupStack::PopAndDestroy(4, this); // data, data2, this, ussdMessaging
+    }
+
+
+
+/**
+@SYMTestCaseID BA-CTSY-USSDM-USMDH-0003
+@SYMComponent telephony_ctsy
+@SYMTestCaseDesc Test support in CTSY client requests to RMobileUssdMessaging::SendMessage with default and priority clients
+@SYMTestPriority High
+@SYMTestActions Invokes request to RMobileUssdMessaging::SendMessage with EMobileUssdMessagingSendMessageDefaultHandler option
+@SYMTestExpectedResults Pass
+@SYMTestType CT
+*/
+void CCTsyUssdMessagingFU::TestSendMessageDefaultHandlerWithTestClient0003L()
+    {	
+	
+	OpenEtelServerL(EUseExtendedError);
+	CleanupStack::PushL(TCleanupItem(Cleanup,this));
+	OpenPhoneL();
+
+	RBuf8 data;
+	CleanupClosePushL(data);
+
+	RArray<TUssdClientTestData> data1;
+	RMobileUssdMessaging ussdMessaging;
+	TInt ret = ussdMessaging.Open(iPhone);
+	ASSERT_EQUALS(KErrNone, ret);
+	CleanupClosePushL(ussdMessaging);
+	
+	TRequestStatus requestStatus;
+
+	TUint32 flags = 100;
+	RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified;
+	RMobileUssdMessaging::TMobileUssdMessageType type  = RMobileUssdMessaging::EUssdMORequest;
+	TUint8 dcs = 200;
+
+	//-------------------------------------------------------------------------
+	// function parameters
+
+	RMobileUssdMessaging::TMobileUssdAttributesV1 attributes;
+	TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes);
+	
+	attributes.iFlags  = flags;
+	attributes.iFormat = format;
+	attributes.iType   = type;
+	attributes.iDcs   = dcs;
+	
+	TName name = _L("Name1");
+	TPckg<TName> msgData(name);
+
+	//-------------------------------------------------------------------------
+
+	TMockLtsyData2<TName, RMobileUssdMessaging::TMobileUssdAttributesV1> 
+		mockData2(name, attributes);
+	mockData2.SerialiseL(data);	
+	//-------------------------------------------------------------------------
+	RBuf8 data2;
+	CleanupClosePushL(data2);
+	//-------------------------------------------------------------------------	
+	RMobileUssdMessaging::TMobileUssdAttributesV1 completeAttributes;
+	completeAttributes.iFlags  = flags;
+	completeAttributes.iFormat = format;
+	completeAttributes.iType   = type;
+	completeAttributes.iDcs    = dcs;
+	TBuf8<KMaxName> completeName = _L8("Name2");
+	TMockLtsyData2<TBuf8<KMaxName>, RMobileUssdMessaging::TMobileUssdAttributesV1> 
+											mockData3(completeName, completeAttributes);
+	mockData3.SerialiseL(data2);
+	//-------------------------------------------------------------------------
+	data1.Append(TUssdClientTestData(_L("ussdtestclient_priority.exe"),_L("-R -M"), KRequestPending, EExitPending, KErrNone)); //Priority
+	data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"), _L("-R -M"), KErrNone, EExitKill, KErrNone)); //Default
+	const TInt numClients = data1.Count();
+	RProcess* proc = new RProcess[numClients];
+	TRequestStatus* req = new TRequestStatus[numClients];
+	
+	for (TInt i=0; i<numClients; ++i)
+		{
+		TInt err = proc[i].Create(data1[i].iExe, data1[i].iClientParams);
+		// If a client isn't created properly, we need to clean up previously created ones here
+		if (err != KErrNone)
+			{
+			for (TInt c=0; c<i-1; ++c)
+				{
+				proc[c].Kill(KErrNone);
+				proc[c].Close();
+				}
+			}
+		// Fail the test if any client has not been created properly
+		ASSERT_EQUALS(err, KErrNone);
+		}
+	// All processes created successfully, start their execution
+	for (TInt i = 0; i < numClients; i++)
+		{
+		proc[i].Logon(req[i]);
+		proc[i].Resume();
+		// Pause here so that clients register in the order specified (i.e. As ordered in the array)
+		// Resolves timing issues in WDP/SMP.
+		User::After(500000);
+		}
+	//-------------------------------------------------------------------------
+	
+	iMockLTSY.ExpectL(EMobileUssdMessagingSendMessageDefaultHandler, data);
+	iMockLTSY.CompleteL(EMobileUssdMessagingSendMessageDefaultHandler, KErrNone);
+		
+	ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler);	
+	User::WaitForRequest(requestStatus);        
+	AssertMockLtsyStatusL();
+	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
+	//---------------------------------------------------------------------------
+		
+	iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data2, 15);
+	User::After(5 * 1000000);
+	
+	for (TInt i = 0; i < numClients; i++)
+		{
+		TRequestStatus status = req[i];
+		TExitType exit = proc[i].ExitType();
+		TInt reason = proc[i].ExitReason();
+		
+		// Kill/Close the clients before doing assert
+		proc[i].Kill(KErrNone);
+		proc[i].Close();
+
+		const TBool checkRequestStatus = status.Int() == data1[i].iReqStatus;
+		const TBool checkExitType = exit == data1[i].iExitType;
+		TBool checkExitReason = ETrue;
+		if (data1[i].iExitType == EExitKill)
+			{
+			checkExitReason = reason == data1[i].iExitReason;
+			}
+
+		if (!checkRequestStatus || !checkExitType || !checkExitReason)
+			{
+			// Some useful output in case of a failed test
+			INFO_PRINTF2(_L("Client[%d] returned unexpected results:"),i);
+			if (!checkRequestStatus)
+				INFO_PRINTF3(_L("  [RequestStatus] Expected: %d , Actual: %d"),data1[i].iReqStatus,status.Int());
+			if (!checkExitType)
+				INFO_PRINTF3(_L("  [ExitType]      Expected: %d , Actual: %d"),data1[i].iExitType,exit);
+			if (!checkExitReason)
+				INFO_PRINTF3(_L("  [ExitReason]    Expected: %d , Actual: %d"),data1[i].iExitReason,reason);
+			for (TInt c=i+1; c<numClients; ++c)
+				{
+				proc[c].Kill(KErrNone);
+				proc[c].Close();
+				}
+			ASSERT_TRUE(checkRequestStatus);
+			ASSERT_TRUE(checkExitType);
+			ASSERT_TRUE(checkExitReason);
+			}
+		}	
+	//---------------------------------------------------------------------------
+	data1.Close();
+	CleanupStack::PopAndDestroy(4, this); // data, data2, this, ussdMessaging
+    }
+
+
+/**
+@SYMTestCaseID BA-CTSY-USSDM-USMDH-0004
+@SYMComponent telephony_ctsy
+@SYMTestCaseDesc Test support in CTSY client requests to RMobileUssdMessaging::SendMessage with default, normal and priority clients
+@SYMTestPriority High
+@SYMTestActions Invokes request to RMobileUssdMessaging::SendMessage with EMobileUssdMessagingSendMessageDefaultHandler option
+@SYMTestExpectedResults Pass
+@SYMTestType CT
+*/
+void CCTsyUssdMessagingFU::TestSendMessageDefaultHandlerWithTestClient0004L()
+    {	
+	
+	OpenEtelServerL(EUseExtendedError);
+	CleanupStack::PushL(TCleanupItem(Cleanup,this));
+	OpenPhoneL();
+
+	RBuf8 data;
+	CleanupClosePushL(data);
+
+	RArray<TUssdClientTestData> data1;
+	RMobileUssdMessaging ussdMessaging;
+	TInt ret = ussdMessaging.Open(iPhone);
+	ASSERT_EQUALS(KErrNone, ret);
+	CleanupClosePushL(ussdMessaging);
+	
+	TRequestStatus requestStatus;
+
+	TUint32 flags = 100;
+	RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified;
+	RMobileUssdMessaging::TMobileUssdMessageType type  = RMobileUssdMessaging::EUssdMORequest;
+	TUint8 dcs = 200;
+
+	//-------------------------------------------------------------------------
+	// function parameters
+
+	RMobileUssdMessaging::TMobileUssdAttributesV1 attributes;
+	TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes);
+	
+	attributes.iFlags  = flags;
+	attributes.iFormat = format;
+	attributes.iType   = type;
+	attributes.iDcs   = dcs;
+	
+	TName name = _L("Name1");
+	TPckg<TName> msgData(name);
+
+	//-------------------------------------------------------------------------
+
+	TMockLtsyData2<TName, RMobileUssdMessaging::TMobileUssdAttributesV1> 
+		mockData2(name, attributes);
+	mockData2.SerialiseL(data);	
+	//-------------------------------------------------------------------------
+	RBuf8 data2;
+	CleanupClosePushL(data2);
+	//-------------------------------------------------------------------------	
+	RMobileUssdMessaging::TMobileUssdAttributesV1 completeAttributes;
+	completeAttributes.iFlags  = flags;
+	completeAttributes.iFormat = format;
+	completeAttributes.iType   = type;
+	completeAttributes.iDcs    = dcs;
+	TBuf8<KMaxName> completeName = _L8("Name2");
+	TMockLtsyData2<TBuf8<KMaxName>, RMobileUssdMessaging::TMobileUssdAttributesV1> 
+											mockData3(completeName, completeAttributes);
+	mockData3.SerialiseL(data2);
+	//-------------------------------------------------------------------------
+	data1.Append(TUssdClientTestData(_L("ussdtestclient_priority.exe"),_L("-R -M"), KRequestPending, EExitPending, KErrNone)); //Priority
+	data1.Append(TUssdClientTestData(_L("ussdtestclient_normal.exe"),_L("-R -M"), KRequestPending, EExitPending, KErrNone)); //Normal
+	data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"), _L("-R -M"), KErrNone, EExitKill, KErrNone)); //Default
+	const TInt numClients = data1.Count();
+	RProcess* proc = new RProcess[numClients];
+	TRequestStatus* req = new TRequestStatus[numClients];
+	
+	for (TInt i=0; i<numClients; ++i)
+		{
+		TInt err = proc[i].Create(data1[i].iExe, data1[i].iClientParams);
+		// If a client isn't created properly, we need to clean up previously created ones here
+		if (err != KErrNone)
+			{
+			for (TInt c=0; c<i-1; ++c)
+				{
+				proc[c].Kill(KErrNone);
+				proc[c].Close();
+				}
+			}
+		// Fail the test if any client has not been created properly
+		ASSERT_EQUALS(err, KErrNone);
+		}
+	// All processes created successfully, start their execution
+	for (TInt i = 0; i < numClients; i++)
+		{
+		proc[i].Logon(req[i]);
+		proc[i].Resume();
+		// Pause here so that clients register in the order specified (i.e. As ordered in the array)
+		// Resolves timing issues in WDP/SMP.
+		User::After(500000);
+		}
+	//-------------------------------------------------------------------------
+	
+	iMockLTSY.ExpectL(EMobileUssdMessagingSendMessageDefaultHandler, data);
+	iMockLTSY.CompleteL(EMobileUssdMessagingSendMessageDefaultHandler, KErrNone);
+		
+	ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler);	
+	User::WaitForRequest(requestStatus);        
+	AssertMockLtsyStatusL();
+	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
+	//---------------------------------------------------------------------------
+		
+	iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data2, 15);
+	User::After(5 * 1000000);
+	
+	for (TInt i = 0; i < numClients; i++)
+		{
+		TRequestStatus status = req[i];
+		TExitType exit = proc[i].ExitType();
+		TInt reason = proc[i].ExitReason();
+		
+		// Kill/Close the clients before doing assert
+		proc[i].Kill(KErrNone);
+		proc[i].Close();
+
+		const TBool checkRequestStatus = status.Int() == data1[i].iReqStatus;
+		const TBool checkExitType = exit == data1[i].iExitType;
+		TBool checkExitReason = ETrue;
+		if (data1[i].iExitType == EExitKill)
+			{
+			checkExitReason = reason == data1[i].iExitReason;
+			}
+
+		if (!checkRequestStatus || !checkExitType || !checkExitReason)
+			{
+			// Some useful output in case of a failed test
+			INFO_PRINTF2(_L("Client[%d] returned unexpected results:"),i);
+			if (!checkRequestStatus)
+				INFO_PRINTF3(_L("  [RequestStatus] Expected: %d , Actual: %d"),data1[i].iReqStatus,status.Int());
+			if (!checkExitType)
+				INFO_PRINTF3(_L("  [ExitType]      Expected: %d , Actual: %d"),data1[i].iExitType,exit);
+			if (!checkExitReason)
+				INFO_PRINTF3(_L("  [ExitReason]    Expected: %d , Actual: %d"),data1[i].iExitReason,reason);
+			for (TInt c=i+1; c<numClients; ++c)
+				{
+				proc[c].Kill(KErrNone);
+				proc[c].Close();
+				}
+			ASSERT_TRUE(checkRequestStatus);
+			ASSERT_TRUE(checkExitType);
+			ASSERT_TRUE(checkExitReason);
+			}
+		}	
+	//---------------------------------------------------------------------------
+	data1.Close();
+	CleanupStack::PopAndDestroy(4, this); // data, data2, this, ussdMessaging
+    }
+
--- a/telephonyserverplugins/common_tsy/test/component/ussdtestclient/inc/ussdtestclient.h	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserverplugins/common_tsy/test/component/ussdtestclient/inc/ussdtestclient.h	Thu Nov 04 20:30:45 2010 +0200
@@ -29,15 +29,18 @@
     EOptionSend = 2,
     EOptionAccept = 4,
     EOptionReceiveTimeout = 8,
-    EOptionRandom = 16
+    EOptionRandom = 16,
+    EOptionDefault = 32,
+    EOptionMO = 64 // this is a mobile originated(MO) request
     };
 
 class CCTsyUssdMessagingTestClient : public CBase
 	{
 public:
 CCTsyUssdMessagingTestClient();
-TInt ReceiveMessageL(TBool aAcceptDialogue, TBool aReceiveTimeout, TReal aAfterTimeperiod);
+TInt ReceiveMessageL(TBool aAcceptDialogue, TBool aReceiveTimeout, TReal aAfterTimeperiod, TBool aMO);
 TInt SendMessageL();
+TInt SendMessageDefaultHandlerL();
 TInt RandomLoopL();
 
 private:
--- a/telephonyserverplugins/common_tsy/test/component/ussdtestclient/src/ussdtestclient.cpp	Tue Oct 19 18:11:09 2010 +0300
+++ b/telephonyserverplugins/common_tsy/test/component/ussdtestclient/src/ussdtestclient.cpp	Thu Nov 04 20:30:45 2010 +0200
@@ -18,7 +18,6 @@
 #include <e32debug.h>
 #include <e32math.h> 
 
-
 CCTsyUssdMessagingTestClient::CCTsyUssdMessagingTestClient()
     {
     }  
@@ -32,7 +31,7 @@
 @SYMTestExpectedResults Pass
 @SYMTestType CT
 */
-TInt CCTsyUssdMessagingTestClient::ReceiveMessageL(TBool aAcceptDialogue, TBool aReceiveTimeout, TReal aAfterTimePeriod)
+TInt CCTsyUssdMessagingTestClient::ReceiveMessageL(TBool aAcceptDialogue, TBool aReceiveTimeout, TReal aAfterTimePeriod, TBool aMO)
     {
     // Create a cleanup stack object
     CTrapCleanup* cleanup=CTrapCleanup::New();
@@ -114,30 +113,39 @@
     User::WaitForRequest(requestStatus);     
     //RDebug::Printf("%x << WaitForRequest", User::Identity());
     //RDebug::Printf("%x requestStatus = %d", User::Identity(), requestStatus.Int());
-    
-
+        
     if (aAfterTimePeriod)
         {
         //RDebug::Printf("%x Waiting for %f seconds", User::Identity(), aAfterTimePeriod);
         // Wait, mimic a bad client taking too long...
         User::After(aAfterTimePeriod * 1000000);
         }
-        
-    if (aAcceptDialogue)
+    
+    if(EFalse == aMO)
+    	//network initiated dialog
         {
-        //RDebug::Printf("%x >> AcceptIncomingDialogue", User::Identity());
-        // Client wants the dialogue
-        ret = ussdMessaging.AcceptIncomingDialogue(); 
-        //RDebug::Printf("%x << AcceptIncomingDialogue", User::Identity());
+    	//RDebug::Printf("NI Dialog");
+		if (aAcceptDialogue)
+			{
+			//RDebug::Printf("%x >> AcceptIncomingDialogue", User::Identity());
+			// Client wants the dialogue
+			ret = ussdMessaging.AcceptIncomingDialogue(); 
+		   //RDebug::Printf("%x << AcceptIncomingDialogue", User::Identity());
+			}
+		else
+			{
+			// Client not interested
+			//RDebug::Printf("%x >> RejectIncomingDialogue", User::Identity());
+			ret = ussdMessaging.RejectIncomingDialogue();   
+			//RDebug::Printf("%x << RejectIncomingDialogue", User::Identity());
+			}
         }
     else
-        {
-        // Client not interested
-        //RDebug::Printf("%x >> RejectIncomingDialogue", User::Identity());
-        ret = ussdMessaging.RejectIncomingDialogue();   
-        //RDebug::Printf("%x << RejectIncomingDialogue", User::Identity());
-        }
-    
+    	{
+    	//RDebug::Printf("MO Dialogue");
+    	ret = requestStatus.Int();    	
+    	}
+    //RDebug::Printf("%x Received Message: %S", User::Identity(), &name);
     User::After(2 * 1000000);
 
     ussdMessaging.Close();
@@ -199,17 +207,11 @@
         phone.Close();
         return ret; 
         }
-    
-    //RDebug::Printf(">> SendMessage");
+        
     ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes);
-    //RDebug::Printf("<< SendMessage");
-    //RDebug::Printf(">> WaitForRequest");
-    User::WaitForRequest(requestStatus);     
-    //RDebug::Printf("<< WaitForRequest");
+    User::WaitForRequest(requestStatus);
     ret = requestStatus.Int();
-    //RDebug::Printf("requestStatus = %d", ret);
-
-
+    
     User::After(2 * 1000000);
 
     ussdMessaging.Close();
@@ -220,6 +222,74 @@
     return KErrNone;
     }
 
+TInt CCTsyUssdMessagingTestClient::SendMessageDefaultHandlerL()
+    {
+    // Create a cleanup stack object
+    CTrapCleanup* cleanup=CTrapCleanup::New();
+    if (cleanup==NULL)
+        return KErrNoMemory;    
+    
+    RTelServer server;
+    RMobilePhone phone;
+
+   TInt ret = server.Connect();
+   if (ret != KErrNone)
+	   {
+	   server.Close();
+	   return ret; 
+	   }
+
+   RDebug::Printf(">> server.Connect() SUCCESS!");
+       ret = phone.Open(server,KMmTsyPhoneName);
+       if (ret != KErrNone)
+           {
+           server.Close();
+           phone.Close();
+           return ret; 
+           }
+   RDebug::Printf(">> phone.Open() SUCCESS!"); 
+   TRequestStatus requestStatus;
+
+   TUint32 flags = 100;
+   RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified;
+   RMobileUssdMessaging::TMobileUssdMessageType type  = RMobileUssdMessaging::EUssdMORequest;
+   TUint8 dcs = 200;
+
+   RMobileUssdMessaging::TMobileUssdAttributesV1 attributes;
+   TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes);
+	
+	attributes.iFlags  = flags;
+	attributes.iFormat = format;
+	attributes.iType   = type;
+	attributes.iDcs   = dcs;
+    
+    TName name = _L("Name1");
+    TPckg<TName> msgData(name);
+    
+    RMobileUssdMessaging ussdMessaging;
+    ret = ussdMessaging.Open(phone);
+    if (ret != KErrNone)
+        {
+        server.Close();
+        phone.Close();
+        return ret; 
+        }
+    RDebug::Printf(">> ussdMessaging.Open() SUCCESS!"); 
+            
+    ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler);    
+    User::WaitForRequest(requestStatus);
+    ret = requestStatus.Int();
+    RDebug::Printf(">> ret = %d", ret);
+    
+    User::After(2 * 1000000);
+
+    ussdMessaging.Close();
+    phone.Close();
+    server.Close();
+    
+    delete cleanup;
+    return ret;
+    }
 TInt CCTsyUssdMessagingTestClient::RandomLoopL()
     {
     // Create a cleanup stack object
@@ -333,6 +403,8 @@
 _LIT(KAcceptOption,"-A");
 _LIT(KTimerOption,"-T");
 _LIT(KRandomOption,"-Random");
+_LIT(KDefaultOption,"-D");
+_LIT(KMOOption,"-M");
 TInt ParseCommandLine(TReal& aAfterTimePeriod)
     {
     TBuf<256> c;
@@ -363,6 +435,14 @@
             {               
             option |= EOptionAccept;
             }
+        else if (nextToken == KDefaultOption)
+			{               
+			option |= EOptionDefault;
+			}
+        else if (nextToken == KMOOption)
+			{               
+			option |= EOptionMO;
+			}
         else if (nextToken == KTimerOption)
             {               
             nextToken.Set(l.NextToken());
@@ -401,7 +481,7 @@
     CCTsyUssdMessagingTestClient ussdClient;
     if (option & EOptionReceive)
         {
-        TRAPD(err, ret = ussdClient.ReceiveMessageL((option & EOptionAccept), (option & EOptionReceiveTimeout), afterTimePeriod));
+        TRAPD(err, ret = ussdClient.ReceiveMessageL((option & EOptionAccept), (option & EOptionReceiveTimeout), afterTimePeriod, (option & EOptionMO)));
         }
     
     if (option & EOptionSend)
@@ -409,6 +489,11 @@
         TRAPD(err, ret = ussdClient.SendMessageL());
         }
     
+    if (option & EOptionDefault)
+		{
+		TRAPD(err, ret = ussdClient.SendMessageDefaultHandlerL());
+		}
+    
     if (option & EOptionRandom)
         {
         TRAPD(err, ret = ussdClient.RandomLoopL());