[OpenSIPS-Users] How to delay a branch

Liviu Chircu liviu at opensips.org
Fri Jul 24 10:12:05 EST 2020


On 13.07.2020 16:02, ryan embgrets wrote:
>
> So, I set a branch flag on those registrations before calling the save 
> function, and then try to use async sleep in the branch route after 
> lookup.
>
> But I see sleep applies on the whole call(all branches are sent with 
> delay) no matter if it was called on a single branch.

Hey, Ryan!

Did you solve your problem in the meantime?  I think you are confusing 
parallel forking with serial forking.  Implicitly, the OpenSIPS request 
branching engine performs **parallel** forking.  In other words, no 
matter how you prepare your branches (be it using append_branch(), 
lookup(), mid_registrar_lookup(), etc.), they will all be sent out 
concurrently, hence the effect you are noticing ("the sleep applies on 
the whole call").

To change the behavior to a **serial** forking one, try calling 
serialize_branches() [1] after building your branch set.  IIRC, there's 
a caveat in there, which also requires you to call next_branches() 
afterwards.  Just read the docs carefully and you should be fine.

Best regards,

[1]: https://opensips.org/Documentation/Script-CoreFunctions-3-2#toc44

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




More information about the Users mailing list