Fixed logs error in case of auto reject
[apps/osp/Call.git] / src / CallTelephonyManager.cpp
index 9059e43..3df209c 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <FBaseSys.h>
 #include <FSystem.h>
+#include <FTelephony.h>
 #include "ITapiModem.h"
 #include "ITapiSim.h"
 #include "CallInfo.h"
@@ -33,6 +34,7 @@ using namespace Tizen::Graphics;
 using namespace Tizen::Social;
 using namespace Tizen::System;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::Telephony;
 
 const char* callEventList[] = {
                TAPI_NOTI_VOICE_CALL_STATUS_IDLE,
@@ -82,6 +84,7 @@ TelephonyManager::TelephonyManager(ITelephonyEventListener* pEventListener)
        __isSpeakerOn = false;
        __pSoundManager = null;
        __pCalllogMgr = null;
+       __pNetworkManager = null;
 }
 
 TelephonyManager::~TelephonyManager(void)
@@ -177,7 +180,7 @@ TelephonyManager::Initialize(void)
        {
                return r;
        }
-       __pActiveCallList = new (std::nothrow) HashMapT<long, CallInfo>();
+       __pActiveCallList = new (std::nothrow) HashMapT<long, AppCallInfo>();
        __pActiveCallList->Construct(IDI_MAX_ACTIVE_CALLS);
 
        //Initialize the Settings Manager to fetch call settings
@@ -192,6 +195,11 @@ TelephonyManager::Initialize(void)
        {
                return E_FAILURE;
        }
+       __pNetworkManager = new NetworkManager();
+       if(__pNetworkManager != null)
+       {
+               __pNetworkManager->Construct(this);
+       }
        return r;
 }
 
