public override bool AddMonitorEvent(SIPMonitorMachineEvent machineEvent)
        {
            try
            {
                lock (DialogInfo)
                {
                    MonitorLogEvent_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.Notifier, SIPMonitorEventTypesEnum.Monitor, "Monitor event " + machineEvent.MachineEventType + " dialog " + ResourceURI.ToString() + " (ID " + machineEvent.ResourceID + ").", SubscriptionDialogue.Owner));

                    string state = GetStateForEventType(machineEvent.MachineEventType);

                    if (machineEvent.MachineEventType == SIPMonitorMachineEventTypesEnum.SIPDialogueRemoved)
                    {
                        DialogInfo.DialogItems.Add(new SIPEventDialog(machineEvent.ResourceID, state, null));
                        return(true);
                    }
                    else
                    {
                        SIPDialogueAsset sipDialogue = GetDialogue_External(new Guid(machineEvent.ResourceID));

                        if (sipDialogue == null)
                        {
                            // Couldn't find the dialogue in the database so it must be terminated.
                            DialogInfo.DialogItems.Add(new SIPEventDialog(machineEvent.ResourceID, "terminated", null));
                            return(true);
                        }
                        else if (machineEvent.MachineEventType == SIPMonitorMachineEventTypesEnum.SIPDialogueTransfer)
                        {
                            // For dialog transfer events add both dialogs involved to the notification.
                            DialogInfo.DialogItems.Add(new SIPEventDialog(sipDialogue.Id.ToString(), state, sipDialogue.SIPDialogue));

                            if (sipDialogue.SIPDialogue.BridgeId != Guid.Empty)
                            {
                                SIPDialogueAsset bridgedDialogue = GetDialogues_External(d => d.BridgeId == sipDialogue.BridgeId && d.Id != sipDialogue.Id, null, 0, 1).FirstOrDefault();
                                if (bridgedDialogue != null)
                                {
                                    DialogInfo.DialogItems.Add(new SIPEventDialog(bridgedDialogue.Id.ToString(), state, bridgedDialogue.SIPDialogue));
                                }
                            }

                            return(true);
                        }
                        else
                        {
                            DialogInfo.DialogItems.Add(new SIPEventDialog(sipDialogue.Id.ToString(), state, sipDialogue.SIPDialogue));
                            return(true);
                        }
                    }
                }
            }
            catch (Exception excp)
            {
                MonitorLogEvent_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.Notifier, SIPMonitorEventTypesEnum.Monitor, "Exception AddMonitorEvent. " + excp.Message, null));
                logger.Error("Exception SIPDialogEventSubscription AddMonitorEvent. " + excp.Message);
                throw;
            }
        }
 private void DetailsControlClosed()
 {
     m_selectedSIPCall = null;
     m_sipCallsPanel.CloseDetailsPane();
 }
        private void SIPCallsDataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (m_initialLoadComplete && !m_sipCallLoadInProgress && m_sipCalls.Count > 0)
                {
                    DataGrid dataGrid = (DataGrid)sender;
                    SIPDialogueAsset sipCall = (SIPDialogueAsset)m_sipCallsDataGrid.SelectedItem;

                    if (m_selectedSIPCall == null || m_selectedSIPCall != sipCall)
                    {
                        m_selectedSIPCall = sipCall;
                        //m_sipCallsPanel.SetDetailsElement(editControl);
                    }
                }
            }
            catch (Exception excp)
            {
                string excpMessage = (excp.InnerException != null) ? excp.InnerException.Message : excp.Message;
                LogActivityMessage_External(MessageLevelsEnum.Error, "Exception showing Call details. " + excpMessage);
                m_selectedSIPCall = null;
            }
        }