mmmw_plat/voip_audio_services_api/tsrc/VoIPAudioServicesTestClass/src/VoIPAudioServicesTestClassBlocks.cpp
changeset 55 e267340986c9
parent 0 71ca22bcf22a
--- a/mmmw_plat/voip_audio_services_api/tsrc/VoIPAudioServicesTestClass/src/VoIPAudioServicesTestClassBlocks.cpp	Fri Sep 17 08:33:15 2010 +0300
+++ b/mmmw_plat/voip_audio_services_api/tsrc/VoIPAudioServicesTestClass/src/VoIPAudioServicesTestClassBlocks.cpp	Mon Oct 04 00:51:56 2010 +0300
@@ -1,21 +1,19 @@
 /*
-* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: voip audio service -
-*
-*/
-
-
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: voip audio service -
+ *
+ */
 
 // INCLUDE FILES
 #include <e32svr.h>
@@ -24,57 +22,6 @@
 #include "VoIPAudioServicesTestClass.h"
 #include "debug.h"
 
-// EXTERNAL DATA STRUCTURES
-//extern  ?external_data;
-
-// EXTERNAL FUNCTION PROTOTYPES
-//extern ?external_function( ?arg_type,?arg_type );
-
-// CONSTANTS
-//const ?type ?constant_var = ?constant;
-
-// MACROS
-//#define ?macro ?macro_def
-
-// LOCAL CONSTANTS AND MACROS
-//const ?type ?constant_var = ?constant;
-//#define ?macro_name ?macro_def
-
-// MODULE DATA STRUCTURES
-//enum ?declaration
-//typedef ?declaration
-
-// LOCAL FUNCTION PROTOTYPES
-//?type ?function_name( ?arg_type, ?arg_type );
-
-// FORWARD DECLARATIONS
-//class ?FORWARD_CLASSNAME;
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// ?function_name ?description.
-// ?description
-// Returns: ?value_1: ?description
-//          ?value_n: ?description_line1
-//                    ?description_line2
-// -----------------------------------------------------------------------------
-//
-/*
-?type ?function_name(
-    ?arg_type arg,  // ?description
-    ?arg_type arg)  // ?description
-    {
-
-    ?code  // ?comment
-
-    // ?comment
-    ?code
-    }
-*/
-
-// ============================ MEMBER FUNCTIONS ===============================
-
 // -----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::Delete
 // Delete here all resources allocated and opened from test methods.
@@ -82,7 +29,7 @@
 // -----------------------------------------------------------------------------
 //
 void CVoIPAudioServicesTestClass::Delete()
-{
+    {
 
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Delete")));
 
@@ -90,10 +37,11 @@
     iOcurredEvents.Close();
 
     iLog->Log(_L("Deleting test class..."));
-	iLog->Log(_L(""));
-	iLog->Log(_L(""));
+    iLog->Log(_L(""));
+    iLog->Log(_L(""));
 
-	iBitratesArray.Reset();
+    iBitratesArray.Reset();
+    iBitratesArray.Close();
 
     delete iG711DecFormatIntfc;
     delete iG711EncFormatIntfc;
@@ -111,133 +59,118 @@
     delete iDTMFTonePlayerDn;
     delete iDTMFTonePlayerUp;
 
-    delete iPlayBuf;
-
-#ifdef __JITTER_BUFFER_TEST__
     delete iJBIntfc;
-    delete iPlayJBuf;
-#endif //__JITTER_BUFFER_TEST__
+    delete iPlayBuf; //will also remove iPlayJBuf
 
-    if (iVoIPDnlink )
-    	{
+    if (iVoIPDnlink)
+        {
         if (iDnLinkStatus != ENotReady)
-        	{
+            {
             iVoIPDnlink->Close();
-        	}
+            }
         delete iVoIPDnlink;
         iVoIPDnlink = NULL;
-    	}
+        }
 
-    if (iVoIPUplink )
-    	{
+    if (iVoIPUplink)
+        {
         if (iUpLinkStatus != ENotReady)
-        	{
+            {
             iVoIPUplink->Close();
-        	}
+            }
         delete iVoIPUplink;
         iVoIPUplink = NULL;
-    	}
-
-    delete iFactory;
+        }
 
     delete iDecFormatIntfc;
     delete iEncFormatIntfc;
-}
+    delete iFactory;
+    }
 
 // -----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::RunMethodL
 // Run specified method. Contains also table of test mothods and their names.
 // -----------------------------------------------------------------------------
 //
-TInt CVoIPAudioServicesTestClass::RunMethodL( CStifItemParser& aItem )
-{
-
+TInt CVoIPAudioServicesTestClass::RunMethodL(CStifItemParser& aItem)
+    {
     static TStifFunctionInfo const KFunctions[] =
         {
         // Copy this line for every implemented function.
         // First string is the function name used in TestScripter script file.
         // Second is the actual implementation member function.
 
-        ENTRY( "SetTimeout", CVoIPAudioServicesTestClass::SetTimeout ),
-        ENTRY( "CreateFactory", CVoIPAudioServicesTestClass::CreateVoIPUtilityFactory ),
-        ENTRY( "CreateRingToneFactory", CVoIPAudioServicesTestClass::CreateRingToneFactory ),
-        ENTRY( "CreateDownlinkStream", CVoIPAudioServicesTestClass::CreateDownlinkStream ),
-        ENTRY( "CreateUplinkStream", CVoIPAudioServicesTestClass::CreateUplinkStream ),
-        ENTRY( "CreateDTMFTonePlayer", CVoIPAudioServicesTestClass::CreateDTMFTonePlayer ),
-        ENTRY( "CreateRingTonePlayer", CVoIPAudioServicesTestClass::CreateRingTonePlayer ),
-        ENTRY( "GetSupportedDownlinkFormats", CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats ),
-        ENTRY( "GetSupportedUplinkFormats", CVoIPAudioServicesTestClass::GetSupportedUplinkFormats ),
-        ENTRY( "SetDownlinkFormat", CVoIPAudioServicesTestClass::SetDownlinkFormat ),
-        ENTRY( "SetUplinkFormat", CVoIPAudioServicesTestClass::SetUplinkFormat ),
-        ENTRY( "OpenDownlink", CVoIPAudioServicesTestClass::OpenDownlink ),
-        ENTRY( "OpenUplink", CVoIPAudioServicesTestClass::OpenUplink ),
-        ENTRY( "Gain", CVoIPAudioServicesTestClass::Gain ),
-        ENTRY( "Volume", CVoIPAudioServicesTestClass::Volume ),
-        ENTRY( "SetDevice", CVoIPAudioServicesTestClass::SetDevice ),
-        ENTRY( "Close", CVoIPAudioServicesTestClass::Close ),
-        ENTRY( "Start", CVoIPAudioServicesTestClass::Start ),
-        ENTRY( "Stop", CVoIPAudioServicesTestClass::Stop ),
-        ENTRY( "InitDTMFTonePlayer", CVoIPAudioServicesTestClass::InitDTMFTonePlayer ),
-        ENTRY( "DTMFTonePlay", CVoIPAudioServicesTestClass::DTMFTonePlay ),
-        ENTRY( "CloseDTMFPlayer", CVoIPAudioServicesTestClass::CloseDTMFPlayer ),
-        ENTRY( "StopDTMFPlayer", CVoIPAudioServicesTestClass::StopDTMFTonePlayer ),
-        ENTRY( "GetDownlinkVersion", CVoIPAudioServicesTestClass::GetDownlinkVersion ),
-        ENTRY( "GetUplinkVersion", CVoIPAudioServicesTestClass::GetUplinkVersion ),
-        ENTRY( "InitRingTonePlayer", CVoIPAudioServicesTestClass::InitRingTonePlayer ),
-        ENTRY( "CloseRingTonePlayer", CVoIPAudioServicesTestClass::CloseRingTonePlayer ),
-        ENTRY( "PlayRingTone", CVoIPAudioServicesTestClass::PlayRingTone ),
-        ENTRY( "PauseRingTone", CVoIPAudioServicesTestClass::PauseRingTone ),
-        ENTRY( "ResumeRingTone", CVoIPAudioServicesTestClass::ResumeRingTone ),
-        ENTRY( "StopRingTone", CVoIPAudioServicesTestClass::StopRingTone ),
-        ENTRY( "GetSupportedBitrates", CVoIPAudioServicesTestClass::GetSupportedBitrates ),
-        ENTRY( "SetBitrate", CVoIPAudioServicesTestClass::SetBitrate ),
-        ENTRY( "GetBitrate", CVoIPAudioServicesTestClass::GetBitrate ),
-        ENTRY( "GetVAD", CVoIPAudioServicesTestClass::GetVAD ),
-        ENTRY( "ToggleVAD", CVoIPAudioServicesTestClass::ToggleVAD ),
-        ENTRY( "GetFrameMode", CVoIPAudioServicesTestClass::GetFrameMode ),
-        ENTRY( "ToggleFrameMode", CVoIPAudioServicesTestClass::ToggleFrameMode ),
-        ENTRY( "GetFrameModeRqrdForEC", CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC ),
-        ENTRY( "ConcealErrForNextBuf", CVoIPAudioServicesTestClass::ConcealErrForNextBuf ),
-        ENTRY( "GetMode", CVoIPAudioServicesTestClass::GetMode ),
-        ENTRY( "SetMode", CVoIPAudioServicesTestClass::SetMode ),
-        ENTRY( "GetCNG", CVoIPAudioServicesTestClass::GetCNG ),
-        ENTRY( "ToggleCNG", CVoIPAudioServicesTestClass::ToggleCNG ),
-        ENTRY( "GetPLC", CVoIPAudioServicesTestClass::GetPLC ),
-        ENTRY( "TogglePLC", CVoIPAudioServicesTestClass::TogglePLC ),
-        ENTRY( "BadLsfNextBuffer", CVoIPAudioServicesTestClass::BadLsfNextBuffer ),
-        ENTRY( "GetBufferType", CVoIPAudioServicesTestClass::GetBufferType ),
-
-        ENTRY( "ConfigEncAudDevice", CVoIPAudioServicesTestClass::ConfigEncAudDevice ),
-
-        ENTRY( "Example", CVoIPAudioServicesTestClass::ExampleL ),
-
-#ifdef __JITTER_BUFFER_TEST__
-        ENTRY( "ConfigureJB", CVoIPAudioServicesTestClass::ConfigureJB ),
-        ENTRY( "ResetJB", CVoIPAudioServicesTestClass::ResetJB ),
-        ENTRY( "DelayDown", CVoIPAudioServicesTestClass::DelayDown ),
-        ENTRY( "DelayUp", CVoIPAudioServicesTestClass::DelayUp ),
-#endif //__JITTER_BUFFER_TEST__
-
+        ENTRY("SetTimeout", CVoIPAudioServicesTestClass::SetTimeout),
+        ENTRY("CreateFactory", CVoIPAudioServicesTestClass::CreateVoIPUtilityFactory),
+        ENTRY("CreateRingToneFactory", CVoIPAudioServicesTestClass::CreateRingToneFactory),
+        ENTRY("CreateDownlinkStream", CVoIPAudioServicesTestClass::CreateDownlinkStream),
+        ENTRY("CreateDownlinkStreamJB", CVoIPAudioServicesTestClass::CreateDownlinkStreamJB),
+        ENTRY("CreateUplinkStream", CVoIPAudioServicesTestClass::CreateUplinkStream),
+        ENTRY("CreateDTMFTonePlayer", CVoIPAudioServicesTestClass::CreateDTMFTonePlayer),
+        ENTRY("CreateRingTonePlayer", CVoIPAudioServicesTestClass::CreateRingTonePlayer),
+        ENTRY("GetSupportedDownlinkFormats", CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats),
+        ENTRY("GetSupportedUplinkFormats", CVoIPAudioServicesTestClass::GetSupportedUplinkFormats),
+        ENTRY("SetDownlinkFormat", CVoIPAudioServicesTestClass::SetDownlinkFormat),
+        ENTRY("SetUplinkFormat", CVoIPAudioServicesTestClass::SetUplinkFormat),
+        ENTRY("OpenDownlink", CVoIPAudioServicesTestClass::OpenDownlink),
+        ENTRY("OpenUplink", CVoIPAudioServicesTestClass::OpenUplink),
+        ENTRY("Gain", CVoIPAudioServicesTestClass::Gain),
+        ENTRY("Volume", CVoIPAudioServicesTestClass::Volume),
+        ENTRY("SetDevice", CVoIPAudioServicesTestClass::SetDevice),
+        ENTRY("Close", CVoIPAudioServicesTestClass::Close),
+        ENTRY("Start", CVoIPAudioServicesTestClass::Start),
+        ENTRY("Stop", CVoIPAudioServicesTestClass::Stop),
+        ENTRY("SetLoopPlay", CVoIPAudioServicesTestClass::SetLoopPlay),
+        ENTRY("InitDTMFTonePlayer", CVoIPAudioServicesTestClass::InitDTMFTonePlayer),
+        ENTRY("DTMFTonePlay", CVoIPAudioServicesTestClass::DTMFTonePlay),
+        ENTRY("CloseDTMFPlayer", CVoIPAudioServicesTestClass::CloseDTMFPlayer),
+        ENTRY("StopDTMFPlayer", CVoIPAudioServicesTestClass::StopDTMFTonePlayer),
+        ENTRY("GetDownlinkVersion", CVoIPAudioServicesTestClass::GetDownlinkVersion),
+        ENTRY("GetUplinkVersion", CVoIPAudioServicesTestClass::GetUplinkVersion),
+        ENTRY("InitRingTonePlayer", CVoIPAudioServicesTestClass::InitRingTonePlayer),
+        ENTRY("CloseRingTonePlayer", CVoIPAudioServicesTestClass::CloseRingTonePlayer),
+        ENTRY("PlayRingTone", CVoIPAudioServicesTestClass::PlayRingTone),
+        ENTRY("PauseRingTone", CVoIPAudioServicesTestClass::PauseRingTone),
+        ENTRY("ResumeRingTone", CVoIPAudioServicesTestClass::ResumeRingTone),
+        ENTRY("StopRingTone", CVoIPAudioServicesTestClass::StopRingTone),
+        ENTRY("GetSupportedBitrates", CVoIPAudioServicesTestClass::GetSupportedBitrates),
+        ENTRY("SetBitrate", CVoIPAudioServicesTestClass::SetBitrate),
+        ENTRY("GetBitrate", CVoIPAudioServicesTestClass::GetBitrate),
+        ENTRY("GetVAD", CVoIPAudioServicesTestClass::GetVAD),
+        ENTRY("ToggleVAD", CVoIPAudioServicesTestClass::ToggleVAD),
+        ENTRY("GetFrameMode", CVoIPAudioServicesTestClass::GetFrameMode),
+        ENTRY("ToggleFrameMode", CVoIPAudioServicesTestClass::ToggleFrameMode),
+        ENTRY("GetFrameModeRqrdForEC", CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC),
+        ENTRY("ConcealErrForNextBuf", CVoIPAudioServicesTestClass::ConcealErrForNextBuf),
+        ENTRY("GetMode", CVoIPAudioServicesTestClass::GetMode),
+        ENTRY("SetMode", CVoIPAudioServicesTestClass::SetMode),
+        ENTRY("GetCNG", CVoIPAudioServicesTestClass::GetCNG),
+        ENTRY("ToggleCNG", CVoIPAudioServicesTestClass::ToggleCNG),
+        ENTRY("GetPLC", CVoIPAudioServicesTestClass::GetPLC),
+        ENTRY("TogglePLC", CVoIPAudioServicesTestClass::TogglePLC),
+        ENTRY("BadLsfNextBuffer", CVoIPAudioServicesTestClass::BadLsfNextBuffer),
+        ENTRY("GetBufferType", CVoIPAudioServicesTestClass::GetBufferType),
+        ENTRY("ConfigEncAudDevice", CVoIPAudioServicesTestClass::ConfigEncAudDevice),
+        ENTRY("ConfigureJB", CVoIPAudioServicesTestClass::ConfigureJB),
+        ENTRY("ResetJB", CVoIPAudioServicesTestClass::ResetJB),
+        ENTRY("DelayDown", CVoIPAudioServicesTestClass::DelayDown),
+        ENTRY("DelayUp", CVoIPAudioServicesTestClass::DelayUp),
+        ENTRY("TestNullObjects", CVoIPAudioServicesTestClass::TestNullObjects)
         };
 
-    const TInt count = sizeof( KFunctions ) /
-                        sizeof( TStifFunctionInfo );
-
-    return RunInternalL( KFunctions, count, aItem );
-
-}
-
+    const TInt count = sizeof(KFunctions) / sizeof(TStifFunctionInfo);
+    return RunInternalL(KFunctions, count, aItem);
+    }
 
 // -----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::EventName
 // Return descriptor with the notification description
 // -----------------------------------------------------------------------------
