enum TVerdict CTestOpenFaxFrCall::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Open Fax From Call"));

    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RCall call;
	ret=call.OpenNewCall(server,DSTD_CALL_FULLNAME);
    TESTCHECK(ret, KErrNone);

	RFax fax;
	ret=fax.Open(call);
    TESTCHECK(ret, KErrNone);

	fax.Close();
	call.Close();
  	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
    ServerClose(server);

	return TestStepResult();
	}
enum TVerdict CTestOpenCallFrLine::doTestStepL()
	{
	INFO_PRINTF1(_L("Open Call from RLine!"));
    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RPhone phone;
    ret = phone.Open(server,DSTD_PHONE_NAME);
    TESTCHECK(ret, KErrNone);

	RLine line;
    ret = line.Open(phone,DSTD_LINE_NAME);
	TESTCHECK(ret, KErrNone);

	RCall call;
	ret = call.OpenNewCall(line);
    TESTCHECK(ret, KErrNone);
	call.Close();

	line.Close();
	phone.Close();
  	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
    ServerClose(server);

	return TestStepResult();
	}
enum TVerdict CTestRelinquishCase1::doTestStepL()
//
// This test is used to check the objects are destroy in the right order
// make break points at CCallBase,CLineBase,CPhoneBase and CPhoneFactoryBase
// and ensure that to stop at the break point in order described above
//
    {
 	INFO_PRINTF1(_L("Test Call Relinquish Case 1"));
	RTelServer serverA;
	TInt ret = serverA.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=serverA.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);;

	RCall callA;
    ret = callA.OpenNewCall(serverA,DSTD_CALL_FULLNAME);
	TESTCHECK(ret, KErrNone);;

	RCall::TCallParams callParams;
	RCall::TCallParamsPckg callParamsPckg(callParams);

    ret=callA.Dial(callParamsPckg,DACQ_PHONE_NUMBER_TO_DIAL);
	TESTCHECK(ret, KErrNone);;


	callA.Close();
	ServerClose(serverA);

	return TestStepResult();
	}
enum TVerdict CTestRelinquishOwner::doTestStepL()
	{
 	INFO_PRINTF1(_L("Test Call Recover Port And Relinquish Ownership"));
	RTelServer serverA;
	TInt ret = serverA.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=serverA.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);
	RCall callA;
    ret = callA.OpenNewCall(serverA,DSTD_CALL_FULLNAME);
	TESTCHECK(ret, KErrNone);
	RCall::TCallParams callParams;
	RCall::TCallParamsPckg callParamsPckg(callParams);

    ret=callA.Dial(callParamsPckg,DACQ_PHONE_NUMBER_TO_DIAL);
	TESTCHECK(ret, KErrNone);

	RCall::TCommPort port;
	ret=callA.LoanDataPort(port);
    TESTCHECK(ret, KErrNone);
	callA.Close();

	ServerClose(serverA);

	return TestStepResult();
	}
enum TVerdict CTestMemZeroLength::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Zero Length Dials"));
    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RPhone phone;
    ret = phone.Open(server,DSTD_PHONE_NAME);
    TESTCHECK(ret, KErrNone);

	RLine line;
    ret = line.Open(phone,DSTD_LINE_NAME);
	TESTCHECK(ret, KErrNone);

	RCall call;
	TName name;
    ret = call.OpenNewCall(line,name);
	TESTCHECK(ret, KErrNone);

	RCall::TTelNumberC number(_L(""));
	TPtrC8 callParams(_L8(""));
	ret=call.Dial(number);
    TESTCHECK(ret, KErrArgument);

	ret=call.Dial(callParams,number);
    TESTCHECK(ret, KErrArgument);

	TRequestStatus status;
	call.Dial(status,number);
	User::WaitForRequest(status);
    TESTCHECK(status.Int(), KErrArgument);

	call.Dial(status,callParams,number);
	User::WaitForRequest(status);
    TESTCHECK(status.Int(), KErrArgument);

	call.Close();
	line.Close();

	INFO_PRINTF1(_L("Passed illegal Cancel Test"));
	INFO_PRINTF1(_L("Test an illegal Cancel"));

// This shouldn't panic
	phone.NotifyModemDetectedCancel();

	phone.Close();
    ServerClose(server);

	INFO_PRINTF1(_L("Passed illegal Cancel Test"));

	return TestStepResult();
	}
