I know before I asked about blocking for an event, and maybe I should have created a new topic..<div><br></div><div>but <span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-style: italic;">now </span></span>I want to actually sleep (rather than block) for a set time frame...this app will not be consuming events.</div>
<div><br></div><div>can I get an example of how to use msleep in a lua script? This lua script will be running in the background, and not part of a session or event consumer. Thanks.</div><div><br></div><div>--matt<br><br>
<div class="gmail_quote">2009/3/31 Michael Jerris <span dir="ltr">&lt;<a href="mailto:mike@jerris.com">mike@jerris.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word">as replied earlier, if your doing nothing but consuming events, you can just block instead of sleep:<div><br></div><div>con:pop(1)</div><div><br></div><div>there is also a msleep function that you can call the same way you do console_log, it takes milli seconds as its arg.  Note this should NOT be used when you have a script running as a session, only when you are running an api script.</div>
<div><br></div><div>Mike</div><div><div></div><div class="h5"><div><br><div><div>On Mar 31, 2009, at 11:15 AM, Matthew Fong wrote:</div><br><blockquote type="cite">Got a few more questions about running LUA scripts, please forgive me, I&#39;m an absolute newbie with LUA.<div>
<br></div><div>If I want to subscribe to a custom event, and I use</div><div><br></div><div>con = freeswitch.EventConsumer(&quot;CUSTOM my::event&quot;);</div> <div><br></div><div>I get an error. Is this because I must subscribe to the CUSTOM (only) event, and then filter out the events using the <span style="font-family:-webkit-sans-serif;line-height:19px">Event-Subclass myself? Or am I missing something in the syntax of the subscribe?</span></div>
 <div><span style="font-family:-webkit-sans-serif;line-height:19px"><br></span></div><div><span style="font-family:-webkit-sans-serif;line-height:19px">Also, if I do not have a freeswitch.Session, what is the best way to have my LUA script sleep? I want a functionality, where a statement inside my LUA script gets iterated every 30 seconds. My program does not use a session, so I cannot use session:execute(&quot;sleep&quot;,&quot;1000&quot;), as suggested in the wiki. I tried api::sleep(30000) and a few other combinations with execute but no luck :(. </span></div>
 <div><span style="font-family:-webkit-sans-serif;line-height:19px"><br></span></div><div><span style="font-family:-webkit-sans-serif;line-height:19px">Thanks.</span></div> <div><span style="font-family:-webkit-sans-serif;line-height:19px">--matt<br>
</span><br><div class="gmail_quote">On Sat, Mar 28, 2009 at 12:43 AM, Michael Collins <span dir="ltr">&lt;<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>&gt;</span> wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>&gt; con = freeswitch.EventConsumer(&quot;all&quot;);<br> &gt;<br> &gt; now you have a consumer obj<br> &gt;<br> &gt; every time you call con:pop() with no arg you will either get an event or<br> &gt; nil when there are no events to consume.<br>
 &gt; every time you call con:pop(1) the consumer object will block until there is<br> &gt; an event.<br> &gt;<br> &gt; So you use the first way in conjunction with some other lock to do async or<br> &gt; the 2nd way you do a dedicated blocking loop.<br>
 <br> </div>FYI, I added this information to the wiki page for freeswitch.EventConsumer.<br> <font color="#888888">-MC<br> </font><div><div></div><div><br> _______________________________________________<br> Freeswitch-users mailing list<br>
 <a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
 UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
 </div></div></blockquote></div><br></div> _______________________________________________<br>Freeswitch-users mailing list<br><a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>