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

Bogdan-Andrei Iancu bogdan at opensips.org
Mon Nov 5 12:07:47 EST 2018


Hi Vitalii,

Yes, that is correct. The idea is you cannot do async() ops in the 
branch route as this type of route is strongly interfering with the SIP 
signaling - branch route is triggered when a new branch is set out (as a 
result of a t_relay) and no signaling operations are allowed (as you are 
already doing a signaling op).
Still, this limitation is valid only for async calls () as async is 
based on the transaction status. But, you can do regular sync() queries 
from the branch route, with a risk of blocking the processes of opensips.

The spiraling (as you described) is also a valid option, but you need to 
be a bit careful with the script logic to be sure you do not mix the 
loops :)

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/02/2018 12:04 PM, Vitalii Aleksandrov 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




More information about the Users mailing list