I`ve understood reason of this problem: mod_lua uses lua version 5.2, but this library written maximum for lua 5.1 and dont work with lua 5.2 Next question: when FreeSWITCH mod_lua began using lua 5.2 ? 2014-10-07 16:08 GMT+04:00 Борисов, Дмитрий <bordmi@rarus.ru>:
I have a myself writed script, it must read data from database and create XML config for FS. For creating XML I using genx library, it was installed by luarocks. This library worked fine when I use it in standalone scripts, but when I use it in FS I`ve got next error (I`ve put there bigger part of freeswitch.log for better explanation):
2014-10-07 15:34:02.010800 [INFO] switch_cpp.cpp:1328 package.path /usr/local/share/freeswitch/scripts/lua/?.lua package.cpath /usr/local/lib/lua/5.1/?.so;/usr/local/lib/?.so 2014-10-07 15:34:02.010848 [NOTICE] switch_cpp.cpp:1328 Debug from gen_dir_user_xml.lua, provided params: 'Event-Name: GENERAL Core-UUID: ed5920d2-154e-e411-b150-005056a83c1f FreeSWITCH-Hostname: voip-bsd-01.local FreeSWITCH-Switchname: voip-bsd-01.local FreeSWITCH-IPv4: xxx.xxx.xxx.xxx FreeSWITCH-IPv6: %3A%3A1 Event-Date-Local: 2014-10-07%2015%3A34%3A02 Event-Date-GMT: Tue,%2007%20Oct%202014%2011%3A34%3A02%20GMT Event-Date-Timestamp: 1412681642009651 Event-Calling-File: switch_core.c Event-Calling-Function: switch_load_network_lists Event-Calling-Line-Number: 1393 Event-Sequence: 397 domain: company1.xxxx.com purpose: network-list
' 2014-10-07 15:34:02.010858 [NOTICE] switch_cpp.cpp:1328 Debug from gen_dir_user_xml.lua: XML_REQUEST[section]:directory XML_REQUEST["tag_name"]:domain XML_REQUEST["key_name"]:name XML_REQUEST["key_value"]:company1.xxxx.com 2014-10-07 15:34:02.016535 [DEBUG] freeswitch_lua.cpp:360 DBH handle 0x80c32d0f0 Connected. 2014-10-07 15:34:02.016916 [ERR] mod_lua.cpp:203 error loading module 'genx' from file '/usr/local/lib/lua/5.1/genx.so': /usr/local/lib/lua/5.1/genx.so: Undefined symbol "lua_call" stack traceback: [C]: in ? [C]: in function 'require' .../local/share/freeswitch/scripts/lua/gen_dir_user_xml.lua:202: in main chunk 2014-10-07 15:34:02.016923 [ERR] mod_lua.cpp:269 LUA script parse/execute error!
My lua.conf.xml:
<configuration name="lua.conf" description="LUA Configuration"> <settings> <param name="module-directory" value="/usr/local/lib/lua/5.1/?.so"/> <param name="module-directory" value="/usr/local/lib/?.so"/> <param name="script-directory" value="$${script_dir}/lua/?.lua"/> <param name="xml-handler-script" value="lua/gen_dir_user_xml.lua"/> <param name="xml-handler-bindings" value="directory"/> </settings> </configuration>
I`d attached script because it is large.
Any thinks about methods for solving problem?
-- best regards, Dmitriy Borisov
-- С уважением, Борисов Дмитрий