<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 01.11.2022 17:12, Conrad de Wet
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:524C3EFD-3571-4A13-B239-E8D6A32EF0BD@gmail.com">
<p class="MsoNormal" style="font-size: 12pt;
-webkit-text-size-adjust: auto; margin: 0cm; font-family:
Calibri, sans-serif;"><span style="font-size: 11pt;"
lang="EN-US"></span></p>
<p class="MsoNormal" style="font-size: 12pt;
-webkit-text-size-adjust: auto; margin: 0cm; font-family:
Calibri, sans-serif;"><span style="font-size: 11pt;"
lang="EN-US">This works, except I want to extend this even
further. I want these 4 branches to keep trying on a loop
until the transaction timeout occurs or one of the calls is
answered. Except I find that the “failure_route” has two main
problems, firstly if I try a “t_relay()” in the failure_route,
the original call gets relayed again and I can’t seem to refer
back to the branch.<o:p></o:p></span></p>
<p class="MsoNormal" style="font-size: 12pt;
-webkit-text-size-adjust: auto; margin: 0cm; font-family:
Calibri, sans-serif;"><span style="font-size: 11pt;"
lang="EN-US"> </span></p>
<p class="MsoNormal" style="font-size: 12pt;
-webkit-text-size-adjust: auto; margin: 0cm; font-family:
Calibri, sans-serif;"><span style="font-size: 11pt;"
lang="EN-US">This causes the number of branches to quickly run
out (I think max is 16), as it seem to nest the branch. Also
because the t_relay() appears to act on the main branch, all
the urls are reset, so I don’t really know where I was
originally sending this request to.<o:p></o:p></span></p>
<p class="MsoNormal" style="font-size: 12pt;
-webkit-text-size-adjust: auto; margin: 0cm; font-family:
Calibri, sans-serif;"><span style="font-size: 11pt;"
lang="EN-US"> </span></p>
<p class="MsoNormal" style="font-size: 12pt;
-webkit-text-size-adjust: auto; margin: 0cm; font-family:
Calibri, sans-serif;"><span style="font-size: 11pt;"
lang="EN-US">failure_route[my_on_failure]{<o:p></o:p></span></p>
<p class="MsoNormal" style="font-size: 12pt;
-webkit-text-size-adjust: auto; margin: 0cm; font-family:
Calibri, sans-serif;"><span style="font-size: 11pt;"
lang="EN-US"> seturi($branch(uri)); # <--
This is null<o:p></o:p></span></p>
<p class="MsoNormal" style="font-size: 12pt;
-webkit-text-size-adjust: auto; margin: 0cm; font-family:
Calibri, sans-serif;"><span style="font-size: 11pt;"
lang="EN-US"> t_relay(); # causes new branches
that don’t seem to kill the old ones.<o:p></o:p></span></p>
<p class="MsoNormal" style="font-size: 12pt;
-webkit-text-size-adjust: auto; margin: 0cm; font-family:
Calibri, sans-serif;"><span style="font-size: 11pt;"
lang="EN-US">}</span></p>
</blockquote>
<p><font face="monospace">Hi, Conrad!</font></p>
<p><font face="monospace">Re: the confusion around failure_route:
the failure route callback actually means a "failure to relay",
not a "failure of a specific branch". So no matter how many
branches you attempted to relay in parallel (1, 2, 8, etc.), it
means they *all* failed (some explicitly with, e.g. a 404,
others implicitly with a 408 internal timeout). So now you're
in this callback and you're only given the original Request-URI
of the message, with an opportunity to build a new set of </font><font
face="monospace"><font face="monospace"></font>branches to relay
(optionally with a new failure route callback), or just give up
and pass the error message back upstream.</font></p>
<p><font face="monospace">On topic: I'm assuming the need to "keep
trying these branches in a loop" stems from the fact that the
"lookup()" operation may produce different results throughout
the duration of the call attempt. So instead of having a long
transaction timeout, you prefer to have a shorter one and keep
redo'ing the "failure_route + lookup()" loop in hope that the WS
device comes online, correct? If so, you may indeed often run
into the "max branches exceeded" limitation quite easily this
way, at least with how the code currently works...</font></p>
<p><font face="monospace">Possible cheap workaround: recompile with
a larger MAX_BRANCHES (say, go from 12 to 31). At least you may
get your PoC working this way and move to solving other
problems. Medium-term, maybe we can look into developing some
support for creating lots of branches in the "master" OpenSIPS
tree.<br>
</font></p>
<p><font face="monospace">Best regards,<br>
</font></p>
<pre class="moz-signature" cols="72">--
Liviu Chircu
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/liviuchircu">www.twitter.com/liviuchircu</a> | <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
</body>
</html>