-TPtrC CVoIPAudioServicesTestClass::EventName( TInt aKey )
-{
-    static TText* const badKeyword = (TText*)L"BadKeyword";
+TPtrC CVoIPAudioServicesTestClass::EventName(TInt aKey)
+    {
+    static TText* const badKeyword = (TText*) L"BadKeyword";
     static TText* const keywords[] =
-    {
-
+        {
         (TText*)L"EOpenDownlinkComplete",
         (TText*)L"EOpenUplinkComplete",
         (TText*)L"EDownlinkClosed",
@@ -248,126 +181,128 @@
         (TText*)L"EPlaybackComplete",
         (TText*)L"EEmptyBuffer",
         (TText*)L"EFillBuffer",
-
-    };
-
-
+        (TText*)L"EDownlinkError",
+        (TText*)L"EUplinkError"
+        };
 
     if( (TUint)aKey >= (sizeof( keywords )/sizeof(TText*)) )
-    	{
+        {
         iLog->Log(_L("Keyword out of bounds"));
         TPtrC keyword( badKeyword );
         return keyword;
-    	}
+        }
     else
-    	{
+        {
         TPtrC keyword( keywords[aKey] );
         return keyword;
-    	}
-}
+        }
+    }
 
-// -----------------------------------------------------------------------------
-// CVoIPAudioServicesTestClass::AddExpectedEvent
-// Add an event to the expected events' list
-// -----------------------------------------------------------------------------
-void CVoIPAudioServicesTestClass::AddExpectedEvent(TVoIPExpectedEvent event, TInt ms)
-{
+    // -----------------------------------------------------------------------------
+    // CVoIPAudioServicesTestClass::AddExpectedEvent
+    // Add an event to the expected events' list
+    // -----------------------------------------------------------------------------
+void CVoIPAudioServicesTestClass::AddExpectedEvent(TVoIPExpectedEvent event,
+        TInt ms)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::AddExpectedEvent")));
     iExpectedEvents.Append(event);
     TPtrC eventName = EventName(event);
-    iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event, &eventName, iExpectedEvents.Count() );
+    iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event,
+            &eventName, iExpectedEvents.Count());
 
-    if ( iTimeoutController && !iTimeoutController->IsActive() )
-    	{
+    if (iTimeoutController && !iTimeoutController->IsActive())
+        {
         if (ms > 0)
             {
-            iTimeoutController->Start( TTimeIntervalMicroSeconds(ms * 1000) );
+            iTimeoutController->Start(TTimeIntervalMicroSeconds(ms * 1000));
             }
         else
             {
             iLog->Log(_L("Timeout with default value (1s)"));
-            iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) );
+            iTimeoutController->Start(TTimeIntervalMicroSeconds(1000000));
             }
-    	}
-}
+        }
+    }
 
 // -----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::RemoveExpectedEvent
 // Remove the indicated event from the expected events' list
 // -----------------------------------------------------------------------------
-TBool CVoIPAudioServicesTestClass::RemoveExpectedEvent(TVoIPExpectedEvent aEvent)
-{
+TBool CVoIPAudioServicesTestClass::RemoveExpectedEvent(
+        TVoIPExpectedEvent aEvent)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::RemoveExpectedEvent")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::RemoveExpectedEvent"));
     TBool match = EFalse;
-    for (TUint i=0; i < iExpectedEvents.Count() ; i++)
-    	{
+    for (TUint i = 0; i < iExpectedEvents.Count(); i++)
+        {
         if (iExpectedEvents[i] == aEvent)
-        	{
-        	iLog->Log(_L("Expeted events: %d"), iExpectedEvents.Count());
+            {
+            iLog->Log(_L("Expeted events: %d"), iExpectedEvents.Count());
             iExpectedEvents.Remove(i);
             match = ETrue;
             break;
-        	}
-    	}
+            }
+        }
 
     return match;
-}
-
+    }
 
 // -----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::RemoveAllExpectedEvents
 // Remove the indicated event from the expected events' list
 // -----------------------------------------------------------------------------
 void CVoIPAudioServicesTestClass::RemoveAllExpectedEvents()
-{
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::RemoveAllExpectedEvents")));
     iLog->Log(_L("Removing all expected events"));
 
     iExpectedEvents.Reset();
     iOcurredEvents.Reset();
-}
-
+    }
 
 // -----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::ProcessEvent
 // -----------------------------------------------------------------------------
-void CVoIPAudioServicesTestClass::ProcessEvent(TVoIPExpectedEvent aEvent, TInt aError)
-{
+void CVoIPAudioServicesTestClass::ProcessEvent(TVoIPExpectedEvent aEvent,
+        TInt aError)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ProcessExpectedEvent")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::ProcessExpectedEvent"));
     TPtrC nameEvent = EventName(aEvent);
 
     if (aError == KErrNone)
-    	{
+        {
         if (RemoveExpectedEvent(aEvent))
-        	{
-            iLog->Log(_L("Expected Event: (0x%02x)%S has ocurred Total=%d"), aEvent, &nameEvent,iExpectedEvents.Count());
-        	}
+            {
+            iLog->Log(_L("Expected Event: (0x%02x)%S has ocurred Total=%d"),
+                    aEvent, &nameEvent, iExpectedEvents.Count());
+            }
         else
-        	{
+            {
             iLog->Log(_L("Event: (0x%02x)%S has ocurred"), aEvent, &nameEvent);
             return;
-        	}
+            }
 
-        if (iExpectedEvents.Count() == 0 )
-        	{
+        if (iExpectedEvents.Count() == 0)
+            {
             Signal();
             iTimeoutController->Cancel();
-        	}
-
-    	}
+            }
+        }
     else
-    	{
-        iLog->Log(_L("[Error] Event: (0x%02x)%S return with error code=%d"), aEvent, &nameEvent, aError);
-        if (iExpectedEvents.Count() != 0 )
-        	{
+        {
+        iLog->Log(_L("[Error] Event: (0x%02x)%S return with error code=%d"),
+                aEvent, &nameEvent, aError);
+        if (iExpectedEvents.Count() != 0)
+            {
             RemoveExpectedEvent(aEvent);
-        	}
+            }
         iTimeoutController->Cancel();
         Signal(KErrCallbackErrorCode);
-    	}
-}
+        }
+    }
 
 // -----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::HandleTimeout
@@ -375,29 +310,29 @@
 // -----------------------------------------------------------------------------
 
 void CVoIPAudioServicesTestClass::HandleTimeout(TInt aError)
-{
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::HandleTimeout")));
 
     if (aError != KErrNone)
-    	{
-        if (iExpectedEvents.Count() == 0 )
-        	{
+        {
+        if (iExpectedEvents.Count() == 0)
+            {
             iLog->Log(_L("Timing out but events have ocurred"));
             Signal();
-        	}
+            }
         else
-        	{
+            {
             RemoveAllExpectedEvents();
             iLog->Log(_L("Timing out and events still pending"));
             Signal(KErrEventPending);
-        	}
-    	}
+            }
+        }
     else
-    	{
+        {
         iLog->Log(_L("Timing out return a error %d"), aError);
         Signal(aError);
-    	}
-}
+        }
+    }
 
 // -----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::SetTimeout
@@ -406,136 +341,112 @@
 // It's used rather than the "timeout" keyword in the configuration file
 // because in this way the log continues
 // -----------------------------------------------------------------------------
-TInt CVoIPAudioServicesTestClass::SetTimeout( CStifItemParser& aItem )
-{
+TInt CVoIPAudioServicesTestClass::SetTimeout(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetTimeout")));
-    TInt timeout=0;
-    TInt error = aItem.GetNextInt(timeout) ;
-    if ( iTimeoutController )
-    	{
-        if ( timeout > 0 )
-        	{
-            iTimeoutController->Start( TTimeIntervalMicroSeconds(timeout*1000) );
-        	}
+    TInt timeout = 0;
+    TInt error = aItem.GetNextInt(timeout);
+    if (iTimeoutController)
+        {
+        if (timeout > 0)
+            {
+            iTimeoutController->Start(TTimeIntervalMicroSeconds(timeout *1000));
+            }
         else
-        	{
-            iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) );
-        	}
-    	}
+            {
+            iTimeoutController->Start(TTimeIntervalMicroSeconds(1000000));
+            }
+        }
     else
-    	{
+        {
         iLog->Log(_L("Timeout Controller doesn't exist"));
         error = KErrTimeoutController;
-    	}
-
+        }
     return error;
-}
-
+    }
 
 // -----------------------------------------------------------------------------
 // Uses the TestModuleBase API to allow a panic as exit reason for a test case
 // -----------------------------------------------------------------------------
-TInt CVoIPAudioServicesTestClass::SetAllowedPanic( CStifItemParser& aItem )
-{
+TInt CVoIPAudioServicesTestClass::SetAllowedPanic(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetAllowedPanic")));
     TInt error = KErrNone;
     TInt panicCode;
     TPtrC panicType;
-    if (  ( KErrNone == aItem.GetNextString(panicType) ) &&
-    ( KErrNone == aItem.GetNextInt(panicCode) )  )
-    	{
+    if ((KErrNone == aItem.GetNextString(panicType)) && (KErrNone
+            == aItem.GetNextInt(panicCode)))
+        {
         iLog->Log(_L("Allowing panic: %S %d"), &panicType, panicCode);
-        iTestModuleIf.SetExitReason( CTestModuleIf::EPanic, panicCode );
+        iTestModuleIf.SetExitReason(CTestModuleIf::EPanic, panicCode);
         iNormalExitReason = EFalse;
-    	}
+        }
     else
-    	{
+        {
         iLog->Log(KMsgBadTestParameters);
         error = KErrBadTestParameter;
-    	}
-
+        }
     return error;
-}
+    }
 
 // -----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::SetExpectedEvents()
 // -----------------------------------------------------------------------------
-TInt CVoIPAudioServicesTestClass::SetExpectedEvents( CStifItemParser& aItem )
-{
+TInt CVoIPAudioServicesTestClass::SetExpectedEvents(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetExpectedEvents")));
     TInt error = KErrNone;
-    TInt event=0;
-    while ( KErrNone == aItem.GetNextInt(event))
-    	{
-        AddExpectedEvent(static_cast<TVoIPExpectedEvent>(event), 0); // Default timeout value
-    	}
-
+    TInt event = 0;
+    while (KErrNone == aItem.GetNextInt(event))
+        {
+        // Default timeout value
+        AddExpectedEvent(static_cast<TVoIPExpectedEvent> (event), 0);
+        }
     return error;
-}
-
-
-// -----------------------------------------------------------------------------
-// CVoIPAudioServicesTestClass::ExampleL
-// Example test method function.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CVoIPAudioServicesTestClass::ExampleL( CStifItemParser& aItem )
-{
+    }
 
-    // Print to UI
-    _LIT( KVoIPAudioServicesTestClass, "VoIPAudioServicesTestClass" );
-    _LIT( KExample, "In Example" );
-    TestModuleIf().Printf( 0, KVoIPAudioServicesTestClass, KExample );
-    // Print to log file
-    iLog->Log( KExample );
-
-    TInt i = 0;
-    TPtrC string;
-    _LIT( KParam, "Param[%i]: %S" );
-    while ( aItem.GetNextString ( string ) == KErrNone )
-        {
-        TestModuleIf().Printf( i, KVoIPAudioServicesTestClass, KParam, i, &string );
-        i++;
-        }
-
-    return KErrNone;
-}
-
-TInt CVoIPAudioServicesTestClass::CreateVoIPUtilityFactory( CStifItemParser& /*aItem */)
-{
+TInt CVoIPAudioServicesTestClass::CreateVoIPUtilityFactory(
+        CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateFactory")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateFactory"));
     TInt error = KErrNone;
-
     error = CVoIPUtilityFactory::CreateFactory(iFactory);
-
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::CreateRingToneFactory( CStifItemParser& /*aItem */)
-{
+TInt CVoIPAudioServicesTestClass::CreateRingToneFactory(
+        CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateRingToneFactory")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateRingToneFactory"));
     TInt error = KErrNone;
-
     error = CRingToneFactory::CreateFactory(iRingToneFactory);
-
     return error;
-}
+    }
 
-TInt CVoIPAudioServicesTestClass::CreateDownlinkStream( CStifItemParser& /*aItem */)
-{
-	iLog->Log(_L("MVoIPUplinkObserver::KOpenComplete: iUpLinkStatus = %d"), iUpLinkStatus);
-    FTRACE(FPrint(_L("MVoIPUplinkObserver::KOpenComplete: iUpLinkStatus = %d"), iUpLinkStatus));
+TInt CVoIPAudioServicesTestClass::CreateDownlinkStream(
+        CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateDownlinkStream")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateDownlinkStream"));
     TInt error = KErrNone;
-
     const TVersion ver(1, 0, 0);
 
-#ifdef __JITTER_BUFFER_TEST__
+    // Create DNL without JB interface
+    error = iFactory->CreateDownlinkStream(ver,
+            CVoIPUtilityFactory::EVoIPCall, iVoIPDnlink);
+    return error;
+    }
+
+TInt CVoIPAudioServicesTestClass::CreateDownlinkStreamJB(
+        CStifItemParser& /*aItem */)
+    {
+    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateDownlinkStreamJB")));
+    iLog->Log(_L("CVoIPAudioServicesTestClass::CreateDownlinkStreamJB"));
+    TInt error = KErrNone;
+    const TVersion ver(1, 0, 0);
+
     // Create DNL with JB interface
     error = iFactory->CreateDownlinkStream(ver, iJBIntfc, iVoIPDnlink);
 
@@ -543,95 +454,89 @@
         {
         iJBIntfc->SetObserver(*this);
         }
-#else  //__JITTER_BUFFER_TEST__
-    // Create DNL without JB interface
-    error = iFactory->CreateDownlinkStream(ver,
-                                           CVoIPUtilityFactory::EVoIPCall,
-                                           iVoIPDnlink);
-#endif //__JITTER_BUFFER_TEST__
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::GetDownlinkVersion( CStifItemParser& /*aItem */)
-{
-	FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetDownlinkVersion")));
+TInt CVoIPAudioServicesTestClass::GetDownlinkVersion(
+        CStifItemParser& /*aItem */)
+    {
+    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetDownlinkVersion")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetDownlinkVersion"));
     TInt error = KErrNone;
-
-    TVersion ver(0,0,0);
+    TVersion ver(0, 0, 0);
     error = iVoIPDnlink->GetVersion(ver);
-
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::CreateUplinkStream( CStifItemParser& /*aItem */)
-{
+TInt CVoIPAudioServicesTestClass::CreateUplinkStream(
+        CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateUplinkStream")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateUplinkStream"));
     TInt error = KErrNone;
-
     const TVersion ver(1, 0, 0);
-    error = iFactory->CreateUplinkStream(ver,
-                                       CVoIPUtilityFactory::EVoIPCall,
-                                       iVoIPUplink);
+    error = iFactory->CreateUplinkStream(ver, CVoIPUtilityFactory::EVoIPCall,
+            iVoIPUplink);
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::GetUplinkVersion( CStifItemParser& /*aItem */)
-{
-	FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetUplinkVersion")));
+TInt CVoIPAudioServicesTestClass::GetUplinkVersion(
+        CStifItemParser& /*aItem */)
+    {
+    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetUplinkVersion")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetUplinkVersion"));
     TInt error = KErrNone;
-
-    TVersion ver(0,0,0);
+    TVersion ver(0, 0, 0);
     error = iVoIPUplink->GetVersion(ver);
-
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::CreateDTMFTonePlayer( CStifItemParser& /*aItem */)
-{
+TInt CVoIPAudioServicesTestClass::CreateDTMFTonePlayer(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateDTMFTonePlayer")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateDTMFTonePlayer"));
     TInt error = KErrNone;
-
-    if (iVoIPDnlink)
-    	{
-        error = iFactory->CreateDTMFTonePlayer(iDTMFTonePlayerDn);
-    	}
+    TPtrC startType;
+    error = aItem.GetNextString(startType);
 
-    if (iVoIPUplink)
-    	{
-    	error = iFactory->CreateDTMFTonePlayer(iDTMFTonePlayerUp);
-    	}
-
+    if (error == KErrNone)
+        {
+        if (startType == KTagUplink)
+            {
+            error = iFactory->CreateDTMFTonePlayer(iDTMFTonePlayerUp);
+            }
+        else if (startType == KTagDnlink)
+            {
+            error = iFactory->CreateDTMFTonePlayer(iDTMFTonePlayerDn);
+            }
+        else
+            {
+            iLog->Log(KMsgBadTestParameters);
+            error = KErrBadTestParameter;
+            }
+        }
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::CreateRingTonePlayer( CStifItemParser& /*aItem */)
-{
+TInt CVoIPAudioServicesTestClass::CreateRingTonePlayer(
+        CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateRingTonePlayer")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateRingTonePlayer"));
     TInt error = KErrNone;
 
     if (iRingToneFactory)
-    	{
+        {
         error = iRingToneFactory->CreateRingTonePlayer(iRingTonePlayer);
-    	}
+        }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats( CStifItemParser& /*aItem */)
-{
+TInt CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats(
+        CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats"));
     TInt error = KErrNone;
@@ -659,10 +564,11 @@
     formats.Close();
 
     return error;
-}
+    }
 
-TInt CVoIPAudioServicesTestClass::GetSupportedUplinkFormats( CStifItemParser& /*aItem */)
-{
+TInt CVoIPAudioServicesTestClass::GetSupportedUplinkFormats(
+        CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetSupportedUplinkFormats")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetSupportedUplinkFormats"));
     TInt error = KErrNone;
@@ -690,14 +596,10 @@
     formats.Close();
 
     return error;
-}
-
-
+    }
 
