[OpenSIPS-Users] async and event handlers

Ben Newlin Ben.Newlin at genesys.com
Wed Mar 20 11:35:55 EDT 2019


I think it would depend on whether you have defined the event handler itself to be sync or async. [1]

[1] https://opensips.org/html/docs/modules/2.4.x/event_route.html#overview

Ben Newlin 

´╗┐On 3/20/19, 10:56 AM, "Users on behalf of John Quick" <users-bounces at lists.opensips.org on behalf of john.quick at smartvox.co.uk> 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