sipvoipprovider/svphold/src/svpholdcontroller.cpp
changeset 0 a4daefaec16c
child 20 65a3ef1d5bd0
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     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:  Hold controller, interface class to SVP sessions
       
    15 *
       
    16 */
       
    17  
       
    18 
       
    19 #include    <mcesession.h>
       
    20 #include    <mcemediastream.h>
       
    21 #include    <mceaudiostream.h>
       
    22 
       
    23 #include    "svpholdcontroller.h"
       
    24 #include    "svpholdmediahandler.h"
       
    25 #include    "svpholdobserver.h"
       
    26 #include    "svpsessionbase.h"
       
    27 #include    "svpsipconsts.h"
       
    28 #include    "svpconsts.h"
       
    29 #include    "svplogger.h"
       
    30 
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // CSVPHoldController::CSVPHoldController
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CSVPHoldController::CSVPHoldController() :
       
    37         iContext( NULL ),
       
    38         iPreviousHoldState( ESVPHoldConnected ),
       
    39         iHoldRequestCompleted( EFalse ),
       
    40         iHoldRequest( ESVPHoldNoRequest ),
       
    41         iReinviteCrossover( EFalse )
       
    42     {
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CSVPHoldController::ConstructL
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 void CSVPHoldController::ConstructL( 
       
    50                             CMceSession& aSession,
       
    51                             TMceTransactionDataContainer& aContainer,
       
    52                             MSVPHoldObserver* aObserver,
       
    53                             TBool aIsMobileOriginated )
       
    54     {
       
    55     iContext = CSVPHoldContext::NewL( aSession, aContainer, aObserver,
       
    56                                       aIsMobileOriginated );
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CSVPHoldController::NewL
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CSVPHoldController* CSVPHoldController::NewL( 
       
    64                             CMceSession& aSession,
       
    65                             TMceTransactionDataContainer& aContainer,
       
    66                             MSVPHoldObserver* aObserver,
       
    67                             TBool aIsMobileOriginated )
       
    68     {    
       
    69     CSVPHoldController* self = new ( ELeave ) CSVPHoldController();
       
    70     
       
    71     CleanupStack::PushL( self );
       
    72     self->ConstructL( aSession, aContainer, aObserver,
       
    73                       aIsMobileOriginated );
       
    74                       
       
    75     CleanupStack::Pop( self );
       
    76 
       
    77     return self;
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // CSVPHoldController::NewLC
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 CSVPHoldController* CSVPHoldController::NewLC( 
       
    85                             CMceSession& aSession,
       
    86                             TMceTransactionDataContainer& aContainer,
       
    87                             MSVPHoldObserver* aObserver,
       
    88                             TBool aIsMobileOriginated )
       
    89     {
       
    90     CSVPHoldController* self = new ( ELeave ) CSVPHoldController();
       
    91     CleanupStack::PushL( self );
       
    92     self->ConstructL( aSession, aContainer, aObserver,
       
    93                       aIsMobileOriginated );
       
    94 
       
    95     return self;
       
    96     }
       
    97 
       
    98 
       
    99 // ---------------------------------------------------------------------------
       
   100 // CSVPHoldController::~CSVPHoldController
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 CSVPHoldController::~CSVPHoldController()
       
   104     {
       
   105     delete iContext;
       
   106     SVPDEBUG1( "CSVPHoldController::~CSVPHoldController Done" );
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CSVPHoldController::RetryHoldRequest
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 TInt CSVPHoldController::RetryHoldRequest( CMceSession* aSession )
       
   114     {
       
   115     SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- IN" );
       
   116     TInt err = KErrNone;
       
   117     switch ( iHoldRequest )
       
   118         {
       
   119         case ESVPHoldToHold:
       
   120             {
       
   121             SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- Hold" );
       
   122             err = HoldSession( aSession );
       
   123             break;
       
   124             }
       
   125             
       
   126         case ESVPHoldToResume:
       
   127             {
       
   128             SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- Resume" );
       
   129             err = ResumeSession( aSession );
       
   130             break;
       
   131             }
       
   132         
       
   133         default:
       
   134             {
       
   135             SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- No request!!" );
       
   136             err = KErrNotFound;
       
   137             break;
       
   138             }
       
   139         }
       
   140     
       
   141     iHoldRequest = ESVPHoldNoRequest;
       
   142     SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- OUT" );
       
   143     return err;
       
   144     }
       
   145 
       
   146 // ---------------------------------------------------------------------------
       
   147 // CSVPHoldController::HoldSession
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 TInt CSVPHoldController::HoldSession( CMceSession* aSession )
       
   151     {
       
   152     SVPDEBUG1( "CSVPHoldController::HoldSession -- IN" );
       
   153 
       
   154     if ( HoldAllowed() )
       
   155         {
       
   156         iHoldRequest = ESVPHoldToHold;
       
   157         iHoldRequestCompleted = EFalse;
       
   158         SVPDEBUG1( "CSVPHoldController::HoldSession -- Allowed" );
       
   159         TInt err = KErrNone;
       
   160         iContext->SetSessionObject( aSession );
       
   161 
       
   162         TRAP( err, iContext->ApplyCurrentStateL( aSession,
       
   163                                                  ESVPHoldToHold ) );
       
   164         
       
   165         SVPDEBUG2(
       
   166         "CSVPHoldController::HoldSession -- ApplyCurrentState done, err = %i",
       
   167          err );
       
   168          
       
   169         switch ( err )
       
   170             {                
       
   171             case KErrSVPHoldLocalOldwayholdNeeded:
       
   172                 {
       
   173                 SVPDEBUG1(
       
   174                 "CSVPHoldController::HoldSession: Oldway hold needed" );
       
   175                 
       
   176                 iContext->SetFirstAttempt( EFalse ); // Clearing the flag                
       
   177                 TRAP( err, iContext->ApplyCurrentStateL( aSession,
       
   178                                                          ESVPHoldToHold ) );
       
   179                 return err;
       
   180                 }
       
   181                 
       
   182             default:
       
   183                 {
       
   184                 SVPDEBUG2(
       
   185                 "CSVPHoldController::HoldSession - default, err: %i", err );
       
   186                 return err;
       
   187                 }
       
   188             }        
       
   189         }
       
   190         
       
   191     else
       
   192         {
       
   193         return KErrSVPHoldInProgress;
       
   194         }
       
   195     }
       
   196 
       
   197 // ---------------------------------------------------------------------------
       
   198 // CSVPHoldController::ResumeSession
       
   199 // ---------------------------------------------------------------------------
       
   200 //
       
   201 TInt CSVPHoldController::ResumeSession( CMceSession* aSession )
       
   202     {
       
   203     if ( ResumeAllowed() )
       
   204         {
       
   205         iHoldRequest = ESVPHoldToResume;
       
   206         iHoldRequestCompleted = EFalse;
       
   207         TInt err = KErrNone;
       
   208         iContext->SetSessionObject( aSession );
       
   209         TRAP( err, iContext->ApplyCurrentStateL( aSession,
       
   210                                                  ESVPHoldToResume ) );
       
   211         return err;
       
   212         }
       
   213     else
       
   214         {
       
   215         return KErrSVPHoldResumeInProgress;
       
   216         }
       
   217     }
       
   218 
       
   219 // ---------------------------------------------------------------------------
       
   220 // CSVPHoldController::TimedOut
       
   221 // ---------------------------------------------------------------------------
       
   222 //
       
   223 void CSVPHoldController::TimedOut()
       
   224     {
       
   225     iContext->TimedOut();
       
   226     }
       
   227 
       
   228 // ---------------------------------------------------------------------------
       
   229 // CSVPHoldController::IncomingRequest
       
   230 // ---------------------------------------------------------------------------
       
   231 //
       
   232 TInt CSVPHoldController::IncomingRequest( CMceSession* aSession )
       
   233     {
       
   234     SVPDEBUG1( "CSVPHoldController::IncomingRequest IN" )
       
   235     if ( IncomingRequestAllowed() )
       
   236         {
       
   237         SVPDEBUG1( "CSVPHoldController::IncomingRequest allowed" )
       
   238         
       
   239         iHoldRequestCompleted = EFalse;
       
   240         iContext->SetSessionObject( aSession );
       
   241         TInt err = KErrNone;
       
   242         TRAP( err, iContext->ApplyCurrentStateL( aSession,
       
   243                                                  ESVPHoldIncoming ) );
       
   244         
       
   245         if ( KErrSVPHoldNotHoldRequest == err )
       
   246             {
       
   247             iHoldRequestCompleted = ETrue;
       
   248             }
       
   249         
       
   250         return err;            
       
   251         }
       
   252         
       
   253     else
       
   254         {
       
   255         SVPDEBUG1( "CSVPHoldController::IncomingRequest not allowed!" )
       
   256         
       
   257         return KErrSVPHoldRequestPending;
       
   258         }    
       
   259     }
       
   260 
       
   261 // ---------------------------------------------------------------------------
       
   262 // CSVPHoldController::IncomingResponse
       
   263 // ---------------------------------------------------------------------------
       
   264 //
       
   265 TInt CSVPHoldController::IncomingResponse( 
       
   266                             CMceSession* aSession, 
       
   267                             TInt aStatusCode )
       
   268     {
       
   269     if ( IncomingResponseAllowed() )
       
   270         {
       
   271         SVPDEBUG1( "CSVPHoldController::IncomingResponse - Allowed" );
       
   272         iContext->SetSessionObject( aSession );
       
   273         iContext->SetResponseStatusCode( aStatusCode );
       
   274         TInt err = KErrNone;
       
   275         TRAP( err, iContext->ApplyCurrentStateL() );
       
   276         iContext->SetResponseStatusCode( KErrNotFound );
       
   277                                                  
       
   278         SVPDEBUG2( "CSVPHoldController::IncomingResponse - Error = %i", err );                                         
       
   279         return err;            
       
   280         }
       
   281         
       
   282     else
       
   283         {
       
   284         SVPDEBUG1( "CSVPHoldController::IncomingResponse - not Allowed!" );
       
   285         return KErrSVPHoldRequestPending;
       
   286         }        
       
   287     }
       
   288 
       
   289 // ---------------------------------------------------------------------------
       
   290 // CSVPHoldController::HoldInProgress
       
   291 // ---------------------------------------------------------------------------
       
   292 //
       
   293 TBool CSVPHoldController::HoldInProgress() const
       
   294     {
       
   295     return !iHoldRequestCompleted;
       
   296     }
       
   297 
       
   298 // ---------------------------------------------------------------------------
       
   299 // CSVPHoldController::HoldRolledBack
       
   300 // ---------------------------------------------------------------------------
       
   301 //
       
   302 TBool CSVPHoldController::HoldRolledBack() const
       
   303     {
       
   304     return iContext->HoldRolledBack();
       
   305     }
       
   306 
       
   307 // ---------------------------------------------------------------------------
       
   308 // CSVPHoldController::HoldFailed
       
   309 // ---------------------------------------------------------------------------
       
   310 //
       
   311 TBool CSVPHoldController::HoldFailed()
       
   312     {
       
   313     return iContext->HoldFailed();    
       
   314     }
       
   315 
       
   316 // ---------------------------------------------------------------------------
       
   317 // CSVPHoldController::ResumeFailed
       
   318 // ---------------------------------------------------------------------------
       
   319 //
       
   320 TBool CSVPHoldController::ResumeFailed()
       
   321     {
       
   322     return iContext->ResumeFailed();    
       
   323     }
       
   324 
       
   325 // ---------------------------------------------------------------------------
       
   326 // CSVPHoldController::ContinueHoldProcessing
       
   327 // ---------------------------------------------------------------------------
       
   328 //
       
   329 TInt CSVPHoldController::ContinueHoldProcessing( CMceSession& aSession )
       
   330     {
       
   331     SVPDEBUG1( "CSVPHoldController::ContinueHoldProcessing - IN" );
       
   332     iReinviteCrossover = EFalse;
       
   333     TInt err = KErrNone;
       
   334     iContext->SetSessionObject( &aSession );
       
   335 
       
   336     TRAP( err, iContext->ApplyCurrentStateL() );
       
   337     
       
   338     iHoldRequestCompleted = ETrue;
       
   339     SVPDEBUG2( "CSVPHoldController::ContinueHoldProcessing - Ready, err = %i",
       
   340                 err );
       
   341     return err;
       
   342     }
       
   343 
       
   344 // ---------------------------------------------------------------------------
       
   345 // CSVPHoldController::RequestFailed
       
   346 // ---------------------------------------------------------------------------
       
   347 //
       
   348 TInt CSVPHoldController::RequestFailed( CMceSession& aSession, 
       
   349                                         TInt aStatusCode, 
       
   350                                         CSVPSessionBase& aBase )
       
   351     {
       
   352     SVPDEBUG1( "CSVPHoldController::RequestFailed - IN" );
       
   353 
       
   354 
       
   355     aBase.StopTimers();
       
   356     
       
   357     // If 491 received first time, try it once more. No need to enable /
       
   358     // disable audios
       
   359     if ( KSVPRequestPendingVal == aStatusCode )
       
   360         {
       
   361         SVPDEBUG1( "CSVPHoldController::RequestFailed - 491 received" )
       
   362         if ( !iReinviteCrossover )
       
   363             {
       
   364             // First 491 received              
       
   365             iReinviteCrossover = ETrue;
       
   366             iContext->CrossOver( ETrue );                
       
   367             }
       
   368         else
       
   369             {
       
   370             // Second 491; hold/resume request failed
       
   371             iReinviteCrossover = EFalse;
       
   372             iContext->CrossOver( EFalse );
       
   373             }
       
   374         }
       
   375 
       
   376     TInt err = KErrNone;
       
   377     if ( iReinviteCrossover )
       
   378         {
       
   379         TRAP( err, aBase.StartTimerL( aBase.ReinviteCrossoverTime(),
       
   380                                        KSVPReInviteTimerExpired ) );
       
   381         if ( err )
       
   382             {
       
   383             SVPDEBUG2("CSVPHoldController::RequestFailed - Timer, err %i",
       
   384                        err )
       
   385             }
       
   386         }
       
   387 
       
   388     iContext->SetCallRequestFailed( ETrue );
       
   389     err = IncomingResponse( &aSession, aStatusCode );
       
   390     iContext->SetCallRequestFailed( EFalse );
       
   391     SVPDEBUG1( "CSVPHoldController::RequestFailed - OUT" );
       
   392     return err;
       
   393     }
       
   394 
       
   395 
       
   396 // ---------------------------------------------------------------------------
       
   397 // CSVPHoldController::CheckCrossOver
       
   398 // ---------------------------------------------------------------------------
       
   399 //
       
   400 void CSVPHoldController::CheckCrossOver( CSVPSessionBase& aBase )
       
   401     {
       
   402     SVPDEBUG1( "CSVPHoldController::CheckCrossOver - IN" );
       
   403     if ( iReinviteCrossover )
       
   404         {
       
   405         SVPDEBUG1("CSVPHoldController::CheckCrossOver - True");
       
   406 
       
   407         aBase.StopTimers();
       
   408         iReinviteCrossover = EFalse;
       
   409         iContext->CrossOver( EFalse );
       
   410  
       
   411         TSVPHoldRequestType previousRequest = HoldRequest();
       
   412         
       
   413         if ( ESVPLocalHold == previousRequest ||
       
   414              ESVPLocalDoubleHold == previousRequest )
       
   415             {
       
   416             aBase.HoldRequestFailed();
       
   417             }
       
   418         
       
   419         else if ( ESVPLocalResume == previousRequest ||
       
   420                   ESVPLocalDoubleHoldResume == previousRequest )
       
   421             {
       
   422             aBase.ResumeRequestFailed();
       
   423             }
       
   424         
       
   425         else
       
   426             {
       
   427             // This case should never happen
       
   428             SVPDEBUG2( "CSVPHoldController::CheckCrossOver - Error,  = %i",
       
   429                         previousRequest );
       
   430             }
       
   431         }
       
   432     
       
   433     SVPDEBUG1( "CSVPHoldController::CheckCrossOver - OUT" );
       
   434     }
       
   435 
       
   436 // ---------------------------------------------------------------------------
       
   437 // CSVPHoldController::HoldState
       
   438 // Returns the hold state.
       
   439 // ---------------------------------------------------------------------------
       
   440 //
       
   441 TSVPSessionHoldState CSVPHoldController::HoldState() const
       
   442     {
       
   443     SVPDEBUG1( "CSVPHoldController::HoldState" );
       
   444     
       
   445     TSVPHoldStateIndex currentState = iContext->CurrentState();
       
   446     
       
   447     
       
   448     if ( KSVPHoldConnectedStateIndex == currentState )
       
   449         {
       
   450         SVPDEBUG1( "CSVPHoldController::HoldState - CONNECTED" );
       
   451         return ESVPConnected;
       
   452         }
       
   453         
       
   454     else if ( KSVPHoldEstablishingStateIndex == currentState )
       
   455         {
       
   456         SVPDEBUG1( "CSVPHoldController::HoldState - ESTABLISHING" );
       
   457         return ESVPEstablishing;
       
   458         }
       
   459         
       
   460     else
       
   461         {
       
   462         SVPDEBUG1( "CSVPHoldController::HoldState - ONHOLD" );
       
   463         return ESVPOnHold;
       
   464         }
       
   465     }
       
   466 
       
   467 // ---------------------------------------------------------------------------
       
   468 // CSVPHoldController::HoldRequest
       
   469 // Returns the hold request type.
       
   470 // ---------------------------------------------------------------------------
       
   471 //
       
   472 TSVPHoldRequestType CSVPHoldController::HoldRequest() const
       
   473     {
       
   474     SVPDEBUG1( "CSVPHoldController::HoldRequest" );
       
   475     return iContext->HoldRequest();
       
   476     }
       
   477 
       
   478 // ---------------------------------------------------------------------------
       
   479 // CSVPHoldController::HoldAllowed
       
   480 // ---------------------------------------------------------------------------
       
   481 //
       
   482 TBool CSVPHoldController::HoldAllowed()
       
   483     {
       
   484     TSVPHoldStateIndex currentState = iContext->CurrentState();
       
   485     
       
   486     if ( KSVPHoldOutStateIndex == currentState ||
       
   487          KSVPHoldEstablishingStateIndex == currentState ||
       
   488          KSVPHoldDHStateIndex == currentState )
       
   489         {
       
   490         SVPDEBUG1( "CSVPHoldController::HoldAllowed - EFalse" );
       
   491         return EFalse;
       
   492         }
       
   493     else
       
   494         {
       
   495         SVPDEBUG1( "CSVPHoldController::HoldAllowed - ETrue" );
       
   496         return ETrue;
       
   497         }
       
   498     }
       
   499 
       
   500 // ---------------------------------------------------------------------------
       
   501 // CSVPHoldController::ResumeAllowed
       
   502 // ---------------------------------------------------------------------------
       
   503 //   
       
   504 TBool CSVPHoldController::ResumeAllowed()
       
   505     {
       
   506     TSVPHoldStateIndex currentState = iContext->CurrentState();
       
   507     if ( KSVPHoldInStateIndex == currentState ||
       
   508          KSVPHoldEstablishingStateIndex == currentState ||
       
   509          KSVPHoldConnectedStateIndex == currentState )
       
   510         {
       
   511         return EFalse;
       
   512         }
       
   513     else
       
   514         {
       
   515         SVPDEBUG1( "CSVPHoldController::ResumeAllowed" );
       
   516         return ETrue;
       
   517         }    
       
   518     }
       
   519 
       
   520 // ---------------------------------------------------------------------------
       
   521 // CSVPHoldController::Muted
       
   522 // ---------------------------------------------------------------------------
       
   523 //
       
   524 void CSVPHoldController::Muted( TBool aMuted )
       
   525     {
       
   526     iContext->Muted( aMuted );
       
   527     }
       
   528 
       
   529 // ---------------------------------------------------------------------------
       
   530 // CSVPHoldController::IncomingRequestAllowed
       
   531 // ---------------------------------------------------------------------------
       
   532 //   
       
   533 TBool CSVPHoldController::IncomingRequestAllowed()
       
   534     {
       
   535     if ( KSVPHoldEstablishingStateIndex == iContext->CurrentState() )
       
   536         {
       
   537         return EFalse;
       
   538         }
       
   539     else
       
   540         {
       
   541         SVPDEBUG1( "CSVPHoldController::IncomingRequestAllowed" );
       
   542         
       
   543         return ETrue;
       
   544         }        
       
   545     }
       
   546     
       
   547 // ---------------------------------------------------------------------------
       
   548 // CSVPHoldController::IncomingResponseAllowed
       
   549 // ---------------------------------------------------------------------------
       
   550 //   
       
   551 TBool CSVPHoldController::IncomingResponseAllowed()
       
   552     {
       
   553     if ( KSVPHoldEstablishingStateIndex == iContext->CurrentState() )
       
   554         {
       
   555         SVPDEBUG1( "CSVPHoldController::IncomingResponseAllowed" );
       
   556         return ETrue;
       
   557         }
       
   558     else
       
   559         {
       
   560         return EFalse;
       
   561         }        
       
   562     }
       
   563 
       
   564 // ---------------------------------------------------------------------------
       
   565 // CSVPHoldController::HoldEvent
       
   566 // ---------------------------------------------------------------------------
       
   567 //
       
   568 MCCPCallObserver::TCCPCallEvent CSVPHoldController::HoldEvent()
       
   569     {
       
   570     return iContext->HoldEvent();
       
   571     }
       
   572 
       
   573 // ---------------------------------------------------------------------------
       
   574 // CSVPHoldController::RefreshHoldStateL
       
   575 // ---------------------------------------------------------------------------
       
   576 //
       
   577 void CSVPHoldController::RefreshHoldStateL()
       
   578     {
       
   579     SVPDEBUG1( "CSVPHoldController::RefreshHoldStateL - In" );
       
   580 
       
   581     CMceSession* session = iContext->SessionObject();
       
   582     const RPointerArray< CMceMediaStream >& streams = session->Streams();
       
   583     CMceMediaStream* mediaStream = NULL;
       
   584 
       
   585     TInt streamCount = streams.Count();
       
   586     for ( TInt i = 0; i < streamCount; i++ )
       
   587         {
       
   588         mediaStream = streams[ i ];
       
   589         TMceMediaType mediaType = mediaStream->Type();
       
   590         if ( KMceAudio == mediaType )
       
   591             {
       
   592             SVPDEBUG1( "CSVPHoldController::RefreshHoldStateL - Stream found" );
       
   593             mediaStream = streams[ i ];
       
   594             RefreshL( *mediaStream );
       
   595             break;
       
   596             }
       
   597         }
       
   598        
       
   599     SVPDEBUG1( "CSVPHoldController::RefreshHoldStateL - Out" );
       
   600     }
       
   601 
       
   602 // ---------------------------------------------------------------------------
       
   603 // CSVPHoldController::RefreshL
       
   604 // ---------------------------------------------------------------------------
       
   605 //
       
   606 void CSVPHoldController::RefreshL( CMceMediaStream& aMediaStream )
       
   607     {
       
   608     if ( &aMediaStream )
       
   609         {
       
   610         switch ( iContext->CurrentState() )
       
   611             {
       
   612             case KSVPHoldOutStateIndex:
       
   613                 {
       
   614                 iContext->MediaHandler().PerformMediaActionL(
       
   615                         aMediaStream, ESVPLocalHold );
       
   616                 break;
       
   617                 }
       
   618                 
       
   619             case KSVPHoldInStateIndex:
       
   620                 {
       
   621                 iContext->MediaHandler().PerformMediaActionL(
       
   622                         aMediaStream, ESVPRemoteHold );
       
   623                 break;
       
   624                 }
       
   625                 
       
   626             case KSVPHoldDHStateIndex:
       
   627                 {
       
   628                 iContext->MediaHandler().PerformMediaActionL(
       
   629                         aMediaStream, ESVPLocalDoubleHold );
       
   630                 break;
       
   631                 }
       
   632             
       
   633             case KSVPHoldConnectedStateIndex:
       
   634                 {
       
   635                 // Special case here; for enablingIOP: audio is lost on Snom M3 when it unholds the call
       
   636                 SVPDEBUG1( "CSVPHoldController::RefreshL -> Refresh audio" );
       
   637                 iContext->MediaHandler().EnableAudioL( *iContext );
       
   638                 SVPDEBUG1( "CSVPHoldController::RefreshL <- Refresh audio done" );
       
   639                 break;
       
   640                 }
       
   641                 
       
   642             case KSVPHoldEstablishingStateIndex:
       
   643                 {
       
   644                 SVPDEBUG1( "CSVPHoldController::RefreshL - Not needed" );
       
   645                 break;
       
   646                 }
       
   647             }
       
   648         }
       
   649 
       
   650     SVPDEBUG1( "CSVPHoldController::RefreshL - Out" );
       
   651     }
       
   652 
       
   653