/// <summary> /// Used for callbacks initiated by across a WCF channel. /// </summary> //public void NotificationsReady() //{ //logger.Debug("NotificationsReady fired for " + Poll.Address + "."); // GetNotifications(); //} /// <summary> /// Used for callbacks from an in process object. /// </summary> /// <param name="address"></param> //public void NotificationsReady(string address) // { //logger.Debug("NotificationsReady fired for " + Poll.Address + "."); // GetNotifications(); // } public void GetNotifications() { NotificationData = new NotificationData(); try { //logger.Debug("NotificationAsyncResult NotificationsReady."); string sessionID; string sessionError; List <string> notifications = GetNotifications_External(Poll.Address, out sessionID, out sessionError); if (sessionError != null) { SessionError = sessionError; SessionID = sessionID; // Don't fire the callback, let the connection timeout to stop the really really stupid duplex channel // from retrying. //if (m_callback != null) //{ // m_callback(this); //} } else if (notifications != null) { // If there are pending events fire the callback. SessionID = sessionID; StringBuilder notificationsBuilder = new StringBuilder(); notifications.ForEach(s => notificationsBuilder.Append(s)); NotificationData.NotificationContent = notificationsBuilder.ToString(); //logger.Debug("NotificationAsyncResult notification retrieved for sessionID=" + SessionID + "."); if (m_callback != null) { m_callback(this); } } //else // { //logger.Debug("NotificationAsyncResult no notifications available."); // There are no pending events, let the publisher know there's an outstanding request and then wait for the callback. //logger.Debug("Notification listener set for " + Poll.Address + "."); //if (RegisterListenerForWCF_External != null) // { //logger.Debug("Monitor event publisher was a SIPMonitorPublisherProxy."); // RegisterListenerForWCF_External(Poll.Address); //} //else //{ // RegisterListenerInProcess_External(Poll.Address, NotificationsReady); //} //} } catch (Exception excp) { logger.Warn("Exception NotificationAsyncResult GetNotifications. " + excp.Message); SessionError = "Exception NotificationAsyncResult GetNotifications. " + excp.Message; if (m_callback != null) { m_callback(this); } } }
/// <summary> /// Used for callbacks initiated by across a WCF channel. /// </summary> //public void NotificationsReady() //{ //logger.Debug("NotificationsReady fired for " + Poll.Address + "."); // GetNotifications(); //} /// <summary> /// Used for callbacks from an in process object. /// </summary> /// <param name="address"></param> //public void NotificationsReady(string address) // { //logger.Debug("NotificationsReady fired for " + Poll.Address + "."); // GetNotifications(); // } public void GetNotifications() { NotificationData = new NotificationData(); try { //logger.Debug("NotificationAsyncResult NotificationsReady."); string sessionID; string sessionError; List<string> notifications = GetNotifications_External(Poll.Address, out sessionID, out sessionError); if (sessionError != null) { SessionError = sessionError; SessionID = sessionID; // Don't fire the callback, let the connection timeout to stop the really really stupid duplex channel // from retrying. //if (m_callback != null) //{ // m_callback(this); //} } else if (notifications != null) { // If there are pending events fire the callback. SessionID = sessionID; StringBuilder notificationsBuilder = new StringBuilder(); notifications.ForEach(s => notificationsBuilder.Append(s)); NotificationData.NotificationContent = notificationsBuilder.ToString(); //logger.Debug("NotificationAsyncResult notification retrieved for sessionID=" + SessionID + "."); if (m_callback != null) { m_callback(this); } } //else // { //logger.Debug("NotificationAsyncResult no notifications available."); // There are no pending events, let the publisher know there's an outstanding request and then wait for the callback. //logger.Debug("Notification listener set for " + Poll.Address + "."); //if (RegisterListenerForWCF_External != null) // { //logger.Debug("Monitor event publisher was a SIPMonitorPublisherProxy."); // RegisterListenerForWCF_External(Poll.Address); //} //else //{ // RegisterListenerInProcess_External(Poll.Address, NotificationsReady); //} //} } catch (Exception excp) { logger.Warn("Exception NotificationAsyncResult GetNotifications. " + excp.Message); SessionError = "Exception NotificationAsyncResult GetNotifications. " + excp.Message; if (m_callback != null) { m_callback(this); } } }