convergedcallengine/cce/src/cccecallcontainer.cpp
changeset 0 ff3b6d0fd310
child 12 ae8abd0db65c
child 43 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  class of call objects
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDE FILES
       
    20 #include "cccecallcontainer.h"
       
    21 #include "mccpcall.h"
       
    22 #include "mccpcscall.h"
       
    23 #include "mcceobserver.h"
       
    24 #include "mccessobserver.h"
       
    25 #include "cccecall.h" 
       
    26 #include "cccelogger.h"
       
    27 #include "ccceutility.h"
       
    28 #include "ccceconferencecall.h"
       
    29 #include "ccceemergencycall.h"
       
    30 #include "cccedtmf.h"
       
    31 #include "cccetransfercontroller.h"
       
    32 #include "cconvergedcallprovider.h"
       
    33 #include "ccceextension.h"
       
    34 #include "cccepluginmanager.h"
       
    35 #include "cccedurationtimer.h"
       
    36 #include "cccecallinfomediator.h"
       
    37 
       
    38 #include <featmgr.h>
       
    39 
       
    40 //CONSTANTS
       
    41 const TInt KCSServiceId = 1;
       
    42 
       
    43 // ======== MEMBER FUNCTIONS ========
       
    44 // ---------------------------------------------------------------------------
       
    45 // Constructor
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CCCECallContainer::CCCECallContainer( MCCEObserver& aObserver ): iMCCEObserver(&aObserver)
       
    49     {
       
    50     // Initialize callinfo call ids
       
    51     for ( TInt i = 0; i < KCCECallObjects; i++ )
       
    52         {
       
    53         iCallInfoCallId[ i ] = KErrNotFound;
       
    54         }
       
    55     
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // Construct object
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 void CCCECallContainer::ConstructL()
       
    63     {
       
    64 	FeatureManager::InitializeLibL();
       
    65     iCallStateMediator = CCCECallInfoMediator::NewL( *this );
       
    66     
       
    67     CreateCallDataArraysL();
       
    68  
       
    69     iTransferController = CCCETransferController::NewL( *this );
       
    70     iPluginManager = CCCEPluginManager::NewL( *this, *iTransferController );
       
    71     iEmergencyCall =  CCCEEmergencyCall::NewL(*this, *iPluginManager);
       
    72     iPluginManager->SetEmergencyCallObserver(*iEmergencyCall);
       
    73     iExtension = CCCEExtension::NewL(*iPluginManager );
       
    74     iConferenceCall = CCCEConferenceCall::NewL( *this, *iPluginManager );
       
    75     if( iMCCEObserver )
       
    76         {
       
    77         iPluginManager->SetObserver(*iMCCEObserver);
       
    78         }
       
    79  
       
    80     // AirTime Timer
       
    81     iCSDuration = CCCEDurationTimer::NewL();
       
    82     iPSDuration = CCCEDurationTimer::NewL();
       
    83     
       
    84     iIdle = CIdle::NewL( CActive::EPriorityIdle );
       
    85     }
       
    86     
       
    87 // ---------------------------------------------------------------------------
       
    88 // Default Symbian constructor
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 CCCECallContainer* CCCECallContainer::NewL( MCCEObserver& aObserver )
       
    92     {
       
    93     CCCECallContainer* self = new( ELeave ) CCCECallContainer(aObserver);
       
    94     CleanupStack::PushL( self );
       
    95     self->ConstructL();
       
    96     CleanupStack::Pop( self );
       
    97     return self;
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // Destructor
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 CCCECallContainer::~CCCECallContainer()
       
   105     {
       
   106     delete iConferenceCall;
       
   107     delete iEmergencyCall;
       
   108     delete iDtmf;
       
   109     delete iExtension;
       
   110     delete iPluginManager;
       
   111     delete iTransferController;
       
   112         
       
   113     if( iCallArray )
       
   114         {
       
   115         iCallArray->ResetAndDestroy();
       
   116         delete iCallArray;
       
   117         }
       
   118     
       
   119     delete iCallStateMediator;
       
   120         
       
   121     iCallstoRelease.Reset();
       
   122     iCallstoRelease.Close();
       
   123     
       
   124     delete iCSDuration;
       
   125     delete iPSDuration;
       
   126     
       
   127     
       
   128     if( iIdle )
       
   129         {
       
   130         iIdle->Cancel();
       
   131         delete iIdle;
       
   132         }
       
   133     FeatureManager::UnInitializeLib();
       
   134     }
       
   135 // -----------------------------------------------------------------------------
       
   136 // SetObserver()
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 void CCCECallContainer::SetObserver( MCCEObserver& aObserver, MCCESsObserver& aSsObserver )
       
   140     {
       
   141     iMCCEObserver = &aObserver;
       
   142     iMCCESsObserver = &aSsObserver;
       
   143     iPluginManager->SetObserver(aObserver );
       
   144     }
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // Create call objects
       
   148 // CS objects are located in the beginning of array and VoIP objects after those
       
   149 // -----------------------------------------------------------------------------
       
   150 //
       
   151 void CCCECallContainer::CreateCallDataArraysL()
       
   152     {
       
   153     CCCECall* call = NULL;
       
   154     TInt callIndex = 0;
       
   155 
       
   156     iCallArray = new ( ELeave ) CArrayPtrFlat<CCCECall>( KCCECallObjects );
       
   157 
       
   158     for( callIndex = 0; callIndex < KCCECallObjects; callIndex++ )
       
   159         {
       
   160         call = CCCECall::NewLC( *this, callIndex );
       
   161         iCallArray->AppendL( call );
       
   162         CleanupStack::Pop( call );
       
   163         }
       
   164     }
       
   165 
       
   166 // -----------------------------------------------------------------------------
       
   167 // Swap PS and CS air duration timers
       
   168 // Is called after handover, when call type has changed
       
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171 void CCCECallContainer::AirTimeDurationSwap(
       
   172                            const CCPCall::TCallType aNewCallType)
       
   173 	{
       
   174     CCELOGSTRING("CCCECallContainer::AirTimeDurationSwap(): IN");
       
   175     
       
   176     CCCECall* call = NULL;
       
   177     TInt calls(0);
       
   178     for ( TInt i = 0; i < KCCECallObjects; i++ )
       
   179         {
       
   180         call = GetCall( i );
       
   181         if ( call->State() == CCPCall::EStateConnected ||
       
   182              call->State() == CCPCall::EStateHold  )
       
   183             {
       
   184             calls ++;
       
   185             }
       
   186         }
       
   187 
       
   188     if( CCPCall::EStateConnected == iEmergencyCall->State() )
       
   189         {
       
   190         calls ++;
       
   191         }
       
   192     
       
   193     if( 1 == calls )
       
   194     	{
       
   195     	// After handover we will have only one active call
       
   196     	// If we have more or less, timer swapping will not happend
       
   197 	    if (aNewCallType == CCPCall::ECallTypePS )
       
   198 	    	{
       
   199 	    	CCELOGSTRING2("CCCECallContainer::AirTimeDurationSwap(): CS Stops, PS restarts from %d",
       
   200 	    			iCSDuration->NumberOfBeats() );
       
   201 	    	iCSDuration->Stop();
       
   202 	    	iPSDuration->RestartAirTimeDuration(iCSDuration->NumberOfBeats());
       
   203 	    	iCSDuration->Reset();
       
   204 	    	}
       
   205 	    else
       
   206 	    	{
       
   207 	    	CCELOGSTRING2("CCCECallContainer::AirTimeDurationSwap(): PS Stops, CS restarts from %d",
       
   208 	    			iPSDuration->NumberOfBeats() );
       
   209 	    	iPSDuration->Stop();
       
   210 	    	iCSDuration->RestartAirTimeDuration(iPSDuration->NumberOfBeats());
       
   211 	    	iPSDuration->Reset();
       
   212 	    	}
       
   213     	}
       
   214     CCELOGSTRING("CCCECallContainer::AirTimeDurationSwap(): OUT");
       
   215 	}
       
   216 	
       
   217 // ---------------------------------------------------------------------------
       
   218 // AirTimeDurationStop()
       
   219 // ---------------------------------------------------------------------------
       
   220 //
       
   221 void CCCECallContainer::AirTimeDurationStop( CCCECall* /*aCall*/ ) const
       
   222     {
       
   223     CCELOGSTRING("CCCECallContainer::AirTimeDurationStop(): IN");
       
   224     CCCECall* call = NULL;
       
   225     TInt csCalls=0;
       
   226     TInt psCalls=0;
       
   227 
       
   228     // Check if any other calls    
       
   229     for ( TInt i = 0; i < KCCECallObjects; i++ )
       
   230         {
       
   231         call = GetCall( i );
       
   232         if ( call->State() == CCPCall::EStateConnected ||
       
   233              call->State() == CCPCall::EStateHold  )
       
   234             {           
       
   235             if ( IsCsPlugin( call, EFalse ) )
       
   236                 {
       
   237                 csCalls++;
       
   238                 CCELOGSTRING2("   AirTimeDurationStop() csCalls=%d ", csCalls);
       
   239                 }
       
   240             // ps call found
       
   241             else
       
   242                 {
       
   243                 psCalls++;
       
   244                 CCELOGSTRING2("   AirTimeDurationStop() psCalls=%d ", psCalls);
       
   245                 }
       
   246             }
       
   247         }
       
   248         
       
   249     if( CCPCall::EStateConnected == iEmergencyCall->State() )
       
   250         {
       
   251         if(  CCPCall::ECallTypePS == iEmergencyCall->Parameters().CallType() )
       
   252             {
       
   253             psCalls++;
       
   254             }
       
   255         else
       
   256             {
       
   257             csCalls++;
       
   258             }
       
   259         }
       
   260         
       
   261            
       
   262     // No other cs calls found
       
   263     if( !csCalls )
       
   264         {
       
   265         CCELOGSTRING("   AirTimeDurationStop() stop CS timer");
       
   266         iCSDuration->Stop();
       
   267         }
       
   268            
       
   269     // No other ps calls found
       
   270     if( !psCalls )
       
   271         {
       
   272         CCELOGSTRING("   AirTimeDurationStop() stop PS timer");
       
   273         iPSDuration->Stop();
       
   274         }
       
   275  
       
   276         
       
   277     CCELOGSTRING("CCCECallContainer::AirTimeDurationStop(): IN");
       
   278     }
       
   279 
       
   280 // ---------------------------------------------------------------------------
       
   281 // AirTimeDurationStart()
       
   282 // ---------------------------------------------------------------------------
       
   283 //
       
   284 void CCCECallContainer::AirTimeDurationStart( CCCECall* /*aCall*/ ) const
       
   285     {
       
   286     CCELOGSTRING("CCCECallContainer::AirTimeDurationStart(): IN");
       
   287     CCCECall* call = NULL;
       
   288     TInt csCalls=0;
       
   289     TInt psCalls=0;
       
   290 
       
   291     // Check if any other calls    
       
   292     for ( TInt i = 0; i < KCCECallObjects; i++ )
       
   293         {
       
   294         call = GetCall( i );
       
   295         if ( call->State() == CCPCall::EStateConnected ||
       
   296              call->State() == CCPCall::EStateHold  )
       
   297             { 	   
       
   298             if ( IsCsPlugin( call, EFalse ) )
       
   299                 {
       
   300                 csCalls++;
       
   301                 CCELOGSTRING2("   AirTimeDurationStart() csCalls=%d ", csCalls);
       
   302                 }
       
   303             // ps call found
       
   304             else
       
   305                 {
       
   306                 psCalls++;
       
   307                 CCELOGSTRING2("   AirTimeDurationStart() pscalls=%d ", psCalls);
       
   308                 }
       
   309             }
       
   310         }
       
   311         
       
   312     if( CCPCall::EStateConnected == iEmergencyCall->State() )
       
   313         {
       
   314         if(  CCPCall::ECallTypePS == iEmergencyCall->Parameters().CallType() )
       
   315             {
       
   316             psCalls++;
       
   317             }
       
   318         else
       
   319             {
       
   320             csCalls++;
       
   321             }
       
   322         }
       
   323         
       
   324     // No other cs calls found
       
   325     if( csCalls )
       
   326         {
       
   327         iCSDuration->StartAirTimeDuration();
       
   328         }
       
   329     // No other ps calls found
       
   330     if( psCalls )
       
   331         {
       
   332         iPSDuration->StartAirTimeDuration();
       
   333         }
       
   334     CCELOGSTRING("CCCECallContainer::AirTimeDurationStart(): OUT");
       
   335     }
       
   336 
       
   337 // ---------------------------------------------------------------------------
       
   338 // From base class MCCECallArray
       
   339 // ---------------------------------------------------------------------------
       
   340 //
       
   341 MCCECallInfo* CCCECallContainer::EmergencyCallInfo() const
       
   342     {
       
   343     return iEmergencyCall;
       
   344     }
       
   345 
       
   346 // ---------------------------------------------------------------------------
       
   347 // From base class MCCECallArray
       
   348 // ---------------------------------------------------------------------------
       
   349 //
       
   350 MCCECallInfo* CCCECallContainer::CallInfo( TInt aIndex ) const  
       
   351     {
       
   352     return iCallArray->At( aIndex );
       
   353     }
       
   354 
       
   355 // ---------------------------------------------------------------------------
       
   356 // From base class MCCECallArray
       
   357 // ---------------------------------------------------------------------------
       
   358 //  
       
   359 TInt CCCECallContainer::MaxNumberOfCalls() const
       
   360     {
       
   361     return iCallArray->Count();
       
   362     }
       
   363 
       
   364 // ---------------------------------------------------------------------------
       
   365 // Add calls to be removed, and start releasing if not already running
       
   366 // ---------------------------------------------------------------------------
       
   367 //
       
   368 void CCCECallContainer::ScheduleReleaseCall( MCCPCall& aCalltoRemove, const TUid aUid )
       
   369     {
       
   370     TCallReleaseEntry entry;
       
   371     entry.iCallToRelease = &aCalltoRemove;
       
   372     entry.iUid = aUid;
       
   373     iCallstoRelease.Append(entry);
       
   374     if (!iIdle->IsActive())
       
   375         {
       
   376         iIdle->Start( TCallBack(ReleaseCalls,this) );
       
   377         }
       
   378     }
       
   379 
       
   380 // ---------------------------------------------------------------------------
       
   381 // Callback to CIdle class to actually release calls
       
   382 // ---------------------------------------------------------------------------
       
   383 // 
       
   384 TInt CCCECallContainer::ReleaseCalls( TAny* aCallContainer )
       
   385     {
       
   386     CCCECallContainer* container = 
       
   387         static_cast< CCCECallContainer* >( aCallContainer );
       
   388         container->DoReleaseCalls();
       
   389    
       
   390     return KErrNone;
       
   391     }
       
   392     
       
   393 // ---------------------------------------------------------------------------
       
   394 // Callback to CIdle class to actually release calls
       
   395 // ---------------------------------------------------------------------------
       
   396 //     
       
   397 void CCCECallContainer::DoReleaseCalls()
       
   398     {
       
   399     CCELOGSTRING("CCCECallContainer::DoReleaseCalls()")
       
   400     while( iCallstoRelease.Count() > 0 )
       
   401         {
       
   402         CConvergedCallProvider* plugin = NULL;
       
   403         TUid pluginUid = iCallstoRelease[0].iUid;
       
   404         TRAP_IGNORE( plugin = iPluginManager->GetPluginL( pluginUid ) );
       
   405         if( plugin )
       
   406             {
       
   407             // release call
       
   408             plugin->ReleaseCall( *iCallstoRelease[0].iCallToRelease );
       
   409             
       
   410             // first check can we indicate plugin release
       
   411             if( !iEmergencyCall->IsInProgress() &&
       
   412                 iPluginManager->ReleaseWhenIdle( pluginUid ) &&
       
   413                 pluginUid != iConferenceCall->ImplementationUid() )
       
   414                 {
       
   415                 // 2nd step
       
   416                 if( 0 == CountCalls( pluginUid ) )
       
   417                     {
       
   418                     TBool releasePlugin = ETrue;
       
   419                     // and last test
       
   420                     if( 1 < iCallstoRelease.Count() )
       
   421                         {
       
   422                         for( TInt a = 1; a < iCallstoRelease.Count(); a++ )
       
   423                             {
       
   424                             if( iCallstoRelease[a].iUid == pluginUid )
       
   425                                 {
       
   426                                 releasePlugin = EFalse;
       
   427                                 }
       
   428                             }
       
   429                         }
       
   430                     
       
   431                     if( releasePlugin )
       
   432                         {
       
   433                         iPluginManager->RemovePlugin( pluginUid );
       
   434                         }
       
   435                     }
       
   436                 }
       
   437             }
       
   438         iCallstoRelease.Remove(0);
       
   439         }
       
   440   
       
   441     };
       
   442 
       
   443 // ---------------------------------------------------------------------------
       
   444 // ConferenceCallL()
       
   445 // ---------------------------------------------------------------------------
       
   446 //
       
   447 CCCEConferenceCall& CCCECallContainer::ConferenceCallL( 
       
   448     const MCCEConferenceCallObserver& aObserver )
       
   449     {
       
   450     if( iConferenceCall )
       
   451         {
       
   452         iConferenceCall->SetObserver( 
       
   453             const_cast<MCCEConferenceCallObserver&>( aObserver ) );
       
   454         }
       
   455     else
       
   456         {
       
   457         iConferenceCall = CCCEConferenceCall::NewL( *this, *iPluginManager );
       
   458         iConferenceCall->SetObserver( 
       
   459             const_cast<MCCEConferenceCallObserver&>( aObserver ) );
       
   460         }
       
   461     return *iConferenceCall;
       
   462     }
       
   463 
       
   464 // ---------------------------------------------------------------------------
       
   465 // ConferenceCall()
       
   466 // ---------------------------------------------------------------------------
       
   467 //
       
   468 CCCEConferenceCall& CCCECallContainer::ConferenceCall() const
       
   469     {
       
   470     return *iConferenceCall;
       
   471     }
       
   472 
       
   473 // ---------------------------------------------------------------------------
       
   474 // DtmfInterfaceL()
       
   475 // ---------------------------------------------------------------------------
       
   476 //
       
   477 CCCEDtmf& CCCECallContainer::DtmfInterfaceL( 
       
   478     const MCCEDtmfObserver& aObserver )
       
   479     {
       
   480     if( iDtmf )
       
   481         {
       
   482         iDtmf->SetObserver( aObserver );
       
   483         }
       
   484     else
       
   485         {
       
   486         iDtmf = CCCEDtmf::NewL( *this, *iPluginManager );
       
   487         iDtmf->AddObserverL( aObserver );
       
   488         }
       
   489     return *iDtmf;
       
   490     }
       
   491 
       
   492 // ---------------------------------------------------------------------------
       
   493 // ExtensionInterfaceL()
       
   494 // ---------------------------------------------------------------------------
       
   495 // 
       
   496 
       
   497 MCCEExtensionInterface& CCCECallContainer::ExtensionInterfaceL(
       
   498         const MCCEExtensionObserver& aObserver )
       
   499     {
       
   500     if( iExtension )
       
   501         {
       
   502         iExtension->AddObserverL( aObserver );
       
   503         }
       
   504     else
       
   505         {
       
   506         iExtension = CCCEExtension::NewL(*iPluginManager );
       
   507         iExtension->AddObserverL( aObserver ); 
       
   508         }
       
   509     return *iExtension;
       
   510     }
       
   511   
       
   512 // ---------------------------------------------------------------------------
       
   513 // GetNextFreeCall()
       
   514 // ---------------------------------------------------------------------------
       
   515 //
       
   516 CCCECall* CCCECallContainer::GetNextFreeCall() const
       
   517     {
       
   518     CCCECall* call = NULL;
       
   519     if ( !iEmergencyCall->IsInProgress())
       
   520         {
       
   521         for (TInt i = 0; i < KCCECallObjects; i++ )
       
   522             {
       
   523             call = GetCall( i );
       
   524 
       
   525             if ( !call->IsInUse() )
       
   526                 {
       
   527                 CCELOGSTRING("CCCE::GetNextFreeCall: Call found");
       
   528                 break;
       
   529                 }
       
   530             }
       
   531         }
       
   532   
       
   533     return call;
       
   534     }
       
   535   
       
   536 // ---------------------------------------------------------------------------
       
   537 // GetCall()
       
   538 // ---------------------------------------------------------------------------
       
   539 //
       
   540 CCCECall* CCCECallContainer::GetCall( CCPCall::TCallState aCallState, 
       
   541     CCCECall* aSkippedCall ) const
       
   542     {
       
   543     CCCECall* call = NULL;
       
   544     CCPCall::TCallState callState = CCPCall::EStateIdle;
       
   545 
       
   546     for (TInt i = 0; i < KCCECallObjects; i++ )
       
   547         {
       
   548         call = GetCall( i );
       
   549 
       
   550         // Skip given call
       
   551         if ( call == aSkippedCall )
       
   552             {
       
   553             continue;
       
   554             }
       
   555 
       
   556 
       
   557         callState = call->State();
       
   558         if ( callState == aCallState )
       
   559             {
       
   560             return call;
       
   561             }
       
   562 
       
   563         }
       
   564 
       
   565     return NULL;
       
   566     }
       
   567 
       
   568 // -----------------------------------------------------------------------------
       
   569 // Open new MCCP call and bind it to MCCECall
       
   570 // -----------------------------------------------------------------------------
       
   571 //
       
   572  MCCECall& CCCECallContainer::OpenNewCallL(
       
   573     const TDesC&                        aNumber,
       
   574     const CCCECallParameters& aCallParameters,
       
   575     const MCCECallObserver&             aCallObserver )
       
   576     {
       
   577     CCCECall* call = GetNextFreeCall();
       
   578     
       
   579     if(call)
       
   580         {
       
   581         CleanupReleasePushL( *call );
       
   582         
       
   583         MCCPCall* convergedCall = NULL;
       
   584         // This block could be put to own method in transfercontroller
       
   585         if( iTransferController->TransferCall() &&
       
   586             CCCETransferController::ECCETypeUnattended == 
       
   587             iTransferController->OngoingTransferType() && 
       
   588             aNumber == iTransferController->TransferCall()->RemoteParty() )
       
   589             {
       
   590             CCELOGSTRING("CCCE::OpenNewCallL: Use transfer call");
       
   591             convergedCall = iTransferController->TransferCall();        
       
   592             // For MO transfer call observer needs to be set 
       
   593             convergedCall->AddObserverL( *call );
       
   594             call->SetTransferController( iTransferController ); 
       
   595             
       
   596             convergedCall->SetParameters( aCallParameters );
       
   597             }
       
   598         else
       
   599             {
       
   600             CCELOGSTRING2("CCCE::OpenNewCallL: ServiceId = %d", aCallParameters.ServiceId() );
       
   601             CConvergedCallProvider* plugin = 
       
   602                 iPluginManager->GetPluginL( aCallParameters.ServiceId() );
       
   603             convergedCall = plugin->NewCallL(aCallParameters, aNumber, *call);
       
   604             }
       
   605         
       
   606         if(convergedCall)
       
   607             {
       
   608             CCELOGSTRING("CCCE::OpenNewCallL: Set converged call to engine call");
       
   609             call->SetConvergedCallL( convergedCall, convergedCall->Uid() );
       
   610             call->SetObserver( aCallObserver );
       
   611             
       
   612             CCELOGSTRING("CCCE::OpenNewCallL():OUT");
       
   613             }
       
   614         else
       
   615             {
       
   616             CCELOGSTRING("CCCE::OpenNewCallL():No converged call:OUT");
       
   617             User::Leave( KErrGeneral );
       
   618             }
       
   619         CleanupStack::Pop( call );
       
   620         }
       
   621     else
       
   622         {
       
   623         CCELOGSTRING("CCCE::OpenNewCallL():No call:OUT");
       
   624         User::Leave( KErrGeneral );
       
   625         }
       
   626 
       
   627     return *call;
       
   628     }
       
   629 // -----------------------------------------------------------------------------
       
   630 // ReleaseCall
       
   631 // -----------------------------------------------------------------------------
       
   632 //
       
   633 TInt CCCECallContainer::ReleaseCall( MCCPCall& aCalltoRelease, const TUid aUid )
       
   634     {
       
   635     
       
   636     CCELOGSTRING("CCCECallContainer::ReleaseCall( MCCPCall& aCalltoRemove, const TUid aUid )");
       
   637     ScheduleReleaseCall(aCalltoRelease,aUid);
       
   638     return KErrNone;
       
   639     }
       
   640 
       
   641 // -----------------------------------------------------------------------------
       
   642 // ReleaseCall
       
   643 // -----------------------------------------------------------------------------
       
   644 //
       
   645 TInt CCCECallContainer::ReleaseCall( MCCPCall& aCalltoRelease)
       
   646     {
       
   647     CCELOGSTRING("CCCECallContainer::ReleaseCall( MCCPCall& aCalltoRelease )");
       
   648     TUid pluginUid = aCalltoRelease.Uid();
       
   649     return ReleaseCall(aCalltoRelease, pluginUid);
       
   650     }
       
   651 
       
   652 // -----------------------------------------------------------------------------
       
   653 // Get emergencycall
       
   654 // -----------------------------------------------------------------------------
       
   655 //
       
   656  MCCECall& CCCECallContainer::EmergencyCall( const MCCECallObserver& aCallObserver )
       
   657     {
       
   658     iEmergencyCall->SetObserver(aCallObserver);
       
   659     return *iEmergencyCall;
       
   660     }
       
   661 
       
   662 // -----------------------------------------------------------------------------
       
   663 // Get call object by call MCCPCall 
       
   664 // -----------------------------------------------------------------------------
       
   665 //
       
   666 CCCECall* CCCECallContainer::GetCall( const MCCPCall* aMCCPCall ) const
       
   667     {
       
   668     CCCECall* call = NULL;
       
   669     
       
   670     for( TInt i = 0; i < iCallArray->Count(); i++ )
       
   671         {        
       
   672         call = iCallArray->At(i);
       
   673         
       
   674         if( aMCCPCall == &call->GetCCPCall() )
       
   675             {
       
   676             CCELOGSTRING("CCCECallContainer::GetCall: Call found");
       
   677             break;
       
   678             }
       
   679             
       
   680         call = NULL;
       
   681         }
       
   682     
       
   683     return call;
       
   684     }    
       
   685 
       
   686 // ---------------------------------------------------------------------------
       
   687 // GetCall()
       
   688 // ---------------------------------------------------------------------------
       
   689 //
       
   690 TInt CCCECallContainer::GetCall( TUid aImplementationUid, 
       
   691     RPointerArray<CCCECall>& aCallArray ) const
       
   692     {
       
   693     CCCECall* call = NULL;
       
   694 
       
   695     for ( TInt i = 0; i < KCCECallObjects; i++ )
       
   696         {
       
   697         call = GetCall( i );
       
   698         if ( call->IsInUse() )
       
   699             {
       
   700             if( call->ImplementationUid() == aImplementationUid )
       
   701                 {
       
   702                 aCallArray.Append(call);
       
   703                 }
       
   704             }
       
   705         }
       
   706 
       
   707     return aCallArray.Count();
       
   708     }
       
   709 
       
   710 // ---------------------------------------------------------------------------
       
   711 // IsAnyActiveOrConnectingCall()
       
   712 // ---------------------------------------------------------------------------
       
   713 //
       
   714 TInt CCCECallContainer::GetActiveOrConnectingCalls(
       
   715     RPointerArray<MCCECallInfo>& aCallArray ) const
       
   716     {
       
   717     CCPCall::TCallState callState = CCPCall::EStateIdle;
       
   718     CCCECall* call = NULL;
       
   719     TInt err = KErrNotFound;
       
   720     TInt i = 0;
       
   721 
       
   722     for ( i = 0; i < KCCECallObjects; i++ )
       
   723         {
       
   724         call = GetCall( i );
       
   725         if ( call->IsInUse() )
       
   726             {
       
   727             callState = call->State();
       
   728             if ( callState == CCPCall::EStateDialling ||
       
   729                  callState == CCPCall::EStateConnecting ||
       
   730                  callState == CCPCall::EStateConnected )
       
   731                 {
       
   732                 aCallArray.Append( call );
       
   733                 err = KErrNone;
       
   734                 }
       
   735             }
       
   736         }
       
   737     
       
   738     if( iEmergencyCall->IsInProgress() )
       
   739         {
       
   740         callState = iEmergencyCall->State();
       
   741         if ( callState == CCPCall::EStateDialling ||
       
   742              callState == CCPCall::EStateConnecting ||
       
   743              callState == CCPCall::EStateConnected )
       
   744             {
       
   745             aCallArray.Append( iEmergencyCall );
       
   746             err = KErrNone;
       
   747             }
       
   748         }
       
   749         
       
   750     return err;
       
   751     }
       
   752 
       
   753 // ---------------------------------------------------------------------------
       
   754 // IsAnyActiveOrConnectingCall()
       
   755 // ---------------------------------------------------------------------------
       
   756 //
       
   757 TInt CCCECallContainer::CountCalls( TUid aImplementationUid ) const
       
   758     {
       
   759     CCCECall* call = NULL;
       
   760     TInt i = 0;
       
   761     TInt count=0;
       
   762     
       
   763     for ( i = 0; i < KCCECallObjects; i++ )
       
   764         {
       
   765         call = GetCall( i );
       
   766         if ( call->IsInUse() )
       
   767             {
       
   768             if( call->ImplementationUid() == aImplementationUid )
       
   769                 {
       
   770                 count++;
       
   771                 }
       
   772             }
       
   773         }
       
   774 
       
   775     if( iEmergencyCall->IsInProgress() )
       
   776         {
       
   777         if( iEmergencyCall->ImplementationUid() == aImplementationUid )
       
   778             {
       
   779             count++;
       
   780             }
       
   781         }
       
   782     
       
   783     return count;
       
   784     }
       
   785 
       
   786 // ---------------------------------------------------------------------------
       
   787 // CountCsCalls()
       
   788 // ---------------------------------------------------------------------------
       
   789 //
       
   790 TInt CCCECallContainer::CountCsCalls( TUid aImplementationUid ) const
       
   791     {
       
   792     TInt count=0;
       
   793     CCCECall* call = NULL;
       
   794     TInt i = 0;
       
   795         
       
   796     for ( i = 0; i < KCCECallObjects; i++ )
       
   797         {
       
   798         call = GetCall( i );
       
   799         if ( call->IsInUse() )
       
   800             {
       
   801             if( call->ImplementationUid() == aImplementationUid && 
       
   802               ( call->Parameters().CallType() !=  CCPCall::ECallTypePS ) )
       
   803                 {
       
   804                 count++;
       
   805                 }
       
   806             }
       
   807         }
       
   808     
       
   809     return count;
       
   810     }
       
   811 
       
   812 // ---------------------------------------------------------------------------
       
   813 // GetCallWithActiveRequest()
       
   814 // ---------------------------------------------------------------------------
       
   815 //
       
   816 CCCECall* CCCECallContainer::GetCallWithActiveRequest( CCCECall* aCall ) const
       
   817     {
       
   818     CCCECall* call = NULL;
       
   819     for( TInt i = 0; i < iCallArray->Count(); i++ )
       
   820         {        
       
   821 
       
   822         if( CCCECall::ECCENone != iCallArray->At(i)->Request() )
       
   823             {
       
   824             CCELOGSTRING( "CCCECallContainer::GetCallWithRequest: Call found" );
       
   825             if( iCallArray->At(i) != aCall )
       
   826                 {
       
   827                 call = iCallArray->At(i);
       
   828                 }
       
   829             }
       
   830         }
       
   831 
       
   832     return call;
       
   833     }
       
   834 
       
   835 // ---------------------------------------------------------------------------
       
   836 // GetNonConferenceCall()
       
   837 // ---------------------------------------------------------------------------
       
   838 //
       
   839 CCCECall* CCCECallContainer::GetNonConferenceCall() const
       
   840     {
       
   841     CCCECall* call = NULL;
       
   842     for( TInt i = 0; i < iCallArray->Count(); i++ )
       
   843         {        
       
   844         if( iCallArray->At(i)->IsInUse() )
       
   845             {
       
   846             if( !iConferenceCall->IsPartOfConference( *iCallArray->At(i) ) )
       
   847                 {
       
   848                 CCELOGSTRING( "CCCECallContainer::GetNonConferenceCall: Call found" );
       
   849                 call = iCallArray->At(i);
       
   850                 break;
       
   851                 }
       
   852             }
       
   853         }
       
   854 
       
   855     return call;
       
   856     }
       
   857     
       
   858 // -----------------------------------------------------------------------------
       
   859 // Handle Conference status changes.
       
   860 // If dial was pending for hold and hold is received, continue dial.
       
   861 // -----------------------------------------------------------------------------
       
   862 //
       
   863 
       
   864 void CCCECallContainer::HandleConferenceStatusChange( 
       
   865         MCCEConferenceCallObserver::TCCEConferenceCallState aStatus )
       
   866     {
       
   867   
       
   868     CCELOGSTRING2("CCCECallContainer::HandleConferenceStatusChange: %d", aStatus );    
       
   869     CCCECall* callWithRequest = GetCallWithActiveRequest( NULL );
       
   870 
       
   871     switch ( aStatus )
       
   872         {
       
   873         case MCCEConferenceCallObserver::ECCEConferenceIdle:
       
   874             if ( callWithRequest &&
       
   875                  callWithRequest->Request() == CCCECall::ECCEReplaceActive &&
       
   876                  !GetCall( CCPCall::EStateConnected, callWithRequest ) )
       
   877                 {
       
   878                 callWithRequest->DoPendingRequest();
       
   879                 }
       
   880             break;
       
   881         
       
   882         case MCCEConferenceCallObserver::ECCEConferenceHold:
       
   883             if( iConferenceCall->EnumerateCalls() != 0 )
       
   884                 {
       
   885                 // Swap 1/2 point ( two calls in hold ) if there isnt connected call allready
       
   886                 CCCECall* call = GetNonConferenceCall();
       
   887                 if( call && 
       
   888                     call->State() == CCPCall::EStateHold )
       
   889                     {
       
   890                     if( call->ImplementationUid() == KCSProviderUid && 
       
   891                         iConferenceCall->ImplementationUid() == KCSProviderUid )
       
   892                         {
       
   893                         // If there is two cs calls do nothing
       
   894                         }
       
   895                     else
       
   896                         {
       
   897                         call->ResumeNoNotify();
       
   898                         }
       
   899 
       
   900                     break;
       
   901                     }
       
   902                 
       
   903                 // Answer new call when one(ringing) ongoing
       
   904                 // Answer new call when one(queued) ongoing
       
   905                 // Dial new call when one ongoing
       
   906                 if( callWithRequest )
       
   907                     {
       
   908                     callWithRequest->DoPendingRequest();
       
   909                     }
       
   910                 }
       
   911             break;
       
   912         case MCCEConferenceCallObserver::ECCEConferenceActive:
       
   913         
       
   914             // Swap completed
       
   915             if( callWithRequest )
       
   916                 {
       
   917                 callWithRequest->RequestComplete( ECCPErrorNone );
       
   918                 }
       
   919         default:
       
   920             break;
       
   921 
       
   922         }       
       
   923     }
       
   924 
       
   925 // -----------------------------------------------------------------------------
       
   926 // Updates the call information API clients.
       
   927 // -----------------------------------------------------------------------------
       
   928 //
       
   929 void CCCECallContainer::HandleEmergencyCallStatusChange(
       
   930     CCECallEnums::TNotifyType aNotify )
       
   931     {
       
   932     CCELOGSTRING("CCCECallContainer::HandleEmergencyCallStatusChange(): IN");
       
   933     if ( aNotify != CCECallEnums::ENoNotify )
       
   934         {
       
   935         iCallStateMediator->UpdateCallInfos();
       
   936         }
       
   937     CCELOGSTRING("CCCECallContainer::HandleEmergencyCallStatusChange(): OUT");
       
   938     }
       
   939 
       
   940 // -----------------------------------------------------------------------------
       
   941 // Handle call status changes.
       
   942 // If dial was pending for hold and hold is received, continue dial.
       
   943 // If swap is active, and hold was received for wanted object, start resume other call
       
   944 // If swap is active, and resume was received for wanted call, complete swap request
       
   945 // -----------------------------------------------------------------------------
       
   946 //
       
   947 void CCCECallContainer::HandleCallStatusChange( 
       
   948     CCPCall::TCallState aState, 
       
   949     CCCECall* aCall,
       
   950     CCECallEnums::TNotifyType aNotify )
       
   951     {
       
   952     CCELOGSTRING( "CCCECallContainer::HandleCallStatusChange(): IN" );
       
   953     CCCECall* call = NULL;
       
   954     TInt error = KErrNone;
       
   955     CCCECall* callWithRequest = GetCallWithActiveRequest( aCall );
       
   956 
       
   957     switch ( aState )
       
   958         {
       
   959         case CCPCall::EStateConnected:
       
   960             AirTimeDurationStart( aCall );
       
   961         
       
   962             // Swap completed
       
   963             if( callWithRequest )
       
   964                 {
       
   965                 callWithRequest->RequestComplete( ECCPErrorNone );
       
   966                 }
       
   967             break;
       
   968 
       
   969         case CCPCall::EStateIdle:
       
   970             AirTimeDurationStop( aCall );
       
   971             
       
   972             if ( callWithRequest &&
       
   973                 callWithRequest->Request() == CCCECall::ECCEReplaceActive &&
       
   974                 !iConferenceCall->IsPartOfConference( *aCall ) &&
       
   975                 !GetCall( CCPCall::EStateConnected, aCall ) )
       
   976                 {
       
   977                 error = callWithRequest->DoPendingRequest();
       
   978                 }
       
   979             break;
       
   980             
       
   981         case CCPCall::EStateHold:
       
   982             // Check if there is conference call
       
   983             if( iConferenceCall->EnumerateCalls() != 0 )
       
   984                 {
       
   985                 // Do nothing when there is only cscalls
       
   986 
       
   987                 if ( IsCsPlugin( aCall, ETrue ) )
       
   988                 	{
       
   989                 	
       
   990                     break;
       
   991                     }
       
   992                     
       
   993                 // If call or conferencecall isn`t cscall then do conference swap
       
   994                 if( iConferenceCall->State() == MCCEConferenceCallObserver::ECCEConferenceHold &&
       
   995                         !iConferenceCall->IsPartOfConference( *aCall ) )
       
   996                     {
       
   997                     iConferenceCall->Swap();
       
   998                     }
       
   999                 break;
       
  1000                 }
       
  1001         
       
  1002             // Swap 1/2 point ( two calls in hold ) if there isnt connected call allready
       
  1003             call = GetCall( CCPCall::EStateHold, aCall );
       
  1004             if( call && !GetCall( CCPCall::EStateConnected, aCall ) )
       
  1005                 {
       
  1006                 
       
  1007                 if ( IsCsPlugin( call, EFalse ) && IsCsPlugin( aCall, EFalse ) )
       
  1008                     {
       
  1009                     // If there is two cs calls do nothing
       
  1010                     }
       
  1011                 else
       
  1012                     {
       
  1013                     error = call->ResumeNoNotify();
       
  1014                     }
       
  1015 
       
  1016                 break;
       
  1017                 }
       
  1018 
       
  1019             // Answer new call when one(ringing) ongoing
       
  1020             // Answer new call when one(queued) ongoing
       
  1021             // Dial new call when one ongoing. NOTICE: Idle!
       
  1022             if( callWithRequest )
       
  1023                 {
       
  1024                 error = callWithRequest->DoPendingRequest();
       
  1025                 }
       
  1026             break;
       
  1027 
       
  1028         default:
       
  1029             CCELOGSTRING2("CCCECallContainer::HandleCallStatusChange: \
       
  1030                 Unhandled state = %d", aState );
       
  1031             break;
       
  1032         }
       
  1033         
       
  1034     if( error != KErrNone )
       
  1035         {
       
  1036         // Do some error handling
       
  1037         }
       
  1038     if ( aNotify != CCECallEnums::ENoNotify )
       
  1039         {
       
  1040         iCallStateMediator->UpdateCallInfos();
       
  1041         }
       
  1042     CCELOGSTRING( "CCCECallContainer::HandleCallStatusChange(): OUT" );
       
  1043     }
       
  1044 
       
  1045 // -----------------------------------------------------------------------------
       
  1046 // contained call has failed
       
  1047 // -----------------------------------------------------------------------------
       
  1048 //
       
  1049 void CCCECallContainer::ErrorOccurred( CCCECall* aCall, TCCPError aError )
       
  1050     {
       
  1051     
       
  1052     CCCECall* callWithRequest = GetCallWithActiveRequest( aCall );
       
  1053     if( callWithRequest )
       
  1054         {
       
  1055         // When swap fails try to resume call with request
       
  1056         if( callWithRequest->Request() == CCCECall::ECCESwap && 
       
  1057             aCall != callWithRequest && 
       
  1058             !GetCall( CCPCall::EStateConnected, NULL ) )
       
  1059             {
       
  1060             callWithRequest->ResumeNoNotify();
       
  1061             }
       
  1062         if( aError == ECCPLocalHoldFail && 
       
  1063             callWithRequest->Request() == CCCECall::ECCEDial &&
       
  1064             CCPCall::ECallTypePS != callWithRequest->Parameters().CallType() )
       
  1065             {
       
  1066             callWithRequest->RequestComplete( ECCPErrorAlreadyInUse );
       
  1067             }
       
  1068         else
       
  1069             {
       
  1070             callWithRequest->RequestComplete( aError );
       
  1071             }
       
  1072         }
       
  1073     }
       
  1074 
       
  1075 // -----------------------------------------------------------------------------
       
  1076 // Search for first available callinfo call id and save it to array.
       
  1077 // -----------------------------------------------------------------------------
       
  1078 //
       
  1079 void CCCECallContainer::ReserveCallInfoCallId( TInt aCallId )
       
  1080     {
       
  1081     for ( TInt i = 0; i < KCCECallObjects; i++ )
       
  1082         {
       
  1083         if ( KErrNotFound == iCallInfoCallId[ i ] )
       
  1084             {
       
  1085             iCallInfoCallId[ i ] = aCallId;
       
  1086             break;
       
  1087             }
       
  1088         }
       
  1089     }
       
  1090 
       
  1091 // -----------------------------------------------------------------------------
       
  1092 // Release call's call id.
       
  1093 // -----------------------------------------------------------------------------
       
  1094 //
       
  1095 void CCCECallContainer::ReleaseCallInfoCallId( TInt aCallId )
       
  1096     {
       
  1097     // Clear CallInfoCallId from array.
       
  1098     for ( TInt i = 0; i < KCCECallObjects; i++ )
       
  1099         {
       
  1100         if ( iCallInfoCallId[ i ] == aCallId )
       
  1101             {
       
  1102             iCallInfoCallId[ i ] = KErrNotFound;
       
  1103             break;
       
  1104             }
       
  1105         }
       
  1106     }
       
  1107 
       
  1108 // -----------------------------------------------------------------------------
       
  1109 // Get call object by call id
       
  1110 // -----------------------------------------------------------------------------
       
  1111 //
       
  1112 CCCECall* CCCECallContainer::GetCall( TInt aCallId ) const
       
  1113     {
       
  1114     if(iCallArray->Count()>aCallId)
       
  1115         {
       
  1116         return iCallArray->At( aCallId );
       
  1117         }
       
  1118     else
       
  1119         {
       
  1120         return NULL;
       
  1121         }
       
  1122     }
       
  1123 
       
  1124 // -----------------------------------------------------------------------------
       
  1125 // Get call durations
       
  1126 // -----------------------------------------------------------------------------
       
  1127 //
       
  1128 void CCCECallContainer::GetAirTimeDuration( TTimeIntervalSeconds& aCSDuration, 
       
  1129         TTimeIntervalSeconds& aPSDuration)
       
  1130     {
       
  1131     CCELOGSTRING("CCCECallContainer::GetAirTimeDuration()");
       
  1132     aCSDuration = iCSDuration->NumberOfBeats();
       
  1133     aPSDuration = iPSDuration->NumberOfBeats();
       
  1134     }
       
  1135     
       
  1136 // -----------------------------------------------------------------------------
       
  1137 // TerminateAllButRingingAndQueuedCalls
       
  1138 // -----------------------------------------------------------------------------
       
  1139 //    
       
  1140 void CCCECallContainer::TerminateAllButRingingAndQueuedCalls()
       
  1141     {
       
  1142     CCELOGSTRING("CCCECallContainer::TerminateAllButRingingAndQueuedCalls():IN");
       
  1143     
       
  1144     for( TInt i = 0; i < KCCECallObjects; i++ )
       
  1145         {
       
  1146         CCCECall* call = GetCall( i );
       
  1147         if( call->IsInUse() && 
       
  1148             call->State() != CCPCall::EStateQueued && 
       
  1149             call->State() != CCPCall::EStateRinging &&
       
  1150             !iConferenceCall->IsPartOfConference( *call ) )
       
  1151             {
       
  1152             // Quiet hangup
       
  1153             switch( call->State() )
       
  1154                 {
       
  1155                 case CCPCall::EStateDialling:
       
  1156                     call->GetCCPCall().Cancel();
       
  1157                     break;
       
  1158                 case CCPCall::EStateAnswering:
       
  1159                     call->GetCCPCall().Reject();
       
  1160                     break;
       
  1161                 default:
       
  1162                     call->GetCCPCall().HangUp();
       
  1163                     break;
       
  1164                 }
       
  1165             
       
  1166             }
       
  1167         }
       
  1168 
       
  1169     if( iConferenceCall->EnumerateCalls() )
       
  1170         {
       
  1171         iConferenceCall->HangUp();
       
  1172         }
       
  1173 
       
  1174         
       
  1175     CCELOGSTRING("CCCECallContainer::TerminateAllButRingingAndQueuedCalls():OUT");
       
  1176     }
       
  1177 // -----------------------------------------------------------------------------
       
  1178 // TerminateAllCalls
       
  1179 // -----------------------------------------------------------------------------
       
  1180 //    
       
  1181 void CCCECallContainer::TerminateAllCalls()
       
  1182     {
       
  1183     CCELOGSTRING("CCCECallContainer::TerminateAllCalls():IN");
       
  1184     
       
  1185     for( TInt i = 0; i < KCCECallObjects; i++ )
       
  1186         {
       
  1187         CCCECall* call = GetCall( i );
       
  1188         
       
  1189         if( call->IsInUse() && 
       
  1190             !iConferenceCall->IsPartOfConference( *call ) )
       
  1191             {
       
  1192             // Quiet hangup
       
  1193             switch( call->State() )
       
  1194                 {
       
  1195                 case CCPCall::EStateDialling:
       
  1196                     call->GetCCPCall().Cancel();
       
  1197                     break;
       
  1198                 case CCPCall::EStateAnswering:
       
  1199                 case CCPCall::EStateRinging:
       
  1200                 case CCPCall::EStateQueued:
       
  1201                     call->GetCCPCall().Reject();
       
  1202                     break;
       
  1203                 default:
       
  1204                     call->GetCCPCall().HangUp();
       
  1205                     break;
       
  1206                 }
       
  1207             }
       
  1208         
       
  1209         }
       
  1210 
       
  1211     if( iConferenceCall->EnumerateCalls() )
       
  1212         {
       
  1213         iConferenceCall->HangUp();
       
  1214         }
       
  1215 
       
  1216     CCELOGSTRING("CCCECallContainer::TerminateAllCalls():OUT");
       
  1217     }
       
  1218 
       
  1219 // -----------------------------------------------------------------------------
       
  1220 // TerminateAllVoIPCalls
       
  1221 // -----------------------------------------------------------------------------
       
  1222 //
       
  1223 void CCCECallContainer::TerminateAllVoIPCalls()
       
  1224     {
       
  1225     CCELOGSTRING("CCCECallContainer::TerminateAllVoIPCalls():IN");
       
  1226 
       
  1227     for( TInt i = 0; i < KCCECallObjects; i++ )
       
  1228         {
       
  1229         CCCECall* call = GetCall( i );
       
  1230         
       
  1231         //Only VoIP calls are terminated
       
  1232         if( call->IsInUse() && 
       
  1233                 !iConferenceCall->IsPartOfConference( *call ) && 
       
  1234                 !IsCsPlugin( call, ETrue ) )
       
  1235             {
       
  1236             // Quiet hangup
       
  1237             switch( call->State() )
       
  1238                 {
       
  1239                 case CCPCall::EStateDialling:
       
  1240                     call->GetCCPCall().Cancel();
       
  1241                     break;
       
  1242                 case CCPCall::EStateAnswering:
       
  1243                 case CCPCall::EStateRinging:
       
  1244                 case CCPCall::EStateQueued:
       
  1245                     call->GetCCPCall().Reject();
       
  1246                     break;
       
  1247                 default:
       
  1248                     call->GetCCPCall().HangUp();
       
  1249                     break;
       
  1250                 }
       
  1251             }
       
  1252 
       
  1253         }
       
  1254     
       
  1255     //Hang up VoIP conference
       
  1256     if( iConferenceCall->EnumerateCalls() &&
       
  1257             iConferenceCall->Parameters().CallType() == 
       
  1258             CCPCall::ECallTypePS )
       
  1259         {
       
  1260         iConferenceCall->HangUp();
       
  1261         }
       
  1262 
       
  1263     CCELOGSTRING("CCCECallContainer::TerminateAllVoIPCalls():OUT");
       
  1264     }
       
  1265 
       
  1266 // -----------------------------------------------------------------------------
       
  1267 // Return CCE observer
       
  1268 // -----------------------------------------------------------------------------
       
  1269 //    
       
  1270 MCCEObserver* CCCECallContainer::CCEObserver()
       
  1271     {
       
  1272     return iMCCEObserver;
       
  1273     }
       
  1274 
       
  1275 // -----------------------------------------------------------------------------
       
  1276 // Return ss observer
       
  1277 // -----------------------------------------------------------------------------
       
  1278 //    
       
  1279 MCCESsObserver* CCCECallContainer::SsObserver()
       
  1280     {
       
  1281     return iMCCESsObserver;
       
  1282     }
       
  1283 
       
  1284 
       
  1285 
       
  1286 // -----------------------------------------------------------------------------
       
  1287 // GetLifeTime()
       
  1288 // -----------------------------------------------------------------------------
       
  1289 // 
       
  1290 TBool CCCECallContainer::GetLifeTime( TDes8& aLifeTimeInfo )
       
  1291 	{
       
  1292     CCELOGSTRING("CCCE::GetLifeTime()");
       
  1293     
       
  1294 	CConvergedCallProvider* plugin = NULL;
       
  1295 	
       
  1296     TRAP_IGNORE( plugin = iPluginManager->GetPluginL(KCSServiceId));
       
  1297     
       
  1298     if( plugin )
       
  1299     	{
       
  1300     	plugin->GetLifeTime(aLifeTimeInfo);
       
  1301     	}
       
  1302 	else
       
  1303 		{
       
  1304     	CCELOGSTRING("CCCE::GetLifeTime() - CS plugin not found!");
       
  1305     	return EFalse;
       
  1306 		}
       
  1307 
       
  1308    	return ETrue;
       
  1309     }
       
  1310 
       
  1311 // -----------------------------------------------------------------------------
       
  1312 // GetCSInfo()
       
  1313 // -----------------------------------------------------------------------------
       
  1314 // 
       
  1315 TBool CCCECallContainer::GetCSInfo( CSInfo& aCSInfo )
       
  1316 	{
       
  1317     CCELOGSTRING("CCCE::GetCSInfo()");
       
  1318 
       
  1319 	CConvergedCallProvider* plugin = NULL;
       
  1320 	
       
  1321 	TRAP_IGNORE( plugin = iPluginManager->GetPluginL(KCSServiceId));
       
  1322         
       
  1323     
       
  1324     if( plugin )
       
  1325     	{
       
  1326     	plugin->GetCSInfo(aCSInfo);
       
  1327     	}
       
  1328 	else
       
  1329 		{
       
  1330     	CCELOGSTRING("CCCE::GetCSInfo() - CS plugin not found!");
       
  1331     	return EFalse;
       
  1332 		}
       
  1333 
       
  1334    	return ETrue;
       
  1335 	}
       
  1336 
       
  1337 // ---------------------------------------------------------------------------
       
  1338 // CCCECallContainer::IsCsPlugin
       
  1339 // ---------------------------------------------------------------------------
       
  1340 //
       
  1341 TBool CCCECallContainer::IsCsPlugin(CCCECall* aCall, TBool aConference ) const
       
  1342     {
       
  1343     TBool isCsPlugin( EFalse );
       
  1344     if ( FeatureManager::FeatureSupported( KFeatureIdFfVoiceCallContinuity ) )
       
  1345         {
       
  1346         if ( aCall->Parameters().CallType() != 
       
  1347                 CCPCall::ECallTypePS )
       
  1348             {
       
  1349             isCsPlugin = ETrue;
       
  1350             if( aConference &&
       
  1351                 iConferenceCall->Parameters().CallType() == 
       
  1352                     CCPCall::ECallTypePS )
       
  1353                 {
       
  1354                 isCsPlugin = EFalse;
       
  1355                 }
       
  1356             }
       
  1357         }
       
  1358     else
       
  1359         {
       
  1360         if( aCall->ImplementationUid() == KCSProviderUid )
       
  1361             {
       
  1362             isCsPlugin = ETrue;
       
  1363             }
       
  1364         }
       
  1365     return isCsPlugin;
       
  1366     }
       
  1367 
       
  1368 
       
  1369 //end of file