Fixed logs error in case of auto reject
[apps/osp/Call.git] / src / CallTelephonyManager.cpp
index 8a654bb..3df209c 100644 (file)
@@ -388,8 +388,39 @@ TelephonyManager::EndCall(AppCallInfo& endCallInfo)
 }
 
 result
+TelephonyManager::AnswerAutoRejectCall(int callHandle)
+{
+       AppLogDebug("Enter ");
+       result r = E_FAILURE;
+       TelCallAnswerType_t answerType = TAPI_CALL_ANSWER_ACCEPT;
+       int res = -1;
+
+       AppLogDebug("tel_answer_call");
+       answerType = TAPI_CALL_ANSWER_REJECT;
+       AppCallInfo rejectedCallInfo;
+       rejectedCallInfo = *(__pIncomingCall);
+       rejectedCallInfo.SetCalllogType(CALL_LOG_TYPE_VOICE_BLOCKED);
+       SaveCallInfoToLogsDb(rejectedCallInfo);
+       delete __pIncomingCall;
+       __pIncomingCall = null;
+       // redirect to reject call back handler as the flow has to be handled
+       res = tel_answer_call(__pTapiHandle, callHandle, answerType, &HandleCallbackResponse, this);
+
+       if (res == TAPI_CAUSE_SUCCESS)
+       {
+               r = E_SUCCESS;
+       }
+       else
+       {
+               r = E_FAILURE;
+       }
+       return r;
+}
+
+result
 TelephonyManager::AnswerCall(int callHandle, bool acceptCall)
 {
+       AppLogDebug("Enter %d",acceptCall);
        result r = E_FAILURE;
        __pSoundManager->StopAlert();
        TelCallAnswerType_t answerType = TAPI_CALL_ANSWER_ACCEPT;
@@ -402,6 +433,7 @@ TelephonyManager::AnswerCall(int callHandle, bool acceptCall)
        }
        else
        {
+               AppLogDebug("tel_answer_call");
                answerType = TAPI_CALL_ANSWER_REJECT;
                // redirect to reject call back handler as the flow has to be handled
                res = tel_answer_call(__pTapiHandle, callHandle, answerType, &HandleRejectCallbackResponse, this);
@@ -2151,6 +2183,7 @@ TelephonyManager::HandleCallConnected(unsigned int connectedCallHandle)
 bool
 TelephonyManager::CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo)
 {
+       AppLogDebug("Enter");
        int callHandle = pIncomingCallInfo->GetCallHandle()->ToLong();
        String contactNumber(L"");
        contactNumber.Append(pIncomingCallInfo->GetContactNumber());
@@ -2159,7 +2192,7 @@ TelephonyManager::CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo)
        if (((__pSettingsManager->GetUnknownRejectStatus() == true) && (pIncomingCallInfo->GetContactInfo() == null))
                        || (__pSettingsManager->IsCallToBeRejected(contactNumber) == true))
        {
-               AnswerCall(callHandle,false);
+               AnswerAutoRejectCall(callHandle);
                return true;
        }
        return false;