Hello,

opening this for discussion to get more eyes on the IETF specs to be sure I haven't missed any requirements.

We are no adding received parameter to Via header as required by RFC 3261:

18.2.1 Receiving Requests

   When the server transport receives a request over any transport, it
   MUST examine the value of the "sent-by" parameter in the top Via
   header field value.  If the host portion of the "sent-by" parameter
   contains a domain name, or if it contains an IP address that differs
   from the packet source address, the server MUST add a "received"
   parameter to that Via header field value.  This parameter MUST
   contain the source address from which the packet was received.  This
   is to assist the server transport layer in sending the response,
   since it must be sent to the source IP address from which the request
   came.

But then RFC3581 says:

4.  Server Behavior

   The server behavior specified here affects the transport processing
   defined in Section 18.2 of SIP [1].

   When a server compliant to this specification (which can be a proxy
   or UAS) receives a request, it examines the topmost Via header field
   value.  If this Via header field value contains an "rport" parameter
   with no value, it MUST set the value of the parameter to the source
   port of the request.  This is analogous to the way in which a server
   will insert the "received" parameter into the topmost Via header
   field value.  In fact, the server MUST insert a "received" parameter
   containing the source IP address that the request came from, even if
   it is identical to the value of the "sent-by" component.  Note that
   this processing takes place independent of the transport protocol.

I understand that if rport parameter is present in incoming Via, received has to be added always, even when matching the IP address in via. RFC3261 required to be added only when it source IP was different than the address in Via.

On the other hand, the RFC3261 says received is needed for helping the server to route back the reply, so received shouldn't make much sense for upstream. However, apparently, some clients use it (or at least check it and don't work properly if not present after a rport -- one specific example is that some phone is not making calls after sending REGISTER with rport and not receiving received).

RFC3581 says that server behavior affect what was specified in 3261, so my plan is to send received always if rport is present, but I wanted to see if anyone sees issues with that or there is another more recent rfc amending further the behaviour related to rport.

Cheers,
Daniel
-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany