Sorry it's a typo. I read the code, it works not like in event socket. So, only works with one event. 

either

EventConsumer("all")
or
EventConsumer("CUSTOM", "lua::stop");      


Thank you.

2009/8/7 Raffaele P. Guidi <raffaele.p.guidi@gmail.com>
>> 5) Seems that only EventConsumer("all") working. EventConsumer("CHANNEL_HANUP CUSTOM lua::stop") doesn't seem to work. Any idea to this?

isn't it CHANNEL_HANGUP? Is the G missing only in the email or in the code, too? 

On Thu, Aug 6, 2009 at 17:52, Seven Du <dujinfang@gmail.com> wrote:
for e in (function() return con:pop(1) end) do

btw, the script works.

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


_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org