-
-
-TInt CVoIPAudioServicesTestClass::SetDownlinkFormat( CStifItemParser& aItem )
-{
+TInt CVoIPAudioServicesTestClass::SetDownlinkFormat(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetDownlinkFormat")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::SetDownlinkFormat"));
     TInt error = KErrNone;
@@ -705,185 +607,205 @@
     TPtrC decoderType;
     error = aItem.GetNextString(decoderType);
     if (error == KErrNone)
-    	{
+        {
         CVoIPFormatIntfc* formatIntfc = NULL;
 
-        // NOTE: We can now set either 10ms or 20ms G.711 frame;
-        //	 	 call GetSupportedDownlinkFormats() to see if it
-        //		 returns EG711 or EG711_10MS and set codec accordingly.
         if (decoderType == KTagG711)
-        	{
-        	error = iVoIPDnlink->SetFormat(EG711, formatIntfc);
-        	if (error == KErrNone)
-        		{
+            {
+            error = iVoIPDnlink->SetFormat(EG711, formatIntfc);
+            if (error == KErrNone)
+                {
                 if (iG711DecFormatIntfc)
-                	{
-                	delete iG711DecFormatIntfc;
-                	iG711DecFormatIntfc = NULL;
-                	}
+                    {
+                    delete iG711DecFormatIntfc;
+                    iG711DecFormatIntfc = NULL;
+                    }
 
-		            iG711DecFormatIntfc = (CVoIPG711DecoderIntfc*)formatIntfc;
-		            error = iG711DecFormatIntfc->SetObserver(*this);
-		            iDnLinkCodec = EG711;
-
-		            iLog->Log(_L("G.711 DNL Codec Set: error = %d"), error);
-        		}
-        	else
+                iG711DecFormatIntfc = (CVoIPG711DecoderIntfc*) formatIntfc;
+                error = iG711DecFormatIntfc->SetObserver(*this);
+                iDnLinkCodec = EG711;
+                iLog->Log(_L("G.711 DNL Codec Set: error = %d"), error);
+                }
+            else
                 {
                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
                 }
-        	}
+            }
+        else if (decoderType == KTagG711_10MS)
+            {
+            error = iVoIPDnlink->SetFormat(EG711_10MS, formatIntfc);
+            if (error == KErrNone)
+                {
+                if (iG711DecFormatIntfc)
+                    {
+                    delete iG711DecFormatIntfc;
+                    iG711DecFormatIntfc = NULL;
+                    }
+
+                iG711DecFormatIntfc = (CVoIPG711DecoderIntfc*) formatIntfc;
+                error = iG711DecFormatIntfc->SetObserver(*this);
+                iDnLinkCodec = EG711_10MS;
+                iLog->Log(_L("G.711 10ms DNL Codec Set: error = %d"), error);
+                }
+            else
+                {
+                iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
+                }
+            }
         else if (decoderType == KTagG729)
-        	{
-        	error = iVoIPDnlink->SetFormat(EG729, formatIntfc);
-        	if (error == KErrNone)
-        		{
+            {
+            error = iVoIPDnlink->SetFormat(EG729, formatIntfc);
+            if (error == KErrNone)
+                {
                 if (iG729DecFormatIntfc)
-                	{
-		            delete iG729DecFormatIntfc;
-		            iG729DecFormatIntfc = NULL;
-		            }
+                    {
+                    delete iG729DecFormatIntfc;
+                    iG729DecFormatIntfc = NULL;
+                    }
 
-	            iG729DecFormatIntfc = (CVoIPG729DecoderIntfc*)formatIntfc;
-	            error = iG729DecFormatIntfc->SetObserver(*this);
-	            iDnLinkCodec = EG729;
+                iG729DecFormatIntfc = (CVoIPG729DecoderIntfc*) formatIntfc;
+                error = iG729DecFormatIntfc->SetObserver(*this);
+                iDnLinkCodec = EG729;
 
-	            iLog->Log(_L("G.729 DNL Codec Set: error = %d"), error);
-        		}
-        	else
+                iLog->Log(_L("G.729 DNL Codec Set: error = %d"), error);
+                }
+            else
                 {
                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
                 }
-        	}
+            }
         else if (decoderType == KTagILBC)
-        	{
-        	error = iVoIPDnlink->SetFormat(EILBC, formatIntfc);
-        	if (error == KErrNone)
-        		{
+            {
+            error = iVoIPDnlink->SetFormat(EILBC, formatIntfc);
+            if (error == KErrNone)
+                {
                 if (iILBCDecFormatIntfc)
-		            {
-		            delete iILBCDecFormatIntfc;
-		            iILBCDecFormatIntfc = NULL;
-		            }
+                    {
+                    delete iILBCDecFormatIntfc;
+                    iILBCDecFormatIntfc = NULL;
+                    }
+
+                iILBCDecFormatIntfc = (CVoIPILBCDecoderIntfc*) formatIntfc;
+                error = iILBCDecFormatIntfc->SetObserver(*this);
+                iDnLinkCodec = EILBC;
 
-		            iILBCDecFormatIntfc = (CVoIPILBCDecoderIntfc*)formatIntfc;
-		            error = iILBCDecFormatIntfc->SetObserver(*this);
-		            iDnLinkCodec = EILBC;
+                iLog->Log(_L("iLBC DNL Codec Set: error = %d"), error);
+                }
+            else
+                {
+                iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
+                }
+            }
+        else if (decoderType == KTagAMRNB)
+            {
+            error = iVoIPDnlink->SetFormat(EAMR_NB, formatIntfc);
+            if (error == KErrNone)
+                {
+                if (iAMRNBDecFormatIntfc)
+                    {
+                    delete iAMRNBDecFormatIntfc;
+                    iAMRNBDecFormatIntfc = NULL;
+                    }
 
-		            iLog->Log(_L("iLBC DNL Codec Set: error = %d"), error);
-        		}
-        	else
+                iAMRNBDecFormatIntfc = formatIntfc;
+                error = iAMRNBDecFormatIntfc->SetObserver(*this);
+                iDnLinkCodec = EAMR_NB;
+
+                iLog->Log(_L("AMR-NB DNL Codec Set: error = %d"), error);
+                }
+            else
                 {
                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
                 }
-        	}
-        else if (decoderType == KTagAMRNB)
-        	{
-        	error = iVoIPDnlink->SetFormat(EAMR_NB, formatIntfc);
-        	if (error == KErrNone)
-        		{
-                if (iAMRNBDecFormatIntfc)
-		            {
-		            delete iAMRNBDecFormatIntfc;
-		            iAMRNBDecFormatIntfc = NULL;
-		            }
+            }
+        else if (decoderType == KTagPCM16)
+            {
+            error = iVoIPDnlink->SetFormat(EPCM16, formatIntfc);
+            if (error == KErrNone)
+                {
+                if (iPCM16DecFormatIntfc)
+                    {
+                    delete iPCM16DecFormatIntfc;
+                    iPCM16DecFormatIntfc = NULL;
+                    }
 
-		            iAMRNBDecFormatIntfc = formatIntfc;
-		            error = iAMRNBDecFormatIntfc->SetObserver(*this);
-		            iDnLinkCodec = EAMR_NB;
+                iPCM16DecFormatIntfc = formatIntfc;
+                error = iPCM16DecFormatIntfc->SetObserver(*this);
+                iDnLinkCodec = EPCM16;
 
-		            iLog->Log(_L("AMR-NB DNL Codec Set: error = %d"), error);
-        		}
-        	else
+                iLog->Log(_L("PCM16 DNL Codec Set: error = %d"), error);
+                }
+            else
                 {
                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
                 }
-        	}
-        else if (decoderType == KTagPCM16)
-        	{
-        	error = iVoIPDnlink->SetFormat(EPCM16, formatIntfc);
-        	if (error == KErrNone)
-        		{
-                if (iPCM16DecFormatIntfc)
-		            {
-		            delete iPCM16DecFormatIntfc;
-		            iPCM16DecFormatIntfc = NULL;
-		            }
-
-		            iPCM16DecFormatIntfc = formatIntfc;
-		            error = iPCM16DecFormatIntfc->SetObserver(*this);
-		            iDnLinkCodec = EPCM16;
-
-		            iLog->Log(_L("PCM16 DNL Codec Set: error = %d"), error);
-        		}
-        	else
-                {
-                iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
-                }
-        	}
+            }
+        else if (decoderType == KTagNULL)
+            {
+            error = iVoIPDnlink->SetFormat(ENULL, formatIntfc);
+            iLog->Log(_L("NULL DNL Codec Set: error = %d"), error);
+            }
         else
-        	{
+            {
             iLog->Log(KMsgBadTestParameters);
             error = KErrBadTestParameter;
             return error;
-        	}
-    	}
+            }
+        }
+
+    return error;
+    }
 
+TInt CVoIPAudioServicesTestClass::OpenDownlink(CStifItemParser& aItem)
+    {
+    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::OpenDownlink")));
+    iLog->Log(_L("CVoIPAudioServicesTestClass::OpenDownlink"));
+    TInt error = KErrNone;
+
+    TPtrC bufType;
+    error = aItem.GetNextString(bufType);
     if (error == KErrNone)
         {
         delete iPlayBuf;
         iPlayBuf = NULL;
+        iPlayJBuf = NULL;
 
-#ifdef __JITTER_BUFFER_TEST__
-        iPlayJBuf = NULL;
-        if (iDnLinkCodec != EPCM16)
+        if (bufType == KTagJbBuf)
+            {
+            error = iFactory->CreateBuffer(iPlayBuf,
+                    CVoIPDataBuffer::EJitterBuffer, iDnLinkCodec);
+            iPlayJBuf = static_cast<CVoIPJBDataBuffer*> (iPlayBuf);
+            }
+        else
             {
-            iFactory->CreateBuffer(iPlayBuf,
-                                   CVoIPDataBuffer::EJitterBuffer,
-                                   iDnLinkCodec);
-            iPlayJBuf = static_cast<CVoIPJBDataBuffer*>(iPlayBuf);
+            error = iFactory->CreateBuffer(iPlayBuf,
+                    CVoIPDataBuffer::EStandard, iDnLinkCodec);
             }
-#else  //__JITTER_BUFFER_TEST__
-        iFactory->CreateBuffer(iPlayBuf,
-                               CVoIPDataBuffer::EStandard,
-                               iDnLinkCodec);
-#endif //__JITTER_BUFFER_TEST__
+        }
+
+    if (iDnLinkStatus == ENotReady && error == KErrNone)
+        {
+        error = iVoIPDnlink->Open(*this);
+        if (error == KErrNone)
+            {
+            iDnLinkStatus = EReady;
+            AddExpectedEvent(EOpenDownlinkComplete, KShortTimeout);
+            }
+        else
+            {
+            iLog->Log(_L("DNL open error: error = %d"), error);
+            }
+        }
+    else
+        {
+        iLog->Log(_L("DNL open error = %d"), error);
         }
 
     return error;
-}
-
-
-TInt CVoIPAudioServicesTestClass::OpenDownlink(CStifItemParser& /*aItem */ )
-{
-    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::OpenDownlink")));
-    iLog->Log(_L("CVoIPAudioServicesTestClass::OpenDownlink"));
-    TInt error = KErrNone;
+    }
 
-    if (iDnLinkStatus == ENotReady)
-    	{
-    	error = iVoIPDnlink->Open(*this);
-    	if (error != KErrNone)
-    		{
-            iLog->Log(_L("DNL open error: error = %d"), error);
-    		}
-    	else
-    		{
-      		iDnLinkStatus = EReady;
-            AddExpectedEvent(EOpenDownlinkComplete, KMediumTimeout);
-    		}
-    	}
-    else
-    	{
-    	iLog->Log(_L("DNL already open: error = %d"), KErrInUse);
-    	}
-
-  return error;
-}
-
-
-TInt CVoIPAudioServicesTestClass::SetUplinkFormat( CStifItemParser& aItem )
-{
+TInt CVoIPAudioServicesTestClass::SetUplinkFormat(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetUplinkFormat")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::SetUplinkFormat"));
     TInt error = KErrNone;
@@ -891,164 +813,182 @@
     TPtrC encoderType;
     error = aItem.GetNextString(encoderType);
     if (error == KErrNone)