Exemplo n.º 6
0
enum TVerdict CTestSetDes::doTestStepL()
	{
	INFO_PRINTF1(_L("Set By Des"));
    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);
	RPhone phone;
	ret = phone.Open(server,DSTD_PHONE_NAME);
    TESTCHECK(ret, KErrNone);

	RCall call;
	ret=call.OpenNewCall(phone,DSTD_OPEN_CALL_FROM_PHONE_NAME);
	TESTCHECK(ret, KErrNone);

	RCall::TCallParams callParams;
	RCall::TCallParamsPckg callParamsPckg(callParams);

	TDummyString dialString=DACQ_PHONE_NUMBER_TO_DIAL;
	ret=call.Dial(callParamsPckg,dialString);
	TESTCHECK(ret, KErrNone);

	RFax fax;
	ret=fax.Open(call);

	TRequestStatus faxReadStatus;
	TRequestStatus faxWriteStatus;

	TAcqFaxBuf readbuf=DACQ_FAX_BUF_DATA;
	TAcqFaxBuf writebuf=DACQ_FAX_BUF_DATA;

	// check each req complete correctly
	fax.Read(faxReadStatus,readbuf);
	User::WaitForRequest(faxReadStatus);
	TESTCHECKSTR(readbuf, DACQ_FAX_BUF_DATA);

	fax.Write(faxWriteStatus,writebuf);
	User::WaitForRequest(faxWriteStatus);

	fax.Close();
	call.Close();
	phone.Close();
  	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
    ServerClose(server);

	return TestStepResult();
	}
enum TVerdict CTestOpenPhoneFrServ::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Open Phone From Server"));

    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RPhone phone;
    ret = phone.Open(server,DSTD_PHONE_NAME);
    TESTCHECK(ret, KErrNone);
	phone.Close();
  	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
    ServerClose(server);

	return TestStepResult();
    }
 TInt CTestMemRelinquish::RelinquishCall(TAny * /* aArg */)
 	{
 	CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
 	
 	RTelServer serverA;
 	TInt ret = serverA.Connect();
   	ret=serverA.LoadPhoneModule(DSTD_MODULE_NAME);
 
 	RCall callA;
    ret = callA.OpenNewCall(serverA,DSTD_CALL_FULLNAME);
 	RCall::TCallParams callParams;
 	RCall::TCallParamsPckg callParamsPckg(callParams);
 
    ret=callA.Dial(callParamsPckg,DACQ_PHONE_NUMBER_TO_DIAL);
 	serverA.Close();
 
 	User::After(KETelThreadShutdownGuardPeriod);
 
 	delete cleanup;
 	return KErrNone;
 	}
void CSmsStackTestServer::LoadTsyL(RTelServer& aServer, RPhone& aPhone, const TDesC& aTsyName)
    {
    INFO_PRINTF2(_L("Using TSY \"%S\"Loading RTelServer..."), &aTsyName);

    TInt ret = aServer.LoadPhoneModule(aTsyName);
    if (ret!=KErrNone)
        {
        ERR_PRINTF2(_L("Loading Phone Module returned %d"), ret);
        User::Leave(ret);
        }
    
    // Find the phone corresponding to this TSY and open a number of handles on it
    TInt numPhones;
    ret = aServer.EnumeratePhones(numPhones);
    if (ret!=KErrNone)
        {
        ERR_PRINTF2(_L("Enumerate Phones  returned %d"), ret);
        User::Leave(ret);
        }
    
    TBool found=EFalse;

    while (numPhones--)
        {
        TName phoneTsy;
        ret = aServer.GetTsyName(numPhones,phoneTsy);
        if (ret!=KErrNone)
            {
            ERR_PRINTF2(_L("GetTsyName returned %d"), ret);
            User::Leave(ret);
            }
        
        if (phoneTsy.CompareF(aTsyName)==KErrNone)
            {
            INFO_PRINTF1(_L("Found RPhone..."));
            found = ETrue;
            RTelServer::TPhoneInfo info;
            ret = aServer.GetPhoneInfo(numPhones,info);
            if (ret!=KErrNone)
                {
                ERR_PRINTF2(_L("GetPhoneInfo returned %d"), ret);
                User::Leave(ret);
                }
            ret = aPhone.Open(aServer,info.iName);
            if (ret!=KErrNone)
                {
                ERR_PRINTF2(_L("Opening phone returned %d"), ret);
                User::Leave(ret);
                }
 
            INFO_PRINTF1(_L("Initializing..."));
            ret = aPhone.Initialise();
            TTimeIntervalMicroSeconds32 InitPause=9000000;  //Required Pause to Allow SMSStack to Complete its Async Init
            User::After(InitPause);                         //call to the TSY and finish its StartUp.
            if (ret!=KErrNone)
                {
                ERR_PRINTF2(_L("Completed Initialize returned %d"), ret);
                User::Leave(ret);
                }
            break;
            }
        }
    
    if(!found)
        {
        ERR_PRINTF2(_L("Couldn't find the phone for TSY %S"), &aTsyName);
        }
    }
