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

Olle E. Johansson oej at edvina.net
Wed Dec 22 16:35:09 UTC 2010

> 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.
"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."

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.


More information about the asterisk-dev mailing list