Fix for 44593 42495
[apps/osp/Call.git] / src / CallTelephonyManager.cpp
index f05ad00..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,
@@ -1990,15 +1991,18 @@ TelephonyManager::HandleEndNormalActiveCall(AppCallInfo& endCallInfo)
                }
                else
                {
-                       //fetch active calls to show appropriate scene
-                       pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pActiveCallList->GetValuesN());
-                       //fetch the held call on disconnecting the active call and activate it.
-                       r = pCallList->GetAt(0, heldCall);
-                       if (r == E_SUCCESS)
+                       if(__pIncomingCall == null)
                        {
-                               HoldActiveCall(&heldCall, false);
-                               delete pCallList;
+                               //fetch active calls to show appropriate scene
                                pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pActiveCallList->GetValuesN());
+                               //fetch the held call on disconnecting the active call and activate it.
+                               r = pCallList->GetAt(0, heldCall);
+                               if (r == E_SUCCESS)
+                               {
+                                       HoldActiveCall(&heldCall, false);
+                                       delete pCallList;
+                                       pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pActiveCallList->GetValuesN());
+                               }
                        }
                }
 
@@ -2375,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;
 }