<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 20.08.2020 09:37, Darpan Patel
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAKzT-z2psu73E-4vSPKVNT9YLSC1uUV=F=wr93nKRByh=18M0A@mail.gmail.com">
<pre class="gmail-programlisting">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 .
</pre>
<pre class="gmail-programlisting">regards ,
</pre>
<pre class="gmail-programlisting">Darpan Patel</pre>
</blockquote>
<p><tt>Hey Darpan,</tt></p>
<p><tt>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.</tt></p>
<p><tt>Alternatively, I suggest a simpler solution, which will
actually be quite performant:</tt></p>
<p><tt> "as long as the lookup() keeps failing due the user still
being offline, keep doing<br>
async(sleep(1 second), route_lookup_user). Start with an
$avp() value of 40 and<br>
keep decrementing it, so you know when to give up doing
those sleep() operations,<br>
after 40 decrements (seconds)."</tt></p>
<p><tt>Reasons why this close to optimal:<br>
<br>
* 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.</tt></p>
<p><tt>* async(sleep()) is safe & straight-forward. It will
also help you maintain a high throughput (thousands of CPS)<br>
</tt></p>
<p><tt>* the user experience will be quite OK, with the caller
receiving the call 1 second after the registration, on the worst
case<br>
</tt></p>
<p><tt>Best regards,<br>
</tt></p>
<pre class="moz-signature" cols="72">--
Liviu Chircu
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/liviuchircu">www.twitter.com/liviuchircu</a> | <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a>
OpenSIPS Summit 2020 Distributed
<a class="moz-txt-link-abbreviated" href="http://www.opensips.org/events/Summit-2020Distributed">www.opensips.org/events/Summit-2020Distributed</a></pre>
</body>
</html>