<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Liviu,<br>
</p>
<div class="moz-cite-prefix">Your suggestion with async(sleep(),
resume) is really cool. I use async(wait_for_event(), resume) a
bit differently and pause a call for another type of event that is
generated upon reception of an external notification (SIP or
clusterer) and had to patch event_routing, add a timer and
forcibly call "resume" route when it expires. But even my use case
can be rewritten by setting some global flag or cache_srote() from
an event handler and checking it from resume route.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">I completely forgot that haven't sent
that patch for review. <br>
</div>
<blockquote type="cite"
cite="mid:1a35d919-94ff-b2f9-1b1e-a4686ac983e2@opensips.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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" moz-do-not-send="true">www.twitter.com/liviuchircu</a> | <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" moz-do-not-send="true">www.opensips-solutions.com</a>
OpenSIPS Summit 2020 Distributed
<a class="moz-txt-link-abbreviated" href="http://www.opensips.org/events/Summit-2020Distributed" moz-do-not-send="true">www.opensips.org/events/Summit-2020Distributed</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</body>
</html>