diff -r 33a5d2bbf6fc -r 73a1feb507fb mmsharing/mmshavailability/src/musavacalleventmonitor.cpp --- a/mmsharing/mmshavailability/src/musavacalleventmonitor.cpp Thu Aug 19 09:51:39 2010 +0300 +++ b/mmsharing/mmshavailability/src/musavacalleventmonitor.cpp Tue Aug 31 15:12:07 2010 +0300 @@ -117,66 +117,39 @@ CallDirectionL" ) return direction; } - + // -------------------------------------------------------------------------- -// Returns the direction of connected call. +// aTelNumber will be filled with telephone number or SIP URI of current +// connected call // -------------------------------------------------------------------------- // -TInt CMusAvaCallEventMonitor::CallPrivacyL() - { - MUS_LOG( "mus: [CMusAvaCallEventMonitor] -> CMusAvaCallEventMonitor::\ - CallPrivacyL" ) - // retrieve call count - TInt privacy( 0 ); - User::LeaveIfError( RProperty::Get( - NMusSessionInformationApi::KCategoryUid, - NMusSessionInformationApi::KMUSPrivacy, - privacy ) ); +void +CMusAvaCallEventMonitor::GetTelNumberL( TDes& aTelNumber, TBool& aIsSipUri ) - MUS_LOG1( "mus: [CMusAvaCallEventMonitor] Call privacy = %d ", - privacy ) - MUS_LOG( "mus: [CMusAvaCallEventMonitor] <- CMusAvaCallEventMonitor::\ - CallPrivacyL" ) - return privacy; - } - -// -------------------------------------------------------------------------- -// aTelNumber will be filled with telephone number of current connected call -// -------------------------------------------------------------------------- -// -void CMusAvaCallEventMonitor::GetTelNumberL( TDes& aTelNumber ) { MUS_LOG( "mus: [CMusAvaCallEventMonitor] -> CMusAvaCallEventMonitor::\ GetTelNumberL" ) - TBuf telNumber; - MUS_LOG( "mus: [CMusAvaCallEventMonitor] CMusAvaCallEventMonitor::\ - GetTelNumberL - a" ) - TInt error = RProperty::Get( - NMusSessionInformationApi::KCategoryUid, - NMusSessionInformationApi::KMusTelNumber, - telNumber ); + TInt error = RProperty::Get( NMusSessionInformationApi::KCategoryUid, + NMusSessionInformationApi::KMusTelNumber, + aTelNumber ); MUS_LOG1( "mus: [CMusAvaCallEventMonitor] CMusAvaCallEventMonitor::\ GetTelNumberL (%d)", error ) - if ( error != KErrOverflow ) - { - User::LeaveIfError( error ); - } - - TInt length = telNumber.Length(); - TInt maxLength = aTelNumber.MaxLength(); - if ( maxLength < length ) + if ( error == KErrOverflow ) { - // buffer is too small for returned tel number. - MUS_LOG2( "mus: [CMusAvaCallEventMonitor] CMusAvaCallEventMonitor::\ - GetTelNumberL - Buffer too small (%d, %d), leave", - maxLength, length ) - User::Leave( KErrOverflow ); + MUS_LOG1( "mus: [CMusAvaCallEventMonitor] CMusAvaCallEventMonitor::\ + GetTelNumberL - Buffer too small (%d), leave", + aTelNumber.MaxLength() ) + User::Leave( error ); } - - aTelNumber.Copy( telNumber ); + User::LeaveIfError( error ); + + aIsSipUri = IsSipUri( aTelNumber ); + MUS_LOG1( "mus: [CMusAvaCallEventMonitor] CMusAvaCallEventMonitor::\ + GetTelNumberL (is SIP URI=%d)", aIsSipUri ) + MUS_LOG( "mus: [CMusAvaCallEventMonitor] <- CMusAvaCallEventMonitor::\ GetTelNumberL" ) } @@ -248,38 +221,19 @@ case NMusSessionInformationApi::ECallConnected: { - // retrieve telnumber - TInt error; TBuf telNumber; - error = RProperty::Get( - NMusSessionInformationApi::KCategoryUid, - NMusSessionInformationApi::KMusTelNumber, - telNumber ); - - if ( error != KErrOverflow ) - { - User::LeaveIfError( error ); - } - - iObserver.CallConnectedL( telNumber ); + TBool isSipUri( EFalse ); + GetTelNumberL( telNumber, isSipUri ); + iObserver.CallConnectedL( telNumber, isSipUri ); break; } case NMusSessionInformationApi::ECallHold: { - // retrieve telnumber - TInt error; TBuf telNumber; - error = RProperty::Get( - NMusSessionInformationApi::KCategoryUid, - NMusSessionInformationApi::KMusTelNumber, - telNumber ); - - if ( error != KErrOverflow ) - { - User::LeaveIfError( error ); - } - iObserver.CallHoldL( telNumber ); + TBool isSipUri( EFalse ); + GetTelNumberL( telNumber, isSipUri ); + iObserver.CallHoldL( telNumber, isSipUri ); break; } @@ -288,11 +242,6 @@ iObserver.ConferenceCallL(); break; } - case NMusSessionInformationApi::EConferenceTerminated: - { - iObserver.ConferenceCallLTerminated(); - break; - } default: { @@ -322,3 +271,15 @@ MUS_LOG( "mus: [MUSAOP] <- CMusAvaCallEventMonitor::RunError" ) return aError; } + + +// -------------------------------------------------------------------------- +// CMusAvaCallEventMonitor::IsSipUri() +// -------------------------------------------------------------------------- +// +TBool CMusAvaCallEventMonitor::IsSipUri( const TDesC& aTelNumber ) const + { + _LIT( KSipPrefix, "sip:" ); + TPtrC prefix = aTelNumber.Left( KSipPrefix().Length() ); + return prefix.Compare( KSipPrefix ) == 0; + }