Hello, I am trying to get a loop done using if ... then .. return function, using below syntax but getting error on it. if (session:ready()) then return ack() end function ack() session:answer(); session:streamFile("/usr/local/freeswitch/sounds/en/us/callie/zrtp/8000/zrtp-somethings_wrong.wav") end error:--- EXECUTE sofia/internal/7001@192.168.2.190 lua(hello.lua) 2010-12-21 14:55:34.724790 [ERR] mod_lua.cpp:182 /usr/local/freeswitch/scripts/hello.lua:1: attempt to call global 'ack' (a nil value) stack traceback: /usr/local/freeswitch/scripts/hello.lua:1: in main chunk Any ideas to resolve this. Regards Sam
You are trying to call the function which is not declared yet. First define a function, then call it. You should really read this: http://www.lua.org/manual/5.1/ Regards, Nazim On 12/21/2010 01:36 PM, Sam wrote:
Hello,
I am trying to get a loop done using if ... then .. return function, using below syntax but getting error on it.
if (session:ready()) then return ack() end
function ack()
session:answer(); session:streamFile("/usr/local/freeswitch/sounds/en/us/callie/zrtp/8000/zrtp-somethings_wrong.wav")
end
error:--- EXECUTE sofia/internal/7001@192.168.2.190 lua(hello.lua) 2010-12-21 14:55:34.724790 [ERR] mod_lua.cpp:182 /usr/local/freeswitch/scripts/hello.lua:1: attempt to call global 'ack' (a nil value) stack traceback: /usr/local/freeswitch/scripts/hello.lua:1: in main chunk
Any ideas to resolve this.
Regards Sam
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Nazim Aghabayov
-
Sam