private void NotifyReceived(object sender, NotifyReceivedEventArgs e) { try { if (e.Error == null) { string notificationText = e.request.GetBody <NotificationData>().NotificationContent; if (notificationText.IsNullOrBlank() || notificationText == NotificationData.NOTIFICATION_CLOSE_CONTENT) { DebugMessage_External("Blank or close notify message received=" + notificationText + "."); //LogActivityMessage(MessageLevelsEnum.Warn, "Unknown error on machine notification session."); Close(); } /*else if (notificationText.StartsWith(m_closeSessionPrefix)) { * // This indicates an error has occurred creating the subscription and the session must be closed. * string errorMessage = notificationText.Replace(m_closeSessionPrefix, String.Empty); * LogActivityMessage(MessageLevelsEnum.Warn, "Error on machine notification session. " + errorMessage + "."); * CloseNotificationChannel(true); * }*/ else { if (NotificationReceived != null) { NotificationReceived(notificationText); } // Only machine events will be received on this channel. //SIPMonitorEvent monitorEvent = SIPMonitorEvent.ParseEventCSV(notificationText); //SIPEventMonitorClient_MonitorEventReceived((SIPMonitorMachineEvent)monitorEvent); } } else { //LogActivityMessage(MessageLevelsEnum.Error, "NotifyReceived Error: " + e.Error.Message); Close(); } } catch (Exception excp) { //LogActivityMessage(MessageLevelsEnum.Error, "Exception NotifyReceived. " + excp.Message); Close(); } }
private void CloseSessionReceived(object sender, NotifyReceivedEventArgs e) { DebugMessage_External("CloseSessionReceived."); Close(); }