/// <summary>
        ///
        /// </summary>
        /// <remarks>
        /// Throwing an exception in this method does not result in a message being sent to the client.
        /// </remarks>
        /// <param name="result"></param>
        /// <returns></returns>
        public Message EndMakeConnect(IAsyncResult result)
        {
            try
            {
                NotificationAsyncResult asyncResult = result as NotificationAsyncResult;
                if (asyncResult == null)
                {
                    throw new ArgumentException("Invalid async result", "result");
                }

                logger.Debug("EndMakeConnect sessionID=" + asyncResult.SessionID + ", address=" + asyncResult.Poll.Address + ".");

                lock (m_pendingNotifications)
                {
                    m_pendingNotifications.Remove(asyncResult.Poll.Address);
                }

                Message response = null;
                if (asyncResult.NotificationData != null)
                {
                    if (asyncResult.SessionError != null)
                    {
                        //logger.Debug("EndMakeConnect session error, sessionID=" + "faulting channel: " + asyncResult.SessionError + ".");
                        //response = Message.CreateMessage(MessageVersion.Default, NotificationData.CLOSE_ACTION, NotificationData.NOTIFICATION_CLOSE_CONTENT);
                        //response = asyncResult.Poll.PrepareResponse(response, asyncResult.SessionID);
                        logger.Debug("EndMakeConnect session error, sessionID=" + asyncResult.SessionID + "had a fault, " + asyncResult.SessionError + ", not responding to keep the client from retrying.");
                    }
                    else
                    {
                        response = Message.CreateMessage(MessageVersion.Default, NotificationData.NOTIFICATION_ACTION, asyncResult.NotificationData);
                        response = asyncResult.Poll.PrepareResponse(response, asyncResult.SessionID);
                    }
                }
                else
                {
                    response = asyncResult.Poll.CreateEmptyResponse();
                }

                return(response);
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPNotifierService EndMakeConnect. " + excp.Message);
                return(null);
                // throw;
            }
        }
        public IAsyncResult BeginMakeConnect(MakeConnection poll, AsyncCallback callback, object state)
        {
            logger.Debug("BeginMakeConnect " + poll.Address + ".");
            NotificationAsyncResult notificationAR = new NotificationAsyncResult(
                GetNotificationsFromPublisher,
                //RegisterListenerWithPublisher,
                //RegisterListenerWithPublisher,
                poll,
                callback,
                state);

            lock (m_pendingNotifications)
            {
                if (m_pendingNotifications.ContainsKey(poll.Address))
                {
                    m_pendingNotifications.Remove(poll.Address);
                }
                m_pendingNotifications.Add(poll.Address, notificationAR);
            }

            return(notificationAR);
        }
        public IAsyncResult BeginMakeConnect(MakeConnection poll, AsyncCallback callback, object state)
        {
            logger.Debug("BeginMakeConnect " + poll.Address + ".");
            NotificationAsyncResult notificationAR = new NotificationAsyncResult(
                GetNotificationsFromPublisher,
                //RegisterListenerWithPublisher,
                //RegisterListenerWithPublisher,
                poll,
                callback,
                state);

            lock (m_pendingNotifications)
            {
                if (m_pendingNotifications.ContainsKey(poll.Address))
                {
                    m_pendingNotifications.Remove(poll.Address);
                }
                m_pendingNotifications.Add(poll.Address, notificationAR);
            }

            return notificationAR;
        }