<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Bogdan,<div class=""><br class=""></div><div class="">I have no idea on real changes between 2.3 and 3.0 but it seems that there is much more script sanity checks (and that’s great) that now blocks (erroneous) things that was not blocked before…</div><div class="">For example, that’s the reason why i had to replace sl_send_reply() by send_reply().</div><div class="">But in my case, i’m already in a failure_route.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">failure_route</span><span style="font-variant-ligatures: no-common-ligatures; color: #2fb41d" class="">[GW_FAILOVER]</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        route(CONTROLS)</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        if (t_was_cancelled()) {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                exit</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        }</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        do_accounting("db","failed")</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        $acc_extra(identity)=</span><span style="font-variant-ligatures: no-common-ligatures; color: #b42419" class="">$hdr(P-Asserted-Identity)</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        $acc_extra(src)=</span><span style="font-variant-ligatures: no-common-ligatures; color: #b42419" class="">$fU</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        $acc_extra(dst)=</span><span style="font-variant-ligatures: no-common-ligatures; color: #b42419" class="">$tU</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        $acc_extra(src_ip) =</span><span style="font-variant-ligatures: no-common-ligatures; color: #b42419" class=""> $si</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">; # source IP of the request</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(64, 11, 217);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">        </span><span style="font-variant-ligatures: no-common-ligatures" class=""># failure detection with redirect to next available trunk</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        if (t_check_status("(408)|(</span><span style="font-variant-ligatures: no-common-ligatures; color: #2fb41d" class="">[56][0-9][0-9]</span><span style="font-variant-ligatures: no-common-ligatures" class="">)")) {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                xlog("L_INFO","Failed trunk $rd/$du detected \n")</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                if ( ds_next_dst() ) {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font color="#400bd9" class="">                        </font>t_on_branch("CLEANING")</span><span style="font-variant-ligatures: no-common-ligatures;" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                        t_on_failure("GW_FAILOVER")</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                        route(RELAY)</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">#this block is not usable there</span></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                        if (!t_relay()) {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space:pre">                              </span>sl_reply_error();</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                        }</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                        exit</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                }</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                send_reply(500,"All GW are down")</span><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        }</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="font-family: Helvetica; font-size: 12px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">So do you think activating the failure_route inside the failure_route is enough to manage the eventual t_relay failures? (and by the way, is it safe to activate failure_routes inside failure_routes).</span></div><div class=""><br class=""></div></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Reading your other posts (about 408 failover) makes me better understand the opensips internal (i think so).</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">If i well understand, a failure_route is forcibly stateful, so it is not logical to send stateless replies inside a stateful block.</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">On the opposite side i actually no idea how to send errors replies inside stateful blocks (maybe that’s internally managed - there is my limit).</span></div><div class=""><br class=""></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">I hope this is better now to understand my problem.</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Thank you</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Regards</span></div><div><br class=""><blockquote type="cite" class=""><div class="">Le 6 janv. 2020 à 18:41, Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" class="">bogdan@opensips.org</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi Daren,<br class=""><br class="">I do not remember to have any changes between 2.3 and 3.0 when comes to the sl_send_reply() usage - maybe you can be more explicit on the differences you see between the versions.<br class=""><br class="">Now, one using handling the failure of `t_relay()` - if the function has some internal failure in sending out the request, it will automatically send back a negative reply and return success to script. The failure indication is returned to the script ONLY if the both sending the request AND the negative reply ops failed.<br class="">The sending of the negative reply is done in stateful mode, so this is the explanation of sl_reply_error() you see in examples - it will try to report back a reply in a stateless mode (in a lighter way, with a higher probability of success than the stateful attempt).<br class="">Why not doing this in failure route? as in failure route you are already in stateful mode, so there are almost 0 chances to get a failure indication from t_relay().<br class=""><br class="">As a note, see the 0x02 flag for t_relay() - <a href="https://opensips.org/html/docs/modules/3.0.x/tm.html#func_t_relay" class="">https://opensips.org/html/docs/modules/3.0.x/tm.html#func_t_relay</a><br class=""><br class="">Best Regards,<br class=""><br class="">Bogdan-Andrei Iancu<br class=""><br class="">OpenSIPS Founder and Developer<br class="">  <a href="https://www.opensips-solutions.com" class="">https://www.opensips-solutions.com</a><br class="">OpenSIPS Summit, Amsterdam, May 2020<br class="">  <a href="https://www.opensips.org/events/Summit-2020Amsterdam/" class="">https://www.opensips.org/events/Summit-2020Amsterdam/</a><br class="">OpenSIPS Bootcamp, Miami, March 2020<br class="">  <a href="https://opensips.org/training/OpenSIPS_Bootcamp_2020/" class="">https://opensips.org/training/OpenSIPS_Bootcamp_2020/</a><br class=""><br class="">On 12/15/19 5:11 PM, Daren FERREIRA wrote:<br class=""><blockquote type="cite" class="">Hello,<br class=""><br class="">I’ve been using my configuration script for a while without problems on 2.3.x releases, but, with 3.0.x some errors are coming.<br class="">Syntax changes are not a problem, as fortunately changes are well documented on the wikis :)<br class=""><br class="">My problem is relative to replies (sl_send_reply and sl_reply_error) and the places where we’re allowed to use them.<br class="">For sl_send_reply, send_reply alternative has solved my problem, but that’s not as easy for sl_reply_error.<br class=""><br class="">In every documentation, examples or forums i read, we use to do<br class=""><br class="">         if (!t_relay()) {<br class="">                 sl_reply_error();<br class="">         }<br class=""><br class="">In order to send an error in case of any problem with t_relay.<br class=""><br class="">But sl_reply_error is forbidden in failure routes, so, should we consider there will never have any problems with t_relay in failure routes?<br class=""><br class="">In my case i use dispatcher, and, in case of failure, i try to find another destination, and relay messages to it, until the call succeed…<br class="">If the first try fails, it triggers a failure route where i’m no more able to send an error if the t_relay fails…<br class=""><br class="">So is it safe not to check anymore the t_relay return on failure routes?<br class="">If not, is there any alternatives? I think about using send_reply instead of sl_reply_error, but with what arguments?  $err.rcode and $err.rreason ?<br class=""><br class="">Thank you for your help and comments.<br class=""><br class="">Regards<br class="">_______________________________________________<br class="">Users mailing list<br class=""><a href="mailto:Users@lists.opensips.org" class="">Users@lists.opensips.org</a><br class="">http://lists.opensips.org/cgi-bin/mailman/listinfo/users<br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></body></html>