<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">Hello,</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">I’m trying to use the Hook event’s with LUA script’s when the channel Hangup a call,</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">but I’m unable to get the variables, for example uuid, ani or billed seconds for the call,</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">I’m using freeswitch 1.4.13 on Centos 6.6 and my configuration is:</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">In /autoload_configs/lua.conf.xml</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">[…]</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><font face="Calibri,sans-serif"> <hook event="CHANNEL_HANGUP_COMPLETE" script="catch-event-cdr1.lua"/></font></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">In my catch-event-cdr1.lua script I wrote:</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"> ses = freeswitch.Session();</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><div><font face="Calibri,sans-serif"> my_uuid = ses:getVariable("uuid");</font></div><div><font face="Calibri,sans-serif"> freeswitch.consoleLog("notice"," uuid=("..my_uuid..")\n")</font></div></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">But I’m get the following error:</div><div><div><font face="Calibri,sans-serif"> 2014-12-15 23:51:46.100755 [ERR] switch_cpp.cpp:724 session is not initalized</font></div><div><font face="Calibri,sans-serif"> 2014-12-15 23:51:46.100755 [NOTICE] switch_cpp.cpp:1328 uuid=()</font></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">Also, in the wiki doc I see a reference for the “env” Object, (<a href="https://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object">https://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object</a>) but if I call it as the example in the same lua script my result is:</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">How I call the env variable:</div><div><div><font face="Calibri,sans-serif"> dat = env:serialize()</font></div><div><font face="Calibri,sans-serif"> freeswitch.consoleLog("INFO","Here's everything:\n" .. dat .. "\n”)</font></div></div><div><font face="Calibri,sans-serif"><br></font></div><div><div>And I got the following error:</div><div><font face="Calibri,sans-serif"> 2014-12-16 00:00:17.440782 [ERR] mod_lua.cpp:203 /usr/share/freeswitch/scripts/catch-event-reg6.lua:27: attempt to index global 'env' (a nil value)</font></div></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><font face="Calibri,sans-serif">Your help will be appreciated.</font></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">—</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">Jamie</div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">Jaimecm@gmail.com</div><span id="OLK_SRC_BODY_SECTION" style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"></span></body></html>