[OpenSIPS-Users] async and event handlers

John Quick john.quick at smartvox.co.uk
Mon Apr 8 09:36:39 EDT 2019

Hi Bogdan,

I call save(location) from the script in the usual way.
>From observation of events triggered by this process, I found (as you would
 E_UL_CONTACT_INSERT event is triggered whenever a contact is inserted
 E_UL_CONTATC_DELETE event is triggered whenever a contact is deleted

It is my intention to use these events to update a record stored in another
completely separate database.
This additional database is used - indirectly - to control core FreeSwitch
telephony servers. It allows them to know if a particular AOR is registered
and thereby avoids the need to send an INVITE to the OpenSIPS Proxy and get
back a 404 when the user has no devices registered.
I am updating the additional database from the event handlers by calling
cache_store().  [It is actually a couchbase store.]

My question is this: Can I use async() or launch() as a wrapper for a
cache_store() function call made from within an event handler? Is there any
advantage to doing so or can I regard event handlers as a safe place to
initiate blocking operations because, I assume, events must already have
their own queue.

I tried Ben's suggestion to make the event handler itself async, but this
failed as explained earlier in this thread.

John Quick
Smartvox Limited

> 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

More information about the Users mailing list