VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
dujinfang at gmail.com Guest
|
Posted: Thu Aug 06, 2009 5:02 am Post subject: [Freeswitch-users] A few questions about lua |
|
|
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 |
|
Back to top |
|
|
elihay at savion.huji.... Guest
|
Posted: Thu Aug 06, 2009 10:50 am Post subject: [Freeswitch-users] A few questions about lua |
|
|
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 |
|
Back to top |
|
|
dujinfang at gmail.com Guest
|
Posted: Thu Aug 06, 2009 10:59 am Post subject: [Freeswitch-users] A few questions about lua |
|
|
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:
Quote: | 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:
Quote: | 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 |
|
Back to top |
|
|
raffaele.p.guidi at gm... Guest
|
Posted: Thu Aug 06, 2009 7:33 pm Post subject: [Freeswitch-users] A few questions about lua |
|
|
Quote: | Quote: | 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 (dujinfang@gmail.com)> wrote:
Quote: | 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:
Quote: | 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:
Quote: | 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 (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
|
|
|
Back to top |
|
|
dujinfang at gmail.com Guest
|
Posted: Thu Aug 06, 2009 10:52 pm Post subject: [Freeswitch-users] A few questions about lua |
|
|
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 (raffaele.p.guidi@gmail.com)>
Quote: | >> 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 (dujinfang@gmail.com)> wrote:
Quote: | 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:
Quote: | 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:
Quote: | 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 (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 (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
|
|
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|