phoneengine/phonemodel/src/cpemessagehandler.cpp
changeset 77 2be0b271d017
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
72:c76a0b1755b9 77:2be0b271d017
  2483         TEFLOGSTRING( KTAMESINT, "PE CPEMGsmessageHandler::ClearCallAudio() Deactivating" );
  2483         TEFLOGSTRING( KTAMESINT, "PE CPEMGsmessageHandler::ClearCallAudio() Deactivating" );
  2484         iGsmAudioData.HandleCallEnding();
  2484         iGsmAudioData.HandleCallEnding();
  2485         }
  2485         }
  2486     }
  2486     }
  2487 
  2487 
  2488 // -----------------------------------------------------------------------------
       
  2489 // CPEMessageHandler::HandleSwitchToVideoOrVoice 
       
  2490 // This method handle EPEMessageSwitchToVideoOrVoice message. If current call id
       
  2491 // is Data then call will be switched to Voice call and the other way around. 
       
  2492 // Method set current phonenumber to dataStore and get call parameter and call 
       
  2493 // hangUp to current call. 
       
  2494 // When hangUp is completed (EPEMessageIdle was sent) sequence will be continue 
       
  2495 // from ContinueSwitchToCall method.
       
  2496 // -----------------------------------------------------------------------------
       
  2497 //
       
  2498 TInt CPEMessageHandler::HandleSwitchToVideoOrVoice( const TInt aCallId )
       
  2499     {
       
  2500     // First get the current phone number and then end voice call
       
  2501     // or video call.
       
  2502     TInt err( ECCPErrorNone );
       
  2503     
       
  2504     TEFLOGSTRING2( KTAINT, 
       
  2505         "PE CPEMessageHandler::HandleSwitchToVideoOrVoice, aCallId : %d", aCallId );
       
  2506     // if out of memory case then phonenumber is already datastore.
       
  2507     if( aCallId != KPECallIdNotUsed )
       
  2508         {
       
  2509         if ( iDataStore.CallDirection( aCallId ) == RMobileCall::EMobileOriginated )
       
  2510             {
       
  2511             iDataStore.SetSwitchToNumberCommand( iDataStore.WholeOutgoingPhoneNumber( aCallId ) );  
       
  2512             // Clear phonenumber to prevent using the wrong number in MO video call.
       
  2513             iDataStore.SetPhoneNumber( KNullDesC() );
       
  2514             }
       
  2515         else
       
  2516             {
       
  2517             iDataStore.SetSwitchToNumberCommand( iDataStore.RemotePhoneNumber( aCallId ) );
       
  2518             // Remote phone number must be stored as the phone number in case of low-memory situation where 
       
  2519             // an MO voice call can be initiated after failing to answer an MT video call.
       
  2520             iDataStore.SetPhoneNumber( iDataStore.RemotePhoneNumber( aCallId ) );
       
  2521             }
       
  2522 
       
  2523         err = HandleReleaseCall();
       
  2524         }
       
  2525 
       
  2526     return err;
       
  2527     }
       
  2528     
       
  2529 // -----------------------------------------------------------------------------
       
  2530 // CPEMessageHandler::ContinueSwitchToCall
       
  2531 // Metdod calls dial to multimedia call or voice call.
       
  2532 // -----------------------------------------------------------------------------
       
  2533 //
       
  2534 TInt CPEMessageHandler::ContinueSwitchToCall( const TInt aCallId )  
       
  2535     {
       
  2536     TEFLOGSTRING2( KTAINT, 
       
  2537         "PE CPEMessageHandler::ContinueSwitchToCall, aCallId : %d", aCallId );
       
  2538     TInt callId;
       
  2539     TInt errorCode( ECCPErrorNone );
       
  2540   
       
  2541     TPEPhoneNumber phoneNumber = iDataStore.SwitchToNumberCommand();
       
  2542     TEFLOGSTRING2( KTAINT, 
       
  2543         "PE CPEMessageHandler::ContinueSwitchToCall, phoneNumber : %S", 
       
  2544         &phoneNumber );
       
  2545 
       
  2546     // Check is current call voice or video
       
  2547     if ( CallIdCheck::IsVoice( aCallId ) )
       
  2548         {
       
  2549         // Create new video call to same phonenumber
       
  2550         iDataStore.SetCallTypeCommand( EPECallTypeVideo );
       
  2551         errorCode = iCallHandling.DialMultimedia( phoneNumber, callId );
       
  2552         }
       
  2553     else if ( CallIdCheck::IsVideo( aCallId ) )
       
  2554         {
       
  2555         // Create new voice call to same phonenumber
       
  2556         iDataStore.SetCallTypeCommand( EPECallTypeCSVoice );
       
  2557         errorCode = iCallHandling.DialCall( phoneNumber, callId );
       
  2558         }
       
  2559     TEFLOGSTRING2( KTAINT, 
       
  2560         "PE CPEMessageHandler::ContinueSwitchToCall(), error : %d", errorCode );    
       
  2561     return errorCode;    
       
  2562     }
       
  2563 
  2488 
  2564 // -----------------------------------------------------------------------------
  2489 // -----------------------------------------------------------------------------
  2565 // CPEMessageHandler::RemovePreAndPostFix
  2490 // CPEMessageHandler::RemovePreAndPostFix
  2566 // Remmove supplementary service prefix and dtmf postfix.
  2491 // Remmove supplementary service prefix and dtmf postfix.
  2567 // Phone number can contain following parts: supplementary
  2492 // Phone number can contain following parts: supplementary