[Freeswitch-users] how to call mod_commands from within a lua script

Adam Wilt wiltingtree at gmail.com
Sun Sep 6 05:59:51 PDT 2009


Thank you Michael.  Sorry I missed that page.

On Sun, Sep 6, 2009 at 3:36 AM, Michael S Collins <msc at freeswitch.org>wrote:

>
> On Sep 5, 2009, at 8:25 PM, Adam Wilt <wiltingtree at gmail.com> wrote:
>
> > Hi, the documentation says that mod_commands is available from
> > within mod_lua. But when I try to access it like this:
> >
> > session:execute("uuid_broadcast",session_id .. " " .. filename .. "
> > both")
> >
> > I get: Invalid Application uuid_broadcast
> >
> > or
> >
> > session:execute("bgapi","uuid_broadcast " .. session_id .. " " ..
> > filename .. " both")
> >
> > I get: Invalid Application bgapi
> >
> > or
> >
> > session:uuid_broadcast(session_id .. " " .. filename .. " both")
> >
> > I get: attempt to call field 'uuid_broadcast' (a nil value)
> >
> >
> >
> > Can somebody please explain how to do this?
> >
> > Thanks!
> >
>
> Absolutely. Using session:execute is only for dialplan applications.
> To do API commands, including all the stuff in mod_commands, you need
> to create an API object:
>
> api = freeswitch.API()
>
> Then send a command and the variable will receive the results:
>
> reply = api:executeString("version")
>
> Check out this page for more examples:
> http://wiki.freeswitch.org/wiki/Make_API_calls_directly_from_Lua_code
>
> -MC
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090906/b95fd6aa/attachment-0002.html 


More information about the FreeSWITCH-users mailing list