[asterisk-dev] [Code Review] Properly route responses according to the Via headers in the request

Klaus Darilion klaus.mailinglists at pernau.at
Thu Dec 23 08:58:48 UTC 2010

Am 22.12.2010 17:35, schrieb Olle E. Johansson:
>> AFAIK the response routing is always based on Via headers. Thus, if the in-dialog request bypasses the proxy, also the response should bypass the proxy.
> Not really. If we had a transaction layer we would add our own via header before handling the request. We should send response to our OWN
> via header, not a received one. Which means we should always respond to the senders IP address and port.
> In RFC 3261 section 18.2.1 there's an explanation of how to add the Via header before sending the request up the stack.
> Qoute:
> "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."

That's why there is the "received" parameter. If the request's src-IP 
differs from the IP address in the received Via header, the received 
parameter must be added - and later used for response routing.

Thus, I think we are talking about the same thing but in different 
words, and both of us are correct.

> Asterisk is buggy here. We have an issue in the tracker that propably can celebrate a multi-year anniversary soon about this. Nat=yes
> is the only possible setting today, since it forces correct behaviour.
>> If the proxy does not add a Record-Route header, then the UAC is fine and Asterisk behaves wrong.
>> If the proxy adds a Record-Route header, then the UAC is buggy. In this case Asterisk is buggy too, as it should send the response directly to the UAC.
> Now in this case with a record-route header, the other end sent an in-dialog request not using the defined route set for the dialog. I haven't researched on how to handle that,
> whether to accept it or not. Sounds like interesting christmas research for someone.

I guess there are 2 choices. Be strict and ignore the request, be 
liberal and bypass the proxy too. There is no usefulness in responding 
to the proxy as the response misses the proxies Via header and the proxy 
will discard the response.


More information about the asterisk-dev mailing list