Re: [OpenSIPS-Users] async and event handlers

2019-04-22 Thread Liviu Chircu
Hi, John! Some answers below: 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? Calling async() or launch() from an event handler SHOULD work (see below).  Unfortunately, the "cache_" family of functions do not

Re: [OpenSIPS-Users] async and event handlers

2019-04-08 Thread John Quick
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 expect): 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

Re: [OpenSIPS-Users] async and event handlers

2019-03-25 Thread Bogdan-Andrei Iancu
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,

Re: [OpenSIPS-Users] async and event handlers

2019-03-20 Thread John Quick
Ben, Thanks. I hadn't spotted that little detail in the Event Handler documentation. My event handler first retrieves some data about the relevant AOR from the DB, then updates it, then writes it back. Interestingly, when I add "async" as a 2nd parameter in the event handler definition, this

Re: [OpenSIPS-Users] async and event handlers

2019-03-20 Thread Ben Newlin
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" wrote: I have a script which employs USRLOC

[OpenSIPS-Users] async and event handlers

2019-03-20 Thread John Quick
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