Klaus Darilion writes:
i first thought to add the $du test, but looks like the via test makes it unnecessary. however, loose_route() may be key to solving the reply problem: if loose_route() sets $du, it means that next hop is another proxy. then it is possible to set TO_PROXY flag and test it onreply_route. right?
yes, but only in in-dialog requests.
that is what i meant.
In my setups currently I do the NAT decision in first request processing and store the result in a RR-cookie. in-dialog NAT handling is purely done on RR-cookie. RR-cookie defines if NAT handling is done for caller, callee or both.
Regarding NAT-detection my decision algorithm is simple and pragmatic: if request comes from a local account (is_from_local()), then the caller will be marked for NAT traversal (regardless if behind NAT or not. Further, target will be analysed and calls to local users will be NAT-handled.
klaus, you keep on mentioning nat. these functions have nothing to do with nat detection.
-- juha