phoneengine/loghandling/src/cpeloghandling.cpp
branchRCL_3
changeset 9 8871b09be73b
parent 0 5f000ab63145
child 61 41a7f70b3818
--- a/phoneengine/loghandling/src/cpeloghandling.cpp	Tue Feb 02 00:10:04 2010 +0200
+++ b/phoneengine/loghandling/src/cpeloghandling.cpp	Fri Feb 19 22:50:26 2010 +0200
@@ -394,13 +394,16 @@
     
     if ( EPECallTypeVoIP == iDataStore.CallType( aCallId ) )
         {
-        // voip address field must be used for voip calls
-        aLogInfo.SetVoipAddress( aLogInfo.PhoneNumber() );
-        aLogInfo.SetPhoneNumber( KNullDesC() );
+        if ( EFalse == IsValidPhoneNumber( aLogInfo.PhoneNumber() ) )
+            {
+            // voip address field must be used for voip calls if
+            // string is not valid for CS call.
+            aLogInfo.SetVoipAddress( aLogInfo.PhoneNumber() );
+            aLogInfo.SetPhoneNumber( KNullDesC() );
+            }
         }
     }
 
-
 // -----------------------------------------------------------------------------
 // CPELogHandling::SaveCallInfoL
 // Update log external data.
@@ -841,4 +844,23 @@
     return CPELogExtensionWrapper::NewLC( aPluginUid );
     }
 
+// -----------------------------------------------------------------------------
+// CPELogHandling::IsValidPhoneNumber
+// -----------------------------------------------------------------------------
+//
+TBool CPELogHandling::IsValidPhoneNumber( 
+        const TDesC& aString ) const
+    {
+    _LIT( KAllowedCharsInPhoneNumber, "0123456789*+pw#PW" );
+    
+    TLex input( aString );
+    TPtrC validChars( KAllowedCharsInPhoneNumber );
+    while ( validChars.Locate( input.Peek() ) != KErrNotFound )
+        {
+        input.Inc();
+        }
+    
+    return ( !input.Remainder().Length() );
+    }
+
 // End of File