[OpenSIPS-Users] How to delay a branch

Liviu Chircu liviu at opensips.org
Fri Jul 24 13:49:27 EST 2020


On 24.07.2020 16:25, Ben Newlin wrote:
>
> I think the issue here is that the sleep function pauses the OpenSIPS 
> process in which it is running; it doesn’t matter what type of route 
> you call it in, the whole process will sleep. Since all message 
> processing, and all branch routes, are running in the same process 
> then sleeping that process will delay everything.
>
> Even asynchronous sleep is performed by suspending all message 
> processing for that message, not individual branches.
>
Spot on, Ben!  All branches are forked out by the same process: if you 
pause it, you pause the forking of the remaining branches in the set... 
which somehow leads me to believe that doing an async(sleep) after 
t_relay()'ing the last mobile phone branch _should work_, at least in 
theory... such that after the sleep is completed, the remaining branches 
in the set will be forked out.

Now, the tricky part is making sure that the mobile phone branches are 
always ahead of the desk phone ones, so they parallel fork first.  I do 
not see an easy solution to this, nor are there any handy script 
functions to help you do this... you will have to "swap" the branch data 
around using the $branch properties and other variables (e.g. $ru, $du, 
$socket_out) until you obtain the desired effect.

Curious to hear other opinions as well :)

Best regards,

-- 
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS Summit 2020 Distributed
   www.opensips.org/events/Summit-2020Distributed

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200724/a89706c6/attachment.html>


More information about the Users mailing list