Hi Guys,

 

I’m baffled by this error.  I’m updating the db on call hang-up If I comment out curs:close() no error, but I’m concerned about memory leaks.  Can anyone tell me what FS is complaining about?

 

The db gets updated in both cases

 

Regards

 

 

 

require "luasql.mysql"

 

function myHangupHook(s, status, arg)

            freeswitch.consoleLog("info", " : They hung up on US!!!\n");

            env = assert (luasql.mysql())

            con = assert (env:connect("xxxxl","xxxxxxxxx","pass","192.168.3.205"))

            curs = assert (con:execute"UPDATE callers SET lastcall = 'BOB' WHERE id = 33292")

            curs:close()

            con:close()

            env:close()

            freeswitch.consoleLog("NOTICE", "myHangupHook: " .. status .. "\n");

    --error()

end

 

 

 

 

2009-02-10 20:53:20 [INFO] switch_cpp.cpp:1086 console_log()  : They hung up on US!!!

2009-02-10 20:53:20 [ERR] mod_lua.cpp:176 lua_parse_and_execute() /usr/local/freeswitch/scripts/helloworld.lua:50: attempt to index global 'curs' (a number value)

stack traceback:

        /usr/local/freeswitch/scripts/helloworld.lua:50: in function </usr/local/freeswitch/scripts/helloworld.lua:45>

        [C]: in function 'hangup'

        /usr/local/freeswitch/scripts/helloworld.lua:70: in main chunk

2009-02-10 20:53:20 [NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 63 (sofia/internal/1001@192.168.3.206) Ended