Hi Benoit,
> On 30 Jan 2024, at 08:28, Benoit Panizzon <[email protected]> wrote:
>
> Hi Alex
>
>> As is often the case, there is a useful opportunity here to step back,
>> switch to decaf, and ask why you want to call 'exit' from a branch_route in
>> the first place.
>
> :-)
>
> Actually I intended to call 'return(1)' to stop processing that actual
> route and continue in the calling route at the point when all work is
> done.
This will happen naturally, because branch_route, like onreply_route, is
essentially a callback/event hook, not a request route subroutine.
In other words:
request_route {
...
t_on_branch("BRANCH");
...
other_stuff(); # will execute after branch_route
t_relay();
...
}
branch_route[BRANCH] {
branch_scoped_stuff();
}
> I wrapped everything in if/else and I am re-testing.
>
> But on the first glimpse, I still seem to get corrupted stuff at a
> certain point in branching like $du being null instead of the intended
> destination of that branch.
>
> Am I right, that $du should contain the sip URI of where the INVITE is
> being routed to in the branch route? Or am I mistaking here?
Not necessarily; $du is only used to override the RURI ($ru), where needed.
Otherwise, the domain portion of the request URI is consumed by t_relay() to
make the next-hop determination.
You can access the next-hop determination using $nh(...):
https://www.kamailio.org/wikidocs/cookbooks/5.7.x/pseudovariables/#nhkey
> In most of my branches, $du is correctly pointing to the next hop (so I
> can use it to determine how to engage RTPengine), but sometimes it's
> null and I still didn't figure out why.
$du is not mandatorily populated, as mentioned above. Consider $nh(...) instead.
In terms of the original question you posed, why not do this?
request_route {
...
if(jittery)
t_on_branch("BRANCH_DECAF");
else
t_on_branch("BRANCH_REGULAR");
t_relay();
}
-- Alex
--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com
Tel: +1-706-510-6800
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the
sender!
Edit mailing list options or unsubscribe: