Fix for N_SE-52935 N_SE-52866
[apps/osp/Call.git] / src / CallPresentationModel.cpp
index 6020c28..04220e0 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
 #include <FApp.h>
 #include <FUi.h>
 #include <FMedia.h>
+#include <FShell.h>
 #include "CallApp.h"
+#include "CallAppControlRequestMgr.h"
 #include "CallActiveCallForm.h"
+#include "CallAppUtility.h"
 #include "CallInfo.h"
 #include "CallPresentationModel.h"
 #include "CallSettingsPresentationModel.h"
@@ -38,6 +41,10 @@ using namespace Tizen::Graphics;
 using namespace Tizen::Media;
 using namespace Tizen::Social;
 using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Telephony;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Messaging;
+using namespace Tizen::Shell;
 
 CallPresentationModel* CallPresentationModel::__pInstance = null;
 
@@ -48,12 +55,41 @@ CallPresentationModel::CallPresentationModel(void)
        __pSettingsPresentor = null;
        __isMessageAppControlRunning = false;
        __isDialAppControlRunning = false;
+       __pAppControlMgr = null;
+       __pNetworkManager = null;
+       __psimStateManager = null;
+       __psimInfo = null;
+       __pSmsManager = null;
+       __isMessageSendInProgress = false;
+       __pNotificationManager = null;
 }
 
 CallPresentationModel::~CallPresentationModel(void)
 {
+       AppControl::StopAppControlResponseListener(this);
        __pTelephonyMgr = null;
        __pSettingsPresentor = null;
+       __pAppControlMgr =null;
+       if(__pNetworkManager != null)
+       {
+               delete __pNetworkManager;
+               __pNetworkManager = null;
+       }
+       if(__psimStateManager != null)
+       {
+               delete __psimStateManager;
+               __psimStateManager = null;
+       }
+       if(__psimInfo != null)
+       {
+               delete __psimInfo;
+               __psimInfo = null;
+       }
+       if(__pSmsManager != null)
+       {
+               delete __pSmsManager;
+               __pSmsManager = null;
+       }
 }
 
 void
@@ -97,6 +133,12 @@ CallPresentationModel::Construct(void)
        //Fetch Telephony Manager
        __pTelephonyMgr = TelephonyManager::GetInstance(this);
        __pSettingsPresentor = SettingsPresentationModel::GetInstance();
+       __pAppControlMgr = CallAppControlRequestMgr::GetInstance();
+       __pNetworkManager = new (std::nothrow)NetworkManager();
+       __pNetworkManager->Construct(null);
+       __pNotificationManager = new (std::nothrow) Tizen::Shell::NotificationManager;
+       __pNotificationManager->Construct();
+       GetSimInfo();
        return E_SUCCESS;
 }
 
@@ -107,19 +149,68 @@ CallPresentationModel::SetTelEventListener(ITelephonyEventListener* pTelEventLis
        __pTelEventListener = pTelEventListener;
 }
 
+bool
+CallPresentationModel::IfNumberEndsWithHash(Tizen::Base::String& phoneNumber)
+{
+       String phoneNumberEndingWithHash(L"#$");
+       RegularExpression checkHash;
+       checkHash.Construct(phoneNumberEndingWithHash);
+       bool endsWithHash = checkHash.Match(phoneNumber,false);
+       if(endsWithHash == true)
+       {
+               return true;
+       }
+       return false;
+}
+
 void
 CallPresentationModel::DialCall(String& contactNumber, bool isEmergency)
 {
        int errorCode = ERROR_NONE;
+       bool isCallServiceAvailable = false;
+       bool numberEndsWithHash = false;
+       NetworkStatus networkStatus;
+       result r;
        //Check if Telephony Manager is initialized
        TryCatch(__pTelephonyMgr != null, (errorCode = ERROR_TAPI_INIT_FAILED), "TAPI initialization failed");
 
        //check if phone is in flight mode
-       if(__pSettingsPresentor->GetFlightModeStatus() == true)
+       if(__pSettingsPresentor != null && __pSettingsPresentor->GetFlightModeStatus() == true)
        {
                __pTelEventListener->HandleTelephonyError(ERROR_FLIGHT_MODE_SET);
                return;
        }
+       //Check if dialing a call is possible - Check if sim is available
+       if (IsSimAvailable() == false)
+       {
+               __pTelEventListener->HandleTelephonyError(ERROR_CODE_SIM_INITIALIZATION_FAILED);
+               return ;
+       }
+
+       //fetch call service status
+       if(__pNetworkManager != null)
+       {
+               r = __pNetworkManager->GetNetworkStatus(networkStatus);
+               if (r == E_SUCCESS)
+               {
+                       isCallServiceAvailable = networkStatus.IsCallServiceAvailable();
+               }
+       }
+
+
+       if (isCallServiceAvailable == false)
+       {
+               __pTelEventListener->HandleTelephonyError(ERROR_DIAL_FAILED);
+               return ;
+       }
+       // check if GPRS number
+       numberEndsWithHash = IfNumberEndsWithHash(contactNumber);
+       if(numberEndsWithHash == true)
+       {
+               __pTelEventListener->HandleTelephonyError(ERROR_USSD_NUMBER);
+               return ;
+       }
+
        //setup outgoing call
        errorCode = __pTelephonyMgr->SetupMoCall(contactNumber, isEmergency);
        TryCatch(errorCode == ERROR_NONE,,"Error occurred while setup MO call");
@@ -257,7 +348,7 @@ CallPresentationModel::GetConferenceCallInfoN(void)
        return __pTelephonyMgr->GetConferenceCallInfoN();
 }
 
