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