Hi Bogdan,

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…
For example, that’s the reason why i had to replace sl_send_reply() by 
send_reply().
But in my case, i’m already in a failure_route.

failure_route[GW_FAILOVER] {
        route(CONTROLS);

        if (t_was_cancelled()) {
                exit;
        }
        do_accounting("db","failed");
        $acc_extra(identity)=$hdr(P-Asserted-Identity);
        $acc_extra(src)=$fU;
        $acc_extra(dst)=$tU;
        $acc_extra(src_ip) = $si; # source IP of the request

        # failure detection with redirect to next available trunk
        if (t_check_status("(408)|([56][0-9][0-9])")) {
                xlog("L_INFO","Failed trunk $rd/$du detected \n");

                if ( ds_next_dst() ) {
                        t_on_branch("CLEANING");
                        t_on_failure("GW_FAILOVER");
                        route(RELAY);
#this block is not usable there
                        if (!t_relay()) {
                                sl_reply_error();
                        };
                        exit;
                }
                send_reply(500,"All GW are down");
        }
}
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).

Reading your other posts (about 408 failover) makes me better understand the 
opensips internal (i think so).
If i well understand, a failure_route is forcibly stateful, so it is not 
logical to send stateless replies inside a stateful block.
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).

I hope this is better now to understand my problem.

Thank you

Regards

> Le 6 janv. 2020 à 18:41, Bogdan-Andrei Iancu <[email protected]> a écrit :
> 
> Hi Daren,
> 
> 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.
> 
> 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.
> 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).
> 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().
> 
> As a note, see the 0x02 flag for t_relay() - 
> https://opensips.org/html/docs/modules/3.0.x/tm.html#func_t_relay
> 
> Best Regards,
> 
> Bogdan-Andrei Iancu
> 
> OpenSIPS Founder and Developer
>  https://www.opensips-solutions.com
> OpenSIPS Summit, Amsterdam, May 2020
>  https://www.opensips.org/events/Summit-2020Amsterdam/
> OpenSIPS Bootcamp, Miami, March 2020
>  https://opensips.org/training/OpenSIPS_Bootcamp_2020/
> 
> On 12/15/19 5:11 PM, Daren FERREIRA wrote:
>> Hello,
>> 
>> 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.
>> Syntax changes are not a problem, as fortunately changes are well documented 
>> on the wikis :)
>> 
>> My problem is relative to replies (sl_send_reply and sl_reply_error) and the 
>> places where we’re allowed to use them.
>> For sl_send_reply, send_reply alternative has solved my problem, but that’s 
>> not as easy for sl_reply_error.
>> 
>> In every documentation, examples or forums i read, we use to do
>> 
>>         if (!t_relay()) {
>>                 sl_reply_error();
>>         }
>> 
>> In order to send an error in case of any problem with t_relay.
>> 
>> 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?
>> 
>> 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…
>> 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…
>> 
>> So is it safe not to check anymore the t_relay return on failure routes?
>> 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 ?
>> 
>> Thank you for your help and comments.
>> 
>> Regards
>> _______________________________________________
>> Users mailing list
>> [email protected]
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to