Hello,

I’m trying to use the Hook event’s with LUA script’s when the channel Hangup a call,
but I’m unable to get the variables, for example uuid, ani or billed seconds for the call,
I’m using freeswitch 1.4.13 on Centos 6.6 and my configuration is:

In /autoload_configs/lua.conf.xml
[…]
    <hook event="CHANNEL_HANGUP_COMPLETE" script="catch-event-cdr1.lua"/>

In my catch-event-cdr1.lua script I wrote:
    ses = freeswitch.Session();
    my_uuid = ses:getVariable("uuid");
    freeswitch.consoleLog("notice","    uuid=("..my_uuid..")\n")

But I’m get the following error:
    2014-12-15 23:51:46.100755 [ERR] switch_cpp.cpp:724 session is not initalized
    2014-12-15 23:51:46.100755 [NOTICE] switch_cpp.cpp:1328     uuid=()

Also, in the wiki doc I see a reference for the “env” Object, (https://wiki.freeswitch.org/wiki/Mod_lua#Special_Case:_env_object) but if I call it as the example in the same lua script my result is:

How I call the env variable:
    dat = env:serialize()
    freeswitch.consoleLog("INFO","Here's everything:\n" .. dat .. "\n”)

And I got the following error:
    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)


Your help will be appreciated.


—
Jamie
Jaimecm@gmail.com