Exemplo n.º 10
0
static void DialNumberL(PktBuf &in, PktBuf &out) {
	/// @todo maybe use a CActive object to allow the call to be cancelled from gammu
	TBuf<100> aPhoneNumber;

	in >> aPhoneNumber;

	cons->Printf( _L("dialing... number:\n") );
	cons->Printf( aPhoneNumber );
	cons->Printf( _L("\n") );

	TName newCallName = _L("call");

	//Create a connection to the tel server
	RTelServer server;
	CleanupClosePushL(server);
	User::LeaveIfError(server.Connect());

	//Load in the phone device driver
	User::LeaveIfError(server.LoadPhoneModule(KTsyName));
	
	//Find the number of phones available from the tel server
	TInt numberPhones;
	User::LeaveIfError(server.EnumeratePhones(numberPhones));

	//Check there are available phones
	if (numberPhones < 1)
	{
		User::Leave(KErrNotFound);
	}

	//Get info about the first available phone
	RTelServer::TPhoneInfo info;
	User::LeaveIfError(server.GetPhoneInfo(0, info));

	//Use this info to open a connection to the phone, the phone is identified by its name
	RPhone phone;
	CleanupClosePushL(phone);
	User::LeaveIfError(phone.Open(server, info.iName));

	//Get info about the first line from the phone
	RPhone::TLineInfo lineInfo;
	User::LeaveIfError(phone.GetLineInfo(0, lineInfo));

	//Use this to open a line
	RLine line;
	CleanupClosePushL(line);
	User::LeaveIfError(line.Open(phone, lineInfo.iName));

	//Open a new call on this line
	RCall call;
	CleanupClosePushL(call);
	User::LeaveIfError(call.OpenNewCall(line, newCallName));

	if ((call.Dial(aPhoneNumber) == KErrNone))
	{
		TRequestStatus iStatus;
		RCall::TStatus iLineStatus;
		line.NotifyStatusChange(iStatus, iLineStatus);
		User::WaitForRequest(iStatus);
	}

	CleanupStack::PopAndDestroy(4);//phone, line, call

	//Unload the phone device driver
	User::LeaveIfError(server.UnloadPhoneModule(KTsyName));

	out << (TUint16)GNAPPLET_MSG_PHONEBOOK_DIAL_RESP;
	out << (TUint16)GN_ERR_NONE;
}
void CSmsReplyToStep::InitialiseSimTsyL()
	{
	
	INFO_PRINTF1(_L("Initialising the SimTsy..."));
	
	_LIT(KDefaultTsyName, "SIM"); 
	HBufC* tsyName =KDefaultTsyName().AllocLC();

	//Initialize TSY using the System Agent
	TInt testState;
	TInt testNumber=1;
	if(KErrNone != RProperty::Get(KUidPSSimTsyCategory, KPSSimTsyTestNumber, testState))
		{
		User::LeaveIfError(RProperty::Define(KUidPSSimTsyCategory, KPSSimTsyTestNumber, RProperty::EInt));
		}
	User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, testNumber));
	if(KErrNone != RProperty::Get(KUidSystemCategory, KMsvTestUidPhonePwrValue, testState))
		{
		User::LeaveIfError(RProperty::Define(KUidSystemCategory, KMsvTestUidPhonePwrValue, RProperty::EInt));
		}
	User::LeaveIfError(RProperty::Set(KUidSystemCategory, KMsvTestUidPhonePwrValue, EMsvTestPhoneOn));

	User::LeaveIfError(RProperty::Get(KUidPSSimTsyCategory, KPSSimTsyTestNumber, testNumber));

	RTelServer etelServer;
	User::LeaveIfError(etelServer.Connect());
	CleanupClosePushL(etelServer);
	User::LeaveIfError(etelServer.LoadPhoneModule(tsyName->Des()));

	// Find the phone corresponding to this TSY and open a number of handles on it
	TInt numPhones;
	User::LeaveIfError(etelServer.EnumeratePhones(numPhones));	
	TBool found=EFalse;
	
	RMobilePhone iPhone;
	while (!found && numPhones--)
		{
		TName phoneTsy;
		User::LeaveIfError(etelServer.GetTsyName(numPhones,phoneTsy));
		if (phoneTsy.CompareF(tsyName->Des())==KErrNone)
			{
			found = ETrue;
			RTelServer::TPhoneInfo info;
			User::LeaveIfError(etelServer.GetPhoneInfo(numPhones,info));
			CleanupClosePushL(iPhone);
			User::LeaveIfError(iPhone.Open(etelServer,info.iName));
			User::LeaveIfError(iPhone.Initialise());
			//Required Pause to Allow SMSStack to Complete its Async Init call to the TSY and finish its StartUp.
			TTimeIntervalMicroSeconds32 InitPause=9000000;  
			User::After(InitPause);							
			
			CleanupStack::PopAndDestroy(&iPhone);
			}
		}
	
	CleanupStack::PopAndDestroy(&etelServer);	

	CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion());
	CleanupStack::PushL(dbSession);
	CMDBRecordSet<CCDGlobalSettingsRecord> globalSettingsRecord(KCDTIdGlobalSettingsRecord);
	TRAPD(err, globalSettingsRecord.LoadL(*dbSession));
	if(err != KErrNone)
		{
		User::Leave(KErrNotFound);				
		}
	
	CCDModemBearerRecord *modemRecord = static_cast<CCDModemBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdModemBearerRecord));		
	CleanupStack::PushL(modemRecord);
	modemRecord->SetRecordId(((CCDGlobalSettingsRecord*)globalSettingsRecord.iRecords[0])->iModemForPhoneServicesAndSMS);
	modemRecord->LoadL(*dbSession);
	modemRecord->iTsyName.SetMaxLengthL(tsyName->Des().Length());
	modemRecord->iTsyName = tsyName->Des();	
	modemRecord->ModifyL(*dbSession);
	CleanupStack::PopAndDestroy(3);  //tsyName, dbSession, modemRecord 	
	
	INFO_PRINTF1(_L("Successfully initialised the Sim Tsy"));
	}
