phoneengine/loghandling/src/cpeloghandling.cpp
branchRCL_3
changeset 61 41a7f70b3818
parent 9 8871b09be73b
child 62 5266b1f337bd
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
   184     TInt errorCode( KErrArgument );
   184     TInt errorCode( KErrArgument );
   185     if ( CallIdCheck::IsVoice( aCallId ) || 
   185     if ( CallIdCheck::IsVoice( aCallId ) || 
   186          CallIdCheck::IsVideo( aCallId )
   186          CallIdCheck::IsVideo( aCallId )
   187        ) 
   187        ) 
   188         {
   188         {
   189 		CPELogInfo* logInfo( NULL );
   189         CPELogInfo* logInfo( NULL );
   190         TRAP( errorCode, logInfo = CPELogInfo::NewL(); );
   190         TRAP( errorCode, logInfo = CPELogInfo::NewL(); );
   191             
   191             
   192         if ( logInfo )
   192         if ( logInfo )
   193             {
   193             {
   194             // continue gathering log data
   194             // continue gathering log data
   195             
   195             
   196 		    // set phonenumber and/or voip address
   196             // set phonenumber and/or voip address
   197 			SetRemoteContact( aCallId, *logInfo );
   197             SetRemoteContact( aCallId, *logInfo );
   198             logInfo->SetEventData( aCallId, iDataStore ); 
   198             logInfo->SetEventData( aCallId, iDataStore ); 
   199             TRAP_IGNORE( 
   199             TRAP_IGNORE( 
   200                 // Contact link can be big, not critical for basic functionality.
   200                 // Contact link can be big, not critical for basic functionality.
   201                 if ( &iDataStore.ContactId( aCallId ) )
   201                 if ( &iDataStore.ContactId( aCallId ) )
   202                     {
   202                     {
   392         aLogInfo.SetPhoneNumber( iDataStore.RemotePhoneNumber( aCallId ) );
   392         aLogInfo.SetPhoneNumber( iDataStore.RemotePhoneNumber( aCallId ) );
   393         }
   393         }
   394     
   394     
   395     if ( EPECallTypeVoIP == iDataStore.CallType( aCallId ) )
   395     if ( EPECallTypeVoIP == iDataStore.CallType( aCallId ) )
   396         {
   396         {
   397         if ( EFalse == IsValidPhoneNumber( aLogInfo.PhoneNumber() ) )
   397         // voip address field must be used for voip calls
   398             {
   398         aLogInfo.SetVoipAddress( aLogInfo.PhoneNumber() );
   399             // voip address field must be used for voip calls if
   399         aLogInfo.SetPhoneNumber( KNullDesC() );
   400             // string is not valid for CS call.
   400         }
   401             aLogInfo.SetVoipAddress( aLogInfo.PhoneNumber() );
   401     }
   402             aLogInfo.SetPhoneNumber( KNullDesC() );
   402 
   403             }
       
   404         }
       
   405     }
       
   406 
   403 
   407 // -----------------------------------------------------------------------------
   404 // -----------------------------------------------------------------------------
   408 // CPELogHandling::SaveCallInfoL
   405 // CPELogHandling::SaveCallInfoL
   409 // Update log external data.
   406 // Update log external data.
   410 // Call SaveEventL if event should be saved to log db.
   407 // Call SaveEventL if event should be saved to log db.
   842         const TUid& aPluginUid ) const
   839         const TUid& aPluginUid ) const
   843     {
   840     {
   844     return CPELogExtensionWrapper::NewLC( aPluginUid );
   841     return CPELogExtensionWrapper::NewLC( aPluginUid );
   845     }
   842     }
   846 
   843 
   847 // -----------------------------------------------------------------------------
       
   848 // CPELogHandling::IsValidPhoneNumber
       
   849 // -----------------------------------------------------------------------------
       
   850 //
       
   851 TBool CPELogHandling::IsValidPhoneNumber( 
       
   852         const TDesC& aString ) const
       
   853     {
       
   854     _LIT( KAllowedCharsInPhoneNumber, "0123456789*+pw#PW" );
       
   855     
       
   856     TLex input( aString );
       
   857     TPtrC validChars( KAllowedCharsInPhoneNumber );
       
   858     while ( validChars.Locate( input.Peek() ) != KErrNotFound )
       
   859         {
       
   860         input.Inc();
       
   861         }
       
   862     
       
   863     return ( !input.Remainder().Length() );
       
   864     }
       
   865 
       
   866 // End of File
   844 // End of File