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. Ben Newlin From: Users <[email protected]> on behalf of ryan embgrets <[email protected]> Reply-To: OpenSIPS users mailling list <[email protected]> Date: Friday, July 24, 2020 at 8:16 AM To: OpenSIPS users mailling list <[email protected]> Subject: Re: [OpenSIPS-Users] How to delay a branch Hi, Thanks for coming back to me on this query. I did not want to do serial forking. Let me try to explain my query in better detail. So, i have desktop phones and mobile phones registered to same AOR, what i wanted to do was, If we have mobile phone devices registered we send invites to them instantly but desktop devices need to be rung after some delay from phone devices. But if no phone device was registered, we simply do parallel forking to desktop devices. Ryan. On Fri, 24 Jul 2020 at 15:14, Liviu Chircu <[email protected]<mailto:[email protected]>> wrote: 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<https://opensips.org/Documentation/Script-CoreFunctions-3-2#toc44> -- Liviu Chircu www.twitter.com/liviuchircu<http://www.twitter.com/liviuchircu> | www.opensips-solutions.com<http://www.opensips-solutions.com> OpenSIPS Summit 2020 Distributed www.opensips.org/events<http://www.opensips.org/events> _______________________________________________ Users mailing list [email protected]<mailto:[email protected]> http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
