[OpenSIPS-Users] async and event handlers

Bogdan-Andrei Iancu bogdan at opensips.org
Mon Mar 25 13:47:15 EDT 2019


Hi John,

I don't think you can "replicate" the event triggers with some 
avp_db_query() from script. When you so a save(location), you never know 
if that call will translate into updating an existing contact or in 
inserting a new one - this is no visible at script level

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
OpenSIPS Summit 2019
   https://www.opensips.org/events/Summit-2019Amsterdam/

On 03/20/2019 04:55 PM, John Quick wrote:
> I have a script which employs USRLOC to save registrations and also has an
> event handler defined for E_UL_CONTACT_INSERT.
> It is convenient, for the required logic/business rules, that I update a
> user database from within the event handler.
>
> If the DB update were happening directly from the main route, then I would
> probably use async(avp_db_query())
> However, if a potentially blocking operation - such as a DB write - is done
> from within the event handler, am I correct in thinking that this is much
> safer and therefore does not need to be wrapped in an async() or launch()
> function call?
>
> Can you even use async() or launch() from within an event handler?
>
> Using v2.4.4
>
> John Quick
> Smartvox Limited
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list