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