-    	{
+        {
         CVoIPFormatIntfc* formatIntfc = NULL;
         if (encoderType == KTagG711)
-        	{
-		    // NOTE: We can now set either 10ms or 20ms G.711 frame;
-		    //	 	 call GetSupportedDownlinkFormats() to see if it
-		    //		 returns EG711 or EG711_10MS and set codec accordingly.
-        	error = iVoIPUplink->SetFormat(EG711, formatIntfc);
-        	if (error == KErrNone)
-        		{
+            {
+            error = iVoIPUplink->SetFormat(EG711, formatIntfc);
+            if (error == KErrNone)
+                {
                 if (iG711EncFormatIntfc)
-		            {
-		            delete iG711EncFormatIntfc;
-		            iG711EncFormatIntfc = NULL;
-		            }
+                    {
+                    delete iG711EncFormatIntfc;
+                    iG711EncFormatIntfc = NULL;
+                    }
 
-                iG711EncFormatIntfc = (CVoIPG711EncoderIntfc*)formatIntfc;
+                iG711EncFormatIntfc = (CVoIPG711EncoderIntfc*) formatIntfc;
                 error = iG711EncFormatIntfc->SetObserver(*this);
                 iUpLinkCodec = EG711;
 
                 iLog->Log(_L("G.711 UPL Codec Set: error = %d"), error);
-        		}
-        	else
+                }
+            else
                 {
                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
                 }
-        	}
+            }
+        else if (encoderType == KTagG711_10MS)
+            {
+            error = iVoIPUplink->SetFormat(EG711_10MS, formatIntfc);
+            if (error == KErrNone)
+                {
+                if (iG711EncFormatIntfc)
+                    {
+                    delete iG711EncFormatIntfc;
+                    iG711EncFormatIntfc = NULL;
+                    }
+
+                iG711EncFormatIntfc = (CVoIPG711EncoderIntfc*) formatIntfc;
+                error = iG711EncFormatIntfc->SetObserver(*this);
+                iUpLinkCodec = EG711_10MS;
+                iLog->Log(_L("G.711 10ms UPL Codec Set: error = %d"), error);
+                }
+            else
+                {
+                iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
+                }
+            }
         else if (encoderType == KTagG729)
-        	{
-        	error = iVoIPUplink->SetFormat(EG729, formatIntfc);
-        	if (error == KErrNone)
-        		{
+            {
+            error = iVoIPUplink->SetFormat(EG729, formatIntfc);
+            if (error == KErrNone)
+                {
                 if (iG729EncFormatIntfc)
-		            {
-		            delete iG729EncFormatIntfc;
-		            iG729EncFormatIntfc = NULL;
-		            }
+                    {
+                    delete iG729EncFormatIntfc;
+                    iG729EncFormatIntfc = NULL;
+                    }
 
                 iG729EncFormatIntfc = formatIntfc;
                 error = iG729EncFormatIntfc->SetObserver(*this);
                 iUpLinkCodec = EG729;
 
                 iLog->Log(_L("G.729 UPL Codec Set: error = %d"), error);
-        		}
-        	else
+                }
+            else
                 {
                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
                 }
-        	}
+            }
         else if (encoderType == KTagILBC)
-        	{
-        	error = iVoIPUplink->SetFormat(EILBC, formatIntfc);
-        	if (error == KErrNone)
-        		{
-        		if (iILBCEncFormatIntfc)
-		            {
-		            delete iILBCEncFormatIntfc;
-		            iILBCEncFormatIntfc = NULL;
-		            }
+            {
+            error = iVoIPUplink->SetFormat(EILBC, formatIntfc);
+            if (error == KErrNone)
+                {
+                if (iILBCEncFormatIntfc)
+                    {
+                    delete iILBCEncFormatIntfc;
+                    iILBCEncFormatIntfc = NULL;
+                    }
 
-        		iILBCEncFormatIntfc = (CVoIPILBCEncoderIntfc*)formatIntfc;
-        		error = iILBCEncFormatIntfc->SetObserver(*this);
-        		iUpLinkCodec = EILBC;
+                iILBCEncFormatIntfc = (CVoIPILBCEncoderIntfc*) formatIntfc;
+                error = iILBCEncFormatIntfc->SetObserver(*this);
+                iUpLinkCodec = EILBC;
 
-        		iLog->Log(_L("iLBC UPL Codec Set: error = %d"), error);
-        		}
-        	else
+                iLog->Log(_L("iLBC UPL Codec Set: error = %d"), error);
+                }
+            else
                 {
                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
                 }
-        	}
+            }
         else if (encoderType == KTagAMRNB)
-        	{
-        	error = iVoIPUplink->SetFormat(EAMR_NB, formatIntfc);
-        	if (error == KErrNone)
-        		{
+            {
+            error = iVoIPUplink->SetFormat(EAMR_NB, formatIntfc);
+            if (error == KErrNone)
+                {
                 if (iAMRNBEncFormatIntfc)
-		            {
-		            delete iAMRNBEncFormatIntfc;
-		            iAMRNBEncFormatIntfc = NULL;
-		            }
+                    {
+                    delete iAMRNBEncFormatIntfc;
+                    iAMRNBEncFormatIntfc = NULL;
+                    }
 
                 iAMRNBEncFormatIntfc = formatIntfc;
                 error = iAMRNBEncFormatIntfc->SetObserver(*this);
                 iUpLinkCodec = EAMR_NB;
 
                 iLog->Log(_L("AMR-NB UPL Codec Set: error = %d"), error);
-        		}
-        	else
+                }
+            else
                 {
                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
                 }
-        	}
+            }
         else if (encoderType == KTagPCM16)
-        	{
-        	error = iVoIPUplink->SetFormat(EPCM16, formatIntfc);
-        	if (error == KErrNone)
-        		{
+            {
+            error = iVoIPUplink->SetFormat(EPCM16, formatIntfc);
+            if (error == KErrNone)
+                {
                 if (iPCM16EncFormatIntfc)
-		            {
-		            delete iPCM16EncFormatIntfc;
-		            iPCM16EncFormatIntfc = NULL;
-		            }
+                    {
+                    delete iPCM16EncFormatIntfc;
+                    iPCM16EncFormatIntfc = NULL;
+                    }
 
                 iPCM16EncFormatIntfc = formatIntfc;
                 error = iPCM16EncFormatIntfc->SetObserver(*this);
                 iUpLinkCodec = EPCM16;
 
                 iLog->Log(_L("PCM16 UPL Codec Set: error = %d"), error);
-        		}
-        	else
+                }
+            else
                 {
                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
                 }
-        	}
+            }
+        else if (encoderType == KTagNULL)
+            {
+            error = iVoIPUplink->SetFormat(ENULL, formatIntfc);
+            iLog->Log(_L("NULL UPL Codec Set: error = %d"), error);
+            }
         else
-        	{
+            {
             iLog->Log(KMsgBadTestParameters);
             error = KErrBadTestParameter;
             return error;
-        	}
-    	}
+            }
+        }
 
-        iFactory->CreateBuffer(iRecBuf,
-        											 CVoIPDataBuffer::EStandard,
-                               iUpLinkCodec);
-                               
+    iFactory->CreateBuffer(iRecBuf, CVoIPDataBuffer::EStandard, iUpLinkCodec);
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::OpenUplink(CStifItemParser& /*aItem */ )
-{
+TInt CVoIPAudioServicesTestClass::OpenUplink(CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::OpenUplink")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::OpenUplink"));
     TInt error = KErrNone;
 
     if (iUpLinkStatus == ENotReady)
-    	{
-    	error = iVoIPUplink->Open(*this);
-    	if (error != KErrNone)
-    		{
+        {
+        error = iVoIPUplink->Open(*this);
+        if (error != KErrNone)
+            {
             iLog->Log(_L("UPL open error: error = %d"), error);
-    		}
-    	else
-    		{
-            AddExpectedEvent(EOpenUplinkComplete, KMediumTimeout);
+            }
+        else
+            {
+            AddExpectedEvent(EOpenUplinkComplete, KShortTimeout);
             iUpLinkStatus = EReady;
-    		}
-    	}
+            }
+        }
     else
-    	{
-    	iLog->Log(_L("UPL already open: error = %d"), KErrInUse);
-    	}
+        {
+        iLog->Log(_L("UPL already open: error = %d"), KErrInUse);
+        }
 
     return error;
-}
+    }
 
 // ----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::DisplayFormat
@@ -1056,7 +996,7 @@
 // ----------------------------------------------------------------------------
 //
 void CVoIPAudioServicesTestClass::DisplayFormat(TVoIPCodecFormat aFormat)
-{
+    {
     if (aFormat == EAMR_NB)
         {
         iLog->Log(_L("AMR-NB"));
@@ -1077,52 +1017,50 @@
         {
         iLog->Log(_L("PCM-16"));
         }
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::Close(CStifItemParser& aItem  )
-{
+TInt CVoIPAudioServicesTestClass::Close(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Close")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::Close"));
     TInt error = KErrNone;
-
+    iLoopPlay = EFalse;
     TPtrC closeType;
     error = aItem.GetNextString(closeType);
     if (error == KErrNone)
-    	{
+        {
         if (closeType == KTagUplink)
-        	{
-	    	iRecBufPtr.Set(NULL, 0, 0);
-	        iRecBufReady = EFalse;
-	        iUpLinkCodec = ENULL;
-	        iVoIPUplink->Close();
-	        iUpLinkStatus = ENotReady;
-	        iLog->Log(_L("Close Uplink"));
-	        AddExpectedEvent(EUplinkClosed, KMediumTimeout);
-        	}
-	    else if (closeType == KTagDnlink)
-	    	{
-	    	iPlayBufPtr.Set(NULL, 0, 0);
-	        iVoIPDnlink->Close();
-	        iDnLinkStatus = ENotReady;
-	        iPlayBufReady = EFalse;
-	        iDnLinkCodec = ENULL;
-	        iLog->Log(_L("Close Dnlink"));
-	        AddExpectedEvent(EDownlinkClosed, KMediumTimeout);
-		    }
-		else
-		    {
-		    iLog->Log(KMsgBadTestParameters);
-		    error = KErrBadTestParameter;
-		    }
-    	}
+            {
+            iRecBufPtr.Set(NULL, 0, 0);
+            iRecBufReady = EFalse;
+            iUpLinkCodec = ENULL;
+            iVoIPUplink->Close();
+            iUpLinkStatus = ENotReady;
+            iLog->Log(_L("Close Uplink"));
+            AddExpectedEvent(EUplinkClosed, KShortTimeout);
+            }
+        else if (closeType == KTagDnlink)
+            {
+            iPlayBufPtr.Set(NULL, 0, 0);
+            iVoIPDnlink->Close();
+            iDnLinkStatus = ENotReady;
+            iPlayBufReady = EFalse;
+            iDnLinkCodec = ENULL;
+            iLog->Log(_L("Close Dnlink"));
+            AddExpectedEvent(EDownlinkClosed, KShortTimeout);
+            }
+        else
+            {
+            iLog->Log(KMsgBadTestParameters);
+            error = KErrBadTestParameter;
+            }
+        }
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::Start(CStifItemParser& aItem  )
-{
+TInt CVoIPAudioServicesTestClass::Start(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Start")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::Start"));
     TInt error = KErrNone;
@@ -1130,52 +1068,49 @@
     TPtrC startType;
     error = aItem.GetNextString(startType);
     if (error == KErrNone)
-    	{
+        {
         if (startType == KTagUplink)
-        	{
-        	if (iUpLinkStatus == EReady)
-        		{
-	            iVoIPUplink->Start();
-	            iUpLinkStatus = EStreaming;
-	            iLog->Log(_L("Start Uplink"));
-	            AddExpectedEvent(EEmptyBuffer, KMediumTimeout);
-        		}
-
-        	else
-        		{
-	            iLog->Log(_L("UPL not ready"));
-	            error = KErrNotReady;
-        		}
-        	}
+            {
+            if (iUpLinkStatus == EReady)
+                {
+                iVoIPUplink->Start();
+                iUpLinkStatus = EStreaming;
+                iRecCounter = 0;
+                iLog->Log(_L("Start Uplink"));
+                }
+            else
+                {
+                iLog->Log(_L("UPL not ready"));
+                error = KErrNotReady;
+                }
+            }
         else if (startType == KTagDnlink)
-        	{
-        	if (iDnLinkStatus == EReady)
-        		{
-	            iVoIPDnlink->Start();
-	            iDnLinkStatus = EStreaming;
-	            iLog->Log(_L("Start Dnlink"));
-	            AddExpectedEvent(EFillBuffer, KMediumTimeout);
-        		}
-
-        	else
-        		{
-	            iLog->Log(_L("DNL not ready"));
-	            error = KErrNotReady;
-        		}
-        	}
+            {
+            if (iDnLinkStatus == EReady)
+                {
+                iVoIPDnlink->Start();
+                iDnLinkStatus = EStreaming;
+                iPlayCounter = 0;
+                iLog->Log(_L("Start Dnlink"));
+                }
+            else
+                {
+                iLog->Log(_L("DNL not ready"));
+                error = KErrNotReady;
+                }
+            }
         else
-        	{
-        	iLog->Log(KMsgBadTestParameters);
+            {
+            iLog->Log(KMsgBadTestParameters);
             error = KErrBadTestParameter;
-        	}
-    	}
+            }
+        }
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::Stop(CStifItemParser& aItem  )
-{
+TInt CVoIPAudioServicesTestClass::Stop(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Stop")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::Stop"));
     TInt error = KErrNone;
@@ -1183,48 +1118,47 @@
     TPtrC stopType;
     error = aItem.GetNextString(stopType);
     if (error == KErrNone)
-    	{
+        {
         if (stopType == KTagUplink)
-        	{
-        	if (iUpLinkStatus == EStreaming)
-        		{
-	            iVoIPUplink->Stop();
-	            iUpLinkStatus = EReady;
-	            iLog->Log(_L("Stop Uplink"));
-        		}
-        	else
-        		{
-	            iLog->Log(_L("UPL not started"));
-	            error = KErrNotReady;
-        		}
-        	}
+            {
+            if (iUpLinkStatus == EStreaming)
+                {
+                iVoIPUplink->Stop();
+                iUpLinkStatus = EReady;
+                iLog->Log(_L("Stop Uplink"));
+                }
+            else
+                {
+                iLog->Log(_L("UPL not started"));
+                error = KErrNotReady;
+                }
+            }
         else if (stopType == KTagDnlink)
-        	{
-        	if (iDnLinkStatus == EStreaming)
-        		{
-	            iVoIPDnlink->Stop();
-	            iDnLinkStatus = EReady;
-	            iLog->Log(_L("Stop Dnlink"));
-        		}
-        	else
-        		{
-        		iLog->Log(_L("DNL not started"));
-        		error = KErrNotReady;
-        		}
-        	}
+            {
+            if (iDnLinkStatus == EStreaming)
+                {
+                iVoIPDnlink->Stop();
+                iDnLinkStatus = EReady;
+                iLog->Log(_L("Stop Dnlink"));
+                }
+            else
+                {
+                iLog->Log(_L("DNL not started"));
+                error = KErrNotReady;
+                }
+            }
         else
-        	{
-        	iLog->Log(KMsgBadTestParameters);
+            {
+            iLog->Log(KMsgBadTestParameters);
             error = KErrBadTestParameter;
-        	}
-    	}
+            }
+        }
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::Gain(CStifItemParser& /*aItem */ )
-{
+TInt CVoIPAudioServicesTestClass::Gain(CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Gain")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::Gain"));
     TInt error = KErrNone;
@@ -1234,27 +1168,28 @@
     iLog->Log(_L("SetMaxGain: %d"), iMaxGain);
     iVoIPUplink->GetGain(iGain);
     if (iGain != iMaxGain)
-    	{
-        iLog->Log(_L("GetGain doesn't return expected MaxGain!!! returned Gain = %d"), iGain);
+        {
+        iLog->Log(_L("GetGain doesn't return expected MaxGain!!! returned Gain = %d"),
+                iGain);
         return KErrUnexpectedValue;
-    	}
+        }
 
     iVoIPUplink->SetGain(0);
     iLog->Log(_L("MuteMic"));
     iVoIPUplink->GetGain(iGain);
 
     if (iGain != 0)
-    	{
-        iLog->Log(_L("GetGain does not return expected Mute value!!! returned Gain = %d"), iGain);
+        {
+        iLog->Log(_L("GetGain does not return expected Mute value!!! returned Gain = %d"),
+                iGain);
         return KErrUnexpectedValue;
-    	}
+        }
 
-  return error;
-}
+    return error;
+    }
 
-
-TInt CVoIPAudioServicesTestClass::Volume(CStifItemParser& /*aItem */ )
-{
+TInt CVoIPAudioServicesTestClass::Volume(CStifItemParser& /*aItem */)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Volume")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::Volume"));
     TInt error = KErrNone;
@@ -1264,28 +1199,28 @@
     iLog->Log(_L("SetMaxVolume: %d"), iMaxVolume);
     iVoIPDnlink->GetVolume(iVolume);
     if (iVolume != iMaxVolume)
-    	{
-        iLog->Log(_L("GetVolume doesn't return expected MaxVolume!!! returned Volume = %d"), iVolume);
+        {
+        iLog->Log(_L("GetVolume doesn't return expected MaxVolume!!! returned Volume = %d"),
+                iVolume);
         return KErrUnexpectedValue;
-    	}
+        }
 
     iVoIPDnlink->SetVolume(0);
     iLog->Log(_L("Mute Volume"));
     iVoIPDnlink->GetVolume(iVolume);
 
     if (iVolume != 0)
-    	{
-        iLog->Log(_L("GetVolume does not return expected Mute value!!! returned Volume = %d"), iVolume);
+        {
+        iLog->Log(_L("GetVolume does not return expected Mute value!!! returned Volume = %d"),
+                iVolume);
         return KErrUnexpectedValue;
-    	}
+        }
 
-  return error;
-}
-
+    return error;
+    }
 
