Exemplo n.º 1
0
        public void ReceiveMessage(SIPChannel sipChannel, SIPEndPoint remoteEndPoint, byte[] buffer)
        {
            try
            {
                if (!m_queueIncoming)
                {
                    SIPMessageReceived(sipChannel, remoteEndPoint, buffer);
                }
                else
                {
                    IncomingMessage incomingMessage = new IncomingMessage(sipChannel, remoteEndPoint, buffer);

                    // Keep the queue within size limits
                    if (m_inMessageQueue.Count >= MAX_INMESSAGE_QUEUECOUNT)
                    {
                        logger.Warn("SIPTransport queue full new message from " + remoteEndPoint + " being discarded.");
                    }
                    else
                    {
                        lock (m_inMessageQueue)
                        {
                            m_inMessageQueue.Enqueue(incomingMessage);
                        }
                    }

                    m_inMessageArrived.Set();
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPTransport ReceiveMessage. " + excp.Message);
                throw excp;
            }
        }
 public void ReceiveMessage(SIPChannel sipChannel, SIPEndPoint remoteEndPoint, byte[] buffer)
 {
     try
     {
         if (!m_queueIncoming)
         {
             SIPMessageReceived(sipChannel, remoteEndPoint, buffer);
         }
         else
         {
             IncomingMessage incomingMessage = new IncomingMessage(sipChannel, remoteEndPoint, buffer);
             m_inMessageQueue.TryAdd(incomingMessage);
         }
     }
     catch (Exception excp)
     {
         logger.Error("Exception SIPTransport ReceiveMessage. " + excp.Message);
         throw excp;
     }
 }