예제 #1
0
        /// <summary>
        /// This method is called when new response is received.
        /// </summary>
        /// <param name="e">Response event arguments.</param>
        private void OnResponseReceived(SIP_ResponseReceivedEventArgs e)
        {
            if ((m_ProxyMode & SIP_ProxyMode.B2BUA) != 0)
            {
                m_pB2BUA.OnResponseReceived(e);
            }
            else
            {
                /* This method is called when stateless proxy gets response or statefull proxy
                 * has no matching server transaction.
                 */

                /* RFC 3261 16.11.
                 *  When a response arrives at a stateless proxy, the proxy MUST inspect the sent-by
                 *  value in the first (topmost) Via header field value. If that address matches the proxy,
                 *  (it equals a value this proxy has inserted into previous requests) the proxy MUST
                 *  remove that header field value from the response and forward the result to the
                 *  location indicated in the next Via header field value.
                 */
                // Just remove topmost Via:, sent-by check is done in transport layer.
                e.Response.Via.RemoveTopMostValue();

                if ((m_ProxyMode & SIP_ProxyMode.Statefull) != 0)
                {
                    // We should not reach here. This happens when no matching client transaction found.
                    // RFC 3161 18.1.2 orders to forward them statelessly.
                    m_pStack.TransportLayer.SendResponse(e.Response);
                }
                else if ((m_ProxyMode & SIP_ProxyMode.Stateless) != 0)
                {
                    m_pStack.TransportLayer.SendResponse(e.Response);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// This method is called when new response is received.
        /// </summary>
        /// <param name="e">Response event arguments.</param>
        private void OnResponseReceived(SIP_ResponseReceivedEventArgs e)
        {
            if ((m_ProxyMode & SIP_ProxyMode.B2BUA) != 0)
            {
                m_pB2BUA.OnResponseReceived(e);
            }
            else if ((m_ProxyMode & SIP_ProxyMode.Statefull) != 0)
            {
                /* RFC 6026 7.3. Proxy Considerations.
                 *  This document changes the behavior of transaction-stateful proxies to
                 *  not forward stray INVITE responses.  When receiving any SIP response,
                 *  a transaction-stateful proxy MUST compare the transaction identifier
                 *  in that response against its existing transaction state machines.
                 *  The proxy MUST NOT forward the response if there is no matching
                 *  transaction state machine.
                 */
            }
            else
            {
                /* This method is called when stateless proxy gets response.
                 */

                /* RFC 3261 16.11.
                 *  When a response arrives at a stateless proxy, the proxy MUST inspect the sent-by
                 *  value in the first (topmost) Via header field value. If that address matches the proxy,
                 *  (it equals a value this proxy has inserted into previous requests) the proxy MUST
                 *  remove that header field value from the response and forward the result to the
                 *  location indicated in the next Via header field value.
                 */
                // Just remove topmost Via:, sent-by check is done in transport layer.
                e.Response.Via.RemoveTopMostValue();

                if ((m_ProxyMode & SIP_ProxyMode.Statefull) != 0)
                {
                    // We should not reach here. This happens when no matching client transaction found.
                    // RFC 3161 18.1.2 orders to forward them statelessly.
                    m_pStack.TransportLayer.SendResponse(e.Response);
                }
                else if ((m_ProxyMode & SIP_ProxyMode.Stateless) != 0)
                {
                    m_pStack.TransportLayer.SendResponse(e.Response);
                }
            }
        }