[Freeswitch-users] lua api_hangup_hook missing env?
Anthony Minessale
anthony.minessale at gmail.com
Wed Apr 21 06:46:09 PDT 2010
yes you can't use luarun, you must use lua there.
On Wed, Apr 21, 2010 at 7:31 AM, Steven Ward <steve.d.ward at gmail.com> wrote:
> I'm invoking a lua script via api_hangup_hook and I can read the env object
> just fine.
>
> Did you try setting api_hangup_hook=*lua* recording.lua instead of luarun?
>
> The example dialplan at *
> http://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object*<http://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object>uses
> *lua *instead of *luarun* as well.
>
> There is a brief statement on luarun vs. lua on the wiki - perhaps when
> luarun spawns its thread to run the script it doesn't get the env object?
> Just a guess...
> http://wiki.freeswitch.org/wiki/Mod_lua#luarun_at_the_CLI
>
>
>
> On Tue, Apr 20, 2010 at 5:30 PM, Troy Anderson <troy at tlainvestments.com>wrote:
>
>> The wiki (
>> http://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object) refers
>> to the env global in mod_lua when executing a lua script set by
>> api_hangup_hook, however, in practice, I don't see env set. Has this been
>> changed or have I messed up somehow? I'm using the following from within
>> the dial plan to get it going.
>>
>> <action application="set" data="api_hangup_hook=luarun recording.lua"/>
>> <action application="bridge" data="user/107@${domain_name}" />
>>
>> *Here are the global variables lua does have set:*
>>
>> 2010-04-20 14:19:14.698522 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> string
>> 2010-04-20 14:19:14.698522 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> xpcall
>> 2010-04-20 14:19:14.698522 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> package
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> tostring
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> print
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: os
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> unpack
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> swig_type
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> require
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> getfenv
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> setmetatable
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> next
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> freeswitch
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> assert
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> argv
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> tonumber
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: io
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> rawequal
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> collectgarbage
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> getmetatable
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> module
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> rawset
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> ipairs
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> script_name
>> 2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> swig_equals
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> math
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> debug
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> pcall
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> table
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> newproxy
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> type
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> coroutine
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: _G
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> select
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> gcinfo
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> pairs
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> rawget
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> loadstring
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> tellme
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> _VERSION
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> dofile
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> setfenv
>> 2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> load
>> 2010-04-20 14:19:14.701584 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> error
>> 2010-04-20 14:19:14.701584 [NOTICE] switch_cpp.cpp:1142 recording.lua:
>> loadfile
>>
>> Thanks!
>> Troy
>>
>> _______________________________________________
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at 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 at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100421/ac290758/attachment-0001.html
More information about the FreeSWITCH-users
mailing list