-void
+bool
 CallPresentationModel::SplitFromConference(SplitConfCallerCmdIds splitCallerCmdId, IListT<AppCallInfo>* pConfCallList)
 {
        int callIndex = -1;
@@ -293,11 +384,11 @@ CallPresentationModel::SplitFromConference(SplitConfCallerCmdIds splitCallerCmdI
        //split single call from conference
        r = __pTelephonyMgr->SplitFromConference(callToBeSpli.GetCallHandle()->ToLong());
        TryCatch(r == E_SUCCESS,,"Split from conf. call failed");
-       return;
+       return true;
 
 CATCH:
        __pTelEventListener->HandleTelephonyError(ERROR_SPLIT_FROM_CONFERENCE_FAILED);
-       return;
+       return false;
 }
 
 void
@@ -378,7 +469,12 @@ CallPresentationModel::GetCallListN(void)
 bool
 CallPresentationModel::RejectCall(int callHandle, bool sendMsg, const String& contactNumber)
 {
-       AppLogDebug("Enter");
+       AppLogDebug("Enter %d",callHandle);
+       if (sendMsg == true && __pAppControlMgr != null)
+       {
+               //launch compose message AppControl
+               __isMessageAppControlRunning = __pAppControlMgr->LaunchComposeMessageAppControl(*(const_cast<String*>(&contactNumber)), this);
+       }
        result r = __pTelephonyMgr->AnswerCall(callHandle, false);
        if (IsFailed(r))
        {
@@ -386,43 +482,31 @@ CallPresentationModel::RejectCall(int callHandle, bool sendMsg, const String& co
                return false;
        }
 
-       if (sendMsg == true)
-       {
-               //launch message
-               result r = E_SUCCESS;
-               HashMap extraData;
-               extraData.Construct();
-
-               extraData.Add(new (std::nothrow) String(MESSAGE_TYPE), new (std::nothrow) String(MESSAGE_SMS_TYPE));
-               extraData.Add(new (std::nothrow) String(MESSAGE_TO), new (std::nothrow) String(contactNumber));
-
-               AppControl* pAc = AppManager::FindAppControlN(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE);
-               if (pAc != null)
-               {
-                       AppLogDebug("Start");
-                       r = pAc->Start(null, null, &extraData, this);
-                       __isMessageAppControlRunning = true;
-                       delete pAc;
-               }
 
-               extraData.RemoveAll(true);
-       }
        AppLogDebug("Exit");
        return true;
 }
 
 void CallPresentationModel::OnAppForeground(void)
 {
+       AppLogDebug("Enter %d %d",__isDialAppControlRunning ,__isMessageAppControlRunning);
+       if (__isDialAppControlRunning == true)
+       {
+               //This comes here, when Dialer AppControl is finished working.
+               __isDialAppControlRunning = false;
+               __pAppControlMgr->AppControlRequestCompleted();
+       }
        if (__isMessageAppControlRunning == true)
        {
                //This comes here, when Message AppControl is finished working.
                __isMessageAppControlRunning = false;
+               __pAppControlMgr->AppControlRequestCompleted();
                //Check if this was the last call, then terminate application.
                //And if any calls are active, then those cases are already handled from Other places.
-               if( GetCurrentCallCount() == 0)
+               if( GetCurrentCallCount() == 0 && IsIncomingorDialingCallPresent() == false)
                {
-                       CallApp* pPhoneApp = static_cast<CallApp*>(UiApp::GetInstance());
-                       pPhoneApp->Terminate();
+                       CallApp* pCallApp = static_cast<CallApp*>(UiApp::GetInstance());
+                       pCallApp->Terminate();
                }
        }
 }
@@ -430,10 +514,12 @@ void CallPresentationModel::OnAppForeground(void)
 void
 CallPresentationModel::OnAppControlCompleteResponseReceived(const AppId& appId, const String& operationId, AppCtrlResult appControlResult, const IMap* pExtraData)
 {
+       AppLogDebug("Enter");
        if (__isMessageAppControlRunning == true)
        {
                //This comes here, when Message AppControl is finished working.
                __isMessageAppControlRunning = false;
+               __pAppControlMgr->AppControlRequestCompleted();
                //Check if this was the last call, then terminate application.
                //And if any calls are active, then those cases are already handled from Other places.
                if( GetCurrentCallCount() == 0)
@@ -446,6 +532,7 @@ CallPresentationModel::OnAppControlCompleteResponseReceived(const AppId& appId,
        {
                __isDialAppControlRunning = false;
 
+               __pAppControlMgr->AppControlRequestCompleted();
                if(appControlResult == APP_CTRL_RESULT_SUCCEEDED)
                {
                        String* pKey = new (std::nothrow) String(PARAM_PHONE_NUMBER);
@@ -470,7 +557,7 @@ CallPresentationModel::AddCall(const String& phoneNumber)
        ArrayList* pLaunchArgs = null;
        SceneManager* pSceneManager = SceneManager::GetInstance();
        int currentActiveCallCount = GetCurrentCallCount();
-       if(currentActiveCallCount <= 1)
+       if(currentActiveCallCount <= 1 && IsIncomingorDialingCallPresent() == false)
        {
                //make an outgoing call with given number
                String* contactTxt = new (std::nothrow) String(phoneNumber);
@@ -484,7 +571,8 @@ CallPresentationModel::AddCall(const String& phoneNumber)
                {
                        nextScene = IDSCN_SCENE_OUT_EMERGENCYCALL;
                }
-               pSceneManager->GoForward( ForwardSceneTransition( nextScene), pLaunchArgs);
+               pSceneManager->GoForward( ForwardSceneTransition( nextScene,
+                               SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_HISTORY_OPTION_NO_HISTORY,SCENE_DESTROY_OPTION_KEEP), pLaunchArgs);
 
        }
 }
@@ -513,6 +601,17 @@ CallPresentationModel::IsEmergencyNumber(const Tizen::Base::String& phoneNumber,
 }
 
 void
+CallPresentationModel::ResumeAlert(AppCallInfo& incomingCallInfo)
+{
+       //Adding incoming call sate setting here
+       if(__pSettingsPresentor != null)
+       {
+               __pSettingsPresentor->SetCallState(CALL_STATE_CALL_VOICE_CONNECTING);
+       }
+       __pTelephonyMgr->ResumeAlert(incomingCallInfo);
+}
+
+void
 CallPresentationModel::StartAlert(AppCallInfo& incomingCallInfo)
 {
        //Adding incoming call sate setting here
@@ -523,6 +622,12 @@ CallPresentationModel::StartAlert(AppCallInfo& incomingCallInfo)
        __pTelephonyMgr->StartAlert(incomingCallInfo);
 }
 
+AppCallInfo*
+CallPresentationModel::GetIncomingCallHandle()
+{
+       return __pTelephonyMgr->GetIncomingCallHandle();
+}
+
 void
 CallPresentationModel::StopAlert(void)
 {
@@ -560,7 +665,28 @@ CallPresentationModel::HandleCallConnected(Tizen::Base::Collection::IListT<AppCa
        }
        if(__pSettingsPresentor != null)
        {
-               __pSettingsPresentor->SetCallState(CALL_STATE_CALL_VOICE_ACTIVE);
+               if(IsIncomingorDialingCallPresent() == false)
+               {
+                       __pSettingsPresentor->SetCallState(CALL_STATE_CALL_VOICE_ACTIVE);
+               }
+       }
+}
+
+void
+CallPresentationModel::HandleCallActive(bool isActive)
+{
+       if (__pTelEventListener != null)
+       {
+               __pTelEventListener->HandleCallActive(isActive);
+       }
+}
+
+void
+CallPresentationModel::HandleCallHeld(bool isHeld)
+{
+       if (__pTelEventListener != null)
+       {
+               __pTelEventListener->HandleCallHeld(isHeld);
        }
 }
 
@@ -574,23 +700,30 @@ CallPresentationModel::HandleCallDisconnected(bool isLastCall, Tizen::Base::Coll
                SetMuteStatus(false);
                if(__pSettingsPresentor != null)
                {
-                       __pSettingsPresentor->SetCallState(CALL_STATE_CALL_OFF);
+                       //Check if there is a incoming call or dialing call present before setting the status
+                       if(IsIncomingorDialingCallPresent() == false)
+                       {
+                               __pSettingsPresentor->SetCallState(CALL_STATE_CALL_OFF);
+                       }
                }
        }
        else
        {
                if(__pSettingsPresentor != null)
                {
-                       __pSettingsPresentor->SetCallState(CALL_STATE_CALL_VOICE_ACTIVE);
+                       if(IsIncomingorDialingCallPresent() == false)
+                       {
+                               __pSettingsPresentor->SetCallState(CALL_STATE_CALL_VOICE_ACTIVE);
+                       }
                }
        }
-       //Defer from sending call disconnected event to form, in case Msg AppControl is running,
+       //1) Defer from sending call disconnected event to form, in case Msg AppControl is running,
        //to avoid PhoneApp from going to EndCall form, where it shows for 3 sec. and automatically closes.
-       if (__pTelEventListener != null && __isMessageAppControlRunning == false)
+       //2) Do not send call disconnected event to any form, in case an incoming call or dialing call is present.
+       if (__pTelEventListener != null /*&& __isMessageAppControlRunning == false*/ )
        {
                __pTelEventListener->HandleCallDisconnected(isLastCall, pCallList);
        }
-
 }
 
 void
@@ -609,6 +742,24 @@ CallPresentationModel::HandleIncomingCall(AppCallInfo& pCallInfo)
 }
 
 void
+CallPresentationModel::HandleConfCallHoldOccured(bool success)
+{
+       if (__pTelEventListener != null)
+       {
+               __pTelEventListener->HandleConfCallHoldOccured(success);
+       }
+}
+
+void
+CallPresentationModel::HandleConfCallActiveOccured(bool success)
+{
+       if (__pTelEventListener != null)
+       {
+               __pTelEventListener->HandleConfCallActiveOccured(success);
+       }
+}
+
+void
 CallPresentationModel::HandleCallSwapOccured(Tizen::Base::Collection::IListT<AppCallInfo>& pCallList)
 {
        if (__pTelEventListener != null)
@@ -620,6 +771,7 @@ CallPresentationModel::HandleCallSwapOccured(Tizen::Base::Collection::IListT<App
 void
 CallPresentationModel::HandleConferenceChange(void)
 {
+       //1) Do not send conf. call changed event to any form, in case an incoming call or dialing call is present.
        if (__pTelEventListener != null)
        {
                __pTelEventListener->HandleConferenceChange();
@@ -635,33 +787,309 @@ CallPresentationModel::HandleTelephonyError(int errorCode)
        }
 }
 
-
-result
+void
 CallPresentationModel::LaunchDialAppControl()
 {
-       result r = E_SUCCESS;
-       AppControl* pAppControl = null;
 
        if(__isDialAppControlRunning == true)
        {
+               AppLogDebug("__isDialAppControlRunning == true");
                //Do not allow another app control if already running
-               return r;
+               return;
+       }
+
+       //Launch dialer AppControl
+       if (__pAppControlMgr != null)
+       {
+               __isDialAppControlRunning = __pAppControlMgr->LaunchDialerAppControl(this);
+       }
+
+}
+
+bool
+CallPresentationModel::IsEnableJoinCallButton(void)
+{
+       //Check if conf. call has maximum participants
+       AppCallInfo* pConfCallInfo = GetConferenceCallInfoN();
+       if(pConfCallInfo != null && pConfCallInfo->GetCallerListCount() >= IDI_MAX_CONF_CALL_PARTICIPANTS)
+       {
+               return false;
+       }
+
+       //check if either of the caller is same or present in conf call.
+       IListT<AppCallInfo>* pActiveCallList = GetCallListN();
+       if ( pActiveCallList != null && pActiveCallList->GetCount() == IDI_MAX_ACTIVE_CALLS)
+       {
+               AppCallInfo firstCall;
+               AppCallInfo secondCall;
+               pActiveCallList->GetAt(0, firstCall);
+               pActiveCallList->GetAt(1, secondCall);
+
+               if (firstCall.IsConferenceCall() == true)
+               {
+                       IListT<AppCallInfo>* pConfMemberList = firstCall.GetCallerList();
+                       for (int index = 0; index < pConfMemberList->GetCount(); index++)
+                       {
+                               AppCallInfo singleConfMember;
+                               pConfMemberList->GetAt(index, singleConfMember);
+                               if (secondCall.GetContactNumber().IsEmpty() == false && secondCall.GetContactNumber().Equals(singleConfMember.GetContactNumber()) == true)
+                               {
+                                       return false;
+                               }
+                       }
+               }
+               else if (secondCall.IsConferenceCall() == true)
+               {
+                       IListT<AppCallInfo>* pConfMemberList = secondCall.GetCallerList();
+                       for (int index = 0; index < pConfMemberList->GetCount(); index++)
+                       {
+                               AppCallInfo singleConfMember;
+                               pConfMemberList->GetAt(index, singleConfMember);
+                               if (firstCall.GetContactNumber().IsEmpty() == false && firstCall.GetContactNumber().Equals(singleConfMember.GetContactNumber()) == true)
+                               {
+                                       return false;
+                               }
+                       }
+               }
+               else
+               {
+                       //Now, we definitely know that both are single active calls.
+                       if (firstCall.GetContactNumber().IsEmpty() == false && firstCall.GetContactNumber().Equals(secondCall.GetContactNumber()) == true)
+                       {
+                               return false;
+                       }
+               }
+       }
+       delete pConfCallInfo;
+       pConfCallInfo = null;
+       return true;
+}
+
+bool
+CallPresentationModel::IsIncomingorDialingCallPresent(void)
+{
+       //returns false, if incoming call or dialed call is present.
+       return __pTelephonyMgr->IsIncomingorDialingCallPresent();
+}
+
+bool
+CallPresentationModel::LaunchComposeMessageAppControl(String& contactNumber, IAppControlResponseListener* pListener)
+{
+       if (__pAppControlMgr != null)
+       {
+               return __pAppControlMgr->LaunchComposeMessageAppControl(contactNumber, pListener);
+       }
+       return false;
+}
+
+bool
+CallPresentationModel::LaunchViewContactAppControl(String& contactId, IAppControlResponseListener* pListener)
+{
+       if (__pAppControlMgr != null)
+       {
+               return __pAppControlMgr->LaunchViewContactAppControl(contactId, pListener);
+       }
+       return false;
+}
+
+bool
+CallPresentationModel::LaunchAddContactAppControl(Tizen::Base::String& contactNumber, Tizen::App::IAppControlResponseListener* pListener)
+{
+       if (__pAppControlMgr != null)
+       {
+               return __pAppControlMgr->LaunchAddContactAppControl(contactNumber, pListener);
+       }
+       return false;
+}
+
+bool
+CallPresentationModel::IsAppControlRunning(void)
+{
+       if (__pAppControlMgr != null)
+       {
+               return __pAppControlMgr->IsAppControlRunning();
+       }
+       return false;
+}
+
+void
+CallPresentationModel::AbortAppControlRequest(void)
+{
+       if (__pAppControlMgr != null)
+       {
+               __pAppControlMgr->AbortAppControlRequest();
+       }
+}
+
+void
+CallPresentationModel::AppControlRequestCompleted(void)
+{
+       if (__pAppControlMgr != null)
+       {
+               __pAppControlMgr->AppControlRequestCompleted();
+       }
+}
+
+result
+CallPresentationModel::GetSimInfo(void)
+{
+       __psimStateManager = new (std::nothrow)SimStateManager();
+       result r = __psimStateManager->Construct();
+       if (IsFailed(r))
+       {
+               delete __psimStateManager;
+               __psimStateManager = null;
+               return E_FAILURE;
+       }
+       __psimStateManager->SetSimEventListener(this);
+
+       __psimInfo = new (std::nothrow)SimInfo();
+       r = __psimStateManager->GetSimInfo(*__psimInfo);
+       if (IsFailed(r))
+       {
+               delete __psimStateManager;
+               __psimStateManager = null;
+               delete __psimInfo;
+               __psimInfo = null;
+               return E_FAILURE;
+       }
+       return E_SUCCESS;
+}
+
+void
+CallPresentationModel::OnTelephonyNetworkStatusChanged(const NetworkStatus& networkStatus)
+{
+
+}
+
+void
+CallPresentationModel::OnTelephonySimStateChanged(Tizen::Telephony::SimState state)
+{
+       if(__psimStateManager != null)
+       {
+               delete __psimStateManager;
+               __psimStateManager =null;
+       }
+       if(__psimInfo != null)
+       {
+               delete __psimInfo;
+               __psimInfo = null;
+       }
+
+       __psimStateManager = new SimStateManager();
+       result r = __psimStateManager->Construct();
+       if (IsFailed(r))
+       {
+               delete __psimStateManager;
+               __psimStateManager = null;
+               return ;
+       }
+
+       __psimInfo = new SimInfo();
+       r = __psimStateManager->GetSimInfo(*__psimInfo);
+       if (IsFailed(r))
+       {
+               delete __psimStateManager;
+               __psimStateManager = null;
+               delete __psimInfo;
+               __psimInfo = null;
+               return ;
        }
 
-       HashMap extraData;
-       extraData.Construct();
-       extraData.Add(new (std::nothrow) String(PARAM_PHONE_NUMBER), new (std::nothrow) String(L""));
+}
 
-       pAppControl = AppManager::FindAppControlN(PROVIDER_ID_PHONE, OPERATION_ID_DIAL);
-       if (pAppControl != null)
+bool
+CallPresentationModel::IsSimAvailable(void)
+{
+       if(__psimInfo != null)
+       {
+               return __psimInfo->IsAvailable();
+       }
+       else
        {
-               r = pAppControl->Start(null, null, &extraData, this);
-               __isDialAppControlRunning = true;
+               return false;
        }
 
-       extraData.RemoveAll(true);
 
-       return r;
+}
 
+void
+CallPresentationModel::SendMessage(String& strMsg,String& recpientNum)
+{
+       AppLogDebug("Enter");
+       result r;
+       if(__pSmsManager == null)
+       {
+               __pSmsManager = new (std::nothrow) SmsManager();
+               result r = __pSmsManager->Construct(*this);
+               if (IsFailed(r) == true)
+               {
+                       delete __pSmsManager;
+                       __pSmsManager = null;
+                       return;
+               }
+
+       }
+       RecipientList recipient;
+       recipient.Add(RECIPIENT_TYPE_TO,recpientNum);
+       SmsMessage smsMessage;
+       r = smsMessage.SetText(strMsg);
+       if (IsFailed(r) == false)
+       {
+               r = __pSmsManager->Send(smsMessage,recipient,true);
+               if (IsFailed(r) == false)
+               {
+                       __isMessageSendInProgress = true;
+               }
+               else
+               {
+                       AppLogDebug("%s",GetErrorMessage(r));
+                       ShowSMSErrorNotification();
+               }
+
+       }
+
+}
+
+void
+CallPresentationModel::ShowSMSErrorNotification(void)
+{
+       NotificationRequest request;
+       String alertString = AppUtility::GetResourceString(IDS_MESSAGE_SENDING_FAILED);
+       request.SetAlertText(L" ");
+       request.SetTitleText(L"\n"+alertString);
+       request.SetNotificationStyle(NOTIFICATION_STYLE_NORMAL);
+       request.SetNotificationCountText(alertString.GetLength());
+
+
+       String resourcePath = App::GetInstance()->GetAppSharedPath() + L"res/";
+
+       String iconPath = resourcePath + L"messages.png";
+       request.SetIconFilePath(iconPath);
+
+       int badgeNumber = __pNotificationManager->GetBadgeNumber();
+       ++badgeNumber;
+       if (badgeNumber <= 0)
+       {
+               badgeNumber = 1;
+       }
+       request.SetBadgeNumber(badgeNumber);
+
+       __pNotificationManager->Notify(request);
+       __pNotificationManager->RemoveNotification();
+}
+
+bool
+CallPresentationModel::IsMessageSendingInProgress(void)
+{
+       AppLogDebug("Enter %d",__isMessageSendInProgress);
+       return __isMessageSendInProgress;
+}
+
+void
+CallPresentationModel::OnSmsMessageSent(result r)
+{
+       AppLogDebug("Enter");
+       __isMessageSendInProgress = false;
 
 }