phoneengine/callhandling/src/cpecallhandling.cpp
branchRCL_3
changeset 25 5266b1f337bd
parent 24 41a7f70b3818
equal deleted inserted replaced
24:41a7f70b3818 25:5266b1f337bd
    36 #include    <pepanic.pan>
    36 #include    <pepanic.pan>
    37 #include    <talogger.h>
    37 #include    <talogger.h>
    38 #include    <PSVariables.h>
    38 #include    <PSVariables.h>
    39 #include    <ctsydomainpskeys.h>
    39 #include    <ctsydomainpskeys.h>
    40 #include    <mccecall.h>
    40 #include    <mccecall.h>
    41 #include    <psetsaobserver.h>
    41 #include    <PsetSAObserver.h>
    42 #include    <cccecallparameters.h>
    42 #include    <cccecallparameters.h>
    43 #include    <centralrepository.h>
    43 #include    <centralrepository.h>
       
    44 #include    <telconfigcrkeys.h>
    44 
    45 
    45 // EXTERNAL DATA STRUCTURES
    46 // EXTERNAL DATA STRUCTURES
    46 // None
    47 // None
    47 
    48 
    48 // EXTERNAL FUNCTION PROTOTYPES  
    49 // EXTERNAL FUNCTION PROTOTYPES  
    49 // None
    50 // None
    50 
    51 
    51 // CONSTANTS
    52 // CONSTANTS
    52 /******************************************************************************
       
    53 * Telephony Configuration API
       
    54 * Keys under this category are used in defining telephony configuration.
       
    55 ******************************************************************************/
       
    56 const TUid KCRUidTelConfiguration = {0x102828B8};
       
    57 
       
    58 /**
       
    59 * Amount of digits to be used in contact matching.
       
    60 * This allows a customer to variate the amount of digits to be matched.
       
    61 */
       
    62 const TUint32 KTelMatchDigits                               = 0x00000001;
       
    63 
       
    64 const TInt KPEMatchDefault = 7;
    53 const TInt KPEMatchDefault = 7;
    65 
    54 
    66 // MACROS
    55 // MACROS
    67 // None
    56 // None
    68 
    57 
   459                                  
   448                                  
   460             MCCECall& connectedCall = call->Call();
   449             MCCECall& connectedCall = call->Call();
   461             CCPCall::TCallType callType = connectedCall.Parameters().CallType();
   450             CCPCall::TCallType callType = connectedCall.Parameters().CallType();
   462  
   451  
   463             if ( EPEStateConnected == call->GetCallState() )
   452             if ( EPEStateConnected == call->GetCallState() )
   464                 {
   453                 {                
   465                 if ( callType == CCPCall::ECallTypePS ) 
   454                 if ( callType == CCPCall::ECallTypePS ) 
   466                     {
   455                     {
   467                     TEFLOGSTRING( KTAMESINT, 
   456                     TEFLOGSTRING( KTAMESINT, 
   468                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to PS");
   457                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to PS");
   469                     iModel.DataStore()->SetCallType( EPECallTypeVoIP, aCallId ); 
   458                     iModel.DataStore()->SetCallType( EPECallTypeVoIP, aCallId ); 
   475                      TEFLOGSTRING( KTAMESINT, 
   464                      TEFLOGSTRING( KTAMESINT, 
   476                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to CS");
   465                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to CS");
   477                     iCallOpenParams->SetCallType( CCPCall::ECallTypeCSVoice );
   466                     iCallOpenParams->SetCallType( CCPCall::ECallTypeCSVoice );
   478                     iModel.DataStore()->SetServiceIdCommand( 1 );
   467                     iModel.DataStore()->SetServiceIdCommand( 1 );
   479                     iModel.DataStore()->SetCallType( EPECallTypeCSVoice, aCallId ); 
   468                     iModel.DataStore()->SetCallType( EPECallTypeCSVoice, aCallId ); 
       
   469                     
   480                     if ( UpdateColpNumber( aCallId, connectedCall ))
   470                     if ( UpdateColpNumber( aCallId, connectedCall ))
   481                         {
   471                         {
   482                         iModel.SendMessage( MEngineMonitor::EPEMessageColpNumberAvailable, aCallId );
   472                         iModel.SendMessage( MEngineMonitor::EPEMessageColpNumberAvailable, aCallId );
   483                         }
   473                         }
   484                     }
   474                     }
   683                 }
   673                 }
   684             else
   674             else
   685                 {
   675                 {
   686                 // Dial request passed on successfully: forward new call id
   676                 // Dial request passed on successfully: forward new call id
   687                 aCallId = callData->GetCallId();
   677                 aCallId = callData->GetCallId();
       
   678                 iModel.SendMessage( MEngineMonitor::EPEMessageInitiatedMoCall, aCallId );
   688                 }
   679                 }
   689             }
   680             }
   690         }
   681         }
   691     else
   682     else
   692         {
   683         {
   845         errorCode = iVideoCallHandling->HangUp( aCallId );
   836         errorCode = iVideoCallHandling->HangUp( aCallId );
   846         }
   837         }
   847 
   838 
   848     else if ( CallIdCheck::IsConference( aCallId ) )
   839     else if ( CallIdCheck::IsConference( aCallId ) )
   849         {
   840         {
   850         if( iConferenceCall )
   841         errorCode = ReleaseConference();
   851             {
       
   852             errorCode = iConferenceCall->HangUp();
       
   853             }
       
   854         }
   842         }
   855     return errorCode;
   843     return errorCode;
   856     }
   844     }
   857 
   845 
   858 // -----------------------------------------------------------------------------
   846 // -----------------------------------------------------------------------------
   867 
   855 
   868     TEFLOGSTRING( KTAMESINT, "CALL CPECallHandling::TerminateAllConnections");
   856     TEFLOGSTRING( KTAMESINT, "CALL CPECallHandling::TerminateAllConnections");
   869     
   857     
   870     RejectCall(); // Rejects ringing call if one exists.
   858     RejectCall(); // Rejects ringing call if one exists.
   871 
   859 
   872     if ( iConferenceCall )
   860     ReleaseConference(); // Release conference call if exists
   873         {
       
   874         TEFLOGSTRING( KTAMESOUT, 
       
   875             "CALL CPECallHandling::TerminateAllConnections: Hanging Up conference call" );
       
   876         iConferenceCall->HangUp();
       
   877         }
       
   878             
   861             
   879     // Hangup normal Voice Calls
   862     // Hangup normal Voice Calls
   880     for( TInt callId = 0; callId < KPEMaximumNumberOfVoiceCalls; callId++ )
   863     for( TInt callId = 0; callId < KPEMaximumNumberOfVoiceCalls; callId++ )
   881         {
   864         {
   882         callData = iCallArrayOwner->GetCallObject( callId );
   865         callData = iCallArrayOwner->GetCallObject( callId );
   892                 }
   875                 }
   893             }
   876             }
   894         }
   877         }
   895     //Terminate all ringing data calls, connected data calls and packet data connections
   878     //Terminate all ringing data calls, connected data calls and packet data connections
   896     return iVideoCallHandling->TerminateAllConnections();
   879     return iVideoCallHandling->TerminateAllConnections();
       
   880     }
       
   881 
       
   882 // -----------------------------------------------------------------------------
       
   883 // CPECallHandling::UpdatePhoneIdentity
       
   884 // Method updates phone identity
       
   885 // -----------------------------------------------------------------------------
       
   886 //
       
   887 EXPORT_C TInt CPECallHandling::UpdatePhoneIdentity(
       
   888     MEngineMonitor::TPEMessagesFromPhoneEngine /*aMessage*/ )
       
   889     {
       
   890     TInt retValue( KErrNone ); 
       
   891     CSInfo csinfo;
       
   892     retValue = iConvergedCallEngine.GetCSInfo( csinfo );
       
   893     
       
   894     TPEPhoneIdentityParameters phoneIdentityParameters;
       
   895     
       
   896     phoneIdentityParameters.iSerialNumber = csinfo.iSerialNumber;
       
   897         
       
   898     iModel.DataStore()->SetPhoneIdentityParameters( phoneIdentityParameters );
       
   899 
       
   900     SendMessage( MEngineMonitor::EPEMessageShowIMEI );
       
   901     return retValue;
   897     }
   902     }
   898 
   903 
   899 // -----------------------------------------------------------------------------
   904 // -----------------------------------------------------------------------------
   900 // CPECallHandling::IsCallInState
   905 // CPECallHandling::IsCallInState
   901 // returns ETrue if there is a call in given state; otherwise EFalse
   906 // returns ETrue if there is a call in given state; otherwise EFalse
  1906     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::DialEmergencyCall" );
  1911     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::DialEmergencyCall" );
  1907     
  1912     
  1908     SendMessage( MEngineMonitor::EPEMessageInitiatedEmergencyCall );
  1913     SendMessage( MEngineMonitor::EPEMessageInitiatedEmergencyCall );
  1909     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::DialEmergencyCall start emergency dialing" );
  1914     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::DialEmergencyCall start emergency dialing" );
  1910     CPESingleCall* callData = iCallArrayOwner->GetCallObject( KPEEmergencyCallId );
  1915     CPESingleCall* callData = iCallArrayOwner->GetCallObject( KPEEmergencyCallId );
  1911     if ( callData )
  1916     // coverity[dereference]
  1912         {
  1917     callData->DialEmergency( aEmergencyNumber );   
  1913         callData->DialEmergency( aEmergencyNumber );   
       
  1914         }
       
  1915     }
  1918     }
  1916 
  1919 
  1917 // -----------------------------------------------------------------------------
  1920 // -----------------------------------------------------------------------------
  1918 // CPECallHandling::GetCallTerminatedDiagnostics
  1921 // CPECallHandling::GetCallTerminatedDiagnostics
  1919 // Returns call terminated diagnostics of a call
  1922 // Returns call terminated diagnostics of a call
  1955         }
  1958         }
  1956 
  1959 
  1957     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::CreateConferenceCallL end" );
  1960     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::CreateConferenceCallL end" );
  1958     }
  1961     }
  1959 
  1962 
  1960 
  1963 // -----------------------------------------------------------------------------
       
  1964 // CPECallHandling::GetLifeTime
       
  1965 // -----------------------------------------------------------------------------
       
  1966 //
       
  1967 EXPORT_C TBool CPECallHandling::GetLifeTime( TDes8& aLifeTimeInfo )
       
  1968     {
       
  1969     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::GetLifeTime" );
       
  1970     return iConvergedCallEngine.GetLifeTime( aLifeTimeInfo );
       
  1971     }
       
  1972     
  1961 // -----------------------------------------------------------------------------
  1973 // -----------------------------------------------------------------------------
  1962 // CPECallHandling::UpdateSaSetting
  1974 // CPECallHandling::UpdateSaSetting
  1963 // -----------------------------------------------------------------------------
  1975 // -----------------------------------------------------------------------------
  1964 //
  1976 //
  1965 void CPECallHandling::UpdateSaSetting()
  1977 void CPECallHandling::UpdateSaSetting()
  2363             }
  2375             }
  2364         }
  2376         }
  2365     else
  2377     else
  2366         {
  2378         {
  2367         CPESingleCall* callData = iCallArrayOwner->CallPointerByState( EPEStateHeld );
  2379         CPESingleCall* callData = iCallArrayOwner->CallPointerByState( EPEStateHeld );
  2368         // Check that no actice and held call, if waiting call gets idle
  2380         if ( callData )
  2369         CPESingleCall* connectedCallData = iCallArrayOwner->CallPointerByState( EPEStateConnected );
  2381             {
  2370         if( callData && ( iModel.DataStore()->ResumeHeldCall( callData->GetCallId() ) )
  2382             // Checks to be done in case waiting call gets idle state:
  2371                     && !connectedCallData )
  2383             // Check that no active and held calls case
  2372             {
  2384             // Check that no dialling/connecting and held calls case
  2373             TEFLOGSTRING( KTAINT, "CALL CPECallHandling::HandleAutoResume single" );
  2385             if ( iModel.DataStore()->ResumeHeldCall( callData->GetCallId() ) &&
  2374             callData->Resume();
  2386                  !IsCallInState( EPEStateConnected ) &&
       
  2387                  !IsCallInState( EPEStateConnecting ) &&
       
  2388                  !IsCallInState( EPEStateDialing ) )
       
  2389                 {
       
  2390                 TEFLOGSTRING( KTAINT, "CALL CPECallHandling::HandleAutoResume single" );
       
  2391                 callData->Resume();
       
  2392                 }
  2375             }
  2393             }
  2376         }
  2394         }
  2377     }
  2395     }
  2378 
  2396 
  2379 // -----------------------------------------------------------------------------
  2397 // -----------------------------------------------------------------------------
  2404     const CCCPCallParameters& parameters = aCall.Parameters();
  2422     const CCCPCallParameters& parameters = aCall.Parameters();
  2405     CCPCall::TCallType callType = parameters.CallType();
  2423     CCPCall::TCallType callType = parameters.CallType();
  2406     if ( callType == CCPCall::ECallTypeCSVoice || callType == CCPCall::ECallTypeVideo )
  2424     if ( callType == CCPCall::ECallTypeCSVoice || callType == CCPCall::ECallTypeVideo )
  2407         {
  2425         {
  2408         const CCCECallParameters& params = static_cast<const CCCECallParameters&>( parameters );
  2426         const CCCECallParameters& params = static_cast<const CCCECallParameters&>( parameters );
  2409                                                     
  2427         
  2410         if ( params.Origin() == CCCECallParameters::ECCECallOriginSAT )
  2428         // do not overwrite if it's client call, which CCE is not aware of 
  2411             {
  2429         if ( iModel.DataStore()->CallOrigin( aCallId ) == EPECallOriginPhone )
  2412             iModel.DataStore()->SetCallOrigin( EPECallOriginSAT, aCallId );
  2430             {                                                
  2413             iModel.DataStore()->SetRemoteName( params.AlphaId(), aCallId );
  2431             if ( params.Origin() == CCCECallParameters::ECCECallOriginSAT )
  2414             iModel.DataStore()->SetRemotePhoneNumber( KNullDesC(), aCallId );
  2432                 {
  2415             }                 
  2433                 iModel.DataStore()->SetCallOrigin( EPECallOriginSAT, aCallId );
       
  2434                 }
       
  2435             }                    
  2416         }                
  2436         }                
  2417     }
  2437     }
  2418 
       
  2419 
  2438 
  2420 // -----------------------------------------------------------------------------
  2439 // -----------------------------------------------------------------------------
  2421 // CPECallHandling::UpdateColpNumber
  2440 // CPECallHandling::UpdateColpNumber
  2422 // -----------------------------------------------------------------------------
  2441 // -----------------------------------------------------------------------------
  2423 //
  2442 //
  2462         updateDone = ETrue;
  2481         updateDone = ETrue;
  2463         }  
  2482         }  
  2464     
  2483     
  2465     return updateDone;
  2484     return updateDone;
  2466     }
  2485     }
  2467        
  2486         
       
  2487 // -----------------------------------------------------------------------------
       
  2488 // CPECallHandling::ReleaseConference
       
  2489 // Release conference call
       
  2490 // -----------------------------------------------------------------------------
       
  2491 //
       
  2492 EXPORT_C TInt CPECallHandling::ReleaseConference()
       
  2493     {
       
  2494     TInt errorCode( ECCPErrorNotFound );
       
  2495     
       
  2496     if ( iConferenceCall )
       
  2497         {            
       
  2498         errorCode = iConferenceCall->HangUp();
       
  2499         }
       
  2500     return errorCode;
       
  2501     }
  2468 
  2502 
  2469 //  End of File 
  2503 //  End of File