Fix for 44593 42495
[apps/osp/Call.git] / src / CallTelephonyManager.cpp
index b057fbe..f1dacba 100644 (file)
@@ -35,6 +35,7 @@ using namespace Tizen::Social;
 using namespace Tizen::System;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Telephony;
+using namespace Tizen::Base::Utility;
 
 const char* callEventList[] = {
                TAPI_NOTI_VOICE_CALL_STATUS_IDLE,
@@ -2378,6 +2379,19 @@ TelephonyManager::CheckValidTelePhoneNumber(const String& contactNumber)
        {
                r = E_FAILURE;
        }
+
+       //Pattern to compare all characters except 0-9 * # P ; , +
+       String phoneNumberPattern(L"[^0-9*#P,p+;]");
+       RegularExpression checkPhoneNumber;
+       checkPhoneNumber.Construct(phoneNumberPattern);
+       //If there is any character other than these listed above then display invalid number
+       bool resultMatch = checkPhoneNumber.Match(contactNumber,false);
+       //return false for patterns other than 0-9 * # P ; , +
+       if(resultMatch == true)
+       {
+               //return phone number is invalid
+               r = E_FAILURE;
+       }
        //TODO: check if valid phone number else return error message
        return r;
 }