Sorry it&#39;s a typo. I read the code, it works not like in event socket. So, only works with one event. <div><br></div><div>either<div><br></div><div>EventConsumer(&quot;all&quot;)</div><div>or</div><div>EventConsumer(&quot;CUSTOM&quot;, &quot;lua::stop&quot;);      <br>
</div><div><br></div><div><br></div><div>Thank you.</div><div><br><div class="gmail_quote">2009/8/7 Raffaele P. Guidi <span dir="ltr">&lt;<a href="mailto:raffaele.p.guidi@gmail.com">raffaele.p.guidi@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><span style="border-collapse:collapse;color:rgb(68, 68, 68)"><div class="im"><div>&gt;&gt; 5) Seems that only EventConsumer(&quot;all&quot;) working. EventConsumer(&quot;CHANNEL_HANUP CUSTOM lua::stop&quot;) doesn&#39;t seem to work. Any idea to this?</div>

<div><br></div></div><div>isn&#39;t it CHANNEL_HAN<b><span style="text-decoration:underline">G</span></b>UP? Is the G missing only in the email or in the code, too? </div></span><div><div></div><div class="h5"><br><div class="gmail_quote">

On Thu, Aug 6, 2009 at 17:52, Seven Du <span dir="ltr">&lt;<a href="mailto:dujinfang@gmail.com" target="_blank">dujinfang@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>for e in (function() return con:pop(1) end) do<br>
<br>
</div>btw, the script works.<br>
<br>
Thanks.<br>
<div><div></div><div>On Aug 6, 2009, at 6:47 PM, Eli Hayun wrote:<br>
&gt; Hi<br>
&gt; I dont know about events so much but I cannot see variable &quot;e&quot; is<br>
&gt; setting<br>
&gt;<br>
&gt; event_name = e:getHeader(&quot;Event-Name&quot;) or &quot;&quot;<br>
&gt; event_subclass = e:getHeader(&quot;Event-Subclass&quot;) or &quot;&quot;<br>
&gt;<br>
&gt; regurds<br>
&gt; Eli<br>
&gt;<br>
&gt; On Thu, 2009-08-06 at 12:58 +0300, Seven Du wrote:<br>
&gt;&gt; ALL-<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; I have a few questions when scripting lua. According to wiki, it is<br>
&gt;&gt; possible to run looping forever lua scripts through start-up config<br>
&gt;&gt; or luarun.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 1) Will the lua script stop when unload mod_lua? I experienced core<br>
&gt;&gt; dump when unload mod_lua while there was a running lua script.<br>
&gt;&gt; Reported on jira.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 2) How to stop a forever running lua script?  I stop it by<br>
&gt;&gt; listening a CUSTOM event fired elsewhere. See code below. Is there<br>
&gt;&gt; any standard way like luastop ?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 3) Any way to show how many running lua scripts? luashow ?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 4) It seems cannot get the lua script name in a lua script, I made<br>
&gt;&gt; a patch to jira by assign it to the argv[0].<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 5) Seems that only EventConsumer(&quot;all&quot;) working.<br>
&gt;&gt; EventConsumer(&quot;CHANNEL_HANUP CUSTOM lua::stop&quot;) doesn&#39;t seem to<br>
&gt;&gt; work. Any idea to this?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Thanks a lot.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; code example:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; con = freeswitch.EventConsumer(&quot;all&quot;);<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; argv[0] = &quot;test.lua&quot;<br>
&gt;&gt;<br>
&gt;&gt; freeswitch.consoleLog(&quot;info&quot;, &quot;==== Lua Script [&quot; .. argv[0] .. &quot;]<br>
&gt;&gt; Starting =====\n&quot;);<br>
&gt;&gt;<br>
&gt;&gt; local all_events = 0<br>
&gt;&gt;<br>
&gt;&gt; for e in (function() return con:pop(1) end) do<br>
&gt;&gt;   -- freeswitch.consoleLog(&quot;info&quot;, &quot;event\n&quot; .. e:serialize(&quot;xml&quot;));<br>
&gt;&gt;    all_events = all_events + 1;<br>
&gt;&gt; freeswitch.consoleLog(&quot;info&quot;, &quot;all_events: &quot; .. all_events .. &quot;\n&quot;)<br>
&gt;&gt;<br>
&gt;&gt; event_name = e:getHeader(&quot;Event-Name&quot;) or &quot;&quot;<br>
&gt;&gt; event_subclass = e:getHeader(&quot;Event-Subclass&quot;) or &quot;&quot;<br>
&gt;&gt;<br>
&gt;&gt; if (event_name == &quot;CUSTOM&quot; and event_subclass == &quot;lua::stop&quot;) then<br>
&gt;&gt;  freeswitch.consoleLog(&quot;info&quot;, &quot;-----lua Script [&quot; .. argv[0] ..<br>
&gt;&gt; &quot;]---Exiting------\n&quot;)<br>
&gt;&gt;  break<br>
&gt;&gt; end<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; end<br>
&gt;&gt;<br>
&gt;&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; FreeSWITCH-users mailing list<br>
&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br>
<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>
</blockquote></div><br>
</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></div>