Hello,
I am creating an external application that uses
FreeSWITCH ESL to initiate an outbound call and then run a LUA
script. Within the LUA script I am executing AVMD. I want to see if its a
human or voicemail on the other end. The outbound call is made
and the LUA script executes.
Currently I would just like to see a consoleLog
entry made by the onInput function in the LUA script, but that function does not
seem to be called. AVMD starts the file is streamed then AVMD stops. As
shown in the log.
I think I'm missing something.
Dave Goodwin
Pertinent FreeSWITCH Log Info:
-------------------------------------------------------------------------------------------------------
Lua Script:
-------------------------------------------------------------------------------------------------------
function onInput(session, type,
obj)
if type == "dtmf" and obj['digit'] == '1' and
human_detected == false then
human_detected = true
freeswitch.consoleLog("INFO","Human Detected\n")
return
"break"
end
if type == "event" and
voicemail_detected == false then
voicemail_detected = true
freeswitch.consoleLog("INFO","Voicemail
Detected\n")
return
"break"
else
freeswitch.consoleLog("INFO","Nothing
Happened\n")
return
"break"
end
end
if session:ready() then
--- the call
has been
answered.
session:setInputCallback("onInput")
session:sleep(1000)
session:execute("avmd","start")
session:sleep(1000)
session:streamFile("ivr/"
..
wav_file)
session:execute("avmd","stop")
session:sleep(1000)
fileName
= "Completed " .. tostring(call_from_num) .. os.time() ..
tostring(call_to_num)
freeswitch.consoleLog("INFO","FileName = " ..
fileName .. "\n")
local myfile, ErrStr = io.open("log/outcall/" ..
fileName,"w")
if myfile then
myfile:write(call_from_num
.. "|", call_to_num .. "|" ,
os.date())
myfile:flush()
myfile:close()
else
freeswitch.consoleLog("INFO","Error
writing File = '" .. ErrStr .. "'\n")
end --if
end
--if