I'm invoking a lua script via api_hangup_hook and I can read the env object just fine.<br><br>Did you try setting <span style="font-family: courier new,monospace;">api_hangup_hook=</span><b style="font-family: courier new,monospace;">lua</b><span style="font-family: courier new,monospace;"> recording.lua</span> instead of <span style="font-family: courier new,monospace;">luarun</span>?<br>
<br>The example dialplan at <a href="http://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object"><i>http://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object</i></a> uses <b>lua </b>instead of <b>luarun</b> as well.<br>
<br>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...<br><a href="http://wiki.freeswitch.org/wiki/Mod_lua#luarun_at_the_CLI">http://wiki.freeswitch.org/wiki/Mod_lua#luarun_at_the_CLI</a><br>
<br><br><br><div class="gmail_quote">On Tue, Apr 20, 2010 at 5:30 PM, Troy Anderson <span dir="ltr"><<a href="mailto:troy@tlainvestments.com">troy@tlainvestments.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="word-wrap: break-word;">The wiki (<a href="http://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object" target="_blank">http://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object</a>) 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.<div>
<br></div><div><span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(128, 0, 64); font-size: 14px; white-space: pre;"><<span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(92, 162, 0); font-weight: bold;">action</span> <span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(137, 109, 0); font-weight: bold;">application</span>=<span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(0, 64, 128); font-weight: bold;">"set"</span> <span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(137, 109, 0); font-weight: bold;">data</span>=<span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(0, 64, 128); font-weight: bold;">"api_hangup_hook=luarun recording.lua"<span style="color: rgb(128, 0, 64); font-weight: normal;">/></span></span></span></div>
<div><font color="#800040" face="Arial, Lucida, 'Lucida Grande', Verdana, sans-serif" size="4"><span style="font-size: 14px; white-space: pre;"><span style="color: rgb(0, 0, 0); font-family: Consolas,'Courier New';"><span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(128, 0, 64);"><<span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(92, 162, 0); font-weight: bold;">action</span> <span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(137, 109, 0); font-weight: bold;">application</span>=<span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(0, 64, 128); font-weight: bold;">"bridge"</span> <span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(137, 109, 0); font-weight: bold;">data</span>=<span style="font-family: Arial,Lucida,'Lucida Grande',Verdana,sans-serif; color: rgb(0, 64, 128); font-weight: bold;">"user/107@${domain_name}"</span> /></span>
</span></span></font><div><br></div><div><b>Here are the global variables lua does have set:</b></div><div><br></div><div><div>2010-04-20 14:19:14.698522 [NOTICE] switch_cpp.cpp:1142 recording.lua: string</div><div>2010-04-20 14:19:14.698522 [NOTICE] switch_cpp.cpp:1142 recording.lua: xpcall</div>
<div>2010-04-20 14:19:14.698522 [NOTICE] switch_cpp.cpp:1142 recording.lua: package</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: tostring</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: print</div>
<div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: os</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: unpack</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: swig_type</div>
<div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: require</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: getfenv</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: setmetatable</div>
<div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: next</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: freeswitch</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: assert</div>
<div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: argv</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: tonumber</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: io</div>
<div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: rawequal</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: collectgarbage</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: getmetatable</div>
<div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: module</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: rawset</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: ipairs</div>
<div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: script_name</div><div>2010-04-20 14:19:14.699536 [NOTICE] switch_cpp.cpp:1142 recording.lua: swig_equals</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: math</div>
<div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: debug</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: pcall</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: table</div>
<div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: newproxy</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: type</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: coroutine</div>
<div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: _G</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: select</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: gcinfo</div>
<div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: pairs</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: rawget</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: loadstring</div>
<div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: tellme</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: _VERSION</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: dofile</div>
<div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: setfenv</div><div>2010-04-20 14:19:14.700538 [NOTICE] switch_cpp.cpp:1142 recording.lua: load</div><div>2010-04-20 14:19:14.701584 [NOTICE] switch_cpp.cpp:1142 recording.lua: error</div>
<div>2010-04-20 14:19:14.701584 [NOTICE] switch_cpp.cpp:1142 recording.lua: loadfile</div><div><br></div>
Thanks!</div><div>Troy</div></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>