[Freeswitch-users] LUA

Joel White joelewhite at gmail.com
Mon Aug 25 21:17:46 MSD 2014


The user directory is now being generated via the DB using the Lua script.
I just needed to analyse the Lua script, and after playing around with it
and checking the logs of the database I figured it out.

The example Lua script on the site had many fields, when they returned a
nil value it looks to have broke the script.  I have since removed some
features from the resulting XML and it works fine.

I also decided to buy the book on Lua and learn more about this powerful
programming language



Thank you everyone for your help :)


On Mon, Aug 18, 2014 at 3:46 PM, Chris Tunbridge <blasterjr at gmail.com>
wrote:

> After re-reading your message (and actually paying attention to the log
> line) can you go into more detail on your configuration?
>
>
> On Mon, Aug 18, 2014 at 1:45 PM, Chris Tunbridge <blasterjr at gmail.com>
> wrote:
>
>> @cmrienzo -  I don't think this is the case, as params should be defined
>> by FreeSWITCH when called as a lua directory. (Currently using LUA to
>> generate my own directory)
>>
>> joelewhite
>>
>> Are you trying to run that script from the command line to test it?  If
>> so, params will not be set, make sure you have your
>> conf/autoload_configs/lua.xml setup.
>>
>> <param name="xml-handler-script" value="directory/generate.lua"/>
>> <param name="xml-handler-bindings" value="directory"/>
>>
>> Maybe go into more detail about what you're currently doing/have
>> configured.
>>
>>
>>
>> On Mon, Aug 18, 2014 at 8:53 AM, Christopher Rienzo <cmrienzo at gmail.com>
>> wrote:
>>
>>> This is an error in your lua script.  On line 5 you must have some code
>>> like "params.foo" or "params[foo]" where params is a nil value.  Check why
>>> params is nil and fix it if it isn't supposed to be.  Otherwise add a check
>>> to handle the nil case.
>>>
>>>
>>>
>>> On Mon, Aug 18, 2014 at 9:10 AM, Joel White <joelewhite at gmail.com>
>>> wrote:
>>>
>>>> I am trying to get Lua generation of the Directory so I can also tie
>>>> this in with auto provisioning.
>>>>
>>>> I have created the table in the Postgres DB and have the lua script
>>>> specified in the lua module config
>>>>
>>>>
>>>> But I keep getting this error
>>>>
>>>>
>>>> 2014-08-18 13:07:11.869818 [ERR] mod_lua.cpp:203
>>>> /usr/local/freeswitch/scripts/gen_dir_user_xml.lua:5: attempt to index
>>>> global 'params' (a nil value)
>>>>
>>>>
>>>>
>>>> I am sure after playing with it for a while I will get everything
>>>> working properly, but would anyone have some information to point me in the
>>>> right direction?
>>>>
>>>> Thank you in advance
>>>>
>>>>
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> http://www.freeswitchsolutions.com
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://confluence.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> 
>>>> 
>>>>
>>>> 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
>>>>
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://confluence.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> 
>>> 
>>>
>>> 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
>>>
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 
> 
>
> 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/20140825/26f6f530/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list