-
-TInt CVoIPAudioServicesTestClass::SetDevice(CStifItemParser& aItem  )
-{
+TInt CVoIPAudioServicesTestClass::SetDevice(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetDevice")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::SetDevice"));
     TInt error = KErrNone;
@@ -1293,44 +1228,46 @@
     TPtrC deviceType;
     error = aItem.GetNextString(deviceType);
     if (error == KErrNone)
-    	{
+        {
         if (deviceType == KTagHandset)
-        	{
-        	iVoIPDnlink->SetAudioDevice(CVoIPAudioDownlinkStream::EHandset);
-        	}
+            {
+            iVoIPDnlink->SetAudioDevice(CVoIPAudioDownlinkStream::EHandset);
+            }
         else if (deviceType == KTagLoudSpeaker)
-        	{
-        	iVoIPDnlink->SetAudioDevice(CVoIPAudioDownlinkStream::ELoudSpeaker);
-        	}
+            {
+            iVoIPDnlink->SetAudioDevice(
+                    CVoIPAudioDownlinkStream::ELoudSpeaker);
+            }
         else
-        	{
+            {
             iLog->Log(KMsgBadTestParameters);
             error = KErrBadTestParameter;
             return error;
-        	}
-    	}
+            }
+        }
 
     CVoIPAudioDownlinkStream::TVoIPOutputDevice device;
     iVoIPDnlink->GetAudioDevice(device);
-    if ((device == CVoIPAudioDownlinkStream::EHandset) && (deviceType == KTagHandset))
-    	{
+    if ((device == CVoIPAudioDownlinkStream::EHandset) &&
+            (deviceType == KTagHandset))
+        {
         iLog->Log(_L("Routing to Private Spkr"));
-    	}
-    else if((device == CVoIPAudioDownlinkStream::ELoudSpeaker) && (deviceType == KTagLoudSpeaker))
-    	{
+        }
+    else if ((device == CVoIPAudioDownlinkStream::ELoudSpeaker)
+            && (deviceType == KTagLoudSpeaker))
+        {
         iLog->Log(_L("Routing to Loudspeaker"));
-    	}
+        }
     else
-    	{
-    	iLog->Log(_L("SetDevice failed"));
-    	}
+        {
+        iLog->Log(_L("SetDevice failed"));
+        }
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::InitDTMFTonePlayer(CStifItemParser& aItem  )
-{
+TInt CVoIPAudioServicesTestClass::InitDTMFTonePlayer(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::InitDTMFTonePlayer")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::InitDTMFTonePlayer"));
     TInt error = KErrNone;
@@ -1338,74 +1275,79 @@
     TPtrC initLink;
     error = aItem.GetNextString(initLink);
     if (error == KErrNone)
-    	{
+        {
         if (initLink == KTagDnlink)
-        	{
-        	if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady || iDnLinkStatus == EStreaming))
-        		{
-        		error = iDTMFTonePlayerDn->AddVoIPAudioDownlinkStream(*iVoIPDnlink);
+            {
+            if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady
+                    || iDnLinkStatus == EStreaming))
+                {
+                error = iDTMFTonePlayerDn->AddVoIPAudioDownlinkStream(
+                        *iVoIPDnlink);
 
-        		if (error == KErrNone)
-        			{
-        			error = iDTMFTonePlayerDn->Open(*this); //sync call
-        			if (error == KErrNone)
-        				{
-        				iLog->Log(_L("DTMF DNL Initialized: error = %d"), error);
-        				AddExpectedEvent(EOpenCompleteDNL, KMediumTimeout);
-        				}
-        			}
+                if (error == KErrNone)
+                    {
+                    error = iDTMFTonePlayerDn->Open(*this); //sync call
+                    if (error == KErrNone)
+                        {
+                        iLog->Log(_L("DTMF DNL Initialized: error=%d"), error);
+                        AddExpectedEvent(EOpenCompleteDNL, KShortTimeout);
+                        }
+                    }
 
-        		if (error != KErrNone)
-        			{
-        			iLog->Log(_L("DTMF DNL-PLR Error"), error);
-        			}
-        		}
-        	else
-        		{
-        		iLog->Log(_L("Open DNL first"), KErrNotFound);
-        		}
-        	}
+                if (error != KErrNone)
+                    {
+                    iLog->Log(_L("DTMF DNL-PLR Error"), error);
+                    }
+                }
+            else
+                {
+                error = iDTMFTonePlayerDn->AddVoIPAudioDownlinkStream(
+                        *iVoIPDnlink);
+                iLog->Log(_L("Open NULL DNL"), error);
+                }
+            }
         else if (initLink == KTagUplink)
-        	{
-        	if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady || iUpLinkStatus == EStreaming))
-        		{
-        		error = iDTMFTonePlayerUp->AddVoIPAudioUplinkStream(*iVoIPUplink);
+            {
+            if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady
+                    || iUpLinkStatus == EStreaming))
+                {
+                error = iDTMFTonePlayerUp->AddVoIPAudioUplinkStream(
+                        *iVoIPUplink);
 
-        		if (error == KErrNone)
-        			{
-        			error = iDTMFTonePlayerUp->Open(*this); //sync call
-        			if (error == KErrNone)
-        				{
-		                iLog->Log(_L("DTMF UPL Initialized: error = %d"), error);
-		                AddExpectedEvent(EOpenCompleteUPL, KMediumTimeout);
-		                }
-        			}
+                if (error == KErrNone)
+                    {
+                    error = iDTMFTonePlayerUp->Open(*this); //sync call
+                    if (error == KErrNone)
+                        {
+                        iLog->Log(_L("DTMF UPL Initialized: error=%d"), error);
+                        AddExpectedEvent(EOpenCompleteUPL, KShortTimeout);
+                        }
+                    }
 
-        		if (error != KErrNone)
-        			{
-        			iLog->Log(_L("DTMF UPL-PLR Error"), error);
-        			}
-        		}
-        	else
-        		{
-        		iLog->Log(_L("Open UPL first"), KErrNotFound);
-        		}
-        	}
+                if (error != KErrNone)
+                    {
+                    iLog->Log(_L("DTMF UPL-PLR Error"), error);
+                    }
+                }
+            else
+                {
+                error = iDTMFTonePlayerUp->AddVoIPAudioUplinkStream(
+                        *iVoIPUplink);
+                iLog->Log(_L("Open NULL UPL"), error);
+                }
+            }
         else
-        	{
-        	iLog->Log(KMsgBadTestParameters);
-        	error = KErrBadTestParameter;
+            {
+            iLog->Log(KMsgBadTestParameters);
+            error = KErrBadTestParameter;
             }
+        }
+
+    return error;
     }
 
-    return error;
-}
-
-
-
-
-TInt CVoIPAudioServicesTestClass::DTMFTonePlay(CStifItemParser& aItem  )
-{
+TInt CVoIPAudioServicesTestClass::DTMFTonePlay(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::DTMFTonePlay")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::DTMFTonePlay"));
     TInt error = KErrNone;
@@ -1413,61 +1355,62 @@
     TPtrC initLink;
     error = aItem.GetNextString(initLink);
     if (error == KErrNone)
-    	{
+        {
         if (initLink == KTagDnlink)
-        	{
-        	if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady || iDnLinkStatus == EStreaming))
-        		{
-	            TChar tone1 = '0';
-	            TChar tone2 = '1';
-	            TChar tone3 = '2';
-	            TBufC<KTonesBufSize> tones;
-	            TPtr ptr = tones.Des();
-	            ptr.Append(tone1);
-	            ptr.Append(tone2);
-	            ptr.Append(tone3);
-	            iDTMFTonePlayerDn->Play(ptr);
-	            iLog->Log(_L("Start to play DTMF"));
-        		}
+            {
+            if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady
+                    || iDnLinkStatus == EStreaming))
+                {
+                TChar tone1 = '0';
+                TChar tone2 = '1';
+                TChar tone3 = '2';
+                TBufC<KTonesBufSize> tones;
+                TPtr ptr = tones.Des();
+                ptr.Append(tone1);
+                ptr.Append(tone2);
+                ptr.Append(tone3);
+                iDTMFTonePlayerDn->Play(ptr);
+                iLog->Log(_L("Start to play DTMF"));
+                }
             else
-            	{
-            	iLog->Log(_L("Open DNL first"), KErrNotFound);
-            	}
-        	}
+                {
+                iLog->Log(_L("Open DNL first"), KErrNotFound);
+                }
+            }
         else if (initLink == KTagUplink)
-        	{
-        	if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady || iUpLinkStatus == EStreaming))
-        		{
-	            TChar tone1 = '9';
-	            TChar tone2 = '8';
-	            TChar tone3 = '7';
-	            TBufC<KTonesBufSize> tones;
-	            TPtr ptr = tones.Des();
-	            ptr.Append(tone1);
-	            ptr.Append(tone2);
-	            ptr.Append(tone3);
+            {
+            if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady
+                    || iUpLinkStatus == EStreaming))
+                {
+                TChar tone1 = '9';
+                TChar tone2 = '8';
+                TChar tone3 = '7';
+                TBufC<KTonesBufSize> tones;
+                TPtr ptr = tones.Des();
+                ptr.Append(tone1);
+                ptr.Append(tone2);
+                ptr.Append(tone3);
 
-	            iDTMFTonePlayerUp->Play(ptr);
-	            iLog->Log(_L("Start to play DTMF"));
-        		}
+                iDTMFTonePlayerUp->Play(ptr);
+                iLog->Log(_L("Start to play DTMF"));
+                }
             else
-	            {
-	            iLog->Log(_L("Open UPL first"), KErrNotFound);
-	            }
-        	}
+                {
+                iLog->Log(_L("Open UPL first"), KErrNotFound);
+                }
+            }
         else
-        	{
-        	iLog->Log(KMsgBadTestParameters);
-        	error = KErrBadTestParameter;
+            {
+            iLog->Log(KMsgBadTestParameters);
+            error = KErrBadTestParameter;
             }
+        }
+
+    return error;
     }
 
-    return error;
-}
-
-
-TInt CVoIPAudioServicesTestClass::CloseDTMFPlayer(CStifItemParser& aItem  )
-{
+TInt CVoIPAudioServicesTestClass::CloseDTMFPlayer(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CloseDTMFPlayer")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::CloseDTMFPlayer"));
     TInt error = KErrNone;
@@ -1475,47 +1418,50 @@
     TPtrC closedLink;
     error = aItem.GetNextString(closedLink);
     if (error == KErrNone)
-    	{
+        {
         if (closedLink == KTagDnlink)
-        	{
-            if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady || iDnLinkStatus == EStreaming))
-            	{
+            {
+            if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady ||
+                    iDnLinkStatus == EStreaming))
+                {
                 iDTMFTonePlayerDn->Close();
-                error = iDTMFTonePlayerDn->RemoveVoIPAudioDownlinkStream(*iVoIPDnlink);
+                error = iDTMFTonePlayerDn->RemoveVoIPAudioDownlinkStream(
+                        *iVoIPDnlink);
                 iLog->Log(_L("DTMF DNL Closed: error = %d"), error);
-            	}
+                }
             else
-            	{
-            	iLog->Log(_L("DTMF DNL-PLR not open"), KErrNotFound);
-            	}
-        	}
+                {
+                iLog->Log(_L("DTMF DNL-PLR not open"), KErrNotFound);
+                }
+            }
         else if (closedLink == KTagUplink)
-        	{
-            if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady || iUpLinkStatus == EStreaming))
-            	{
+            {
+            if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady
+                    || iUpLinkStatus == EStreaming))
+                {
                 iDTMFTonePlayerUp->Close();
-                error = iDTMFTonePlayerUp->RemoveVoIPAudioUplinkStream(*iVoIPUplink);
+                error = iDTMFTonePlayerUp->RemoveVoIPAudioUplinkStream(
+                        *iVoIPUplink);
                 iLog->Log(_L("DTMF UPL Closed: error = %d"), error);
-            	}
+                }
             else
-            	{
-            	iLog->Log(_L("DTMF UPL-PLR not open"), KErrNotFound);
-            	}
-        	}
+                {
+                iLog->Log(_L("DTMF UPL-PLR not open"), KErrNotFound);
+                }
+            }
         else
-        	{
+            {
             iLog->Log(KMsgBadTestParameters);
             error = KErrBadTestParameter;
-        	}
-    }
+            }
+        }
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::StopDTMFTonePlayer( CStifItemParser& aItem )
-{
-	FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::StopDTMFTonePlayer")));
+TInt CVoIPAudioServicesTestClass::StopDTMFTonePlayer(CStifItemParser& aItem)
+    {
+    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::StopDTMFTonePlayer")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::StopDTMFTonePlay"));
     TInt error = KErrNone;
 
