enum TVerdict CTestOpenLineFrPhone::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Open Line From Phone"));

    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);

	line.Close();
	phone.Close();

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

	return TestStepResult();
    }
enum TVerdict CTestErrNewTelObjectIllegalBuffer::doTestStepL()
/** 
Check that CTelSession::NewTelObject fails when an illegal buffer is passed to it for the name of the call.
 (Uses similar code to that in RTelServer::OpenNewCall().)

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	RTelServer::TPhoneInfo phoneInfo;

	ret = server.GetPhoneInfo( 0, phoneInfo );
	TESTCHECK(ret, KErrNone);

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


	RPhone::TLineInfo lineInfo;
	ret = phone.GetLineInfo( 0, lineInfo );
	TESTCHECK(ret, KErrNone);


	RLine line;
	ret = line.Open( phone, lineInfo.iName );

	char retName;  
		// Illegal buffer.

	RCall1 call;

	// Taken from OpenNewCall(line , retName); 
	RSessionBase* session=&line.SessionHandle();
	call.ConstructL();
	TInt subSessionHandle=line.SubSessionHandle();

	TPtrC name(_L("::"));	// necessary so that server knows to ask TSY for new name

	TIpcArgs args(&name,REINTERPRET_CAST(TDes*,&retName),subSessionHandle);
	call.SetSessionHandle(*session);
	ret = call.CreateSubSession(*session,EEtelOpenFromSubSession,args);
	call.Destruct();

	TESTCHECK(ret, KErrBadDescriptor);

	line.Close();
	phone.Close();

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
TInt CTestDriveSsFax::DriveETelApiL()
//
// This function contains the real meat of the Client-side test code
//
	{
	_LIT(KFaxLineName,"Fax");
	_LIT(KMmPhoneName,"GsmPhone1");

	RMobilePhone mmPhone;
	INFO_PRINTF1(_L("Opening Multimode Phone\n"));
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine faxLine;
	INFO_PRINTF1(_L("Opening Fax Line\n"));
	TESTL(faxLine.Open(iPhone,KFaxLineName)==KErrNone);
 	RCall faxCall;
	INFO_PRINTF1(_L("Opening New fax Call\n"));
	TESTL(faxCall.OpenNewCall(faxLine)==KErrNone);

	TRequestStatus stat1,stat2,reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	// Now wait for an incoming fax call...
	INFO_PRINTF1(_L("Answering a Fax Call\n"));
	RCall::TFaxSessionSettings faxSessionSettings;
	faxSessionSettings.iMode=RCall::EReceive;
	faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand;
	faxSessionSettings.iFaxClass=EClassAuto;
	faxSessionSettings.iFaxId.Zero();
	faxSessionSettings.iMaxSpeed=14400;
	faxSessionSettings.iMinSpeed=12000;
	faxSessionSettings.iRxResolution=EFaxNormal;
	faxSessionSettings.iRxCompression=EModifiedHuffman;
	faxCall.SetFaxSettings(faxSessionSettings);
	faxCall.AnswerIncomingCall(stat2);
	User::After(2000000L);					// Wait for a 2secs to make sure the port is "access denied"

	INFO_PRINTF1(_L("Get Signal Strength\n"));
	TInt32 signalStrength;
	TInt8 bar=0;
	mmPhone.GetSignalStrength(stat1,signalStrength,bar);
	User::WaitForRequest(stat1);
	TESTL(stat1==KErrAccessDenied);			// The port is "access denied" by this time

	User::WaitForRequest(stat2);
	User::After(300000L);
	TESTL(faxCall.HangUp()==KErrNone);
	
	mmPhone.Close();
	faxLine.Close();
	faxCall.Close();
	return KErrNone;
	}
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();
	}
enum TVerdict CTestErrNewTelObjectOk::doTestStepL()
/** 
Check that RTelServer::OpenNewCall returns no errors 
 when it has a large enough valid buffer to put the call name in. 

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	RTelServer::TPhoneInfo phoneInfo;

	ret = server.GetPhoneInfo( 0, phoneInfo );
	TESTCHECK(ret, KErrNone);

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


	RPhone::TLineInfo lineInfo;
	ret = phone.GetLineInfo( 0, lineInfo );
	TESTCHECK(ret, KErrNone);


	RLine line;
	ret = line.Open( phone, lineInfo.iName );

	TName retName;

	// Check that we can get a name for the newly opened call. 

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

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

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

	return TestStepResult();
	}
enum TVerdict CTestErrNewTelObjectSmallBuffer::doTestStepL()
/** 
Check that CTelSession::NewTelObject fails when a small buffer is passed to it for the name of the call.
 (Uses similar code to that in RTelServer::OpenNewCall().)

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	RTelServer::TPhoneInfo phoneInfo;

	ret = server.GetPhoneInfo( 0, phoneInfo );
	TESTCHECK(ret, KErrNone);

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


	RPhone::TLineInfo lineInfo;
	ret = phone.GetLineInfo( 0, lineInfo );
	TESTCHECK(ret, KErrNone);


	RLine line;
	ret = line.Open( phone, lineInfo.iName );

	TBuf<1> retName;
		//Buffer too small to recieve name.

	RCall call;
	ret = call.OpenNewCall(line , retName); 

	TESTCHECK(ret, KErrOverflow);

	line.Close();
	phone.Close();

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
TInt CTestDriveDataCallCallBack::DriveETelApiL()
/**
 * This method contains the real meat of the Client-side "Data Call dial-up networking 
 * call-back" test code.  This method sets up an outgoing data-call write test that is 
 * terminated from the remote end.  The test then quickly responds to an incoming call.  
 * Data is received and the call is terminated again from the remote end.
 */
	{
	_LIT(KDataLineName,"Data");

	INFO_PRINTF1(_L("Opening Mobile Phone\n"));

	RLine line;
	INFO_PRINTF1(_L("Opening Data Line\n"));
	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);

	INFO_PRINTF1(_L("Opening New Data Call\n"));
	RCall call;
	TESTL(call.OpenNewCall(line)==KErrNone);

	TRequestStatus reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	// dial
	_LIT(KDialString,"+1234");
	TESTL(call.Dial(KDialString)==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	RCommServ cs;
	TESTL(cs.Connect()==KErrNone);

	RComm port;
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	TRequestStatus stat;
	port.Write(stat,KWriteTestCallBackData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestCallBackData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	// Now wait for an incoming call...
	INFO_PRINTF1(_L("Wait to Answer incoming Data Call\n"));
	TESTL(call.AnswerIncomingCall()==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	TESTL(cs.Connect()==KErrNone);
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	port.Write(stat,KWriteTestCallBackData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestCallBackData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	TInt32 ss;
	TInt8 bar;
	iPhone.GetSignalStrength(stat,ss,bar);
	//	mmPhone.GetSignalStrength(stat,ss,bar);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);

	// close iPhone, line and call
	line.Close();
	call.Close();
	return KErrNone;
	}
TInt CTestDriveRemoteHangupDial::DriveETelApiL()
/**
 * This method contains the real meat of the Client-side "Data Call answer and remote 
 * hang-up closely followed by a dial" test code.  This method sets up to answer a 
 * call and receive a data transfer.  The call is then terminated from the remote end, 
 * and then must quickly respond by dialing the remote end back.  Data is then 
 * transfered and the call is terminated again from the remote end.
 *
 * @return KErrNone.
 */
	{
	_LIT(KMmPhoneName,"GsmPhone1");
	_LIT(KDataLineName,"Data");

	INFO_PRINTF1(_L("Opening Mobile Phone\n"));
	RMobilePhone mmPhone;
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine line;
	INFO_PRINTF1(_L("Opening Data Line\n"));
	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);

	INFO_PRINTF1(_L("Opening New Data Call\n"));
	RCall call;
	TESTL(call.OpenNewCall(line)==KErrNone);

	TRequestStatus reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);
//
// Initialization complete
//

// Now wait for an incoming call...
	INFO_PRINTF1(_L("Wait to Answer incoming Data Call\n"));
	TESTL(call.AnswerIncomingCall()==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	RCommServ cs;
	TESTL(cs.Connect()==KErrNone);

	RComm port;
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	TRequestStatus stat;
	port.Write(stat,KWriteTestRemoteHangupData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);
    
   //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestRemoteHangupData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	// Now perform the user specified delay before making outgoing call...
	INFO_PRINTF2(_L("Start the %d sec delay before making outgoing call\n"), iVarDelay);
	User::After( (TTimeIntervalMicroSeconds32)(iVarDelay*1000000L) );
	INFO_PRINTF2(_L("End of the delay before making outgoing call\n"), iVarDelay);

	// Now perform the outgoing call...
	// dial
	_LIT(KDialString,"+1234");
	TESTL(call.Dial(KDialString)==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	TESTL(cs.Connect()==KErrNone);

	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	port.Write(stat,KWriteTestRemoteHangupData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestRemoteHangupData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	TInt32 ss;
	TInt8 bar=0;
	mmPhone.GetSignalStrength(stat,ss,bar);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);

	// close iPhone, line and call
	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
TInt CTestDriveSSData::DriveETelApiL()
//
// This function contains the real meat of the Client-side test code
//
	{
	_LIT(KDataLineName,"Data");
	_LIT(KMmPhoneName,"GsmPhone1");

	RMobilePhone mmPhone;
	INFO_PRINTF1(_L("Opening Multimode Phone\n"));
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine line;
	INFO_PRINTF1(_L("Opening Data Line\n"));
	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);

	INFO_PRINTF1(_L("Opening New Data Call\n"));
	RSpecialCall call;
	TESTL(call.OpenNewCall(line)==KErrNone);

	TRequestStatus stat,stat1,reqStatus;

	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	_LIT(KDialString,"+1234");
	TInt status = call.Dial(KDialString);
	TESTL(status == KErrNone);

	TInt32 signalStrength;
	TInt8 bar = 0;
	mmPhone.GetSignalStrength(stat1,signalStrength,bar);

	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	RCommServ cs;
	TESTL(cs.Connect()==KErrNone);

	RComm port;
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	port.Write(stat,KDataSsWriteTestData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KDataSsWriteTestData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	port.Close();
	cs.Close();

	call.RecoverDataPort();

	User::After(500000L);

	User::WaitForRequest(stat1); // Result of GetSignalStrength()
	TESTL(stat1==KErrAccessDenied);

	TESTL(call.HangUp()==KErrNone);

	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
TInt CTestDriveDataCallRemoteTerm::DriveETelApiL()
/**
 * This method contains the real meat of the Client-side the "Data Call set-up, data 
 * transfer and remote termination" test code.  This method sets up to make a data-call
 * and then transfer data.  After the data transfer, the call is terminated by the remote end.
 *
 * @return KErrNone.
 */
	{
	_LIT(KMmPhoneName,"GsmPhone1");
	_LIT(KDataLineName,"Data");

	INFO_PRINTF1(_L("Opening Mobile Phone\n"));
	RMobilePhone mmPhone;
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine line;
	INFO_PRINTF1(_L("Opening Data Line\n"));
	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);

	INFO_PRINTF1(_L("Opening New Data Call\n"));
	RCall call;
	TESTL(call.OpenNewCall(line)==KErrNone);

	TRequestStatus reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	// dial
	_LIT(KDialString,"+1234");
	TESTL(call.Dial(KDialString)==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	RCommServ cs;
	TESTL(cs.Connect()==KErrNone);

	RComm port;
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	TRequestStatus stat;
	port.Write(stat,KWriteTestRemoteData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestRemoteData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	TInt32 ss;
	TInt8 bar=0;
	mmPhone.GetSignalStrength(stat,ss,bar);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);

	// close iPhone, line and call
	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
TInt CTestDriveTwoFaxRx::DriveETelApiL()
//
// This function contains the real meat of the Client-side test code
//
	{
	_LIT(KFaxLineName,"Fax");

	RLine faxLine;
	INFO_PRINTF1(_L("Opening Fax Line\n"));
	TESTL(faxLine.Open(iPhone,KFaxLineName)==KErrNone);

	TRequestStatus stat1,stat2,reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

// Now wait for an incoming fax call...
	INFO_PRINTF1(_L("Waiting for an incoming fax call\n"));
	TName callName;
	faxLine.NotifyIncomingCall(stat1,callName);
	User::WaitForRequest(stat1);
	TESTL(stat1==KErrNone);

	RCall faxCall;
	INFO_PRINTF1(_L("Opening Fax Call to answer\n"));
	TESTL(faxCall.OpenNewCall(faxLine)==KErrNone);

	INFO_PRINTF1(_L("Answering a Fax Call\n"));
	RCall::TFaxSessionSettings faxSessionSettings;
	faxSessionSettings.iMode=RCall::EReceive;
	faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand;
	faxSessionSettings.iFaxClass=EClassAuto;
	faxSessionSettings.iFaxId.Zero();
	faxSessionSettings.iMaxSpeed=14400;
	faxSessionSettings.iMinSpeed=12000;
	faxSessionSettings.iRxResolution=EFaxNormal;
	faxSessionSettings.iRxCompression=EModifiedHuffman;
	faxCall.SetFaxSettings(faxSessionSettings);
	faxCall.AnswerIncomingCall(stat2);
	User::WaitForRequest(stat2);
	User::After(300000L);
	TESTL(faxCall.HangUp()==KErrNone);
	faxCall.Close();

// Now wait for a second incoming fax call...
	INFO_PRINTF1(_L("Waiting for a second incoming fax call\n"));
	TName callName2;
	faxLine.NotifyIncomingCall(stat1,callName2);
	User::WaitForRequest(stat1);
	TESTL(stat1==KErrNone);

	RCall faxCall2;
	INFO_PRINTF1(_L("Opening Fax Call to answer\n"));
	TESTL(faxCall2.OpenNewCall(faxLine)==KErrNone);

	INFO_PRINTF1(_L("Answering a Fax Call\n"));
	faxSessionSettings.iMode=RCall::EReceive;
	faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand;
	faxSessionSettings.iFaxClass=EClassAuto;
	faxSessionSettings.iFaxId.Zero();
	faxSessionSettings.iMaxSpeed=14400;
	faxSessionSettings.iMinSpeed=12000;
	faxSessionSettings.iRxResolution=EFaxNormal;
	faxSessionSettings.iRxCompression=EModifiedHuffman;
	faxCall2.SetFaxSettings(faxSessionSettings);
	faxCall2.AnswerIncomingCall(stat2);
	User::WaitForRequest(stat2);
	User::After(300000L);
	TESTL(faxCall2.HangUp()==KErrNone);
	faxCall2.Close();

	faxLine.Close();
	return KErrNone;
	}
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;
	}