<div>
                    The freeswitch variable is provided as a global variable in the script environment only when the script is executed from within FreeSWITCH.</div><div><br></div><div>For example, from the dialplan:</div><div>&nbsp; &lt;action application="lua" data="foo.lua"/&gt;</div><div><br></div><div>Or from the FreeSWITCH command line:</div><div>&nbsp; luarun foo.lua</div><div>(see http://wiki.freeswitch.org/wiki/Mod_lua#at_the_CLI_:_lua_and_luarun)</div><div><br></div><div>Or as a a background script kicked off in&nbsp;lua.conf.xml:</div><div>&nbsp;&nbsp;&lt;param name="startup-script" value="foo.lua"/&gt;</div><div><br></div><div>I would highly recommend reading this entire wiki page:&nbsp;http://wiki.freeswitch.org/wiki/Mod_lua -- that will save everyone time. ;)</div><div><br></div><div>Chad</div>
                <div></div>
                 
                <p style="color: #A0A0A8;">On Thursday, December 5, 2013 at 11:42 AM, Joli Martinez wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>yes I would like an external lua script to call freeswitch commands.  IE check who is on a conference, mute, unmute callers.  etc</div><div><br></div><div>Thanks,</div><div><br></div><div><br></div><div>On Dec 5, 2013, at 2:37 PM, <a href="mailto:covici@ccs.covici.com">covici@ccs.covici.com</a> wrote:</div><div><br></div><blockquote type="cite"><div><div>Are you calling the script from the dial plan?  You will not be able to</div><div>run this outside of fs.</div><div><br></div><div>Joli Martinez &lt;<a href="mailto:mrjoli021@gmail.com">mrjoli021@gmail.com</a>&gt; wrote:</div><div><br></div><blockquote type="cite"><div><div><br></div><div>Hello,</div><div><br></div><div>I am trying to write a lua script and I  am getting an error when calling it.  I have moved the script to the scripts directory in Freeswitch and same result.  The lua mod is enabled and loaded on Freeswitch.</div><div><br></div><div><br></div><div>Script------------------------------------------------------------------------------</div><div>#!/usr/bin/lua</div><div><br></div><div>api = freeswitch.API();</div><div>reply = api:executeString("version");</div><div>~                                          </div><div><br></div><div>Error---------------------------------------------------------------------------------</div><div>lua hello.lua </div><div>lua: hello.lua:3: attempt to index global 'freeswitch' (a nil value)</div><div>stack traceback:</div><div>        hello.lua:3: in main chunk</div><div>        [C]: ?</div><div><br></div><div>thanks,</div><div>_________________________________________________________________________</div><div>Professional FreeSWITCH Consulting Services:</div><div><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a></div><div><a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a></div><div><br></div><div>FreeSWITCH-powered IP PBX: The CudaTel Communication Server</div><div><a href="http://www.cudatel.com">http://www.cudatel.com</a></div><div><br></div><div>Official FreeSWITCH Sites</div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div><div><a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a></div><div><a href="http://www.cluecon.com">http://www.cluecon.com</a></div><div><br></div><div>FreeSWITCH-users mailing list</div><div><a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a></div><div><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></div><div>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div></div></blockquote><div><br></div><div>-- </div><div>Your life is like a penny.  You're going to lose it.  The question is:</div><div>How do</div><div>you spend it?</div><div><br></div><div>        John Covici</div><div>        <a href="mailto:covici@ccs.covici.com">covici@ccs.covici.com</a></div><div><br></div><div>_________________________________________________________________________</div><div>Professional FreeSWITCH Consulting Services:</div><div><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a></div><div><a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a></div><div><br></div><div>FreeSWITCH-powered IP PBX: The CudaTel Communication Server</div><div><a href="http://www.cudatel.com">http://www.cudatel.com</a></div><div><br></div><div>Official FreeSWITCH Sites</div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div><div><a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a></div><div><a href="http://www.cluecon.com">http://www.cluecon.com</a></div><div><br></div><div>FreeSWITCH-users mailing list</div><div><a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a></div><div><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></div><div>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div></div></blockquote><div><br></div><div><br></div><div>_________________________________________________________________________</div><div>Professional FreeSWITCH Consulting Services:</div><div><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a></div><div><a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a></div><div><br></div><div>FreeSWITCH-powered IP PBX: The CudaTel Communication Server</div><div><a href="http://www.cudatel.com">http://www.cudatel.com</a></div><div><br></div><div>Official FreeSWITCH Sites</div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div><div><a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a></div><div><a href="http://www.cluecon.com">http://www.cluecon.com</a></div><div><br></div><div>FreeSWITCH-users mailing list</div><div><a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a></div><div><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></div><div>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>