--- a/phoneengine/phonemodel/src/cpemessagehandler.cpp Tue Aug 31 15:14:29 2010 +0300
+++ b/phoneengine/phonemodel/src/cpemessagehandler.cpp Wed Sep 01 12:30:10 2010 +0100
@@ -50,10 +50,10 @@
#include <coreapplicationuisdomainpskeys.h>
#include <cpeclientinformation.h>
#include <cpegsmaudiodata.h>
-#include <cphonegsmhandlercontainer.h>
-#include <cphonegsmoptioncontainerbase.h>
-#include <cphonegsmparserbase.h>
-#include <cphonegsmparserresult.h>
+#include <CPhoneGsmHandlerContainer.h>
+#include <CPhoneGsmOptionContainerBase.h>
+#include <CPhoneGsmParserBase.h>
+#include <CPhoneGsmParserResult.h>
#include <featmgr.h>
#include <mccecall.h>
#include <mpeaudiodata.h>
@@ -63,8 +63,8 @@
#include <mpeloghandling.h>
#include <pathinfo.h>
#include <pepanic.pan>
-#include <phclttypes.h>
-#include <phonegsmparser.h>
+#include <PhCltTypes.h>
+#include <PhoneGsmParser.h>
#include <ProfileEngineDomainConstants.h>
#include <talogger.h>
#include <w32std.h>
@@ -76,9 +76,9 @@
// None.
// CONSTANTS
-// Prefix change off. See SettingsInternalCRKeys.h
+// Prefix change off. See settingsinternalcrkeys.h
const TInt KPEPrefixChangeOff = 0;
-// Prefix change on. See SettingsInternalCRKeys.h
+// Prefix change on. See settingsinternalcrkeys.h
const TInt KPEPrefixChangeOn = 1;
// International prefix
_LIT( KPEIntPrefix, "+" );
@@ -162,6 +162,7 @@
iExternalDataHandler( aExternalDataHandler ),
iSimStateMonitor( aSimStateMonitor ),
iFsSession( aFsSession ),
+ iSwitchToVidCalReconFlag( EFalse ),
iServiceHandling( aServiceHandling ),
iDataStore( *aModel.DataStore() )
{
@@ -403,6 +404,19 @@
}
// -----------------------------------------------------------------------------
+// CPEMessageHandler::HandleReleaseConference
+// Handles release message from phone application
+// Method calls HangUp method from the CallHandling subsystem.
+// -----------------------------------------------------------------------------
+//
+TInt CPEMessageHandler::HandleReleaseConference()
+ {
+
+ return iCallHandling.ReleaseConference();
+
+ }
+
+// -----------------------------------------------------------------------------
// CPEMessageHandler::HandleSendDtmf
// Handles send dtmf message from phone application
// Method fetches dtmf string from the CPEEngineInfo class and then
@@ -453,6 +467,12 @@
dtmfString = KNullDesC;
}
+ else if ( dtmfString[ 0 ] == KPEDtmfPlusChar ) // speed-dial substitution
+ {
+ TEFLOGSTRING( KTAMESINT, "PE CPEMessageHandler::HandleSendDtmf(), Processing +" );
+ HandlePlusSignInDtmf( dtmfString );
+ dtmfString = KNullDesC;
+ }
else if ( dtmfString[ 0 ] == KPEDtmfPauseCharLowercase ||
dtmfString[ 0 ] == KPEDtmfPauseCharUppercase ) // soft pause
{
@@ -530,6 +550,147 @@
}
// -----------------------------------------------------------------------------
+// CPEMessageHandler::HandlePlusSignInDtmf
+// Handles plus (+) sign in a DTMF string.
+// -----------------------------------------------------------------------------
+//
+void CPEMessageHandler::HandlePlusSignInDtmf(const TPEDtmfString& aDtmfString )
+ {
+ TEFLOGSTRING2( KTAMESINT, "PE CPEMessageHandler::HandlePlusSignInDtmf(), aDtmfString: %S", &aDtmfString );
+
+ // Find the SD index after the plus sign
+ TPtrC validManualDTMFChars( KPEValidSpeedDialChars );
+ TInt index = ECCPErrorNotFound;
+ for ( index = 1 ; index < aDtmfString.Length() ; index++ )
+ {
+ if ( validManualDTMFChars.Locate( aDtmfString[index] ) == ECCPErrorNotFound )
+ {
+ TEFLOGSTRING( KTAMESINT, "PE CPEMessageHandler::HandlePlusSignInDtmf(), Not Found" );
+ break;
+ }
+ }
+ TPESpeedDialSubstituionStatus sdStatus = EPEDtmfSpeedDialOk;
+
+ // Empty string after the plus sign
+ if ( index == 1 )
+ {
+ if ( aDtmfString.Length() > 1 )
+ {
+ // pw+ after the plus sign.
+ sdStatus = EPEDtmfSpeedDialInvalidSpeedDial;
+ }
+ else
+ {
+ // string ended with the plus sign.
+ sdStatus = EPEDtmfSpeedDialPromptUser;
+ }
+ // Clear DTMF string.
+ iDataStore.SetDtmfString( KNullDesC() );
+ }
+ // Else if the SD location ends the DTMF string, move the index to the
+ // last character instead of one over.
+ else if ( index == aDtmfString.Length() )
+ {
+ index--;
+ }
+
+ // Check that the index is valid
+ TInt sdIndex = ECCPErrorNotFound;
+ if ( sdStatus == EPEDtmfSpeedDialOk )
+ {
+ TLex lexer( aDtmfString.Mid( 1, index ) );
+ // convert it to a number
+ if ( lexer.Val(sdIndex) == ECCPErrorNone )
+ {
+ // Is it out of range
+ if ( sdIndex < KPESpeedDialIndexMin ||
+ sdIndex > KPESpeedDialIndexMax )
+ {
+ sdStatus = EPEDtmfSpeedDialInvalidSpeedDial;
+ }
+ }
+ else
+ {
+ sdStatus = EPEDtmfSpeedDialInvalidSpeedDial;
+ }
+ }
+
+ // Fetch the SD location
+ TPEPhoneNumber speedDialLocationString;
+ if ( sdStatus == EPEDtmfSpeedDialOk )
+ {
+ TEFLOGSTRING2( KTAMESINT, "PE CPEMessageHandler::HandlePlusSignInDtmf(), SD location %i", sdIndex );
+ if ( iContactHandling.GetSpeedDialLocation(
+ sdIndex, speedDialLocationString ) == ECCPErrorNone )
+ {
+ // Is content found
+ if ( speedDialLocationString.Length() == 0)
+ {
+ sdStatus = EPEDtmfSpeedDialNotAssigned;
+ }
+ else if ( speedDialLocationString[0] == KPEDtmfPlusChar)
+ {
+ // plus char must be removed from dtmf string before sending
+ RemovePlusPrefix( speedDialLocationString );
+ }
+ }
+ else
+ {
+ sdStatus = EPEDtmfSpeedDialInvalidSpeedDial;
+ }
+ }
+
+ // Now interpret the sdStatus to the next action
+ switch ( sdStatus )
+ {
+ case EPEDtmfSpeedDialOk:
+ {
+ TEFLOGSTRING2( KTAMESINT, "PE CPEMessageHandler::HandlePlusSignInDtmf(), SD result: %S", &speedDialLocationString );
+ // Take the SD location string and use that as new DTMF string
+ iDataStore.SetDtmfStringCommand( speedDialLocationString );
+
+ // Do recursion asyncronously
+ TCallBack callBack( CallBackHandleSendDtmf, this );
+ delete iAsyncCallBack;
+ iAsyncCallBack = NULL;
+ // Function does not allow to leave.
+ iAsyncCallBack = new CAsyncCallBack( callBack, CActive::EPriorityStandard );
+ if ( iAsyncCallBack )
+ {
+ iAsyncCallBack->CallBack();
+ }
+ else
+ {
+ iModel.SendMessage( MEngineMonitor::EPEMessageDTMFSendingAborted );
+ }
+ }
+ break;
+ case EPEDtmfSpeedDialPromptUser:
+ // Speed dial location not given.
+ iDataStore.SetDtmfString( KNullDesC() );
+ iModel.SendMessage( MEngineMonitor::EPEMessagePromptSpeedDial );
+ break;
+ case EPEDtmfSpeedDialNotAssigned:
+ // Speed dial location valid but not assigned
+ iDataStore.SetDtmfString( KNullDesC() );
+ iDataStore.SetDtmfStringCommand( KNullDesC() );
+ iModel.SendMessage( MEngineMonitor::EPEMessageDTMFSendingAborted);
+ iModel.SendMessage( MEngineMonitor::EPEMessageSpeedDialNotAssigned );
+ break;
+ case EPEDtmfSpeedDialInvalidSpeedDial:
+ // Speed dial location invalid
+ iDataStore.SetDtmfString( KNullDesC() );
+ iDataStore.SetDtmfStringCommand( KNullDesC() );
+ iModel.SendMessage( MEngineMonitor::EPEMessageDTMFSendingAborted);
+ iModel.SendMessage( MEngineMonitor::EPEMessageInvalidSpeedDial );
+ break;
+ default:
+ Panic( EPEPanicInvalidState );
+ break;
+ } // end switch
+ }
+
+// -----------------------------------------------------------------------------
// CPEMessageHandler::CheckPrefix
// Checks the status of phone number prefix change setting
// and calls CPEMessageHandler::ChangePrefix for execution.
@@ -935,6 +1096,34 @@
return returnValue;
}
+
+// -----------------------------------------------------------------------------
+// CPEMessageHandler::HandleGetLifeTimerData
+// Reads lifetimerdata from custom api and stores it to engine info
+// -----------------------------------------------------------------------------
+//
+TInt CPEMessageHandler::HandleGetLifeTimerData() const
+ {
+ TCCPLifeTimeData lifeTimeData;
+ TCCPLifeTimeDataPckg pckg( lifeTimeData );
+
+ if ( iCallHandling.GetLifeTime( pckg ) )
+ {
+ TEFLOGSTRING2(
+ KTAGENERAL,
+ "PE: CPEMessageHandler::HandleGetLifeTimerData, iHours = %d",
+ lifeTimeData.iHours);
+ TEFLOGSTRING2(
+ KTAGENERAL,
+ "PE: CPEMessageHandler::HandleGetLifeTimerData, iMinutes = %d",
+ lifeTimeData.iMinutes);
+
+ iDataStore.SetLifeTimerData( pckg );
+ }
+
+ return ECCPErrorNone;
+ }
+
// -----------------------------------------------------------------------------
// CPEMessageHandler::CallbackSendMessageStoppedDTMF
// -----------------------------------------------------------------------------
@@ -1143,8 +1332,7 @@
"PE CPEMessageHandler::UpdateClientInfo, allowmatch: %d",
clientInformation.AllowMatch() );
- if ( EPECallOriginSAT != iDataStore.CallOrigin(aCallId) &&
- ( aCallId != KPEEmergencyCallId ) )
+ if ( clientInformation.AllowMatch() && ( aCallId != KPEEmergencyCallId ) )
{
TEFLOGSTRING2(
KTAINT,
@@ -1168,6 +1356,10 @@
"PE CPEMessageHandler::UpdateClientInfo > MPEContactHandling::FindContactInfoSync( EPEFindWithPhoneNumber ), error code: %d",
errorCode );
}
+ else if ( clientInformation.Name().Length() )
+ {
+ iDataStore.SetRemoteName( clientInformation.Name(), aCallId );
+ }
// Calls have to log also without a contact (ECCPErrorNotFound).
if ( errorCode == ECCPErrorNone || errorCode == ECCPErrorNotFound)
@@ -1198,52 +1390,52 @@
iDataStore.SetRemotePhoneNumberType( EPEEmergencyNumber, aCallId );
}
else if( iDataStore.CallDirection( aCallId ) != RMobileCall::EMobileOriginated )
- {
- switch( tempIdentity )
- {
- case RMobileCall::ERemoteIdentitySuppressed:
- {
- // It is neccessary to perform an additional check for available
- // remote party phone number to comply with Italian operator
- // requirement: "If CLIR is active but network still provides
- // the device with a phone number, it should not be blocked
- // but passed to a client when requested."
- if( iDataStore.RemotePhoneNumber( aCallId ).Length() == 0 )
- {
- HideIdentification( EPEPrivateNumber, aCallId );
- }
- else
- {
- // Align remote identity with remote phone number availability.
- iDataStore.SetRemoteIdentity( RMobileCall::ERemoteIdentityAvailable, aCallId );
- }
- break;
- }
- case RMobileCall::ERemoteIdentityAvailableNoCliRejectedByUser:
- {
- HideIdentification( EPEPrivateNumber, aCallId );
- break;
- }
- case RMobileCall::ERemoteIdentityUnknown:
- case RMobileCall::ERemoteIdentityAvailableNoCliInteractionWithOtherService:
- case RMobileCall::ERemoteIdentityUnavailableNoCliInteractionWithOtherService:
- case RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone:
- case RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone:
- case RMobileCall::ERemoteIdentityAvailableNoCliUnavailable:
- {
- HideIdentification( EPEUnknownNumber, aCallId );
- break;
- }
- case RMobileCall::ERemoteIdentityAvailable:
- default:
- {
- TEFLOGSTRING( KTAINT,
- "PE CPEMessageHandler::CheckAndHideIdentity, CLI available" );
- break;
- }
- }
- }
- }
+ {
+ switch( tempIdentity )
+ {
+ case RMobileCall::ERemoteIdentitySuppressed:
+ {
+ // It is neccessary to perform an additional check for available
+ // remote party phone number to comply with Italian operator
+ // requirement: "If CLIR is active but network still provides
+ // the device with a phone number, it should not be blocked
+ // but passed to a client when requested."
+ if( iDataStore.RemotePhoneNumber( aCallId ).Length() == 0 )
+ {
+ HideIdentification( EPEPrivateNumber, aCallId );
+ }
+ else
+ {
+ // Align remote identity with remote phone number availability.
+ iDataStore.SetRemoteIdentity( RMobileCall::ERemoteIdentityAvailable, aCallId );
+ }
+ break;
+ }
+ case RMobileCall::ERemoteIdentityAvailableNoCliRejectedByUser:
+ {
+ HideIdentification( EPEPrivateNumber, aCallId );
+ break;
+ }
+ case RMobileCall::ERemoteIdentityUnknown:
+ case RMobileCall::ERemoteIdentityAvailableNoCliInteractionWithOtherService:
+ case RMobileCall::ERemoteIdentityUnavailableNoCliInteractionWithOtherService:
+ case RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone:
+ case RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone:
+ case RMobileCall::ERemoteIdentityAvailableNoCliUnavailable:
+ {
+ HideIdentification( EPEUnknownNumber, aCallId );
+ break;
+ }
+ case RMobileCall::ERemoteIdentityAvailable:
+ default:
+ {
+ TEFLOGSTRING( KTAINT,
+ "PE CPEMessageHandler::CheckAndHideIdentity, CLI available" );
+ break;
+ }
+ }
+ }
+ }
// -----------------------------------------------------------------------------
// CPEMessageHandler::FindCallInfo
@@ -1545,20 +1737,24 @@
{
dtmfString = iDataStore.DtmfPostFix( aCallId );
-
+
if ( dtmfString.Length() > 0 )
{
iDataStore.SetDtmfStringCommand( dtmfString );
errorCode = HandleSendDtmf();
}
}
-
+ // Reset unattended transfer callback flag
+ iDataStore.SetDoCallBackRequest( EFalse, aCallId );
+
iDataStore.SetErrorCode( errorCode );
- }
- }
+ }
+ }
// For Sat call ( normal or emergency )
iClientServices->CallRequestMonitor()->SendRespond( ECCPErrorNone );
+
+
// Reset Phonenumber from engine info, this is necessary so that call number
// logging works OK (see CPEMessageHandler::SetPhoneNumberForCallLogging).
iDataStore.SetPhoneNumber( KNullDesC() );
@@ -1673,10 +1869,9 @@
{
HandleClientCallData();
}
- else
+ else
{
- iDataStore.SetCallOriginCommand(EPECallOriginPhone);
- ResetClientCallData();
+ ResetClientCallData();
}
//Get number of calls
@@ -1685,8 +1880,17 @@
// Check the phone number for prefix change and change the prefix if needed
CheckPrefix();
- phoneNumber = iDataStore.PhoneNumber();
-
+ if( iSwitchToVidCalReconFlag )
+ {
+ phoneNumber = iDataStore.SwitchToNumberCommand();
+ // Clear flag to match the previous set operation in HandleSwitchToVideoOrVoice() function.
+ iSwitchToVidCalReconFlag = EFalse;
+ }
+ else
+ {
+ phoneNumber = iDataStore.PhoneNumber();
+ }
+
__ASSERT_ALWAYS( !( phoneNumber == KNullDesC ), User::Leave( ECCPErrorInvalidPhoneNumber ));
// Number parser operations
@@ -1793,6 +1997,11 @@
{
TEFLOGSTRING( KTAINT, "PE CPEMessageHandler::HandleDialingStateL <");
+ if( iCallHandling.GetNumberOfCalls() == 1 )
+ {
+ // Check volume levels - zero level needs to be reset to default value
+ iGsmAudioData.SetDefaultVolume();
+ }
// Save call direction to engine info.
iDataStore.SetCallDirection( RMobileCall::EMobileOriginated, aCallId );
@@ -1847,7 +2056,11 @@
iGsmAudioData.PlayInbandTone();
iWaitingCallId = aCallId;
}
-
+ else if( numberOfCalls == 1 )
+ {
+ // Check volume levels - zero level needs to be reset to default value
+ iGsmAudioData.SetDefaultVolume();
+ }
if( AutomaticAnswer( aCallId ) )
{
TEFLOGSTRING( KTAINT,
@@ -1873,10 +2086,16 @@
iAutomaticAnswerTimer->Cancel();
- TEFLOGSTRING( KTAMESOUT,
+ // Prevent playing inband tone when phone is in silent mode and
+ // audio output is not defined (call is not connected).
+ if ( ( iDataStore.RingingType() != EProfileRingingTypeSilent ) ||
+ ( iDataStore.AudioOutput() != EPENotActive ) )
+ {
+ TEFLOGSTRING( KTAMESOUT,
"PE CPEMessageHandler::HandleDisconnecting > iGsmAudioData.PlayInbandTone()");
- iGsmAudioData.PlayInbandTone();
-
+ iGsmAudioData.PlayInbandTone();
+ }
+
return ECCPErrorNone;
}
@@ -2008,6 +2227,11 @@
numberOfCalls );
}
+ if ( iDataStore.DoCallBackRequest( aCallId ) )
+ {
+ iModel.SendMessage( MEngineMonitor::EPEMessageTransferCallBackRequest, aCallId );
+ }
+
iDataStore.ResetCallInfo( aCallId );
//publish remote party info to Mediator after call info has been cleared.
@@ -2404,7 +2628,7 @@
// Checks if emergency call is allowed.
// -----------------------------------------------------------------------------
//
-TBool CPEMessageHandler::IsNetworkConnectionAllowed() const
+TBool CPEMessageHandler::IsEmergencyAllowed() const
{
TBool networkConnectionAllowed( EFalse );
//It is safe to ignore error code here: a default value of EFalse is used if the get fails
@@ -2511,6 +2735,7 @@
iDataStore.SetSwitchToNumberCommand( iDataStore.WholeOutgoingPhoneNumber( aCallId ) );
// Clear phonenumber to prevent using the wrong number in MO video call.
iDataStore.SetPhoneNumber( KNullDesC() );
+ iSwitchToVidCalReconFlag = ETrue;
}
else
{
@@ -2539,6 +2764,8 @@
TInt errorCode( ECCPErrorNone );
TPEPhoneNumber phoneNumber = iDataStore.SwitchToNumberCommand();
+ RemovePreAndPostFix( phoneNumber );
+
TEFLOGSTRING2( KTAINT,
"PE CPEMessageHandler::ContinueSwitchToCall, phoneNumber : %S",
&phoneNumber );
@@ -2673,26 +2900,6 @@
}
// -----------------------------------------------------------------------------
-// CPEMessageHandler::CheckIfPhoneIsLockedL
-// -----------------------------------------------------------------------------
-//
-void CPEMessageHandler::CheckIfPhoneIsLockedL()
- {
- // Check if phone is locked
- TInt keyLockStatus( EAutolockStatusUninitialized );
- TInt err = RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, keyLockStatus );
- const TBool phoneIsLocked = ( keyLockStatus > EAutolockOff );
-
- if ( phoneIsLocked && err == KErrNone )
- {
- // New call is not possible if device lock is on
- TEFLOGSTRING2( KTAERROR,
- "PE CPEMessageHandler::CheckIfPhoneIsLockedL, keyLockStatus : %d", keyLockStatus );
- User::Leave( ECCPErrorAuthenticationFailed );
- }
- }
-
-// -----------------------------------------------------------------------------
// CPEMessageHandler::IsActiveVideo
// Checks if there are any connected video calls
// -----------------------------------------------------------------------------
@@ -2725,7 +2932,7 @@
// CPEMessageHandler::HandleRemotePartyInfoChanged
// -----------------------------------------------------------------------------
//
-void CPEMessageHandler::HandleRemotePartyInfoChanged( const TInt /*aCallId*/ )
+void CPEMessageHandler::HandleRemotePartyInfoChanged( const TInt aCallId )
{
UpdateRemotePartyInfo();
@@ -2762,6 +2969,8 @@
TInt errorCode = iCallHandling.DoUnattendedTransfer(
iDataStore.TransferTargetCommand() );
+ iDataStore.SetErrorCode( errorCode );
+
return errorCode;
}
@@ -2857,21 +3066,4 @@
}
return errorCode;
}
-
-// -----------------------------------------------------------------------------
-// CPEMessageHandler::HandleDialCall
-// Handles dial message from dial service
-//
-// -----------------------------------------------------------------------------
-//
-TInt CPEMessageHandler::HandleDialServiceCall(
- const TBool /*aClientCall*/ )
- {
- TEFLOGSTRING( KTAINT, "PE CPEMessageHandler::HandleDialCall" );
- TInt errorCode( ECCPErrorNone );
- //TODO
- iModel.HandleInternalMessage( MPEPhoneModel::EPEMessageDialServiceCall );
- return errorCode;
- }
-
-// End of File
+// End of File