[OpenSIPS-Users] wait_for_event(event,filter,timeout)

Liviu Chircu liviu at opensips.org
Fri Aug 21 15:12:24 EST 2020


On 20.08.2020 09:37, Darpan Patel wrote:
> But in my case after 40 seconds it's not trigger resume_call route, so resume_call only called after the event will succeed ? I want to implement a feature like if callee is not registered till 40 seconds then relay call to PSTN Gateway .thanks alot in advance .
>
> regards ,
> Darpan Patel

Hey Darpan,

 From how I recall the code, async() statements have no timeout.  So 
that async(wait_for_event()) will be stuck forever until that 
registration arrives -- I may be wrong here, maybe Bogdan can offer more 
clarifications as he delivered some work on supporting async statement 
timeouts roughly 6 months ago.

Alternatively, I suggest a simpler solution, which will actually be 
quite performant:

     "as long as the lookup() keeps failing due the user still being 
offline, keep doing
       async(sleep(1 second), route_lookup_user).  Start with an $avp() 
value of 40 and
       keep decrementing it, so you know when to give up doing those 
sleep() operations,
       after 40 decrements (seconds)."

Reasons why this close to optimal:

* usrloc lookup() operations are hyper-optimized, since all AoRs are 
held in an AVL tree which sits in a wide hash.  The lookup cost is 
essentially zero.

* async(sleep()) is safe & straight-forward.  It will also help you 
maintain a high throughput (thousands of CPS)

* the user experience will be quite OK, with the caller receiving the 
call 1 second after the registration, on the worst case

Best regards,

-- 
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com

OpenSIPS Summit 2020 Distributed
   www.opensips.org/events/Summit-2020Distributed

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200821/be3392a7/attachment.html>


More information about the Users mailing list