[OpenSIPS-Users] async(wait_for_event()) statement in a branch_route[]

SamyGo govoiper at gmail.com
Mon Nov 5 10:46:41 EST 2018


Hi Bogdan,
Intrigued by this thread, I recall in older threads I was told that I can
do something like this, I'm going to use my example.

event_route[ABCD]{
          route(DO_SOMETHING);
}
and then in that DO_SOMETHING route I can use the redis/mysql functions or
anything that is not acceptable to be used in the event_route.

By the same analogy is this also the right way to write?

branch_route[per_branch_ops]{
                xlog("I'm a branch of the call , I cant do alot here");
                route(WAIT_FOR_EVENT);
}

where;

route[WAIT_FOR_EVENT]{
       async(wait_for_event("ABCX","$avp(filter"),"40"),"resume_here");
}

I think another way to ask Vitalii's question would be, how parallel is
"parallel forking".?  If there are 5 branches and each of them takes
between A-Z amount of time to process script functions then all of them are
going to be relayed out only when ALL branches are done processing? or each
branch is relayed out independent of how much time other branch is taking.

Hope to catch some insight on this. (in context of opensips version 2.4.2)

Regards,
Sammy

On Fri, Nov 2, 2018 at 6:07 AM Vitalii Aleksandrov <vitalik.voip at gmail.com>
wrote:

> Hi Bogdan,
>
> Ok. Let's say I have 5 branches and before calling t_relay() want to
> iterate over branches and do some async() action. From my understanding
> if I do something via async() it will suspend the whole transaction with
> all branches and if I need the same action for every branch it will
> create a big PDD because all async() calls will be done sequentially.
>
> As a workaround I think I can send all branches to myself (spiral call)
> and receiving those INVITEs from loopback opensips will create a
> separate transaction for every destination so I'll be able to run
> async() tasks in parallel and forward a call to every destination
> immediately its async() task is finished.
>
>
> > Hi Vitalii,
> >
> > The async() statement can be used only in REQUEST route. Still,
> > whatever you need to do in terms of async query from branch route can
> > also be done from request route.
> >
> > Regards,
> >
> > Bogdan-Andrei Iancu
> >
> > OpenSIPS Founder and Developer
> >   http://www.opensips-solutions.com
> > OpenSIPS Bootcamp 2018
> >   http://opensips.org/training/OpenSIPS_Bootcamp_2018/
> >
> > On 11/01/2018 01:46 PM, Vitalii Aleksandrov wrote:
> >> Hi,
> >>
> >> I'm a bit new to opensips, while have some experience with kamailio.
> >>
> >> Trying to figure out whether it's possible to use async() statement
> >> from branch_route[].
> >>
> >> From the documentation I understood that async() functionality is
> >> tightly connected to the TM module and creates some context attached
> >> to a transaction, suspends it and resumes a transaction on an event.
> >> If said above is correct I suppose calling async() from a
> >> branch_route[] to suspend only one branch and expect that other
> >> branches will continue their normal execution is not what it was
> >> designed for..
> >>
> >> Is there any way to forward a branch while other branches wait for an
> >> async event or i/o?
> >>
> >> Would appreciate any ideas.
> >>
> >>
> >> _______________________________________________
> >> Users mailing list
> >> Users at lists.opensips.org
> >> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20181105/af67630b/attachment.html>


More information about the Users mailing list