[Freeswitch-users] lua script
Chad Phillips
chad at apartmentlines.com
Thu Dec 5 22:58:39 MSK 2013
The freeswitch variable is provided as a global variable in the script environment only when the script is executed from within FreeSWITCH.
For example, from the dialplan:
<action application="lua" data="foo.lua"/>
Or from the FreeSWITCH command line:
luarun foo.lua
(see http://wiki.freeswitch.org/wiki/Mod_lua#at_the_CLI_:_lua_and_luarun)
Or as a a background script kicked off in lua.conf.xml:
<param name="startup-script" value="foo.lua"/>
I would highly recommend reading this entire wiki page: http://wiki.freeswitch.org/wiki/Mod_lua -- that will save everyone time. ;)
Chad
On Thursday, December 5, 2013 at 11:42 AM, Joli Martinez wrote:
> yes I would like an external lua script to call freeswitch commands. IE check who is on a conference, mute, unmute callers. etc
>
> Thanks,
>
>
> On Dec 5, 2013, at 2:37 PM, covici at ccs.covici.com (mailto:covici at ccs.covici.com) wrote:
>
> > Are you calling the script from the dial plan? You will not be able to
> > run this outside of fs.
> >
> > Joli Martinez <mrjoli021 at gmail.com (mailto:mrjoli021 at gmail.com)> wrote:
> >
> > >
> > > Hello,
> > >
> > > 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.
> > >
> > >
> > > Script------------------------------------------------------------------------------
> > > #!/usr/bin/lua
> > >
> > > api = freeswitch.API();
> > > reply = api:executeString("version");
> > > ~
> > >
> > > Error---------------------------------------------------------------------------------
> > > lua hello.lua
> > > lua: hello.lua:3: attempt to index global 'freeswitch' (a nil value)
> > > stack traceback:
> > > hello.lua:3: in main chunk
> > > [C]: ?
> > >
> > > thanks,
> > > _________________________________________________________________________
> > > Professional FreeSWITCH Consulting Services:
> > > consulting at freeswitch.org (mailto:consulting at freeswitch.org)
> > > http://www.freeswitchsolutions.com
> > >
> > >
> > >
> > >
> > > Official FreeSWITCH Sites
> > > http://www.freeswitch.org
> > > http://wiki.freeswitch.org
> > > http://www.cluecon.com
> > >
> > > FreeSWITCH-users mailing list
> > > FreeSWITCH-users at lists.freeswitch.org (mailto: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
> > >
> >
> >
> > --
> > Your life is like a penny. You're going to lose it. The question is:
> > How do
> > you spend it?
> >
> > John Covici
> > covici at ccs.covici.com (mailto:covici at ccs.covici.com)
> >
> > _________________________________________________________________________
> > Professional FreeSWITCH Consulting Services:
> > consulting at freeswitch.org (mailto:consulting at freeswitch.org)
> > http://www.freeswitchsolutions.com
> >
> >
> >
> >
> > Official FreeSWITCH Sites
> > http://www.freeswitch.org
> > http://wiki.freeswitch.org
> > http://www.cluecon.com
> >
> > FreeSWITCH-users mailing list
> > FreeSWITCH-users at lists.freeswitch.org (mailto: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
> >
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org (mailto:consulting at freeswitch.org)
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org (mailto: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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20131205/09beb13c/attachment-0001.html
Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users
mailing list