@@ -1524,28 +1470,27 @@
     if (error == KErrNone)
         {
         if (stopLink == KTagDnlink)
-        	{
-        	iDTMFTonePlayerDn->Stop();
-        	iLog->Log(_L("DTMF DNL Stoped"));
-        	}
+            {
+            iDTMFTonePlayerDn->Stop();
+            iLog->Log(_L("DTMF DNL Stoped"));
+            }
         else if (stopLink == KTagUplink)
-        	{
-        	iDTMFTonePlayerUp->Stop();
-        	iLog->Log(_L("DTMF UPL Stoped"));
-        	}
+            {
+            iDTMFTonePlayerUp->Stop();
+            iLog->Log(_L("DTMF UPL Stoped"));
+            }
         else
-        	{
-        	iLog->Log(KMsgBadTestParameters);
-        	error = KErrBadTestParameter;
+            {
+            iLog->Log(KMsgBadTestParameters);
+            error = KErrBadTestParameter;
             }
         }
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::InitRingTonePlayer(CStifItemParser& aItem  )
-{
+TInt CVoIPAudioServicesTestClass::InitRingTonePlayer(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::InitRingTonePlayer")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::InitRingTonePlayer"));
     TInt error = KErrNone;
@@ -1554,229 +1499,207 @@
     TPtrC fileType;
     error = aItem.GetNextString(fileType);
     if (error == KErrNone && iRingTonePlayer)
-    	{
+        {
         if (fileType == KTagFile)
-        	{
-        	iLog->Log(_L("InitRingTonePlayerFromFile"));
-        	error = aItem.GetNextString(file);
-        	if (error == KErrNone)
-        		{
-        		if (file == KTagFile1)
-        			{
-        			TBufC<KMaxFileName> file(KTestFile1);
-        			error = iRingTonePlayer->Open(*this, file.Des());
-        			AddExpectedEvent(EOpenComplete, KMediumTimeout);
-        			}
-        		else if (file == KTagFile2)
-        			{
-        			TBufC<KMaxFileName> file(KTestFile2);
-        			error = iRingTonePlayer->Open(*this, file.Des());
-        			AddExpectedEvent(EOpenComplete, KMediumTimeout);
-        			}
-        		}
-        	else
-        		{
-        		iLog->Log(KMsgBadTestParameters);
-        		error = KErrBadTestParameter;
-        		}
-        	}
+            {
+            iLog->Log(_L("InitRingTonePlayerFromFile"));
+            error = aItem.GetNextString(file);
+            if (error == KErrNone)
+                {
+                if (file == KTagFile1)
+                    {
+                    TBufC<KMaxFileName> file(KTestFile1);
+                    error = iRingTonePlayer->Open(*this, file.Des());
+                    AddExpectedEvent(EOpenComplete, KShortTimeout);
+                    }
+                }
+            else
+                {
+                iLog->Log(KMsgBadTestParameters);
+                error = KErrBadTestParameter;
+                }
+            }
 
         else if (fileType == KTagRFile)
-        	{
-        	iLog->Log(_L("InitRingTonePlayerFromRFile"));
-        	error = iFs.Connect();
+            {
+            iLog->Log(_L("InitRingTonePlayerFromRFile"));
+            error = iFs.Connect();
 
-        	if (error == KErrNone)
-	        	{
-	            error = iFs.ShareProtected();
-	        	}
+            if (error == KErrNone)
+                {
+                error = iFs.ShareProtected();
+                }
 
-	        if (error == KErrNone)
-	        	{
-	        	error = aItem.GetNextString(file);
-	        	if (error == KErrNone)
-	        		{
-	        		if (file == KTagFile1)
-	        			{
-	        			error = iRTFile.Open(iFs, KTestFile1, EFileRead);
-	        			}
-	        		else if (file == KTagFile2)
-	        			{
-	        			error = iRTFile.Open(iFs, KTestFile2, EFileRead);
-	        			}
-	        		}
-	        	else
-	        		{
-	        		iLog->Log(KMsgBadTestParameters);
-	        		error = KErrBadTestParameter;
-	        		}
+            if (error == KErrNone)
+                {
+                error = aItem.GetNextString(file);
+                if (error == KErrNone)
+                    {
+                    if (file == KTagFile1)
+                        {
+                        error = iRTFile.Open(iFs, KTestFile1, EFileRead);
+                        }
+                    }
+                else
+                    {
+                    iLog->Log(KMsgBadTestParameters);
+                    error = KErrBadTestParameter;
+                    }
 
-	        	if (error == KErrNone)
-	        		{
-	                error = iRingTonePlayer->Open(*this, iRTFile);
-	                AddExpectedEvent(EOpenComplete, KMediumTimeout);
-	        		}
-	        	}
-        	}
+                if (error == KErrNone)
+                    {
+                    error = iRingTonePlayer->Open(*this, iRTFile);
+                    AddExpectedEvent(EOpenComplete, KShortTimeout);
+                    }
+                }
+            }
 
-	    else if (fileType == KTagProfile)
-	    	{
-	    	iLog->Log(_L("InitRingTonePlayerFromProfile"));
-	    	error = iRingTonePlayer->Open(*this);
-	    	AddExpectedEvent(EOpenComplete, KMediumTimeout);
-	    	}
+        else if (fileType == KTagProfile)
+            {
+            iLog->Log(_L("InitRingTonePlayerFromProfile"));
+            error = iRingTonePlayer->Open(*this);
+            AddExpectedEvent(EOpenComplete, KShortTimeout);
+            }
 
-	    else if (fileType == KTagDesL)
-	    	{
-	    	iLog->Log(_L("InitRingTonePlayerFromDesL"));
-	        TBufC8<KMimeStringSize> mimeType;
-	        TPtr8 pMime = mimeType.Des();
-	        pMime.Copy(KMimetypeWAV);
-	        error = iFs.Connect();
+        else if (fileType == KTagDesL)
+            {
+            iLog->Log(_L("InitRingTonePlayerFromDesL"));
+            TBufC8<KMimeStringSize> mimeType;
+            TPtr8 pMime = mimeType.Des();
+            pMime.Copy(KMimetypeWAV);
+            error = iFs.Connect();
 
-	        if (error == KErrNone)
-	        	{
-	            error = iRTFile.Open(iFs, KTestFile3, EFileRead);
-	            if (error == KErrNone)
-	                {
-	                TInt size;
-	                iRTFile.Size(size);
-	                HBufC8* tone = HBufC8::NewLC(size);
-	                TPtr8 pTone = tone->Des();
-	                iRTFile.Read(pTone);
-	                iRTFile.Close();
-	                error = iRingTonePlayer->Open(*this, pTone, pMime);
-	                CleanupStack::PopAndDestroy(tone);
-	                AddExpectedEvent(EOpenComplete, KMediumTimeout);
-	                }
-	            else
-	            	{
-	            	iLog->Log(_L("RT Open from DesL failed"));
-	            	}
-	            iFs.Close();
-	        	}
-
-	        else
-	        	{
-	        	iLog->Log(_L("RT Connect failed"));
-	        	}
-
-	    	}
-
-	    else
-	        {
-	        iLog->Log(KMsgBadTestParameters);
-	        error = KErrBadTestParameter;
-	        }
-    	}
-
+            if (error == KErrNone)
+                {
+                error = iRTFile.Open(iFs, KTestFile1, EFileRead);
+                if (error == KErrNone)
+                    {
+                    TInt size;
+                    iRTFile.Size(size);
+                    HBufC8* tone = HBufC8::NewLC(size / 5);
+                    TPtr8 pTone = tone->Des();
+                    iRTFile.Read(pTone, size / 5);
+                    error = iRingTonePlayer->Open(*this, pTone, pMime);
+                    CleanupStack::PopAndDestroy(tone);
+                    AddExpectedEvent(EOpenComplete, KShortTimeout);
+                    }
+                else
+                    {
+                    iLog->Log(_L("RT Open from DesL failed"));
+                    }
+                iRTFile.Close();
+                }
+            else
+                {
+                iLog->Log(_L("RT Connect failed"));
+                }
+            iFs.Close();
+            }
+        else
+            {
+            iLog->Log(KMsgBadTestParameters);
+            error = KErrBadTestParameter;
+            }
+        }
     else
-    	{
+        {
         if (!iRingTonePlayer)
-        	{
+            {
             iLog->Log(_L("RT PLR Open failed"));
-        	}
-    	}
+            }
+        }
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::CloseRingTonePlayer(CStifItemParser& /*aItem*/  )
-{
+TInt CVoIPAudioServicesTestClass::CloseRingTonePlayer(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CloseRingTonePlayer")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::CloseRingTonePlayer"));
     TInt error = KErrNone;
 
-  if (iRingTonePlayer)
-	  {
-      iRTFile.Close();
-      iFs.Close();
-      iRingTonePlayer->Close();
+    if (iRingTonePlayer)
+        {
+        iRTFile.Close();
+        iFs.Close();
+        iRingTonePlayer->Close();
+        iLog->Log(_L("RT Player Closed"));
+        }
+    else
+        {
+        iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
+        }
 
-      iLog->Log(_L("RT Player Closed"));
-	  }
-  else
-	  {
-      iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
-	  }
+    return error;
+    }
 
-  return error;
-}
-
-
-
-TInt CVoIPAudioServicesTestClass::PlayRingTone( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::PlayRingTone(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::PlayRingTone")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::PlayRingTone"));
     TInt error = KErrNone;
 
     if (iRingTonePlayer)
-    	{
+        {
         iRingTonePlayer->Play();
-        AddExpectedEvent(EPlaybackComplete, KLongTimeout);  // Played ringing tone file has to be shorter than KLongTimeout
-    	}
-  else
-	  {
-      iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
-      error = KErrNotFound;
-	  }
+        AddExpectedEvent(EPlaybackComplete, KLongTimeout);
+        // Played ringing tone file has to be shorter than KLongTimeout
+        }
+    else
+        {
+        iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
+        error = KErrNotFound;
+        }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::PauseRingTone( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::PauseRingTone(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::PauseRingTone")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::PauseRingTone"));
     TInt error = KErrNone;
 
     if (iRingTonePlayer)
-    	{
+        {
         iRingTonePlayer->Pause();
-    	}
+        }
     else
-	  {
-      iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
-      error = KErrNotFound;
-	  }
+        {
+        iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
+        error = KErrNotFound;
+        }
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::ResumeRingTone( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::ResumeRingTone(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ResumeRingTone")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::ResumeRingTone"));
     TInt error = KErrNone;
 
     if (iRingTonePlayer)
-    	{
+        {
         iRingTonePlayer->Resume();
-    	}
+        }
     else
-    	{
-    	iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
-    	error = KErrNotFound;
-    	}
+        {
+        iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
+        error = KErrNotFound;
+        }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::GetSupportedBitrates( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::GetSupportedBitrates(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetSupportedBitrates")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetSupportedBitrates"));
     TInt error = KErrNone;
 
     iBitratesArray.Reset();
-    GetSupportedBitrates(iBitratesArray);
+    error = GetSupportedBitrates(iBitratesArray);
 
     TInt numOfItems = iBitratesArray.Count();
 
@@ -1786,42 +1709,42 @@
         }
 
     return error;
-}
-
-
+    }
 
 // ----------------------------------------------------------------------------
 // CVoIPTestEngine::GetSupportedBitrates
 //
 // ----------------------------------------------------------------------------
 //
-void CVoIPAudioServicesTestClass::GetSupportedBitrates(RArray<TUint>& aBrArr)
-{
+TInt CVoIPAudioServicesTestClass::GetSupportedBitrates(RArray<TUint>& aBrArr)
+    {
+    TInt error = KErrNone;
+
     switch (iUpLinkCodec)
         {
         case EG711:
-            iG711EncFormatIntfc->GetSupportedBitRates(aBrArr);
+            error = iG711EncFormatIntfc->GetSupportedBitRates(aBrArr);
             break;
         case EG729:
-            iG729EncFormatIntfc->GetSupportedBitRates(aBrArr);
+            error = iG729EncFormatIntfc->GetSupportedBitRates(aBrArr);
             break;
         case EILBC:
-            iILBCEncFormatIntfc->GetSupportedBitRates(aBrArr);
+            error = iILBCEncFormatIntfc->GetSupportedBitRates(aBrArr);
             break;
         case EAMR_NB:
-            iAMRNBEncFormatIntfc->GetSupportedBitRates(aBrArr);
+            error = iAMRNBEncFormatIntfc->GetSupportedBitRates(aBrArr);
             break;
-        case EPCM16:
-            iPCM16EncFormatIntfc->GetSupportedBitRates(aBrArr);
+        case EPCM16: //Not supported
+            error = iPCM16EncFormatIntfc->GetSupportedBitRates(aBrArr);
             break;
         default:
             break;
         }
-}
-
+    return error;
+    }
 
-TInt CVoIPAudioServicesTestClass::SetBitrate( CStifItemParser& aItem )
-{
+TInt CVoIPAudioServicesTestClass::SetBitrate(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetBitrate")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::SetBitrate"));
     TInt error = KErrNone;
@@ -1829,125 +1752,131 @@
     TPtrC bitRate;
     error = aItem.GetNextString(bitRate);
     if (error == KErrNone)
-    	{
+        {
         if (bitRate == KTagMin)
-        	{
-        	if (iBitratesArray.Count() > 0)
-        		{
-	            iBitrate = iBitratesArray[0];
-	            SetBitrate(iBitrate);
-	            iLog->Log(_L("BR set %d"), iBitrate);
-        		}
-        	}
+            {
+            if (iBitratesArray.Count() > 0)
+                {
+                iBitrate = iBitratesArray[0];
+                error = SetBitrate(iBitrate);
+                iLog->Log(_L("BR set %d"), iBitrate);
+                }
+            }
         else if (bitRate == KTagMax)
-        	{
-        	TInt numOfItems = iBitratesArray.Count();
+            {
+            TInt numOfItems = iBitratesArray.Count();
             if (numOfItems > 0)
-            	{
-	            iBitrate = iBitratesArray[numOfItems-1];
-	            SetBitrate(iBitrate);
-	            iLog->Log(_L("BR set %d"), iBitrate);
-            	}
-        	}
-        else
-        	{
-        	iLog->Log(KMsgBadTestParameters);
-        	error = KErrBadTestParameter;
-        	}
-    	}
+                {
+                iBitrate = iBitratesArray[numOfItems - 1];
+                error = SetBitrate(iBitrate);
+                iLog->Log(_L("BR set %d"), iBitrate);
+                }
+            }
+        }
+    else if (error == KErrNotFound) //No parameter
+
+        {
+        // Fail case - setting random bitrate
+        error = SetBitrate(1234);
+        iLog->Log(_L("Random BR set"));
+        }
 
     return error;
-}
-
+    }
 
 // ----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::SetBitrate
 //
 // ----------------------------------------------------------------------------
 //
-void CVoIPAudioServicesTestClass::SetBitrate(TUint aBitrate)
-{
+TInt CVoIPAudioServicesTestClass::SetBitrate(TUint aBitrate)
+    {
+    TInt error = KErrNone;
+
     switch (iUpLinkCodec)
         {
         case EG711:
-            iG711EncFormatIntfc->SetBitRate(aBitrate);
+            error = iG711EncFormatIntfc->SetBitRate(aBitrate);
             break;
         case EG729:
-            iG729EncFormatIntfc->SetBitRate(aBitrate);
+            error = iG729EncFormatIntfc->SetBitRate(aBitrate);
             break;
         case EILBC:
-            iILBCEncFormatIntfc->SetBitRate(aBitrate);
+            error = iILBCEncFormatIntfc->SetBitRate(aBitrate);
             break;
         case EAMR_NB:
-            iAMRNBEncFormatIntfc->SetBitRate(aBitrate);
+            error = iAMRNBEncFormatIntfc->SetBitRate(aBitrate);
             break;
-        case EPCM16:
-            iPCM16EncFormatIntfc->SetBitRate(aBitrate);
+        case EPCM16: //Fail case
+            error = iPCM16EncFormatIntfc->SetBitRate(aBitrate);
+            AddExpectedEvent(EUplinkError, KShortTimeout);
             break;
         default:
             break;
         }
 
     iLog->Log(_L("Set Uplink BR: %d "), iBitrate);
-}
-
-
+    return error;
+    }
 
-
-TInt CVoIPAudioServicesTestClass::GetBitrate( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::GetBitrate(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetBitrate")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetBitrate"));
     TInt error = KErrNone;
 
     TUint currentBitrate;
-    GetBitrate(currentBitrate);
-    iLog->Log(_L("Current BR: %d"), currentBitrate);
-    if (iBitrate != currentBitrate)
-    	{
-        iLog->Log(_L("returned bitRate doesn't match set bitRate: Failed"));
-        error = KErrUnexpectedValue;
-    	}
+    error = GetBitrate(currentBitrate);
+    if (error == KErrNone)
+        {
+        iLog->Log(_L("Current BR: %d"), currentBitrate);
+        if (iBitrate != currentBitrate)
+            {
+            iLog->Log(
+                    _L("returned bitRate doesn't match set bitRate: Failed"));
+            error = KErrUnexpectedValue;
+            }
+        }
 
     return error;
-}
-
+    }
 
 // ----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::GetBitrate
 //
 // ----------------------------------------------------------------------------
 //
-void CVoIPAudioServicesTestClass::GetBitrate(TUint& aBitrate)
-{
+TInt CVoIPAudioServicesTestClass::GetBitrate(TUint& aBitrate)
+    {
+    TInt error = KErrNotSupported;
+
     switch (iUpLinkCodec)
         {
         case EG711:
-            iG711EncFormatIntfc->GetBitRate(aBitrate);
+            error = iG711EncFormatIntfc->GetBitRate(aBitrate);
             break;
         case EG729:
-            iG729EncFormatIntfc->GetBitRate(aBitrate);
+            error = iG729EncFormatIntfc->GetBitRate(aBitrate);
             break;
         case EILBC:
-            iILBCEncFormatIntfc->GetBitRate(aBitrate);
+            error = iILBCEncFormatIntfc->GetBitRate(aBitrate);
             break;
         case EAMR_NB:
-            iAMRNBEncFormatIntfc->GetBitRate(aBitrate);
+            error = iAMRNBEncFormatIntfc->GetBitRate(aBitrate);
             break;
-        case EPCM16:
-            iPCM16EncFormatIntfc->GetBitRate(aBitrate);
+        case EPCM16: //Not supported
+            error = iPCM16EncFormatIntfc->GetBitRate(aBitrate);
             break;
         default:
             break;
         }
 
     iLog->Log(_L("Get Uplink BR: %d "), aBitrate);
-}
-
+    return error;
+    }
 
-
-TInt CVoIPAudioServicesTestClass::GetVAD( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::GetVAD(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetVAD")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetVAD"));
     TInt error = KErrNone;
@@ -1955,7 +1884,7 @@
     TBool aVad;
 
     switch (iUpLinkCodec)
-    	{
+        {
         case EG711:
             error = iG711EncFormatIntfc->GetVAD(aVad);
             break;
@@ -1968,36 +1897,34 @@
         case EAMR_NB:
             error = iAMRNBEncFormatIntfc->GetVAD(aVad);
             break;
-        case EPCM16:
+        case EPCM16: //Not supported
             error = iPCM16EncFormatIntfc->GetVAD(aVad);
             break;
         default:
             break;
-    	}
+        }
 
-     iLog->Log(_L("get VAD: %d"), aVad);
+    iLog->Log(_L("get VAD: %d"), aVad);
 
-     if (aVad != iVad)
+    if (aVad != iVad)
         {
         iLog->Log(_L("returned VAD doesn't match set VAD: Failed"));
         error = KErrUnexpectedValue;
         }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::ToggleVAD( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::ToggleVAD(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ToggleVAD")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::ToggleVAD"));
     TInt error = KErrNone;
 
