phoneengine/callhandling/src/cpecallhandling.cpp
branchRCL_3
changeset 4 24062c24fe38
parent 3 8871b09be73b
child 5 2a26698d78ba
equal deleted inserted replaced
3:8871b09be73b 4:24062c24fe38
   441             
   441             
   442         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   442         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   443             {
   443             {
   444             TEFLOGSTRING( KTAMESINT, "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged");
   444             TEFLOGSTRING( KTAMESINT, "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged");
   445             // HO cases call type can changes
   445             // HO cases call type can changes
   446             CPESingleCall* connectedCall;
   446             CPESingleCall* call;
   447             connectedCall = iCallArrayOwner->CallPointerByState( EPEStateConnected );
   447             call = static_cast<CPESingleCall*>( iCallArrayOwner->CallByCallId( aCallId ) );
   448             
   448                                  
   449             if( connectedCall )
   449             if ( EPEStateConnected == call->GetCallState() )
   450                 {
   450                 {
   451                 MCCECall& call = connectedCall->Call();
   451                 MCCECall& connectedCall = call->Call();
   452                 CCPCall::TCallType callType = call.Parameters().CallType();
   452                 CCPCall::TCallType callType = connectedCall.Parameters().CallType();
   453                 
   453                 
   454                 if ( callType == CCPCall::ECallTypePS ) 
   454                 if ( callType == CCPCall::ECallTypePS ) 
   455                     {
   455                     {
   456                     TEFLOGSTRING( KTAMESINT, 
   456                     TEFLOGSTRING( KTAMESINT, 
   457                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to PS");
   457                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to PS");
   458                     iModel.DataStore()->SetCallType( EPECallTypeVoIP, aCallId ); 
   458                     iModel.DataStore()->SetCallType( EPECallTypeVoIP, aCallId ); 
   459                     iModel.DataStore()->SetServiceIdCommand( connectedCall->Call().Parameters().ServiceId() );
   459                     iModel.DataStore()->SetServiceIdCommand( call->Call().Parameters().ServiceId() );
   460                     iCallOpenParams->SetCallType( CCPCall::ECallTypePS); 
   460                     iCallOpenParams->SetCallType( CCPCall::ECallTypePS); 
   461                     }
   461                     }
   462                 else if ( callType == CCPCall::ECallTypeCSVoice )
   462                 else if ( callType == CCPCall::ECallTypeCSVoice )
   463                     {
   463                     {
   464                      TEFLOGSTRING( KTAMESINT, 
   464                      TEFLOGSTRING( KTAMESINT, 
   465                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to CS");
   465                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to CS");
   466                     iCallOpenParams->SetCallType( CCPCall::ECallTypeCSVoice );
   466                     iCallOpenParams->SetCallType( CCPCall::ECallTypeCSVoice );
   467                     iModel.DataStore()->SetServiceIdCommand( 1 );
   467                     iModel.DataStore()->SetServiceIdCommand( 1 );
   468                     iModel.DataStore()->SetCallType( EPECallTypeCSVoice, aCallId );  
   468                     iModel.DataStore()->SetCallType( EPECallTypeCSVoice, aCallId ); 
   469                     SetColpNumber( aCallId, call );
   469                     
       
   470                     if ( UpdateColpNumber( aCallId, connectedCall ))
       
   471                         {
       
   472                         iModel.SendMessage( MEngineMonitor::EPEMessageColpNumberAvailable, aCallId );
       
   473                         }
   470                     }
   474                     }
   471                 
   475                 
   472                 iModel.DataStore()->SetRemotePartyName( call.RemotePartyName(), aCallId );                
   476                 iModel.DataStore()->SetRemotePartyName( connectedCall.RemotePartyName(), aCallId );                
   473                 iModel.DataStore()->SetRemotePhoneNumber( call.RemoteParty(), aCallId );
   477                 iModel.DataStore()->SetRemotePhoneNumber( connectedCall.RemoteParty().Left( KPEPhoneNumberMaxLength ), aCallId );
   474                 iModel.DataStore()->SetCallIndex(call.CallIndex(), aCallId );
   478                 iModel.DataStore()->SetCallIndex(connectedCall.CallIndex(), aCallId );
   475                 }
   479                 }
   476             break;
   480             break;
   477             }
   481             }
   478                    
   482                    
   479         case MEngineMonitor::EPEMessageIncoming:
   483         case MEngineMonitor::EPEMessageIncoming:
   482             CPESingleCall* callData = iCallArrayOwner->GetCallObject( aCallId );
   486             CPESingleCall* callData = iCallArrayOwner->GetCallObject( aCallId );
   483             if( callData )
   487             if( callData )
   484                 {
   488                 {
   485                 MCCECall& call = callData->Call();
   489                 MCCECall& call = callData->Call();
   486                 iModel.DataStore()->SetRemotePartyName( call.RemotePartyName(), aCallId );
   490                 iModel.DataStore()->SetRemotePartyName( call.RemotePartyName(), aCallId );
   487                 iModel.DataStore()->SetRemotePhoneNumber( call.RemoteParty(), aCallId );
   491                 iModel.DataStore()->SetRemotePhoneNumber( call.RemoteParty().Left( KPEPhoneNumberMaxLength ), aCallId );
   488                 iModel.DataStore()->SetCallIndex(call.CallIndex(), aCallId );
   492                 iModel.DataStore()->SetCallIndex(call.CallIndex(), aCallId );
   489                 }
   493                 }
   490             break;
   494             break;
   491             }
   495             }
   492         case MEngineMonitor::EPEMessageForwardUnconditionalModeActive:
   496         case MEngineMonitor::EPEMessageForwardUnconditionalModeActive:
   831         errorCode = iVideoCallHandling->HangUp( aCallId );
   835         errorCode = iVideoCallHandling->HangUp( aCallId );
   832         }
   836         }
   833 
   837 
   834     else if ( CallIdCheck::IsConference( aCallId ) )
   838     else if ( CallIdCheck::IsConference( aCallId ) )
   835         {
   839         {
   836         ReleaseConference();
   840         errorCode = ReleaseConference();
   837         }
   841         }
   838     return errorCode;
   842     return errorCode;
   839     }
   843     }
   840 
   844 
   841 // -----------------------------------------------------------------------------
   845 // -----------------------------------------------------------------------------
  2370             }
  2374             }
  2371         }
  2375         }
  2372     else
  2376     else
  2373         {
  2377         {
  2374         CPESingleCall* callData = iCallArrayOwner->CallPointerByState( EPEStateHeld );
  2378         CPESingleCall* callData = iCallArrayOwner->CallPointerByState( EPEStateHeld );
  2375         // Check that no actice and held call, if waiting call gets idle
  2379         if ( callData )
  2376         CPESingleCall* connectedCallData = iCallArrayOwner->CallPointerByState( EPEStateConnected );
  2380             {
  2377         if( callData && ( iModel.DataStore()->ResumeHeldCall( callData->GetCallId() ) )
  2381             // Checks to be done in case waiting call gets idle state:
  2378                     && !connectedCallData )
  2382             // Check that no active and held calls case
  2379             {
  2383             // Check that no dialling/connecting and held calls case
  2380             TEFLOGSTRING( KTAINT, "CALL CPECallHandling::HandleAutoResume single" );
  2384             if ( iModel.DataStore()->ResumeHeldCall( callData->GetCallId() ) &&
  2381             callData->Resume();
  2385                  !IsCallInState( EPEStateConnected ) &&
       
  2386                  !IsCallInState( EPEStateConnecting ) &&
       
  2387                  !IsCallInState( EPEStateDialing ) )
       
  2388                 {
       
  2389                 TEFLOGSTRING( KTAINT, "CALL CPECallHandling::HandleAutoResume single" );
       
  2390                 callData->Resume();
       
  2391                 }
  2382             }
  2392             }
  2383         }
  2393         }
  2384     }
  2394     }
  2385 
  2395 
  2386 // -----------------------------------------------------------------------------
  2396 // -----------------------------------------------------------------------------
  2424             }                    
  2434             }                    
  2425         }                
  2435         }                
  2426     }
  2436     }
  2427 
  2437 
  2428 // -----------------------------------------------------------------------------
  2438 // -----------------------------------------------------------------------------
  2429 // CPECallHandling::SetColpNumber
  2439 // CPECallHandling::UpdateColpNumber
  2430 // -----------------------------------------------------------------------------
  2440 // -----------------------------------------------------------------------------
  2431 //
  2441 //
  2432 void CPECallHandling::SetColpNumber( TInt aCallId, const MCCECall& aCall ) const
  2442 TBool CPECallHandling::UpdateColpNumber( TInt aCallId, const MCCECall& aCall ) const
  2433     {
  2443     {
  2434     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::SetColpNumber" );
  2444     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::UpdateColpNumber" );
  2435     
  2445     
       
  2446     TBool updateDone( EFalse );
  2436     TInt errorCode( KErrNone );
  2447     TInt errorCode( KErrNone );
  2437     TInt value( KPEMatchDefault );
  2448     TInt value( KPEMatchDefault );
  2438     TPEMatcher matcher;    
  2449     TPEMatcher matcher;       
  2439     
  2450     TPEPhoneNumber remoteNumber;
  2440     const TPEPhoneNumber& origRemoteNumber = iModel.DataStore()->RemotePhoneNumber( aCallId );    
  2451     
  2441     const TPEPhoneNumber& remoteNumber = aCall.RemoteParty();
  2452     MPEDataStore* dataStore = iModel.DataStore();
       
  2453     
       
  2454     if ( dataStore->RemoteColpNumber( aCallId ).Length() )
       
  2455         {
       
  2456         remoteNumber = dataStore->RemoteColpNumber( aCallId );
       
  2457         }
       
  2458     else
       
  2459         {
       
  2460         remoteNumber = dataStore->RemotePhoneNumber( aCallId );
       
  2461         }    
       
  2462         
       
  2463     const TPEPhoneNumber& updatedNumber = aCall.RemoteParty();
  2442     
  2464     
  2443     errorCode = iRepository->Get( KTelMatchDigits, value );
  2465     errorCode = iRepository->Get( KTelMatchDigits, value );
  2444 
       
  2445     if ( !errorCode == KErrNone )
  2466     if ( !errorCode == KErrNone )
  2446         {
  2467         {
  2447         TEFLOGSTRING( KTAOBJECT, "Reading KTelMatchDigits failed, use default value for matching");
  2468         TEFLOGSTRING( KTAOBJECT, "Reading KTelMatchDigits failed, use default value for matching");
  2448         }    
  2469         } 
  2449     
  2470     
  2450     //check if remote number is different from dialled number
  2471     //check if remote number is different from dialled number
  2451     if ( !matcher.numbersMatch( origRemoteNumber, remoteNumber, value ) )
  2472     if ( !matcher.numbersMatch( remoteNumber, updatedNumber, value ) )
  2452         {
  2473         {
  2453         //set COLP number        
  2474         //set COLP number        
  2454         iModel.DataStore()->SetRemoteColpNumber( remoteNumber, aCallId );
  2475         dataStore->SetRemoteColpNumber( updatedNumber, aCallId );
  2455         
  2476         
  2456         TEFLOGSTRING3( KTAMESINT, 
  2477         TEFLOGSTRING3( KTAMESINT, 
  2457                 "CPECallHandling::SetColpNumber, colp number: '%S', call id: %d", 
  2478                 "CPECallHandling::UpdateColpNumber, colp number: '%S', call id: %d", 
  2458                 &remoteNumber, aCallId );
  2479                 &updatedNumber, aCallId );
  2459         }        
  2480         updateDone = ETrue;
       
  2481         }  
       
  2482     
       
  2483     return updateDone;
  2460     }
  2484     }
  2461         
  2485         
  2462 // -----------------------------------------------------------------------------
  2486 // -----------------------------------------------------------------------------
  2463 // CPECallHandling::ReleaseConference
  2487 // CPECallHandling::ReleaseConference
  2464 // Release conference call
  2488 // Release conference call