sipvoipprovider/svphold/src/svpholdcontroller.cpp
branchRCL_3
changeset 22 d38647835c2e
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2006-2010 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     if ( 0 == aStatusCode && ESVPEstablishing == HoldState() )
       
   377         {
       
   378         SVPDEBUG1( "CSVPHoldController::RequestFailed - status 0 received" )
       
   379         
       
   380         iReinviteCrossover = EFalse;
       
   381         iContext->CrossOver( EFalse );
       
   382         
       
   383         SVPDEBUG1( "CSVPHoldController::RequestFailed - set status code 400" )
       
   384         aStatusCode = KSVPBadRequestVal;
       
   385         }
       
   386 
       
   387     TInt err = KErrNone;
       
   388     if ( iReinviteCrossover )
       
   389         {
       
   390         TRAP( err, aBase.StartTimerL( aBase.ReinviteCrossoverTime(),
       
   391                                        KSVPReInviteTimerExpired ) );
       
   392         if ( err )
       
   393             {
       
   394             SVPDEBUG2("CSVPHoldController::RequestFailed - Timer, err %i",
       
   395                        err )
       
   396             }
       
   397         }
       
   398 
       
   399     iContext->SetCallRequestFailed( ETrue );
       
   400     err = IncomingResponse( &aSession, aStatusCode );
       
   401     iContext->SetCallRequestFailed( EFalse );
       
   402     SVPDEBUG1( "CSVPHoldController::RequestFailed - OUT" );
       
   403     return err;
       
   404     }
       
   405 
       
   406 
       
   407 // ---------------------------------------------------------------------------
       
   408 // CSVPHoldController::CheckCrossOver
       
   409 // ---------------------------------------------------------------------------
       
   410 //
       
   411 void CSVPHoldController::CheckCrossOver( CSVPSessionBase& aBase )
       
   412     {
       
   413     SVPDEBUG1( "CSVPHoldController::CheckCrossOver - IN" );
       
   414     if ( iReinviteCrossover )
       
   415         {
       
   416         SVPDEBUG1("CSVPHoldController::CheckCrossOver - True");
       
   417 
       
   418         aBase.StopTimers();
       
   419         iReinviteCrossover = EFalse;
       
   420         iContext->CrossOver( EFalse );
       
   421  
       
   422         TSVPHoldRequestType previousRequest = HoldRequest();
       
   423         
       
   424         if ( ESVPLocalHold == previousRequest ||
       
   425              ESVPLocalDoubleHold == previousRequest )
       
   426             {
       
   427             aBase.HoldRequestFailed();
       
   428             }
       
   429         
       
   430         else if ( ESVPLocalResume == previousRequest ||
       
   431                   ESVPLocalDoubleHoldResume == previousRequest )
       
   432             {
       
   433             aBase.ResumeRequestFailed();
       
   434             }
       
   435         
       
   436         else
       
   437             {
       
   438             // This case should never happen
       
   439             SVPDEBUG2( "CSVPHoldController::CheckCrossOver - Error,  = %i",
       
   440                         previousRequest );
       
   441             }
       
   442         }
       
   443     
       
   444     SVPDEBUG1( "CSVPHoldController::CheckCrossOver - OUT" );
       
   445     }
       
   446 
       
   447 // ---------------------------------------------------------------------------
       
   448 // CSVPHoldController::HoldState
       
   449 // Returns the hold state.
       
   450 // ---------------------------------------------------------------------------
       
   451 //
       
   452 TSVPSessionHoldState CSVPHoldController::HoldState() const
       
   453     {
       
   454     SVPDEBUG1( "CSVPHoldController::HoldState" );
       
   455     
       
   456     TSVPHoldStateIndex currentState = iContext->CurrentState();
       
   457     
       
   458     
       
   459     if ( KSVPHoldConnectedStateIndex == currentState )
       
   460         {
       
   461         SVPDEBUG1( "CSVPHoldController::HoldState - CONNECTED" );
       
   462         return ESVPConnected;
       
   463         }
       
   464         
       
   465     else if ( KSVPHoldEstablishingStateIndex == currentState )
       
   466         {
       
   467         SVPDEBUG1( "CSVPHoldController::HoldState - ESTABLISHING" );
       
   468         return ESVPEstablishing;
       
   469         }
       
   470         
       
   471     else
       
   472         {
       
   473         SVPDEBUG1( "CSVPHoldController::HoldState - ONHOLD" );
       
   474         return ESVPOnHold;
       
   475         }
       
   476     }
       
   477 
       
   478 // ---------------------------------------------------------------------------
       
   479 // CSVPHoldController::HoldRequest
       
   480 // Returns the hold request type.
       
   481 // ---------------------------------------------------------------------------
       
   482 //
       
   483 TSVPHoldRequestType CSVPHoldController::HoldRequest() const
       
   484     {
       
   485     SVPDEBUG1( "CSVPHoldController::HoldRequest" );
       
   486     return iContext->HoldRequest();
       
   487     }
       
   488 
       
   489 // ---------------------------------------------------------------------------
       
   490 // CSVPHoldController::HoldAllowed
       
   491 // ---------------------------------------------------------------------------
       
   492 //
       
   493 TBool CSVPHoldController::HoldAllowed()
       
   494     {
       
   495     TSVPHoldStateIndex currentState = iContext->CurrentState();
       
   496     
       
   497     if ( KSVPHoldOutStateIndex == currentState ||
       
   498          KSVPHoldEstablishingStateIndex == currentState ||
       
   499          KSVPHoldDHStateIndex == currentState )
       
   500         {
       
   501         SVPDEBUG1( "CSVPHoldController::HoldAllowed - EFalse" );
       
   502         return EFalse;
       
   503         }
       
   504     else
       
   505         {
       
   506         SVPDEBUG1( "CSVPHoldController::HoldAllowed - ETrue" );
       
   507         return ETrue;
       
   508         }
       
   509     }
       
   510 
       
   511 // ---------------------------------------------------------------------------
       
   512 // CSVPHoldController::ResumeAllowed
       
   513 // ---------------------------------------------------------------------------
       
   514 //   
       
   515 TBool CSVPHoldController::ResumeAllowed()
       
   516     {
       
   517     TSVPHoldStateIndex currentState = iContext->CurrentState();
       
   518     if ( KSVPHoldInStateIndex == currentState ||
       
   519          KSVPHoldEstablishingStateIndex == currentState ||
       
   520          KSVPHoldConnectedStateIndex == currentState )
       
   521         {
       
   522         return EFalse;
       
   523         }
       
   524     else
       
   525         {
       
   526         SVPDEBUG1( "CSVPHoldController::ResumeAllowed" );
       
   527         return ETrue;
       
   528         }    
       
   529     }
       
   530 
       
   531 // ---------------------------------------------------------------------------
       
   532 // CSVPHoldController::Muted
       
   533 // ---------------------------------------------------------------------------
       
   534 //
       
   535 void CSVPHoldController::Muted( TBool aMuted )
       
   536     {
       
   537     iContext->Muted( aMuted );
       
   538     }
       
   539 
       
   540 // ---------------------------------------------------------------------------
       
   541 // CSVPHoldController::IncomingRequestAllowed
       
   542 // ---------------------------------------------------------------------------
       
   543 //   
       
   544 TBool CSVPHoldController::IncomingRequestAllowed()
       
   545     {
       
   546     if ( KSVPHoldEstablishingStateIndex == iContext->CurrentState() )
       
   547         {
       
   548         return EFalse;
       
   549         }
       
   550     else
       
   551         {
       
   552         SVPDEBUG1( "CSVPHoldController::IncomingRequestAllowed" );
       
   553         
       
   554         return ETrue;
       
   555         }        
       
   556     }
       
   557     
       
   558 // ---------------------------------------------------------------------------
       
   559 // CSVPHoldController::IncomingResponseAllowed
       
   560 // ---------------------------------------------------------------------------
       
   561 //   
       
   562 TBool CSVPHoldController::IncomingResponseAllowed()
       
   563     {
       
   564     if ( KSVPHoldEstablishingStateIndex == iContext->CurrentState() )
       
   565         {
       
   566         SVPDEBUG1( "CSVPHoldController::IncomingResponseAllowed" );
       
   567         return ETrue;
       
   568         }
       
   569     else
       
   570         {
       
   571         return EFalse;
       
   572         }        
       
   573     }
       
   574 
       
   575 // ---------------------------------------------------------------------------
       
   576 // CSVPHoldController::HoldEvent
       
   577 // ---------------------------------------------------------------------------
       
   578 //
       
   579 MCCPCallObserver::TCCPCallEvent CSVPHoldController::HoldEvent()
       
   580     {
       
   581     return iContext->HoldEvent();
       
   582     }
       
   583 
       
   584 // ---------------------------------------------------------------------------
       
   585 // CSVPHoldController::RefreshHoldStateL
       
   586 // ---------------------------------------------------------------------------
       
   587 //
       
   588 void CSVPHoldController::RefreshHoldStateL()
       
   589     {
       
   590     SVPDEBUG1( "CSVPHoldController::RefreshHoldStateL - In" );
       
   591 
       
   592     CMceSession* session = iContext->SessionObject();
       
   593     const RPointerArray< CMceMediaStream >& streams = session->Streams();
       
   594     CMceMediaStream* mediaStream = NULL;
       
   595 
       
   596     TInt streamCount = streams.Count();
       
   597     for ( TInt i = 0; i < streamCount; i++ )
       
   598         {
       
   599         mediaStream = streams[ i ];
       
   600         TMceMediaType mediaType = mediaStream->Type();
       
   601         if ( KMceAudio == mediaType )
       
   602             {
       
   603             SVPDEBUG1( "CSVPHoldController::RefreshHoldStateL - Stream found" );
       
   604             mediaStream = streams[ i ];
       
   605             RefreshL( *mediaStream );
       
   606             break;
       
   607             }
       
   608         }
       
   609        
       
   610     SVPDEBUG1( "CSVPHoldController::RefreshHoldStateL - Out" );
       
   611     }
       
   612 
       
   613 // ---------------------------------------------------------------------------
       
   614 // CSVPHoldController::RefreshL
       
   615 // ---------------------------------------------------------------------------
       
   616 //
       
   617 void CSVPHoldController::RefreshL( CMceMediaStream& aMediaStream )
       
   618     {
       
   619     if ( &aMediaStream )
       
   620         {
       
   621         switch ( iContext->CurrentState() )
       
   622             {
       
   623             case KSVPHoldOutStateIndex:
       
   624                 {
       
   625                 iContext->MediaHandler().PerformMediaActionL(
       
   626                         aMediaStream, ESVPLocalHold );
       
   627                 break;
       
   628                 }
       
   629                 
       
   630             case KSVPHoldInStateIndex:
       
   631                 {
       
   632                 iContext->MediaHandler().PerformMediaActionL(
       
   633                         aMediaStream, ESVPRemoteHold );
       
   634                 break;
       
   635                 }
       
   636                 
       
   637             case KSVPHoldDHStateIndex:
       
   638                 {
       
   639                 iContext->MediaHandler().PerformMediaActionL(
       
   640                         aMediaStream, ESVPLocalDoubleHold );
       
   641                 break;
       
   642                 }
       
   643             
       
   644             case KSVPHoldConnectedStateIndex:
       
   645                 {
       
   646                 // Special case here; for enablingIOP: audio is lost on Snom M3 when it unholds the call
       
   647                 SVPDEBUG1( "CSVPHoldController::RefreshL -> Refresh audio" );
       
   648                 iContext->MediaHandler().EnableAudioL( *iContext );
       
   649                 SVPDEBUG1( "CSVPHoldController::RefreshL <- Refresh audio done" );
       
   650                 break;
       
   651                 }
       
   652                 
       
   653             case KSVPHoldEstablishingStateIndex:
       
   654                 {
       
   655                 SVPDEBUG1( "CSVPHoldController::RefreshL - Not needed" );
       
   656                 break;
       
   657                 }
       
   658             }
       
   659         }
       
   660 
       
   661     SVPDEBUG1( "CSVPHoldController::RefreshL - Out" );
       
   662     }
       
   663 
       
   664