-    iVad = (iVad)? EFalse : ETrue;
+    iVad = (iVad) ? EFalse : ETrue;
 
     switch (iUpLinkCodec)
-    	{
+        {
         case EG711:
             error = iG711EncFormatIntfc->SetVAD(iVad);
             break;
@@ -2010,68 +1937,71 @@
         case EAMR_NB:
             error = iAMRNBEncFormatIntfc->SetVAD(iVad);
             break;
-        case EPCM16:
+        case EPCM16: //Fail case
             error = iPCM16EncFormatIntfc->SetVAD(iVad);
+            AddExpectedEvent(EUplinkError, KShortTimeout);
             break;
         default:
             break;
-    	}
+        }
 
     iLog->Log(_L("VAD set: %d"), iVad);
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::GetFrameMode( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::GetFrameMode(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetFrameMode")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetFrameMode"));
     TInt error = KErrNone;
 
-    TBool aFrameMode = EFalse;
+    TBool frameMode = EFalse;
     switch (iDnLinkCodec)
         {
         case EG711:
-            error = iG711DecFormatIntfc->GetFrameMode(aFrameMode);
-            iLog->Log(_L("FrameMode: %d"), aFrameMode);
+            error = iG711DecFormatIntfc->GetFrameMode(frameMode);
+            iLog->Log(_L("FrameMode: %d"), frameMode);
             break;
         case EG729:
-            error = iG729DecFormatIntfc->GetFrameMode(aFrameMode);
-            iLog->Log(_L("FrameMode: %d"), aFrameMode);
+            error = iG729DecFormatIntfc->GetFrameMode(frameMode);
+            iLog->Log(_L("FrameMode: %d"), frameMode);
             break;
         case EILBC:
-            error = iILBCDecFormatIntfc->GetFrameMode(iFrameMode);
-            iLog->Log(_L("FrameMode: %d"), aFrameMode);
+            error = iILBCDecFormatIntfc->GetFrameMode(frameMode);
+            iLog->Log(_L("FrameMode: %d"), frameMode);
             break;
         case EAMR_NB:
-            error = iAMRNBDecFormatIntfc->GetFrameMode(iFrameMode);
-            iLog->Log(_L("FrameMode: %d"), aFrameMode);
+            error = iAMRNBDecFormatIntfc->GetFrameMode(frameMode);
+            iLog->Log(_L("FrameMode: %d"), frameMode);
             break;
         case EPCM16:
+            error = iPCM16DecFormatIntfc->GetFrameMode(frameMode);
+            break;
         default:
             break;
         }
 
-      if (aFrameMode != iFrameMode)
-    	  {
-    	  iLog->Log(_L("returned FrameMode doesn't match set FrameMode: Failed"));
-    	  error = KErrUnexpectedValue;
-    	  }
+    if (error == KErrNone)
+        {
+        if (frameMode != iFrameMode)
+            {
+            iLog->Log(
+                    _L("returned FrameMode doesn't match set FrameMode: Failed"));
+            error = KErrUnexpectedValue;
+            }
+        }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::ToggleFrameMode( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::ToggleFrameMode(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ToggleFrameMode")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::ToggleFrameMode"));
     TInt error = KErrNone;
 
-    iFrameMode = (iFrameMode)? EFalse : ETrue;
+    iFrameMode = (iFrameMode) ? EFalse : ETrue;
 
     switch (iDnLinkCodec)
         {
@@ -2091,18 +2021,19 @@
             error = iAMRNBDecFormatIntfc->SetFrameMode(iFrameMode);
             iLog->Log(_L("FrameMode Set: %d"), iFrameMode);
             break;
-        case EPCM16:
+        case EPCM16: //Fail case
+            AddExpectedEvent(EDownlinkError, KShortTimeout);
+            error = iPCM16DecFormatIntfc->SetFrameMode(iFrameMode);
+            break;
         default:
             break;
         }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC"));
     TInt error = KErrNone;
@@ -2110,37 +2041,43 @@
     switch (iDnLinkCodec)
         {
         case EG711:
-            error = iG711DecFormatIntfc->FrameModeRequiredForErrorConcealment(
-                                 iFrameModeReqEC);
+            error
+                    = iG711DecFormatIntfc->FrameModeRequiredForErrorConcealment(
+                            iFrameModeReqEC);
             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
             break;
         case EG729:
-            error = iG729DecFormatIntfc->FrameModeRequiredForErrorConcealment(
-                                 iFrameModeReqEC);
+            error
+                    = iG729DecFormatIntfc->FrameModeRequiredForErrorConcealment(
+                            iFrameModeReqEC);
             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
             break;
         case EILBC:
-            error = iILBCDecFormatIntfc->FrameModeRequiredForErrorConcealment(
-                                 iFrameModeReqEC);
+            error
+                    = iILBCDecFormatIntfc->FrameModeRequiredForErrorConcealment(
+                            iFrameModeReqEC);
             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
             break;
         case EAMR_NB:
-            error = iAMRNBDecFormatIntfc->FrameModeRequiredForErrorConcealment(
-                                  iFrameModeReqEC);
+            error
+                    = iAMRNBDecFormatIntfc->FrameModeRequiredForErrorConcealment(
+                            iFrameModeReqEC);
             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
             break;
-        case EPCM16:
+        case EPCM16: //Not supported
+            error
+                    = iPCM16DecFormatIntfc->FrameModeRequiredForErrorConcealment(
+                            iFrameModeReqEC);
+            break;
         default:
             break;
         }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::ConcealErrForNextBuf( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::ConcealErrForNextBuf(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ConcealErrForNextBuf")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::ConcealErrForNextBuf"));
     TInt error = KErrNone;
@@ -2163,18 +2100,19 @@
             error = iAMRNBDecFormatIntfc->ConcealErrorForNextBuffer();
             iLog->Log(_L("Conceal Error for next buf"));
             break;
-        case EPCM16:
+        case EPCM16: //Fail case
+            AddExpectedEvent(EDownlinkError, KShortTimeout);
+            error = iPCM16DecFormatIntfc->ConcealErrorForNextBuffer();
+            break;
         default:
             break;
         }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::GetMode( CStifItemParser& aItem )
-{
+TInt CVoIPAudioServicesTestClass::GetMode(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetMode")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetMode"));
     TInt error = KErrNone;
@@ -2182,91 +2120,88 @@
     TPtrC linkType;
     error = aItem.GetNextString(linkType);
     if (error == KErrNone)
-    	{
-        if ((linkType == KTagUplink)&&(iUpLinkCodec == EG711))
-        	{
-        	CVoIPFormatIntfc::TG711CodecMode aMode;
-        	iG711EncFormatIntfc->GetMode(aMode);
-        	if (aMode == CVoIPFormatIntfc::EG711ALaw)
-        		{
-        		iLog->Log(_L("UPL Mode: aLaw"));
-        		}
+        {
+        if ((linkType == KTagUplink) && (iUpLinkCodec == EG711))
+            {
+            CVoIPFormatIntfc::TG711CodecMode aMode;
+            iG711EncFormatIntfc->GetMode(aMode);
+            if (aMode == CVoIPFormatIntfc::EG711ALaw)
+                {
+                iLog->Log(_L("UPL Mode: aLaw"));
+                }
             else if (aMode == CVoIPFormatIntfc::EG711uLaw)
-            	{
-            	iLog->Log(_L("UPL Mode: uLaw"));
-            	}
+                {
+                iLog->Log(_L("UPL Mode: uLaw"));
+                }
             else
-            	{
+                {
                 iLog->Log(_L("UPL Mode: unknown"));
-            	}
-        	}
-        else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC) )
-        	{
-        	CVoIPFormatIntfc::TILBCCodecMode aMode;
+                }
+            }
+        else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC))
+            {
+            CVoIPFormatIntfc::TILBCCodecMode aMode;
             iILBCEncFormatIntfc->GetMode(aMode);
             if (aMode == CVoIPFormatIntfc::EiLBC20mSecFrame)
-            	{
+                {
                 iLog->Log(_L("UPL Mode: 20ms frame"));
-            	}
+                }
             else if (aMode == CVoIPFormatIntfc::EiLBC30mSecFrame)
-            	{
+                {
                 iLog->Log(_L("UPL Mode: 30ms frame"));
-            	}
+                }
             else
-            	{
+                {
                 iLog->Log(_L("UPL Mode: unknown"));
-            	}
-        	}
-        else if ((linkType == KTagDnlink)&&(iDnLinkCodec == EG711))
-        	{
-        	CVoIPFormatIntfc::TG711CodecMode aMode;
-        	iG711DecFormatIntfc->GetMode(aMode);
-        	if (aMode == CVoIPFormatIntfc::EG711ALaw)
-	            {
-	            iLog->Log(_L("DNL Mode: aLaw"));
-	            }
+                }
+            }
+        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711))
+            {
+            CVoIPFormatIntfc::TG711CodecMode aMode;
+            iG711DecFormatIntfc->GetMode(aMode);
+            if (aMode == CVoIPFormatIntfc::EG711ALaw)
+                {
+                iLog->Log(_L("DNL Mode: aLaw"));
+                }
             else if (aMode == CVoIPFormatIntfc::EG711uLaw)
-	            {
-	            iLog->Log(_L("DNL Mode: uLaw"));
-	            }
+                {
+                iLog->Log(_L("DNL Mode: uLaw"));
+                }
             else
-            	{
+                {
                 iLog->Log(_L("DNL Mode: unknown"));
-            	}
-        	}
-        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) )
-        	{
-        	CVoIPFormatIntfc::TILBCCodecMode aMode;
+                }
+            }
+        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC))
+            {
+            CVoIPFormatIntfc::TILBCCodecMode aMode;
             iILBCDecFormatIntfc->GetMode(aMode);
             if (aMode == CVoIPFormatIntfc::EiLBC20mSecFrame)
-            	{
+                {
                 iLog->Log(_L("DNL Mode: 20ms frame"));
-            	}
+                }
             else if (aMode == CVoIPFormatIntfc::EiLBC30mSecFrame)
-            	{
+                {
                 iLog->Log(_L("DNL Mode: 30ms frame"));
-            	}
+                }
             else
-            	{
+                {
                 iLog->Log(_L("DNL Mode: unknown"));
-            	}
-        	}
+                }
+            }
         else
-        	{
-        	iLog->Log(KMsgBadTestParameters);
+            {
+            iLog->Log(KMsgBadTestParameters);
             error = KErrBadTestParameter;
-        	}
+            }
 
-    	}
+        }
 
     return error;
-}
-
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::SetMode( CStifItemParser& aItem )
-{
+TInt CVoIPAudioServicesTestClass::SetMode(CStifItemParser& aItem)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetMode")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::SetMode"));
     TInt error = KErrNone;
@@ -2274,68 +2209,74 @@
     TPtrC linkType;
     error = aItem.GetNextString(linkType);
     if (error != KErrNone)
-    	{
+        {
         return error;
-    	}
+        }
 
     TPtrC mode;
     error = aItem.GetNextString(mode);
     if (error == KErrNone)
-    	{
-        if ((linkType == KTagUplink) && (iUpLinkCodec == EG711) && (mode == KTagALaw))
-        	{
-	        iG711EncFormatIntfc->SetMode(CVoIPFormatIntfc::EG711ALaw);
-	        iLog->Log(_L("UPL Mode Set: aLaw"));
-        	}
-        else if ((linkType == KTagUplink) && (iUpLinkCodec == EG711) && (mode == KTagULaw))
-        	{
-        	iG711EncFormatIntfc->SetMode(CVoIPFormatIntfc::EG711uLaw);
-        	iLog->Log(_L("UPL Mode Set: uLaw"));
-        	}
-        else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC)&& (mode == KTag20ms ))
-        	{
-        	iILBCEncFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC20mSecFrame);
-        	iLog->Log(_L("UPL Mode Set: 20ms frame"));
-        	}
-        else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC)&& (mode == KTag30ms ))
-        	{
-        	iILBCEncFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC30mSecFrame);
-        	iLog->Log(_L("UPL Mode Set: 30ms frame"));
-        	}
-        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711) && (mode == KTagALaw) )
-        	{
-        	iG711DecFormatIntfc->SetMode(CVoIPFormatIntfc::EG711ALaw);
-        	iLog->Log(_L("DNL Mode Set: aLaw"));
-        	}
-        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711) && (mode == KTagULaw) )
-        	{
-        	iG711DecFormatIntfc->SetMode(CVoIPFormatIntfc::EG711uLaw);
-	        iLog->Log(_L("DNL Mode Set: uLaw"));
-        	}
-        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) && (mode == KTag20ms) )
-        	{
-        	iILBCDecFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC20mSecFrame);
-        	iLog->Log(_L("DNL Mode Set: 20ms frame"));
-        	}
-        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) && (mode == KTag30ms) )
-        	{
-        	iILBCDecFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC30mSecFrame);
-        	iLog->Log(_L("DNL Mode Set: 30ms frame"));
-        	}
+        {
+        if ((linkType == KTagUplink) && (iUpLinkCodec == EG711) && (mode
+                == KTagALaw))
+            {
+            iG711EncFormatIntfc->SetMode(CVoIPFormatIntfc::EG711ALaw);
+            iLog->Log(_L("UPL Mode Set: aLaw"));
+            }
+        else if ((linkType == KTagUplink) && (iUpLinkCodec == EG711) && (mode
+                == KTagULaw))
+            {
+            iG711EncFormatIntfc->SetMode(CVoIPFormatIntfc::EG711uLaw);
+            iLog->Log(_L("UPL Mode Set: uLaw"));
+            }
+        else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC) && (mode
+                == KTag20ms))
+            {
+            iILBCEncFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC20mSecFrame);
+            iLog->Log(_L("UPL Mode Set: 20ms frame"));
+            }
+        else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC) && (mode
+                == KTag30ms))
+            {
+            iILBCEncFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC30mSecFrame);
+            iLog->Log(_L("UPL Mode Set: 30ms frame"));
+            }
+        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711) && (mode
+                == KTagALaw))
+            {
+            iG711DecFormatIntfc->SetMode(CVoIPFormatIntfc::EG711ALaw);
+            iLog->Log(_L("DNL Mode Set: aLaw"));
+            }
+        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711) && (mode
+                == KTagULaw))
+            {
+            iG711DecFormatIntfc->SetMode(CVoIPFormatIntfc::EG711uLaw);
+            iLog->Log(_L("DNL Mode Set: uLaw"));
+            }
+        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) && (mode
+                == KTag20ms))
+            {
+            iILBCDecFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC20mSecFrame);
+            iLog->Log(_L("DNL Mode Set: 20ms frame"));
+            }
+        else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) && (mode
+                == KTag30ms))
+            {
+            iILBCDecFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC30mSecFrame);
+            iLog->Log(_L("DNL Mode Set: 30ms frame"));
+            }
         else
-        	{
-        	iLog->Log(KMsgBadTestParameters);
+            {
+            iLog->Log(KMsgBadTestParameters);
             error = KErrBadTestParameter;
-        	}
-    	}
+            }
+        }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::GetCNG( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::GetCNG(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetCNG")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetCNG"));
     TInt error = KErrNone;
@@ -2355,24 +2296,22 @@
             break;
         }
 
-      if (aCng != iCng)
-    	  {
-    	  iLog->Log(_L("returned Cng doesn't match set Cng: Failed"));
-    	  error = KErrUnexpectedValue;
-    	  }
+    if (aCng != iCng)
+        {
+        iLog->Log(_L("returned Cng doesn't match set Cng: Failed"));
+        error = KErrUnexpectedValue;
+        }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::ToggleCNG( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::ToggleCNG(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ToggleCNG")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::ToggleCNG"));
     TInt error = KErrNone;
 
-    iCng = (iCng)? EFalse : ETrue;
+    iCng = (iCng) ? EFalse : ETrue;
 
     switch (iDnLinkCodec)
         {
@@ -2389,35 +2328,31 @@
         }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::GetPLC( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::GetPLC(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetPLC")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetPLC"));
     TInt error = KErrNone;
 
     TBool aPlc = EFalse;
     if (iDnLinkCodec == EG711)
