phoneengine/callhandling/src/cpecallhandling.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 30 ebdbd102c78a
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
    27 #include    "cpeconferencecall.h"
    27 #include    "cpeconferencecall.h"
    28 #include    "cpecallarrayowner.h"
    28 #include    "cpecallarrayowner.h"
    29 #include    "mpecallhandling.h"
    29 #include    "mpecallhandling.h"
    30 #include    "cpecceobserver.h"
    30 #include    "cpecceobserver.h"
    31 #include    "cpesystemcallstate.h"
    31 #include    "cpesystemcallstate.h"
       
    32 #include    "tpematcher.h"
    32 
    33 
    33 #include    <gsmerror.h>
    34 #include    <gsmerror.h>
    34 #include    <mpedatastore.h>
    35 #include    <mpedatastore.h>
    35 #include    <pepanic.pan>
    36 #include    <pepanic.pan>
    36 #include    <talogger.h>
    37 #include    <talogger.h>
    37 #include    <PSVariables.h>
    38 #include    <PSVariables.h>
    38 #include    <ctsydomainpskeys.h>
    39 #include    <ctsydomainpskeys.h>
    39 #include    <mccecall.h>
    40 #include    <mccecall.h>
    40 #include    <psetsaobserver.h>
    41 #include    <psetsaobserver.h>
    41 #include    <cccecallparameters.h>
    42 #include    <cccecallparameters.h>
       
    43 #include    <centralrepository.h>
    42 
    44 
    43 // EXTERNAL DATA STRUCTURES
    45 // EXTERNAL DATA STRUCTURES
    44 // None
    46 // None
    45 
    47 
    46 // EXTERNAL FUNCTION PROTOTYPES  
    48 // EXTERNAL FUNCTION PROTOTYPES  
    47 // None
    49 // None
    48 
    50 
    49 // CONSTANTS
    51 // CONSTANTS
    50 // None
    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;
    51 
    65 
    52 // MACROS
    66 // MACROS
    53 // None
    67 // None
    54 
    68 
    55 // LOCAL CONSTANTS AND MACROS
    69 // LOCAL CONSTANTS AND MACROS
    90 // Destructor
   104 // Destructor
    91 EXPORT_C CPECallHandling::~CPECallHandling()
   105 EXPORT_C CPECallHandling::~CPECallHandling()
    92     {  
   106     {  
    93     TEFLOGSTRING( KTAOBJECT, "CALL CPECallHandling::~CPECallHandling() start");
   107     TEFLOGSTRING( KTAOBJECT, "CALL CPECallHandling::~CPECallHandling() start");
    94     
   108     
       
   109     delete iRepository;
    95     delete iSystemCallState;
   110     delete iSystemCallState;
    96     delete iDtmfHandling;
   111     delete iDtmfHandling;
    97     
   112     
    98     // No need to uninitialize feature manager - this is done in MPEPhoneModelInternal .cpp
   113     // No need to uninitialize feature manager - this is done in MPEPhoneModelInternal .cpp
    99         
   114         
   161             *iCallArrayOwner );
   176             *iCallArrayOwner );
   162                                                           
   177                                                           
   163     iCallOpenParams = CCCECallParameters::NewL();
   178     iCallOpenParams = CCCECallParameters::NewL();
   164     
   179     
   165     iSystemCallState = CPESystemCallState::NewL( *iCallArrayOwner, *iModel.DataStore() );
   180     iSystemCallState = CPESystemCallState::NewL( *iCallArrayOwner, *iModel.DataStore() );
       
   181     
       
   182     iRepository = CRepository::NewL( KCRUidTelConfiguration );
   166     
   183     
   167     TEFLOGSTRING( KTAOBJECT, "CALL CPECallHandling::BaseConstructL() complete");
   184     TEFLOGSTRING( KTAOBJECT, "CALL CPECallHandling::BaseConstructL() complete");
   168     }
   185     }
   169 
   186 
   170 // -----------------------------------------------------------------------------
   187 // -----------------------------------------------------------------------------
   435             
   452             
   436         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   453         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   437             {
   454             {
   438             TEFLOGSTRING( KTAMESINT, "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged");
   455             TEFLOGSTRING( KTAMESINT, "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged");
   439             // HO cases call type can changes
   456             // HO cases call type can changes
   440             CPESingleCall* connectedCall;
   457             CPESingleCall* call;
   441             connectedCall = iCallArrayOwner->CallPointerByState( EPEStateConnected );
   458             call = static_cast<CPESingleCall*>( iCallArrayOwner->CallByCallId( aCallId ) );
   442             
   459                                  
   443             if( connectedCall )
   460             MCCECall& connectedCall = call->Call();
       
   461             CCPCall::TCallType callType = connectedCall.Parameters().CallType();
       
   462  
       
   463             if ( EPEStateConnected == call->GetCallState() )
   444                 {
   464                 {
   445                 CCPCall::TCallType callType = connectedCall->Call().Parameters().CallType();
       
   446                 
       
   447                 if ( callType == CCPCall::ECallTypePS ) 
   465                 if ( callType == CCPCall::ECallTypePS ) 
   448                     {
   466                     {
   449                     TEFLOGSTRING( KTAMESINT, 
   467                     TEFLOGSTRING( KTAMESINT, 
   450                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to PS");
   468                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to PS");
   451                     iModel.DataStore()->SetCallType( EPECallTypeVoIP, aCallId ); 
   469                     iModel.DataStore()->SetCallType( EPECallTypeVoIP, aCallId ); 
   452                     iModel.DataStore()->SetServiceIdCommand( connectedCall->Call().Parameters().ServiceId() );
   470                     iModel.DataStore()->SetServiceIdCommand( call->Call().Parameters().ServiceId() );
   453                     iCallOpenParams->SetCallType( CCPCall::ECallTypePS); 
   471                     iCallOpenParams->SetCallType( CCPCall::ECallTypePS); 
   454                     }
   472                     }
   455                 else if ( callType == CCPCall::ECallTypeCSVoice )
   473                 else if ( callType == CCPCall::ECallTypeCSVoice )
   456                     {
   474                     {
   457                      TEFLOGSTRING( KTAMESINT, 
   475                      TEFLOGSTRING( KTAMESINT, 
   458                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to CS");
   476                         "CALL CPECallHandling::SendMessage -> EPEMessageRemotePartyInfoChanged->update call type to CS");
   459                     iCallOpenParams->SetCallType( CCPCall::ECallTypeCSVoice );
   477                     iCallOpenParams->SetCallType( CCPCall::ECallTypeCSVoice );
   460                     iModel.DataStore()->SetServiceIdCommand( 1 );
   478                     iModel.DataStore()->SetServiceIdCommand( 1 );
   461                     iModel.DataStore()->SetCallType( EPECallTypeCSVoice, aCallId );    
   479                     iModel.DataStore()->SetCallType( EPECallTypeCSVoice, aCallId ); 
       
   480                     if ( UpdateColpNumber( aCallId, connectedCall ))
       
   481                         {
       
   482                         iModel.SendMessage( MEngineMonitor::EPEMessageColpNumberAvailable, aCallId );
       
   483                         }
   462                     }
   484                     }
   463                 }
   485                 }
   464             }
   486             // CNAP informations must be in incoming call
   465        // Flow throught
   487             iModel.DataStore()->SetRemotePartyName( connectedCall.RemotePartyName(), aCallId );                
   466             
   488             iModel.DataStore()->SetRemotePhoneNumber( connectedCall.RemoteParty().Left( KPEPhoneNumberMaxLength ), aCallId );
       
   489             iModel.DataStore()->SetCallIndex( connectedCall.CallIndex(), aCallId );            
       
   490             break;
       
   491             }
       
   492                    
   467         case MEngineMonitor::EPEMessageIncoming:
   493         case MEngineMonitor::EPEMessageIncoming:
   468             {
   494             {
       
   495             TEFLOGSTRING( KTAMESINT, "CALL CPECallHandling::SendMessage -> EPEMessageIncoming");
   469             CPESingleCall* callData = iCallArrayOwner->GetCallObject( aCallId );
   496             CPESingleCall* callData = iCallArrayOwner->GetCallObject( aCallId );
   470             if( callData )
   497             if( callData )
   471                 {
   498                 {
   472                 MCCECall& call = callData->Call();
   499                 MCCECall& call = callData->Call();
   473                 iModel.DataStore()->SetRemotePartyName( call.RemotePartyName(), aCallId );
   500                 iModel.DataStore()->SetRemotePartyName( call.RemotePartyName(), aCallId );
   868     //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
   869     return iVideoCallHandling->TerminateAllConnections();
   896     return iVideoCallHandling->TerminateAllConnections();
   870     }
   897     }
   871 
   898 
   872 // -----------------------------------------------------------------------------
   899 // -----------------------------------------------------------------------------
   873 // CPECallHandling::UpdatePhoneIdentity
       
   874 // Method updates phone identity
       
   875 // -----------------------------------------------------------------------------
       
   876 //
       
   877 EXPORT_C TInt CPECallHandling::UpdatePhoneIdentity(
       
   878     MEngineMonitor::TPEMessagesFromPhoneEngine /*aMessage*/ )
       
   879     {
       
   880     TInt retValue( KErrNone ); 
       
   881     CSInfo csinfo;
       
   882     retValue = iConvergedCallEngine.GetCSInfo( csinfo );
       
   883     
       
   884     TPEPhoneIdentityParameters phoneIdentityParameters;
       
   885     
       
   886     phoneIdentityParameters.iSerialNumber = csinfo.iSerialNumber;
       
   887         
       
   888     iModel.DataStore()->SetPhoneIdentityParameters( phoneIdentityParameters );
       
   889 
       
   890     SendMessage( MEngineMonitor::EPEMessageShowIMEI );
       
   891     return retValue;
       
   892     }
       
   893 
       
   894 // -----------------------------------------------------------------------------
       
   895 // CPECallHandling::IsCallInState
   900 // CPECallHandling::IsCallInState
   896 // 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
   897 // -----------------------------------------------------------------------------
   902 // -----------------------------------------------------------------------------
   898 //
   903 //
   899 EXPORT_C TBool CPECallHandling::IsCallInState( TPEState aState ) const
   904 EXPORT_C TBool CPECallHandling::IsCallInState( TPEState aState ) const
  1901     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::DialEmergencyCall" );
  1906     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::DialEmergencyCall" );
  1902     
  1907     
  1903     SendMessage( MEngineMonitor::EPEMessageInitiatedEmergencyCall );
  1908     SendMessage( MEngineMonitor::EPEMessageInitiatedEmergencyCall );
  1904     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::DialEmergencyCall start emergency dialing" );
  1909     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::DialEmergencyCall start emergency dialing" );
  1905     CPESingleCall* callData = iCallArrayOwner->GetCallObject( KPEEmergencyCallId );
  1910     CPESingleCall* callData = iCallArrayOwner->GetCallObject( KPEEmergencyCallId );
  1906     callData->DialEmergency( aEmergencyNumber );   
  1911     if ( callData )
       
  1912         {
       
  1913         callData->DialEmergency( aEmergencyNumber );   
       
  1914         }
  1907     }
  1915     }
  1908 
  1916 
  1909 // -----------------------------------------------------------------------------
  1917 // -----------------------------------------------------------------------------
  1910 // CPECallHandling::GetCallTerminatedDiagnostics
  1918 // CPECallHandling::GetCallTerminatedDiagnostics
  1911 // Returns call terminated diagnostics of a call
  1919 // Returns call terminated diagnostics of a call
  1947         }
  1955         }
  1948 
  1956 
  1949     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::CreateConferenceCallL end" );
  1957     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::CreateConferenceCallL end" );
  1950     }
  1958     }
  1951 
  1959 
  1952 // -----------------------------------------------------------------------------
  1960 
  1953 // CPECallHandling::GetLifeTime
       
  1954 // -----------------------------------------------------------------------------
       
  1955 //
       
  1956 EXPORT_C TBool CPECallHandling::GetLifeTime( TDes8& aLifeTimeInfo )
       
  1957     {
       
  1958     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::GetLifeTime" );
       
  1959     return iConvergedCallEngine.GetLifeTime( aLifeTimeInfo );
       
  1960     }
       
  1961     
       
  1962 // -----------------------------------------------------------------------------
  1961 // -----------------------------------------------------------------------------
  1963 // CPECallHandling::UpdateSaSetting
  1962 // CPECallHandling::UpdateSaSetting
  1964 // -----------------------------------------------------------------------------
  1963 // -----------------------------------------------------------------------------
  1965 //
  1964 //
  1966 void CPECallHandling::UpdateSaSetting()
  1965 void CPECallHandling::UpdateSaSetting()
  2416             }                 
  2415             }                 
  2417         }                
  2416         }                
  2418     }
  2417     }
  2419 
  2418 
  2420 
  2419 
       
  2420 // -----------------------------------------------------------------------------
       
  2421 // CPECallHandling::UpdateColpNumber
       
  2422 // -----------------------------------------------------------------------------
       
  2423 //
       
  2424 TBool CPECallHandling::UpdateColpNumber( TInt aCallId, const MCCECall& aCall ) const
       
  2425     {
       
  2426     TEFLOGSTRING( KTAINT, "CALL CPECallHandling::UpdateColpNumber" );
       
  2427     
       
  2428     TBool updateDone( EFalse );
       
  2429     TInt errorCode( KErrNone );
       
  2430     TInt value( KPEMatchDefault );
       
  2431     TPEMatcher matcher;       
       
  2432     TPEPhoneNumber remoteNumber;
       
  2433     
       
  2434     MPEDataStore* dataStore = iModel.DataStore();
       
  2435     
       
  2436     if ( dataStore->RemoteColpNumber( aCallId ).Length() )
       
  2437         {
       
  2438         remoteNumber = dataStore->RemoteColpNumber( aCallId );
       
  2439         }
       
  2440     else
       
  2441         {
       
  2442         remoteNumber = dataStore->RemotePhoneNumber( aCallId );
       
  2443         }    
       
  2444         
       
  2445     const TPEPhoneNumber& updatedNumber = aCall.RemoteParty();
       
  2446     
       
  2447     errorCode = iRepository->Get( KTelMatchDigits, value );
       
  2448     if ( !errorCode == KErrNone )
       
  2449         {
       
  2450         TEFLOGSTRING( KTAOBJECT, "Reading KTelMatchDigits failed, use default value for matching");
       
  2451         } 
       
  2452     
       
  2453     //check if remote number is different from dialled number
       
  2454     if ( !matcher.numbersMatch( remoteNumber, updatedNumber, value ) )
       
  2455         {
       
  2456         //set COLP number        
       
  2457         dataStore->SetRemoteColpNumber( updatedNumber, aCallId );
       
  2458         
       
  2459         TEFLOGSTRING3( KTAMESINT, 
       
  2460                 "CPECallHandling::UpdateColpNumber, colp number: '%S', call id: %d", 
       
  2461                 &updatedNumber, aCallId );
       
  2462         updateDone = ETrue;
       
  2463         }  
       
  2464     
       
  2465     return updateDone;
       
  2466     }
       
  2467        
       
  2468 
  2421 //  End of File 
  2469 //  End of File