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