-    	{
+        {
         iG711DecFormatIntfc->GetPLC(aPlc);
         iLog->Log(_L("PLC: %d"), aPlc);
-    	}
+        }
 
     return error;
-}
-
+    }
 
-
-TInt CVoIPAudioServicesTestClass::TogglePLC( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::TogglePLC(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::TogglePLC")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::TogglePLC"));
     TInt error = KErrNone;
 
-    iPlc = (iPlc)? EFalse : ETrue;
+    iPlc = (iPlc) ? EFalse : ETrue;
 
     if (iDnLinkCodec == EG711)
         {
@@ -2426,79 +2361,85 @@
         }
 
     return error;
-}
-
+    }
 
+TInt CVoIPAudioServicesTestClass::BadLsfNextBuffer(CStifItemParser& /*aItem*/)
+    {
+    return BadLsfNextBuffer();
+    }
 
-TInt CVoIPAudioServicesTestClass::BadLsfNextBuffer( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::BadLsfNextBuffer()
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::BadLsfNextBuffer")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::BadLsfNextBuffer"));
     TInt error = KErrNone;
-
-    if (iDnLinkCodec == EG729)
+    if (iG729DecFormatIntfc)
         {
         error = iG729DecFormatIntfc->BadLsfNextBuffer();
+        if (iDnLinkStatus != EStreaming)
+            {
+            AddExpectedEvent(EDownlinkError, KShortTimeout);
+            }
         iLog->Log(_L("BadLsf for next buf"));
         }
-
     return error;
-}
+    }
 
-
-
-TInt CVoIPAudioServicesTestClass::StopRingTone( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::StopRingTone(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::StopRingTone")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::StopRingTone"));
     TInt error = KErrNone;
 
     if (iRingTonePlayer)
-    	{
+        {
         iRingTonePlayer->Stop();
         RemoveExpectedEvent(EPlaybackComplete);
-    	}
+        }
     else
-	  {
-      iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
-      error = KErrNotFound;
-	  }
+        {
+        iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
+        error = KErrNotFound;
+        }
 
     return error;
-}
-
+    }
 
-TInt CVoIPAudioServicesTestClass::GetBufferType( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::GetBufferType(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetBufferType")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::GetBufferType"));
-    TInt error = KErrNone;
+    TInt error = KErrNotFound;
 
     CVoIPDataBuffer::TVoIPBufferType BufType;
-    iPlayBuf->GetBufferType(BufType);
+    if (iPlayBuf)
+        {
+        iPlayBuf->GetBufferType(BufType);
+        error = KErrNone;
 
-    if (BufType != CVoIPDataBuffer::EStandard && BufType != CVoIPDataBuffer::EJitterBuffer)
-    	{
-    	error = KErrUnknown;
-    	FTRACE(FPrint(_L("Buffer Type Unknown")));
-        iLog->Log(_L("Buffer Type Unknown"));
-    	}
+        if (BufType != CVoIPDataBuffer::EStandard && BufType
+                != CVoIPDataBuffer::EJitterBuffer)
+            {
+            error = KErrUnknown;
+            FTRACE(FPrint(_L("Buffer Type Unknown")));
+            iLog->Log(_L("Buffer Type Unknown"));
+            }
+        }
+    return error;
+    }
 
-    return error;
-}
-
-
-#ifdef __JITTER_BUFFER_TEST__
 // ----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::ConfigureJB
 //
 // ----------------------------------------------------------------------------
 //
-TInt CVoIPAudioServicesTestClass::ConfigureJB()
-{
+TInt CVoIPAudioServicesTestClass::ConfigureJB(CStifItemParser& /*aItem*/)
+    {
+    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ConfigureJB")));
+    iLog->Log(_L("CVoIPAudioServicesTestClass::ConfigureJB"));
     TInt err = KErrNotSupported;
 
-    if (iJBIntfc && iDnLinkCodec != EPCM16)
+    if (iJBIntfc /*&& iDnLinkCodec != EPCM16*/)
         {
         TVoIPJBConfig jBConfig;
 
@@ -2526,116 +2467,80 @@
         jBConfig.iJBInactivityTimeOut = 30;
 
         // Configure reset buffer tone playback params
-//      jBConfig.iJitterBufPlayToneDuration = ?;
-//      jBConfig.iJitterBufPlayToneFrequency = ?;
-//      jBConfig.iJitterBufPlayToneTimeout = ?;
+        //      jBConfig.iJitterBufPlayToneDuration = ?;
+        //      jBConfig.iJitterBufPlayToneFrequency = ?;
+        //      jBConfig.iJitterBufPlayToneTimeout = ?;
 
         err = iJBIntfc->ConfigureJitterBuffer(jBConfig);
+        iLog->Log(_L("JB Configure and start requested"));
+        AddExpectedEvent(EFillBuffer, KShortTimeout);
         }
-
-//    	DisplayText(_L("JB Initialized"));
-
     return err;
-}
+    }
 
 // ----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::ResetJB
 //
 // ----------------------------------------------------------------------------
 //
-TInt CVoIPAudioServicesTestClass::ResetJB()
-{
+TInt CVoIPAudioServicesTestClass::ResetJB(CStifItemParser& /*aItem*/)
+    {
+    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ResetJB")));
+    iLog->Log(_L("CVoIPAudioServicesTestClass::ResetJB"));
     TInt err = KErrNotSupported;
 
     if (iJBIntfc && iDnLinkCodec != EPCM16)
         {
         err = iJBIntfc->ResetJitterBuffer(ETrue);
         }
-
     return err;
-}
+    }
 
 // ----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::DelayDown
 //
 // ----------------------------------------------------------------------------
 //
-void CVoIPAudioServicesTestClass::DelayDown()
-{
+TInt CVoIPAudioServicesTestClass::DelayDown(CStifItemParser& /*aItem*/)
+    {
+    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::DelayDown")));
+    iLog->Log(_L("CVoIPAudioServicesTestClass::DelayDown"));
+    TInt err = KErrNotSupported;
     if (iJBIntfc && iDnLinkCodec != EPCM16)
         {
-        iJBIntfc->DelayDown();
+        err = iJBIntfc->DelayDown();
         }
-}
+    return err;
+    }
 
 // ----------------------------------------------------------------------------
 // CVoIPAudioServicesTestClass::DelayUp
 //
 // ----------------------------------------------------------------------------
 //
-void CVoIPAudioServicesTestClass::DelayUp()
-{
+TInt CVoIPAudioServicesTestClass::DelayUp(CStifItemParser& /*aItem*/)
+    {
+    FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::DelayUp")));
+    iLog->Log(_L("CVoIPAudioServicesTestClass::DelayUp"));
+    TInt err = KErrNotSupported;
     if (iJBIntfc && iDnLinkCodec != EPCM16)
         {
-        iJBIntfc->DelayUp();
+        err = iJBIntfc->DelayUp();
         }
-}
-#endif //__JITTER_BUFFER_TEST__
-
+    return err;
+    }
 
 // ----------------------------------------------------------------------------
-// CVoIPTestEngine::DoLoopback
+// CVoIPTestEngine::SetLoopPlay
 //
 // ----------------------------------------------------------------------------
 //
-/*void CVoIPAudioServicesTestClass::DoLoopback()
+TInt CVoIPAudioServicesTestClass::SetLoopPlay(CStifItemParser& /*aItem*/)
     {
-   	iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback"));
- 		if (iPlayBufReady && iRecBufReady)
-        {
-        iPlayBufPtr.Copy(iRecBufPtr);
-
-
-#ifdef __JITTER_BUFFER_TEST__
-        if (iDnLinkCodec != EPCM16)
-            {
-            // We need to generate sequence number for each frame.
-            // Real client should get sequence number from the RTP header.
-            // Max possible sequence number of RTP packet with standard
-            // RTP header is 0xFFFF (16-bit value)
-            if (iSeqNum < (KMaxSeqNumber - iSeqNumIncrement))
-            	{
-                iSeqNum += iSeqNumIncrement;
-            	}
-            else
-            	{
-                iSeqNum = iSeqNumIncrement; //wrap-around
-            	}
-
-            iPlayJBuf->SetPayloadPtr(iPlayBufPtr);
-            iPlayJBuf->SetBufferSequence(iSeqNum);
-            iVoIPDnlink->BufferFilled(iPlayJBuf);
-            iPlayBufReady = ETrue; // no FillBuffer events in JB mode
-            iRecBufReady = EFalse; // consumed, ready for EmptyBuffer
-            }
-        else
-        	{
-        	; // PCM not supported in Jitter Buffer mode
-        	}
-#else  //__JITTER_BUFFER_TEST__
-
-        iPlayBuf->SetPayloadPtr(iPlayBufPtr);
-        iVoIPDnlink->BufferFilled(iPlayBuf);
-        iLog->Log(_L("CVoIPAudioServicesTestClass::played"));
-        iPlayBufReady = EFalse;
-        iRecBufReady = EFalse;
-#endif //__JITTER_BUFFER_TEST__
-        }
-    iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback END"));
+    iLog->Log(_L("CVoIPAudioServicesTestClass::SetLoopPlay"));
+    iLoopPlay = ETrue;
+    return 0;
     }
-*/
-
-
 
 // ----------------------------------------------------------------------------
 // CVoIPTestEngine::DoLoopback
@@ -2643,101 +2548,110 @@
 // ----------------------------------------------------------------------------
 //
 void CVoIPAudioServicesTestClass::DoLoopback()
-{
-    
-  
-	iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback"));
-	iLog->Log(_L("loopbackCount = %d"), loopbackCount);
-  if ((0<loopbackCount) && (loopbackCount<= 20))
-  {
-    if (iPlayBufReady && iRecBufReady)
+    {
+    iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback"));
+
+    if (!iLoopPlay)
         {
-        iPlayBufPtr.Copy(iRecBufPtr);
-
-
-#ifdef __JITTER_BUFFER_TEST__
-        if (iDnLinkCodec != EPCM16)
+        if (iPlayBufReady)
+            {
+            // Just keep D/S NULL playback going
+            iPlayBufReady = EFalse;
+            iPlayBufPtr.Copy(_L("0000"));
+            iPlayBuf->SetPayloadPtr(iPlayBufPtr);
+            iVoIPDnlink->BufferFilled(iPlayBuf);
+            }
+        else if (iRecBufReady)
+            {
+            // Keep recording ongoing
+            iRecBufReady = EFalse;
+            iRecBuf->SetPayloadPtr(iRecBufPtr);
+            iVoIPUplink->BufferEmptied(iRecBuf);
+            }
+        }
+    else
+        {
+        if (iPlayBufReady && iRecBufReady)
             {
-            // We need to generate sequence number for each frame.
-            // Real client should get sequence number from the RTP header.
-            // Max possible sequence number of RTP packet with standard
-            // RTP header is 0xFFFF (16-bit value)
-            if (iSeqNum < (KMaxSeqNumber - iSeqNumIncrement))
-            	{
-                iSeqNum += iSeqNumIncrement;
-            	}
-            else
-            	{
-                iSeqNum = iSeqNumIncrement; //wrap-around
-            	}
+            iPlayBufReady = EFalse;
+            iRecBufReady = EFalse;
+            iPlayBufPtr.Copy(iRecBufPtr);
+            iRecBuf->SetPayloadPtr(iRecBufPtr);
+            iVoIPUplink->BufferEmptied(iRecBuf);
+            iPlayBuf->SetPayloadPtr(iPlayBufPtr);
+            iVoIPDnlink->BufferFilled(iPlayBuf);
+            }
+        }
+    }
 
-            iPlayJBuf->SetPayloadPtr(iPlayBufPtr);
-            iPlayJBuf->SetBufferSequence(iSeqNum);
-            iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback, loopbackCount == %d"), loopbackCount);
-            //sue add
-            if (loopbackCount == 10)
-            {
-            	ResetJB();
-            }
-            if (loopbackCount == 12)
+// ----------------------------------------------------------------------------
+// CVoIPTestEngine::DoJBLoopback
+//
+// ----------------------------------------------------------------------------
+//
+void CVoIPAudioServicesTestClass::DoJBLoopback()
+    {
+
+    iLog->Log(_L("CVoIPAudioServicesTestClass::DoJBLoopback"));
+
+    if (iPlayBufReady && iRecBufReady && iDnLinkCodec != EPCM16)
+        {
+        // We need to generate sequence number for each frame.
+        // Real client should get sequence number from the RTP header.
+        // Max possible sequence number of RTP packet with standard
+        // RTP header is 0xFFFF (16-bit value)
+        if (iSeqNum < (KMaxSeqNumber - iSeqNumIncrement))
             {
-            	DelayDown();
-            }
-            if (loopbackCount == 14)
-            {
-            	DelayUp();
-            }
-            // end sue
-            iRecBuf->SetPayloadPtr(iRecBufPtr); //sue add
-            iVoIPDnlink->BufferFilled(iPlayJBuf);
-            iVoIPUplink->BufferEmptied(iRecBuf); 
-            iPlayBufReady = ETrue; // no FillBuffer events in JB mode
-            iRecBufReady = EFalse; // consumed, ready for EmptyBuffer
-            loopbackCount++;	
+            iSeqNum += iSeqNumIncrement;
             }
         else
-        	{
-        	; // PCM not supported in Jitter Buffer mode
-        	}
-#else  //__JITTER_BUFFER_TEST__
+            {
+            iSeqNum = iSeqNumIncrement; //wrap-around
+            }
 
-        iPlayBuf->SetPayloadPtr(iPlayBufPtr);
-        iRecBuf->SetPayloadPtr(iRecBufPtr); 
-        iVoIPDnlink->BufferFilled(iPlayBuf);
-        iVoIPUplink->BufferEmptied(iRecBuf); 
         iPlayBufReady = EFalse;
         iRecBufReady = EFalse;
-        loopbackCount++;	
-        
-        
-
-#endif //__JITTER_BUFFER_TEST__
+        iPlayBufPtr.Copy(iRecBufPtr);
+        iRecBuf->SetPayloadPtr(iRecBufPtr);
+        iVoIPUplink->BufferEmptied(iRecBuf);
+        iPlayJBuf->SetPayloadPtr(iPlayBufPtr);
+        iPlayJBuf->SetBufferSequence(iSeqNum);
+        iVoIPDnlink->BufferFilled(iPlayJBuf);
         }
-	}
-  else
-  {
-    loopbackCount = 0;
-    iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback test end"));
-  }
- }
+    }
 
-
-
-TInt CVoIPAudioServicesTestClass::ConfigEncAudDevice( CStifItemParser& /*aItem*/ )
-{
+TInt CVoIPAudioServicesTestClass::ConfigEncAudDevice(CStifItemParser& /*aItem*/)
+    {
     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ConfigEncAudDevice")));
     iLog->Log(_L("CVoIPAudioServicesTestClass::ConfigEncAudDevice"));
     TInt error = KErrNone;
     if (iUpLinkStatus == EReady)
-    	{
-    // Now we can configure encoder and audio device
-    	iVoIPUplink->GetMaxGain(iMaxGain);
-    	iVoIPUplink->SetGain(iMaxGain);
-    	}
+        {
+        // Now we can configure encoder and audio device
+        iVoIPUplink->GetMaxGain(iMaxGain);
+        iVoIPUplink->SetGain(iMaxGain);
+        }
 
     return error;
-}
+    }
+
+//class CVoIPAudioDownlinkStream2 : public CVoIPAudioDownlinkStream {};
+
+TInt CVoIPAudioServicesTestClass::TestNullObjects(CStifItemParser& /*aItem*/)
+    {
+    //FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateFactory")));
+    //iLog->Log(_L("CVoIPAudioServicesTestClass::CreateFactory"));
 
+    TInt error = KErrNone;
+   // CVoIPAudioDownlinkStream2* dnl = new CVoIPAudioDownlinkStream2();
 
+//    error = CVoIPUtilityFactory::CreateFactory(iFactory);
+//    iFactory->CreateDownlinkStream(TVersion(0,0,0),
+//            CVoIPUtilityFactory::EVoIPCall, iVoIPDnlink);
+    //TInt vol;
+ //   dnl->GetVolume(vol);
+    //delete dnl;
+    return error;
+    }
 
 //  End of File