<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 23 August 2013 11:18, Steve Davies <span dir="ltr"><<a href="mailto:steve@connection-telecom.com" target="_blank">steve@connection-telecom.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Here's what I put in RELAY route block:<br>
<div class="gmail_extra"><div class="gmail_quote"><div><br></div><div><p style="margin:0px;font-size:12px;font-family:Inconsolata">
        $var(rr) = t_relay();</p>
<p style="margin:0px;font-size:12px;font-family:Inconsolata">        xlog("L_NOTICE","SLD: in RELAY, t_relay returned $var(rr)\n");</p>
<p style="margin:0px;font-size:12px;font-family:Inconsolata">        if (!$var(rr)) {</p>
<p style="margin:0px;font-size:12px;font-family:Inconsolata">                sl_reply_error();</p>
<p style="margin:0px;font-size:12px;font-family:Inconsolata">        }</p>
<p style="margin:0px;font-size:12px;font-family:Inconsolata"><br></p><p style="margin:0px;font-size:12px;font-family:Inconsolata"><br></p></div><div>In 4.0.3, t_relay gives a -1 in the case that there is a physical network issue (in my test I have a "-j DROP" iptables rule)</div>

<div><br></div></div></div></div></blockquote><div><br></div><div>Trying to find a way to detect the case where t_relay fails but doesn't call the failure block.  I dumped some hopeful looking pseudo variables, and tried to use an avp to communicate from the failure branch back to the relay point.</div>
<div><br></div><div>I tried this:</div><div><br></div><div>        $avp(senttoast) = 0;</div><div>        $var(rr) = t_relay();</div><div>        xlog("L_NOTICE","SLD: in RELAY, t_relay returned $var(rr) err.rcode is $err.rcode t_r_c is $T_reply_code sent = $avp(senttoast)\n");</div>
<div>        if ($var(rr) < 0) {</div><div>                sl_reply_error();</div><div>        }</div><div><br></div><div>and in my failure block I set $avp(senttoast) to 1.</div><div><br></div><div><br></div><div>I get:</div>
<div><br></div><div>Aug 23 12:07:02 ubuntu /usr/local/sbin/kamailio[7819]: NOTICE: <script>: SLD: in RELAY, t_relay returned -1 err.rcode is <null> t_r_c is 100 sent = 0</div><div><br></div><div>In the case of a 477 being sent back.  So I can't find anything distinctive so far.</div>
<div><br></div><div>In the case of a soft failure (I have the upstream send a 500):</div><div><br></div><div><div>Aug 23 12:09:32 ubuntu /usr/local/sbin/kamailio[7817]: NOTICE: <script>: SLD: in RELAY, t_relay returned 1 err.rcode is <null> t_r_c is 100 sent = 0</div>
</div><div><br></div><div>So the same.</div><div><br></div><div>From the trace I can see that the failure block is only executed after the t_relay returns.  The failure block runs on a different pid.</div><div><br></div><div>
<div>So there is a race.  Or maybe the avp doesn't work across branches or something?</div></div><div><br></div><div>Clues would be welcome!</div><div><br></div><div>Steve</div><div><br></div><div><br></div></div>
</div></div>