@@ -256,8 +264,8 @@ TelephonyManager::SetupMoCall(String& contactNumber, bool isEmergency)
        if (isEmergency && __pActiveCallList->GetCount() > 0)
        {
                //Get first call handle
-               CallInfo endCallInfo;
-               IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+               AppCallInfo endCallInfo;
+               IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
                pCallList->GetAt(0, endCallInfo);
                int callHandle = endCallInfo.GetCallHandle()->ToLong();
                delete pCallList;
@@ -279,8 +287,8 @@ TelephonyManager::SetupMoCall(String& contactNumber, bool isEmergency)
        {
                //Check if there is already an active call,
                //Put the already active call on hold.
-               CallInfo holdCallInfo;
-               IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+               AppCallInfo holdCallInfo;
+               IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
 
                pCallList->GetAt(0, holdCallInfo);
                //Check if call is active, then put on hold
@@ -331,7 +339,7 @@ TelephonyManager::EndActiveCall(Long callHandle)
        result r = E_FAILURE;
 
        //fetch ended callInfo from active call list
-       CallInfo endCall;
+       AppCallInfo endCall;
        r = __pActiveCallList->GetValue(callHandle.ToLong(), endCall);
        if (r == E_SUCCESS)
        {
@@ -352,7 +360,7 @@ TelephonyManager::EndDialingCall(String& contactNumber)
        }
 
        //Check If Ended call matches Dialed Call.
-       CallInfo endCall;
+       AppCallInfo endCall;
        if (__pDialedCall != null && __pDialedCall->GetContactNumber().Equals(contactNumber))
        {
                endCall = *__pDialedCall;
@@ -362,7 +370,7 @@ TelephonyManager::EndDialingCall(String& contactNumber)
 }
 
 result
-TelephonyManager::EndCall(CallInfo& endCallInfo)
+TelephonyManager::EndCall(AppCallInfo& endCallInfo)
 {
        result r = E_FAILURE;
 
@@ -380,8 +388,39 @@ TelephonyManager::EndCall(CallInfo& 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;
@@ -394,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);
@@ -423,7 +463,7 @@ TelephonyManager::AcceptCall(CallAnsweringOptions answerOptions,int callHandle)
                //construct and fetch new Incoming call Info
                String incomingHandle;
                incomingHandle.Append(callHandle);
-               CallInfo* pDuplicateCallInfo = FetchIncomingCallHandleN(incomingHandle, String(L""));
+               AppCallInfo* pDuplicateCallInfo = FetchIncomingCallHandleN(incomingHandle, String(L""));
                if(pDuplicateCallInfo == null)
                {
                        r = E_FAILURE;
@@ -476,11 +516,11 @@ TelephonyManager::AcceptSecondCall(CallAnsweringOptions answerOptions, const int
                //Call connected successfully
                r = E_SUCCESS;
                //update status of first call to "OnHold"
-               IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
-               CallInfo firstCallInfo;
+               IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
+               AppCallInfo firstCallInfo;
                pCallList->GetAt(0, firstCallInfo);
-               //replace old object with update CallInfo
-               CallInfo* pHeldCallInfo = new (std::nothrow) CallInfo();
+               //replace old object with update AppCallInfo
+               AppCallInfo* pHeldCallInfo = new (std::nothrow) AppCallInfo();
                *pHeldCallInfo = firstCallInfo;
                pHeldCallInfo->SetOnHold(true);
                __pActiveCallList->Remove(firstCallInfo.GetCallHandle()->ToLong());
@@ -493,9 +533,9 @@ TelephonyManager::AcceptSecondCall(CallAnsweringOptions answerOptions, const int
        case ANSERWING_OPTION_END_SINGLE_CALL:
        {
                //Transfer Old active calls to a separate list to avoid any processing in HandleIdleCallback().
-               HashMapT<long, CallInfo>*  pEndCallsList = __pActiveCallList;
+               HashMapT<long, AppCallInfo>*  pEndCallsList = __pActiveCallList;
                //create a new ActiveCallList
-               __pActiveCallList = new (std::nothrow) HashMapT<long, CallInfo>();
+               __pActiveCallList = new (std::nothrow) HashMapT<long, AppCallInfo>();
                __pActiveCallList->Construct(IDI_MAX_ACTIVE_CALLS);
 
                //accept call and reject all active calls with 'TAPI_CALL_ANSWER_REPLACE'
@@ -512,10 +552,10 @@ TelephonyManager::AcceptSecondCall(CallAnsweringOptions answerOptions, const int
                //Call connected successfully
                r = E_SUCCESS;
                //Add calls information to call log before deleting from active call list.
-               IListT<CallInfo>* pCallList = pEndCallsList->GetValuesN();
+               IListT<AppCallInfo>* pCallList = pEndCallsList->GetValuesN();
                if(pCallList != null)
                {
-                       CallInfo endCallInfo;
+                       AppCallInfo endCallInfo;
                        if (pCallList->GetAt(0, endCallInfo) == E_SUCCESS)
                        {
                                SaveCallInfoToLogsDb(endCallInfo);
@@ -543,8 +583,8 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
        case ANSERWING_OPTION_REPLACE_ACTIVE_CALL:
        {
                //Replace "Active" call by incoming call and save ended call to call logs db.
-               IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
-               CallInfo callToBeEnded;
+               IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
+               AppCallInfo callToBeEnded;
                pCallList->GetAt(0, callToBeEnded);
                //Check if the call is on "Hold", then fetch 2nd callInfo
                if (callToBeEnded.IsOnHold() == true)
@@ -577,11 +617,11 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
        case ANSERWING_OPTION_REPLACE_HELD_CALL:
        {
                //Replace "Held" call by incoming call and save ended call to call logs db.
-               IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+               IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
                //"Held" call is to be ended
-               CallInfo callToBeEnded;
+               AppCallInfo callToBeEnded;
                //"Active" call will be put on Hold
-               CallInfo callToPutOnHold;
+               AppCallInfo callToPutOnHold;
                pCallList->GetAt(0, callToBeEnded);
                //Check if the call is NOT "Held", then fetch 2nd callInfo
                if (callToBeEnded.IsOnHold() == false)
@@ -607,11 +647,11 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
                }
                else
                {
-                       IListT<CallInfo>* pParticipantsInfo = callToBeEnded.GetCallerList();
+                       IListT<AppCallInfo>* pParticipantsInfo = callToBeEnded.GetCallerList();
                        //need to end every participant individually for conference call
                        for (int index = 0; index < pParticipantsInfo->GetCount(); index++)
                        {
-                               CallInfo memberCallInfo;
+                               AppCallInfo memberCallInfo;
                                pParticipantsInfo->GetAt(index, memberCallInfo);
                                res = tel_end_call(__pTapiHandle, memberCallInfo.GetCallHandle()->ToLong(), TAPI_CALL_END, &HandleCallbackResponse, this);
                        }
@@ -638,7 +678,7 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
                //Call connected successfully and active call is "Onhold"
                r = E_SUCCESS;
                //replace old object with update CallInfo
-               CallInfo* pHeldCallInfo = new (std::nothrow) CallInfo();
+               AppCallInfo* pHeldCallInfo = new (std::nothrow) AppCallInfo();
                *pHeldCallInfo = callToPutOnHold;
                pHeldCallInfo->SetOnHold(true);
                __pActiveCallList->Remove(callToPutOnHold.GetCallHandle()->ToLong());
@@ -652,9 +692,9 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
                // and processing of Incoming call is handled in HandleActiveCallback().
 
                //Transfer Old active calls to a separate list to avoid any processing in HandleIdleCallback().
-               HashMapT<long, CallInfo>*  pEndCallsList = __pActiveCallList;
+               HashMapT<long, AppCallInfo>*  pEndCallsList = __pActiveCallList;
                //create a new ActiveCallList
-               __pActiveCallList = new (std::nothrow) HashMapT<long, CallInfo>();
+               __pActiveCallList = new (std::nothrow) HashMapT<long, AppCallInfo>();
                __pActiveCallList->Construct(IDI_MAX_ACTIVE_CALLS);
 
                //End all active calls and all hold calls
@@ -677,13 +717,13 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
                r = E_SUCCESS;
 
                //Add calls information to call log before deleting from active call list.
-               IListT<CallInfo>* pCallList = pEndCallsList->GetValuesN();
+               IListT<AppCallInfo>* pCallList = pEndCallsList->GetValuesN();
                if(pCallList != null)
                {
                        int callCount = pCallList->GetCount();
                        for (int index = 0; index < callCount; index++)
                        {
-                               CallInfo endCallInfo;
+                               AppCallInfo endCallInfo;
                                if (pCallList->GetAt(index, endCallInfo) == E_SUCCESS)
                                {
                                        SaveCallInfoToLogsDb(endCallInfo);
@@ -711,11 +751,11 @@ TelephonyManager::HoldCall(Tizen::Base::Long callHandle, bool holdCall)
        //Check if there are any existing active calls
        if (__pActiveCallList->GetCount())
        {
-               IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+               IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
                int callCount = pCallList->GetCount();
                for (int index = 0; index < callCount; index++)
                {
-                       CallInfo holdCallInfo;
+                       AppCallInfo holdCallInfo;
 
                        r = pCallList->GetAt(index, holdCallInfo);
                        //check if an active call is found with matching contact no.
@@ -737,10 +777,10 @@ TelephonyManager::EndConferenceCall(void)
 {
        result r = E_FAILURE;
        //fetch conference callInfo to end
-       CallInfo confCallToEnd;
+       AppCallInfo confCallToEnd;
        bool isConferenceCallFound = false;
 
-       IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+       IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
        int callCount = pCallList->GetCount();
        for (int index = 0; index < callCount; index++)
        {
@@ -776,10 +816,10 @@ TelephonyManager::HoldConferenceCall(bool holdCall)
 {
        result r = E_FAILURE;
        int confCallIndex = -1;
-       CallInfo confCallToHold;
+       AppCallInfo confCallToHold;
        bool isConferenceCallFound = false;
 
-       IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+       IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
        int confCallCount = pCallList->GetCount();
 
        for (int index = 0; index < confCallCount; index++)
@@ -822,7 +862,7 @@ TelephonyManager::HoldConferenceCall(bool holdCall)
                {
                        confCallToHold.SetOnHold(false);
                }
-               CallInfo* pConfCallInfo = new (std::nothrow) CallInfo();
+               AppCallInfo* pConfCallInfo = new (std::nothrow) AppCallInfo();
                *pConfCallInfo = confCallToHold;
                __pActiveCallList->Remove(callHandle);
                __pActiveCallList->Add(callHandle, *pConfCallInfo);
@@ -842,10 +882,10 @@ TelephonyManager::JoinCall(void)
 {
        result r = E_FAILURE;
        int res = -1;
-       CallInfo activeCall;
-       CallInfo heldCall;
+       AppCallInfo activeCall;
+       AppCallInfo heldCall;
        // Use enumerator to access elements in the map
-       IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+       IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
        r = pCallList->GetAt(0, activeCall);
 
        if (r == E_SUCCESS)
@@ -881,7 +921,7 @@ TelephonyManager::JoinCall(void)
 }
 
 result
-TelephonyManager::HoldActiveCall(CallInfo* pActiveCallInfo, bool holdCall)
+TelephonyManager::HoldActiveCall(AppCallInfo* pActiveCallInfo, bool holdCall)
 {
        unsigned int callHandle = pActiveCallInfo->GetCallHandle()->ToLong();
        int retStatus = -1;
@@ -896,7 +936,7 @@ TelephonyManager::HoldActiveCall(CallInfo* pActiveCallInfo, bool holdCall)
 
        if (retStatus == TAPI_CAUSE_SUCCESS)
        {
-               CallInfo* pHeldCallInfo = new (std::nothrow) CallInfo();
+               AppCallInfo* pHeldCallInfo = new (std::nothrow) AppCallInfo();
                //copy state into new callinfo object
                *pHeldCallInfo = *pActiveCallInfo;
 
@@ -919,10 +959,15 @@ TelephonyManager::DialOutgoingCall(String& contactNumber, bool isEmergency)
 {
        TelCallDial_t structDialCall;
 
-       AppLogDebug("Enter");
+       AppLogDebug("Enter %ls",contactNumber.GetPointer());
+       //Temp String to replace , with P and ; with W
+       String TempContactNum;
+       TempContactNum.Append(contactNumber);
+       TempContactNum.Replace(L",",L"W");
+       TempContactNum.Replace(L";",L",");
        //conversion "contactNumber" to char*
-       const wchar_t* pContact = contactNumber.GetPointer();
-       int len = contactNumber.GetLength()+1;
+       const wchar_t* pContact = TempContactNum.GetPointer();
+       int len = TempContactNum.GetLength()+1;
        char* pNumber = new (std::nothrow) char[len];
        wcstombs(pNumber, pContact, len);
 
@@ -956,7 +1001,7 @@ TelephonyManager::DialOutgoingCall(String& contactNumber, bool isEmergency)
                        delete __pDialedCall;
                        __pDialedCall = null;
                }
-               __pDialedCall = new (std::nothrow) CallInfo();
+               __pDialedCall = new (std::nothrow) AppCallInfo();
                __pDialedCall->SetContactNumber(contactNumber);
                __pDialedCall->SetEmergency(isEmergency);
                result r = FetchContactInfoForNumber(contactNumber);
@@ -1030,10 +1075,10 @@ TelephonyManager::EndFromConference(int callHandle)
 {
        result r = E_FAILURE;
        int confCallIndex = -1;
-       CallInfo endConfCall;
+       AppCallInfo endConfCall;
        bool isConferenceCallFound = false;
 
-       IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+       IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
        int callCount = pCallList->GetCount();
        for (int index = 0; index < callCount; index++)
        {
@@ -1057,8 +1102,8 @@ TelephonyManager::EndFromConference(int callHandle)
        }
 
        //Identify the call to be ended and remove from list on API success
-       CallInfo callToBeEnded;
-       IListT<CallInfo>* pParticipantList = endConfCall.GetCallerList();
+       AppCallInfo callToBeEnded;
+       IListT<AppCallInfo>* pParticipantList = endConfCall.GetCallerList();
        int participantCount = pParticipantList->GetCount();
        for (int index = 0; index < participantCount; index++)
        {
@@ -1089,10 +1134,10 @@ TelephonyManager::SplitFromConference(int callHandle)
 {
        result r = E_FAILURE;
        int confCallIndex = -1;
-       CallInfo endConfCall;
+       AppCallInfo endConfCall;
        bool isConferenceCallFound = false;
 
-       IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+       IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
        int callCount = pCallList->GetCount();
        for (int index = 0; index < callCount; index++)
        {
@@ -1114,7 +1159,7 @@ TelephonyManager::SplitFromConference(int callHandle)
        }
 
        //Identify the call to be ended and remove from list on API success
-       CallInfo callToBeEnded;
+       AppCallInfo callToBeEnded;
        pCallList = endConfCall.GetCallerList();
        callCount = pCallList->GetCount();
        for (int index = 0; index < callCount; index++)
@@ -1253,7 +1298,7 @@ TelephonyManager::HandleRejectCallbackResponse(TapiHandle* pHandle, int callBack
                //Check if incoming call is rejected
                if (pTelManager->__pIncomingCall != null && (rejectedCallHandle == (unsigned int) pTelManager->__pIncomingCall->GetCallHandle()->ToLong()))
                {
-                       CallInfo rejectedCallInfo;
+                       AppCallInfo rejectedCallInfo;
                        rejectedCallInfo = *(pTelManager->__pIncomingCall);
                        delete pTelManager->__pIncomingCall;
                        pTelManager->__pIncomingCall = null;
@@ -1293,20 +1338,20 @@ TelephonyManager::HandleRejectCallbackResponse(TapiHandle* pHandle, int callBack
                                        }
                                }
                                //Send notification to user
-                               ArrayListT<CallInfo>* pCallList = null;
+                               ArrayListT<AppCallInfo>* pCallList = null;
                                if (isLastCall)
                                {
                                        //save 'RejectedCall' to list to show on EndCallForm
-                                       pCallList = new (std::nothrow) ArrayListT<CallInfo>();
+                                       pCallList = new (std::nothrow) ArrayListT<AppCallInfo>();
                                        pCallList->Construct(1);
-                                       CallInfo* pRejectedCall = new (std::nothrow) CallInfo();
+                                       AppCallInfo* pRejectedCall = new (std::nothrow) AppCallInfo();
                                        *pRejectedCall = rejectedCallInfo;
                                        pCallList->Add(*pRejectedCall);
                                }
                                else
                                {
                                        //fetch active calls to show appropriate scene
-                                       pCallList = static_cast<ArrayListT<CallInfo>*>(pTelManager->__pActiveCallList->GetValuesN());
+                                       pCallList = static_cast<ArrayListT<AppCallInfo>*>(pTelManager->__pActiveCallList->GetValuesN());
                                }
                                pTelManager->__pEventListener->HandleCallDisconnected(isLastCall, *pCallList);
                                delete pCallList;
@@ -1329,14 +1374,14 @@ TelephonyManager::HandleJoinCallbackResponse(TapiHandle* pHandle, int callBackRe
        {
                unsigned int tempHandle = 0;
                TelCallInfoJoinedNoti_t joinedInfoNotification;
-               CallInfo confCallInfo;
+               AppCallInfo confCallInfo;
 
                memcpy(&tempHandle, pData, sizeof(TS_UINT));
                joinedInfoNotification.id = tempHandle;
-               CallInfo activeCall;
-               CallInfo heldCall;
+               AppCallInfo activeCall;
+               AppCallInfo heldCall;
                // Use enumerator to access elements in the map
-               IListT<CallInfo>* pCallList = pTelManager->__pActiveCallList->GetValuesN();
+               IListT<AppCallInfo>* pCallList = pTelManager->__pActiveCallList->GetValuesN();
                result r = pCallList->GetAt(0, activeCall);
 
                if (r == E_SUCCESS)
@@ -1344,7 +1389,7 @@ TelephonyManager::HandleJoinCallbackResponse(TapiHandle* pHandle, int callBackRe
                        r = pCallList->GetAt(1, heldCall);
                        if (r == E_SUCCESS)
                        {
-                               CallInfo* pConfCallInfo = new (std::nothrow) CallInfo();
+                               AppCallInfo* pConfCallInfo = new (std::nothrow) AppCallInfo();
                                unsigned int activeCallHandle = activeCall.GetCallHandle()->ToLong();
                                unsigned int heldCallHandle = heldCall.GetCallHandle()->ToLong();
                                if (activeCall.IsConferenceCall() == true)
@@ -1422,12 +1467,12 @@ TelephonyManager::HandleSwapCallbackResponse(TapiHandle* pHandle, int callBackRe
        TelephonyManager* pTelManager = (TelephonyManager*) pUserData;
        if (callBackResult == TAPI_CAUSE_SUCCESS)
        {
-               IListT<CallInfo>* pCallList = pTelManager->__pActiveCallList->GetValuesN();
+               IListT<AppCallInfo>* pCallList = pTelManager->__pActiveCallList->GetValuesN();
                IListT<long>* pKeyList = pTelManager->__pActiveCallList->GetKeysN();
                int callCount = pTelManager->__pActiveCallList->GetCount();
                for (int index = 0; index < callCount; index++)
                {
-                       CallInfo* pTempCallInfo = new (std::nothrow) CallInfo();
+                       AppCallInfo* pTempCallInfo = new (std::nothrow) AppCallInfo();
                        pCallList->GetAt(index, *pTempCallInfo);
                        (pTempCallInfo->IsOnHold() == false) ? pTempCallInfo->SetOnHold(true) : pTempCallInfo->SetOnHold(false);
                        long callHandle;
@@ -1461,9 +1506,9 @@ TelephonyManager::HandleEndFromConferenceCallbackResponse(TapiHandle* pHandle, i
                TelCallEndCnf_t callEndNotification;
                memcpy(&callEndNotification, pData, sizeof(TelCallEndCnf_t));
                //Fetch conference call
-               CallInfo endConfCall;
+               AppCallInfo endConfCall;
                bool isConferenceCallFound = false;
-               IListT<CallInfo>* pCallList = pTelManager->__pActiveCallList->GetValuesN();
+               IListT<AppCallInfo>* pCallList = pTelManager->__pActiveCallList->GetValuesN();
                int callCount = pCallList->GetCount();
                for (int index = 0; index < callCount; index++)
                {
@@ -1494,14 +1539,14 @@ TelephonyManager::HandleEndFromConferenceCallbackResponse(TapiHandle* pHandle, i
 }
 
 bool
-TelephonyManager::HandleParticipantEndedFromConference(unsigned int participantCallHandle, CallInfo& conferenceCall)
+TelephonyManager::HandleParticipantEndedFromConference(unsigned int participantCallHandle, AppCallInfo& conferenceCall)
 {
        AppLogDebug("ENTER");
        //to check if participant call was found and ended.
        bool isParticipantCallEnded = false;
        //Identify the call to be ended and remove from list.
-       CallInfo callToBeEnded;
-       IListT<CallInfo>* pCallerList = conferenceCall.GetCallerList();
+       AppCallInfo callToBeEnded;
+       IListT<AppCallInfo>* pCallerList = conferenceCall.GetCallerList();
        int callerCount = pCallerList->GetCount();
        for (int index = 0; index < callerCount; index++)
        {
@@ -1528,11 +1573,11 @@ TelephonyManager::HandleParticipantEndedFromConference(unsigned int participantC
        //Check if last participant removed. If yes, switch to single active view
        if (conferenceCall.GetCallerListCount() == 1)
        {
-               CallInfo callFromList;
+               AppCallInfo callFromList;
                pCallerList = conferenceCall.GetCallerList();
                pCallerList->GetAt(0, callFromList);
                //construct a new single active call
-               CallInfo* pActiveCall = new (std::nothrow) CallInfo();
+               AppCallInfo* pActiveCall = new (std::nothrow) AppCallInfo();
                *pActiveCall = callFromList;
                //update conference status and Hold status
                pActiveCall->SetConference(false);
@@ -1543,18 +1588,18 @@ TelephonyManager::HandleParticipantEndedFromConference(unsigned int participantC
                pActiveCall = null;
                //using the callConnected to switch to single active screen
                //or update multiple active call screen
-               IListT<CallInfo>* pActiveCallList = __pActiveCallList->GetValuesN();
+               IListT<AppCallInfo>* pActiveCallList = __pActiveCallList->GetValuesN();
                __pEventListener->HandleCallConnected(*pActiveCallList);
                delete pActiveCallList;
                pActiveCallList = null;
        }
        else
        {
-               CallInfo callFromList;
+               AppCallInfo callFromList;
                pCallerList = conferenceCall.GetCallerList();
                pCallerList->GetAt(0, callFromList);
                //construct a new conference call
-               CallInfo* pConfCallInfo = new (std::nothrow) CallInfo();
+               AppCallInfo* pConfCallInfo = new (std::nothrow) AppCallInfo();
                *pConfCallInfo = conferenceCall;
                if (confCallHandle == participantCallHandle)
                {
@@ -1583,10 +1628,10 @@ TelephonyManager::HandleSplitFromConferenceCallbackResponse(TapiHandle* pHandle,
                TelCallSplitCnf_t callSplitNotification;
                memcpy(&callSplitNotification, pData, sizeof(TelCallSplitCnf_t));
                int confCallIndex = -1;
-               CallInfo endConfCall;
+               AppCallInfo endConfCall;
                bool isConferenceCallFound = false;
 
-               IListT<CallInfo>* pCallList = pTelManager->__pActiveCallList->GetValuesN();
+               IListT<AppCallInfo>* pCallList = pTelManager->__pActiveCallList->GetValuesN();
                int callCount = pCallList->GetCount();
                for (int index = 0; index < callCount; index++)
                {
@@ -1609,7 +1654,7 @@ TelephonyManager::HandleSplitFromConferenceCallbackResponse(TapiHandle* pHandle,
                delete pCallList;
                pCallList = null;
                //Identify the call to be ended and remove from list on API success
-               CallInfo callToBeEnded;
+               AppCallInfo callToBeEnded;
                pCallList = endConfCall.GetCallerList();
                callCount = pCallList->GetCount();
                for (int index = 0; index < callCount; index++)
@@ -1629,10 +1674,10 @@ TelephonyManager::HandleSplitFromConferenceCallbackResponse(TapiHandle* pHandle,
                {
                        //Set hold for the other single call
                        // and add to the list
-                       CallInfo callFromList;
+                       AppCallInfo callFromList;
                        pCallList = endConfCall.GetCallerList();
                        pCallList->GetAt(0, callFromList);
-                       CallInfo* pHeldCall = new (std::nothrow) CallInfo();
+                       AppCallInfo* pHeldCall = new (std::nothrow) AppCallInfo();
                        *pHeldCall = callFromList;
                        pHeldCall->SetConference(false);
                        pHeldCall->SetOnHold(true);
@@ -1644,11 +1689,11 @@ TelephonyManager::HandleSplitFromConferenceCallbackResponse(TapiHandle* pHandle,
                {
                        //Set hold flag for conference call
                        endConfCall.SetOnHold(true);
-                       CallInfo callFromList;
+                       AppCallInfo callFromList;
                        pCallList = endConfCall.GetCallerList();
                        pCallList->GetAt(0, callFromList);
 
-                       CallInfo* pConfCallInfo = new (std::nothrow) CallInfo();
+                       AppCallInfo* pConfCallInfo = new (std::nothrow) AppCallInfo();
                        *pConfCallInfo = endConfCall;
                        if (confCallHandle == callSplitNotification.id)
                        {
@@ -1666,7 +1711,7 @@ TelephonyManager::HandleSplitFromConferenceCallbackResponse(TapiHandle* pHandle,
                        }
                }
                //Add the new active call to active call list
-               CallInfo* pActiveCall = new (std::nothrow) CallInfo();
+               AppCallInfo* pActiveCall = new (std::nothrow) AppCallInfo();
                *pActiveCall = callToBeEnded;
                pActiveCall->SetConference(false);
                pActiveCall->SetOnHold(false);
@@ -1694,8 +1739,8 @@ TelephonyManager::HandleEndConferenceCallbackResponse(TapiHandle* pHandle, int c
        {
                //fetch ended confCall details
                result r = E_FAILURE;
-               CallInfo endConfCallInfo;
-               IListT<CallInfo>* pActiveCallList = pTelManager->__pActiveCallList->GetValuesN();
+               AppCallInfo endConfCallInfo;
+               IListT<AppCallInfo>* pActiveCallList = pTelManager->__pActiveCallList->GetValuesN();
                if(pActiveCallList != null && pActiveCallList->GetCount() > 0)
                {
                        for (int index = 0; index < pActiveCallList->GetCount(); index++)
@@ -1728,19 +1773,19 @@ TelephonyManager::HandleEndConferenceCallbackResponse(TapiHandle* pHandle, int c
 
                //check if the ended call was the last call and show notification to user
                bool isLastCall = (pTelManager->__pActiveCallList->GetCount() == 0);
-               ArrayListT<CallInfo>* pCallList = null;
+               ArrayListT<AppCallInfo>* pCallList = null;
                if (isLastCall)
                {
                        pTelManager->__pSoundManager->SetlastEndedConferenceCall();
                        //stop sound session
                        pTelManager->__pSoundManager->StopSession();
                        //send empty call list to show dialer or call log screen
-                       pCallList = new (std::nothrow) ArrayListT<CallInfo>();
+                       pCallList = new (std::nothrow) ArrayListT<AppCallInfo>();
                }
                else
                {
                        //fetch active calls to show appropriate scene
-                       pCallList = static_cast<ArrayListT<CallInfo>*>(pTelManager->__pActiveCallList->GetValuesN());
+                       pCallList = static_cast<ArrayListT<AppCallInfo>*>(pTelManager->__pActiveCallList->GetValuesN());
                }
                //notify listener that call is disconnected.
                pTelManager->__pEventListener->HandleCallDisconnected(isLastCall, *pCallList);
@@ -1781,7 +1826,7 @@ TelephonyManager::HandleIdleCallBack(void* pData)
        unsigned int endCallHandle = idleNotification.id;
 
        //empty active call list or no dialed or incoming calls - ignore this event
-       IListT<CallInfo>* pActiveCallList = __pActiveCallList->GetValuesN();
+       IListT<AppCallInfo>* pActiveCallList = __pActiveCallList->GetValuesN();
        if((pActiveCallList == null || pActiveCallList->GetCount() <= 0) && __pDialedCall == null && __pIncomingCall == null)
        {
                delete pActiveCallList;
@@ -1791,7 +1836,7 @@ TelephonyManager::HandleIdleCallBack(void* pData)
 
        //Check if ended call was among conference caller list,
        //then divert event to "HandleParticipantEndedFromConference()"
-       CallInfo confCallInfo;
+       AppCallInfo confCallInfo;
        bool isConferenceCallChanged = false;
        for (int index = 0; index < pActiveCallList->GetCount(); index++)
        {
@@ -1815,7 +1860,7 @@ TelephonyManager::HandleIdleCallBack(void* pData)
        }
 
        //check if ended call was among the active call list and not a conference call
-       CallInfo endCallInfo;
+       AppCallInfo endCallInfo;
        result r = __pActiveCallList->GetValue(endCallHandle, endCallInfo);
        if (r == E_SUCCESS)
        {
@@ -1836,7 +1881,7 @@ TelephonyManager::HandleIdleCallBack(void* pData)
                //It comes here only if the ended call was either a "unconnected" dialed call or an "Missed" incoming call.
                bool isLastCall = (__pActiveCallList->GetCount() == 0);
 
-               ArrayListT<CallInfo>* pCallList = null;
+               ArrayListT<AppCallInfo>* pCallList = null;
                //Check if dialed call was ended
                if (isDialedCallEnded == true)
                {
@@ -1855,7 +1900,7 @@ TelephonyManager::HandleIdleCallBack(void* pData)
                        delete __pIncomingCall;
                        __pIncomingCall = null;
                        //update missed status
-                       endCallInfo.SetCalllogType(CALL_LOG_TYPE_VOICE_MISSED);
+                       endCallInfo.SetCalllogType(CALL_LOG_TYPE_VOICE_MISSED_UNSEEN);
                }
                //save ended call to call log db.
                SaveCallInfoToLogsDb(endCallInfo);
@@ -1864,7 +1909,7 @@ TelephonyManager::HandleIdleCallBack(void* pData)
                if (isLastCall == true)
                {
                        __pSoundManager->StopSession();
-                       pCallList = new (std::nothrow) ArrayListT<CallInfo>();
+                       pCallList = new (std::nothrow) ArrayListT<AppCallInfo>();
                        pCallList->Construct(1);
                        if (isMissedIncomingCallEnded == false)
                        {
@@ -1876,7 +1921,7 @@ TelephonyManager::HandleIdleCallBack(void* pData)
                }
                else
                {
-                       pCallList = static_cast<ArrayListT<CallInfo>*>(__pActiveCallList->GetValuesN());
+                       pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pActiveCallList->GetValuesN());
                }
                __pEventListener->HandleCallDisconnected(isLastCall, *pCallList);
                delete pCallList;
@@ -1887,7 +1932,7 @@ TelephonyManager::HandleIdleCallBack(void* pData)
 }
 
 bool
-TelephonyManager::HandleEndNormalActiveCall(CallInfo& endCallInfo)
+TelephonyManager::HandleEndNormalActiveCall(AppCallInfo& endCallInfo)
 {
        // This function gets called only from HandleIdleCallback(),
        // to handle disconnection of normal active calls.
@@ -1897,20 +1942,20 @@ TelephonyManager::HandleEndNormalActiveCall(CallInfo& endCallInfo)
                __pActiveCallList->Remove(endCallInfo.GetCallHandle()->ToLong());
                //check if the ended call was the last call and show notification to user
                bool isLastCall = (__pActiveCallList->GetCount() == 0);
-               ArrayListT<CallInfo>* pCallList = null;
+               ArrayListT<AppCallInfo>* pCallList = null;
                if (isLastCall)
                {
                        //stop sound session
                        __pSoundManager->StopSession();
                        //save "End" CallInfo to list to show EndCallForm
-                       pCallList = new (std::nothrow) ArrayListT<CallInfo>();
+                       pCallList = new (std::nothrow) ArrayListT<AppCallInfo>();
                        pCallList->Construct(1);
                        pCallList->Add(endCallInfo);
                }
                else
                {
                        //fetch active calls to show appropriate scene
-                       pCallList = static_cast<ArrayListT<CallInfo>*>(__pActiveCallList->GetValuesN());
+                       pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pActiveCallList->GetValuesN());
                }
 
                //Save "End" call info to call log database
@@ -1936,7 +1981,7 @@ TelephonyManager::HandleDialingCallBack(void* pData)
        if (__pDialedCall == null)
        {
                //construct new dialed call
-               __pDialedCall = new (std::nothrow) CallInfo();
+               __pDialedCall = new (std::nothrow) AppCallInfo();
 
                TelCallStatus_t callStatus;
                int res = tel_get_call_status(__pTapiHandle, dialingNotification.id, &callStatus);
@@ -1981,13 +2026,13 @@ TelephonyManager::HandleActiveCallBack(void* pData)
        TelCallStatusActiveNoti_t activeNotification;
        memcpy(&newCallHandle, pData, sizeof(TS_UINT));
        activeNotification.id = newCallHandle;
-       IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+       IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
 
        //Check if the "Held" call was activated, i.e it is already present in already activated calls list.
        bool toHandleEvent = true;
        for (int callIndex = 0; (callIndex < pCallList->GetCount() && toHandleEvent == true); callIndex++ )
        {
-               CallInfo tempCallInfo;
+               AppCallInfo tempCallInfo;
                pCallList->GetAt(callIndex, tempCallInfo);
                unsigned int tempCallHandle = tempCallInfo.GetCallHandle()->ToLong();
                //Check if active callback came for "HandleJoinCallbackResponse"
@@ -2001,11 +2046,11 @@ TelephonyManager::HandleActiveCallBack(void* pData)
                        else
                        {
                                //check individual participants of conf call
-                               IListT<CallInfo>* pConfCallList = tempCallInfo.GetCallerList();
+                               IListT<AppCallInfo>* pConfCallList = tempCallInfo.GetCallerList();
                                int confCallCount  = pConfCallList->GetCount();
                                for (int callIndex = 0; (callIndex < confCallCount && toHandleEvent == true); callIndex++)
                                {
-                                       CallInfo confCallerInfo;
+                                       AppCallInfo confCallerInfo;
                                        pConfCallList->GetAt(callIndex, confCallerInfo);
                                        unsigned int confCallerHandle = confCallerInfo.GetCallHandle()->ToLong();
                                        if (confCallerHandle == activeNotification.id)
@@ -2037,7 +2082,7 @@ TelephonyManager::HandleCallConnected(unsigned int connectedCallHandle)
 {
        //Here it comes, only if either new dialed or incoming call was connected.
        //This function should be called only from "HandleActiveCallback()".
-       CallInfo* pConnectedCall = null;
+       AppCallInfo* pConnectedCall = null;
        //to check if incoming call was connected
        bool isIncomingCallConnected = false;
 
@@ -2061,7 +2106,7 @@ TelephonyManager::HandleCallConnected(unsigned int connectedCallHandle)
                // Otherwise Correct the code in some other function, if it comes here.
                AppLogDebug("Error - Connected call was neither one of active calls nor it was dialed or incoming call");
                //Construct a new CallInfo object for call
-               pConnectedCall = new (std::nothrow) CallInfo();
+               pConnectedCall = new (std::nothrow) AppCallInfo();
                pConnectedCall->SetCallHandle(connectedCallHandle);
 
                TelCallStatus_t callStatus;
@@ -2124,7 +2169,7 @@ TelephonyManager::HandleCallConnected(unsigned int connectedCallHandle)
        pConnectedCall = null;
 
        //notify listener that call is connected.
-       IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+       IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
        __pSoundManager->SetSoundMode(SOUND_MODE_VOICE);
        __pEventListener->HandleCallConnected(*pCallList);
        if (isIncomingCallConnected == true)
@@ -2136,8 +2181,9 @@ TelephonyManager::HandleCallConnected(unsigned int connectedCallHandle)
 }
 
 bool
-TelephonyManager::CheckIncomingCallToBeRejected(CallInfo* pIncomingCallInfo)
+TelephonyManager::CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo)
 {
+       AppLogDebug("Enter");
        int callHandle = pIncomingCallInfo->GetCallHandle()->ToLong();
        String contactNumber(L"");
        contactNumber.Append(pIncomingCallInfo->GetContactNumber());
@@ -2146,7 +2192,7 @@ TelephonyManager::CheckIncomingCallToBeRejected(CallInfo* pIncomingCallInfo)
        if (((__pSettingsManager->GetUnknownRejectStatus() == true) && (pIncomingCallInfo->GetContactInfo() == null))
                        || (__pSettingsManager->IsCallToBeRejected(contactNumber) == true))
        {
-               AnswerCall(callHandle,false);
+               AnswerAutoRejectCall(callHandle);
                return true;
        }
        return false;
@@ -2182,20 +2228,20 @@ TelephonyManager::HandleCallback(TapiHandle* pHandle, const char* pNotiId, void*
        }
 }
 
-CallInfo*
+AppCallInfo*
 TelephonyManager::GetConferenceCallInfoN(void)
 {
-       CallInfo* pConfCallInfo = null;
+       AppCallInfo* pConfCallInfo = null;
 
-       IListT<CallInfo>* pCallList = __pActiveCallList->GetValuesN();
+       IListT<AppCallInfo>* pCallList = __pActiveCallList->GetValuesN();
        int callCount = pCallList->GetCount();
        for (int index = 0; index < callCount; index++)
        {
-               CallInfo callInfo;
+               AppCallInfo callInfo;
                pCallList->GetAt(index, callInfo);
                if (callInfo.IsConferenceCall() == true)
                {
-                       pConfCallInfo = new (std::nothrow) CallInfo();
+                       pConfCallInfo = new (std::nothrow) AppCallInfo();
                        *pConfCallInfo = callInfo;
                        //Found the Conference call
                        break;
@@ -2207,13 +2253,13 @@ TelephonyManager::GetConferenceCallInfoN(void)
        return pConfCallInfo;
 }
 
-IListT<CallInfo>*
+IListT<AppCallInfo>*
 TelephonyManager::GetCallListN(void)
 {
-       ArrayListT<CallInfo>* pCallList = null;
+       ArrayListT<AppCallInfo>* pCallList = null;
        if (__pActiveCallList != null)
        {
-               pCallList = static_cast<ArrayListT<CallInfo>*>(__pActiveCallList->GetValuesN());
+               pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pActiveCallList->GetValuesN());
        }
        return pCallList;
 }
@@ -2229,7 +2275,7 @@ TelephonyManager::GetCurrentCallCount(void)
 }
 
 void
-TelephonyManager::StartAlert(CallInfo& incomingCallInfo)
+TelephonyManager::StartAlert(AppCallInfo& incomingCallInfo)
 {
        String contactRingTone(L"");
        String contactNumber = incomingCallInfo.GetContactNumber();
@@ -2420,7 +2466,7 @@ TelephonyManager::GetContactN(const String& phoneNumber)
        return null;
 }
 
-CallInfo*
+AppCallInfo*
 TelephonyManager::FetchIncomingCallHandleN(const String& callHandle, const String& contactNumber)
 {
        if(__pIncomingCall != null)
@@ -2442,7 +2488,7 @@ TelephonyManager::FetchIncomingCallHandleN(const String& callHandle, const Strin
                        return null;
                }
                //construct incoming call info object
-               __pIncomingCall = new (std::nothrow) CallInfo();
+               __pIncomingCall = new (std::nothrow) AppCallInfo();
                __pIncomingCall->SetCallHandle(incomingHandle);
 
                //contact number
@@ -2496,7 +2542,7 @@ TelephonyManager::FetchIncomingCallHandleN(const String& callHandle, const Strin
                }
 
                //construct a new callinfo object to pass its ownership to caller.
-               CallInfo* pNewIncomingCall = new (std::nothrow) CallInfo();
+               AppCallInfo* pNewIncomingCall = new (std::nothrow) AppCallInfo();
                *pNewIncomingCall = *__pIncomingCall;
                return pNewIncomingCall;
        }
@@ -2513,7 +2559,7 @@ TelephonyManager::HandleIncomingCallStatusCallBack(TelCallStatus_t* pCallStatus,
                                        || (pCallStatus->CallState == TAPI_CALL_STATE_WAITING)))
        {
                //construct incoming call details
-               pTelManager->__pIncomingCall = new (std::nothrow) CallInfo();
+               pTelManager->__pIncomingCall = new (std::nothrow) AppCallInfo();
                pTelManager->__pIncomingCall->SetCallHandle(pCallStatus->CallHandle);
                //contact number
                String contactNumber(pCallStatus->pNumber);
@@ -2533,7 +2579,7 @@ TelephonyManager::HandleIncomingCallStatusCallBack(TelCallStatus_t* pCallStatus,
 }
 
 void
-TelephonyManager::SaveCallInfoToLogsDb(CallInfo& endCallInfo)
+TelephonyManager::SaveCallInfoToLogsDb(AppCallInfo& endCallInfo)
 {
        if (endCallInfo.IsConferenceCall() == false)
        {
@@ -2544,10 +2590,10 @@ TelephonyManager::SaveCallInfoToLogsDb(CallInfo& endCallInfo)
        {
                //Conference call
                int confCallCount = endCallInfo.GetCallerListCount();
-               IListT<CallInfo>* pParticipantList = endCallInfo.GetCallerList();
+               IListT<AppCallInfo>* pParticipantList = endCallInfo.GetCallerList();
                for (int index = 0; index < confCallCount; index++)
                {
-                       CallInfo participantInfo;
+                       AppCallInfo participantInfo;
                        if (pParticipantList->GetAt(index, participantInfo) == E_SUCCESS)
                        {
                                //Add call ended to call log database
@@ -2556,3 +2602,13 @@ TelephonyManager::SaveCallInfoToLogsDb(CallInfo& endCallInfo)
                }
        }
 }
+
+void
+TelephonyManager::OnTelephonyNetworkStatusChanged(const NetworkStatus& networkStatus)
+{
+
+       if(networkStatus.IsCallServiceAvailable() == false)
+       {
+               EndAllCalls();
+       }
+}