<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19154">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>Hello, </FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>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.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>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.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>I think I'm missing something.</FONT></DIV>
<DIV><FONT size=2 face=Arial>Dave Goodwin</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Pertinent FreeSWITCH Log Info:</FONT></DIV>
<DIV><FONT size=2
face=Arial>-------------------------------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT size=2 face=Arial>EXECUTE <A
href="mailto:sofia/internal/7202126254@xxx.xx.xxx.xx">sofia/internal/7202126254@xxx.xx.xxx.xx</A>
avmd(start)<BR>2011-11-03 11:05:27.291678 [DEBUG] switch_core_media_bug.c:360
Attaching BUG to <A
href="mailto:sofia/internal/3035649554@xxx.xx.xxx.xx">sofia/internal/7202126254@xxx.xx.xxx.xx</A><BR>2011-11-03
11:05:28.311249 [DEBUG] switch_ivr_play_say.c:1279 Codec Activated <A
href="mailto:L16@8000hz">L16@8000hz</A> 1 channels 20ms<BR>2011-11-03
11:05:28.350313 [DEBUG] switch_rtp.c:3082 Correct ip/port
confirmed.<BR>2011-11-03 11:05:40.235535 [DEBUG] switch_ivr_play_say.c:1649 done
playing file<BR>EXECUTE <A
href="mailto:sofia/internal/3035649554@xxx.xx.xxx.xx">sofia/internal/7202126254@xxx.xx.xxx.xx</A>
avmd(stop)<BR>2011-11-03 11:05:40.237488 [DEBUG] switch_core_media_bug.c:467
Removing BUG from <A
href="mailto:sofia/internal/3035649554@xxx.xx.xxx.xx">sofia/internal/7202126254@xxx.xx.xxx.xx</A><BR></FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Lua Script: </FONT></DIV>
<DIV><FONT size=2
face=Arial>-------------------------------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT size=2 face=Arial>function onInput(session, type,
obj)<BR> if type == "dtmf" and obj['digit'] == '1' and
human_detected == false then<BR>
human_detected = true<BR>
freeswitch.consoleLog("INFO","Human Detected\n")<BR> return
"break"<BR> end<BR> if type == "event" and
voicemail_detected == false then<BR>
voicemail_detected = true<BR>
freeswitch.consoleLog("INFO","Voicemail
Detected\n")<BR> return
"break"<BR> else<BR>
freeswitch.consoleLog("INFO","Nothing
Happened\n")<BR> return
"break"<BR> end<BR>end</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>if session:ready() then<BR> --- the call
has been
answered.<BR> session:setInputCallback("onInput")<BR> session:sleep(1000)<BR> session:execute("avmd","start")<BR> session:sleep(1000)<BR> session:streamFile("ivr/"
..
wav_file)<BR> session:execute("avmd","stop")<BR> session:sleep(1000)<BR> fileName
= "Completed " .. tostring(call_from_num) .. os.time() ..
tostring(call_to_num)<BR> freeswitch.consoleLog("INFO","FileName = " ..
fileName .. "\n")<BR> local myfile, ErrStr = io.open("log/outcall/" ..
fileName,"w")<BR> if myfile then<BR> myfile:write(call_from_num
.. "|", call_to_num .. "|" ,
os.date())<BR> myfile:flush()<BR> myfile:close()<BR> else<BR> freeswitch.consoleLog("INFO","Error
writing File = '" .. ErrStr .. "'\n")<BR> end --if<BR>end
--if<BR></FONT></DIV></BODY></HTML>