i started to wonder why my proxy is calling fix_natted_contact() in
onreply route even when called ua is not behind nat. the function is
called under condition
if (isbflagset("TO_NATED") &&
t_check_status("18[0-9]|2[0-9][0-9]|3[0-9][0-9]")) {
xlog("L_INFO", "Fixing nated contact in onreply_route\n");
fix_nated_contact();
};
i then added xlog telling if "TO_NATED" flags is set when request is
sent out:
if (isbflagset("TO_NATED")) {
xlog("L_INFO", "Flag to_nated is set before t_relay\n");
} else {
xlog("L_INFO", "Flag to_nated is NOT set before t_relay\n");
}
it turns out that sometimes TO_NATED flag is set and sometimes not even
when the calls are exactly identical.
here is my example call: "jh" (behind nat) calls "foo",
"foo" has forwarding
on in the proxy to "test", which causes the request to be sent back to sr at
127.0.0.1:5070 (and then to "test", but the error has happened
already and that is not shown).
first example call where TO_NATED flag is set although it should not
have been:
Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: INVITE
<sip:foo@tutpro.com> is authorized
Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: Unconditional forwarding to
<sip:test@tutpro.com>
Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: Fixing nated contact in
handle_caller_nat
Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: Routing initial INVITE
<sip:test@tutpro.com> to <sip:127.0.0.1:5070>
Oct 30 20:45:29 localhost /usr/sbin/sip-proxy[31447]: INFO: Flag to_nated is set before
t_relay
...
second example call that works as it should:
Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: INVITE
<sip:foo@tutpro.com> is authorized
Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: Unconditional forwarding to
<sip:test@tutpro.com>
Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: Fixing nated contact in
handle_caller_nat
Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: Routing initial INVITE
<sip:test@tutpro.com> to <sip:127.0.0.1:5070>
Oct 30 20:47:03 localhost /usr/sbin/sip-proxy[31441]: INFO: Flag to_nated is NOT set
before t_relay
...
the only conclusion that i can draw is that branch flags sometimes
get somehow corrupted.
let me know if you need more info or have ideas on how to find the cause
of the problem. i do also have pcap traces.
-- juha