phoneengine/loghandling/src/cpeloghandling.cpp
branchRCL_3
changeset 62 5266b1f337bd
parent 61 41a7f70b3818
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
   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         // voip address field must be used for voip calls
   397         if ( EFalse == IsValidPhoneNumber( aLogInfo.PhoneNumber() ) )
   398         aLogInfo.SetVoipAddress( aLogInfo.PhoneNumber() );
   398             {
   399         aLogInfo.SetPhoneNumber( KNullDesC() );
   399             // voip address field must be used for voip calls if
   400         }
   400             // string is not valid for CS call.
   401     }
   401             aLogInfo.SetVoipAddress( aLogInfo.PhoneNumber() );
   402 
   402             aLogInfo.SetPhoneNumber( KNullDesC() );
       
   403             }
       
   404         }
       
   405     }
   403 
   406 
   404 // -----------------------------------------------------------------------------
   407 // -----------------------------------------------------------------------------
   405 // CPELogHandling::SaveCallInfoL
   408 // CPELogHandling::SaveCallInfoL
   406 // Update log external data.
   409 // Update log external data.
   407 // Call SaveEventL if event should be saved to log db.
   410 // Call SaveEventL if event should be saved to log db.
   839         const TUid& aPluginUid ) const
   842         const TUid& aPluginUid ) const
   840     {
   843     {
   841     return CPELogExtensionWrapper::NewLC( aPluginUid );
   844     return CPELogExtensionWrapper::NewLC( aPluginUid );
   842     }
   845     }
   843 
   846 
       
   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 
   844 // End of File
   866 // End of File