if t_relay() fails in route block so that failure route is not executed, is request uri "consumed" so that if a new branch is added by in the route block, that branch will be the only remaining one?
in the test that i made, two lcr gws match the request uri. in route block i have:
load_gws(); next_gw(); /* sets request-uri to uri of first gw */
while ($true) {
t_on_branch("BRANCHES");
if (t_relay()) { xlog("Relaying succeeded with result $rc\n"); exit; } else { xlog("Relaying failed with result $rc\n"); };
if (!next_gw()) { /* tries to append the next gw as a new branch */ xlog("L_WARN", "No more gws\n"); send_reply("503", "Service not available"); exit; };
xlog("found next gw <$ds>\n")
};
and in branch route block BRANCHES i have
branch_route [BRANCHES] {
xlog("L_INFO", "Relaying $rm <$ru>\n"); return;
};
when proxy receives a request, i get to syslog (some lcr DBGs are changed to INFOs):
May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: INFO: lcr [lcr_mod.c:1532]: added gw_uri_avp <1|1|00||lohi.tutpro.com|5060||1|4096> with weight <8192865> May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: INFO: lcr [lcr_mod.c:1532]: added gw_uri_avp <1|1|00||sars.tutpro.com|||2|64> with weight <3725453> May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: INFO: Relaying INVITE sip:00358407058055@sars.tutpro.com;transport=tcp May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: ERROR: tm [ut.h:295]: ERROR: uri2dst: failed to resolve "sars.tutpro.com" :unresolvable A or AAAA request (-7) May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: ERROR: tm [t_fwd.c:1391]: ERROR: t_forward_nonack: failure to add branches May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: ERROR: Relaying failed with result -478 May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: INFO: lcr [lcr_mod.c:1949]: appending branch sip:00358407058055@lohi.tutpro.com:5060 May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: ERROR: found next gw <Contact: sip:00358407058055@sars.tutpro.com;transport=tcp, sip:00358407058055@lohi.tutpro.com:5060> May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: ERROR: tm [ut.h:295]: ERROR: uri2dst: failed to resolve "sars.tutpro.com" :unresolvable A or AAAA request (-7) May 16 15:58:49 localhost /usr/sbin/sip-proxy[11412]: ERROR: Relaying succeeded with result 1 May 16 15:58:54 localhost /usr/sbin/sip-proxy[11459]: WARNING: No more gws
the first gw domain name sars.tutpro.com does not exist and the tm errors are as they should. then next_gw() appends a new branch, but based on the "found next gw" log message it looks like sars.tutpro.com is still in the destination set.
is this how it is supposed to be? if so, looks like i there is a bug in next_gw() in that it should clear the previous branch before adding a new one in case the previous branch was not consumed by t_relay?
another strange thing is, why the branch route is executed only once (for the first t_relay) although the script is calling t_relay() two times and t_on_branch() is called before each call?
-- juha