internal void DeclineCall(CallViewModel viewModel, string message) { //*********************************************************************************************************************************** // Call Declined, Message will contain a message like I am in meeting which was selected when call is declined. //*********************************************************************************************************************************** lock (CallsViewModelList) { if (FindCallViewModel(viewModel)) { LOG.Info(String.Format("Declining call for {0}. {1}", viewModel.CallerInfo, viewModel.ActiveCall.NativeCallPtr)); var contactID = new ContactID( string.Format("{0}@{1}", viewModel.ActiveCall.RemoteParty.Username, viewModel.ActiveCall.RemoteParty.HostAddress), IntPtr.Zero); var contact = ServiceManager.Instance.ContactService.FindContact(contactID); if (contact == null) { contact = new VATRPContact(contactID) { Fullname = viewModel.ActiveCall.RemoteParty.Username, DisplayName = viewModel.ActiveCall.RemoteParty.Username, SipUsername = viewModel.ActiveCall.RemoteParty.Username, RegistrationName = contactID.ID }; ServiceManager.Instance.ContactService.AddContact(contact, string.Empty); } viewModel.DeclineCall(false); try { _linphoneService.DeclineCall(viewModel.ActiveCall.NativeCallPtr); } catch (Exception ex) { ServiceManager.LogError("DeclineCall", ex); } if (message.NotBlank()) { if (_simpleMessageViewModel != null) { _simpleMessageViewModel.SetActiveChatContact(contact, IntPtr.Zero); _simpleMessageViewModel.SendSimpleMessage(string.Format("{0}{1}", VATRPChatMessage.DECLINE_PREFIX, message)); } } } } }
internal void DeclineCall(CallViewModel viewModel, string message) { lock (CallsViewModelList) { if (FindCallViewModel(viewModel)) { LOG.Info(String.Format("Declining call for {0}. {1}", viewModel.CallerInfo, viewModel.ActiveCall.NativeCallPtr)); var contactID = new ContactID( string.Format("{0}@{1}", viewModel.ActiveCall.RemoteParty.Username, viewModel.ActiveCall.RemoteParty.HostAddress), IntPtr.Zero); var contact = ServiceManager.Instance.ContactService.FindContact(contactID); if (contact == null) { contact = new VATRPContact(contactID) { Fullname = viewModel.ActiveCall.RemoteParty.Username, DisplayName = viewModel.ActiveCall.RemoteParty.Username, SipUsername = viewModel.ActiveCall.RemoteParty.Username, RegistrationName = contactID.ID }; ServiceManager.Instance.ContactService.AddContact(contact, string.Empty); } viewModel.DeclineCall(false); try { _linphoneService.DeclineCall(viewModel.ActiveCall.NativeCallPtr); } catch (Exception ex) { ServiceManager.LogError("DeclineCall", ex); } if (message.NotBlank()) { if (_simpleMessageViewModel != null) { _simpleMessageViewModel.SetActiveChatContact(contact, IntPtr.Zero); _simpleMessageViewModel.SendMessage(string.Format("{0}{1}", VATRPChatMessage.DECLINE_PREFIX, message)); } } } } }