Exemplo n.º 12
0
enum TVerdict CTestPhoneInfo::doTestStepL()
{
    INFO_PRINTF1(_L("Test Phone Info"));

    RTelServer server;
    TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);

    TInt  originalNumPhones;
    ret = server.EnumeratePhones(originalNumPhones);
    TESTCHECK(ret, KErrNone);

    ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);
    ret=server.LoadPhoneModule(DSTDNC_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

    TInt numPhones;
    ret=server.EnumeratePhones(numPhones);
    TESTCHECK(ret, KErrNone);
    INFO_PRINTF2(_L("EnumeratePhones returned %d"),numPhones);

    INFO_PRINTF4(_L("Should equal %d + %d + %d"), DSTDNC_NUMBER_OF_PHONES, DSTD_NUMBER_OF_PHONES,
                 originalNumPhones);
    TESTCHECK(numPhones, (DSTDNC_NUMBER_OF_PHONES + DSTD_NUMBER_OF_PHONES + originalNumPhones));

    RTelServer::TPhoneInfo info;
    TName tsyName;
    TInt  phoneIndex = originalNumPhones;

    // first phone
    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTD_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTD_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTD_NUMBER_OF_LINES);

    ret=server.GetTsyName(phoneIndex,tsyName);
    TESTCHECK(ret, KErrNone);
    TESTCHECKSTR(tsyName, DSTD_MODULE_NAME);
    phoneIndex++;

    // second phone
    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTDFC_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTDFC_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTDFC_NUMBER_OF_LINES);

    ret=server.GetTsyName(phoneIndex,tsyName);
    TESTCHECK(ret, KErrNone);
    TESTCHECKSTR(tsyName, DSTD_MODULE_NAME);
    phoneIndex++;

    // third phone
    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTDPM_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTDPM_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTDPM_NUMBER_OF_LINES);

    ret=server.GetTsyName(phoneIndex,tsyName);
    TESTCHECK(ret, KErrNone);
    TESTCHECKSTR(tsyName, DSTD_MODULE_NAME);
    phoneIndex++;

    // fourth phone
    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTDPM_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTD_SLOW_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTDPM_NUMBER_OF_LINES);

    ret=server.GetTsyName(phoneIndex,tsyName);
    TESTCHECK(ret, KErrNone);
    TESTCHECKSTR(tsyName, DSTD_MODULE_NAME);
    phoneIndex++;

    // fifth phone
    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTDNC_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTDNC_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTDNC_NUMBER_OF_LINES);

    ret=server.GetTsyName(phoneIndex,tsyName);
    TESTCHECK(ret, KErrNone);
    TESTCHECKSTR(tsyName, DSTDNC_MODULE_NAME);
    phoneIndex++;

    // sixth phone
    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNotFound);

    ret=server.GetTsyName(phoneIndex,tsyName);
    TESTCHECK(ret, KErrNotFound);
    phoneIndex++;

    ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);
    ret=server.UnloadPhoneModule(DSTDNC_MODULE_NAME);
    TESTCHECK(ret, KErrNone);
    ServerClose(server);

    ret = server.Connect();
    TESTCHECK(ret, KErrNone);
    ret=server.LoadPhoneModule(DSTDNC_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

    ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

    ret=server.EnumeratePhones(numPhones);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(numPhones, (DSTD_NUMBER_OF_PHONES + DSTDNC_NUMBER_OF_PHONES + originalNumPhones));

    phoneIndex = originalNumPhones;

    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTDNC_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTDNC_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTDNC_NUMBER_OF_LINES);
    phoneIndex++;

    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTD_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTD_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTD_NUMBER_OF_LINES);
    phoneIndex++;

    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTDFC_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTDFC_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTDFC_NUMBER_OF_LINES);
    phoneIndex++;

    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTDPM_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTDPM_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTDPM_NUMBER_OF_LINES);
    phoneIndex++;

    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNone);
    TESTCHECK(info.iNetworkType, DSTDPM_NETWORK_TYPE);
    TESTCHECKSTR(info.iName, DSTD_SLOW_PHONE_NAME);
    TESTCHECK(info.iNumberOfLines, DSTDPM_NUMBER_OF_LINES);
    phoneIndex++;

    ret=server.GetPhoneInfo(phoneIndex,info);
    TESTCHECK(ret, KErrNotFound);
    phoneIndex++;

    ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);
    ret=server.UnloadPhoneModule(DSTDNC_MODULE_NAME);
    TESTCHECK(ret, KErrNone);
    ServerClose(server);

    return TestStepResult();
}
TInt CTestDriveOOMVoiceCall::DoTestL(TInt aAllocFailNumber)
	{
	_LIT(KPhoneModule,"MM");
	_LIT(KPhoneName,  "GsmPhone1");
	_LIT(KLineName,   "Voice");

	RTelServer telServer;
	TInt ret=telServer.Connect();
	if(ret!=KErrNone)
		return ret;

	telServer.__DbgFailNext(aAllocFailNumber);

	ret=telServer.LoadPhoneModule(KPhoneModule);
	if(ret!=KErrNone)
		{
		telServer.Close();
		return ret;
		}

	RMobilePhone mobilePhone;
	ret=mobilePhone.Open(telServer, KPhoneName);
	if(ret!=KErrNone)
		{
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	RLine line;
	INFO_PRINTF1(_L("Opening Voice Line"));
	ret=line.Open(mobilePhone,KLineName);
	if(ret!=KErrNone)
		{
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Opening New Voice Call"));
	RCall call;
	ret=call.OpenNewCall(line);
	if(ret!=KErrNone)
		{
		call.Close();
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Initialise the Phone..."));
	
	TRequestStatus reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	mobilePhone.InitialiseMM(reqStatus, tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	if(reqStatus!=KErrNone)
		{
		call.Close();
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Dial a number..."));
	_LIT(KDialString, "+1234");
	ret=call.Dial(KDialString);
	if(ret!=KErrNone)
		{
		call.Close();
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Hangup a call..."));
	ret=call.HangUp();
	if(ret!=KErrNone)
		{
		call.Close();
		line.Close();
		mobilePhone.Close();
		telServer.Close();
		return ret;
		}

	INFO_PRINTF1(_L("Close the call, line & iPhone..."));
	call.Close();
	line.Close();
	mobilePhone.Close();

	return KErrNone;
	}