[Freeswitch-users] Hoot get variables in a LUA Hook Event.

Jaime jaimecm at gmail.com
Tue Dec 16 06:04:43 MSK 2014


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 at gmail.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20141216/943463b7/attachment.html 


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