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: ------------------------------------------------------------------------------------------------------- EXECUTE sofia/internal/7202126254@xxx.xx.xxx.xx avmd(start) 2011-11-03 11:05:27.291678 [DEBUG] switch_core_media_bug.c:360 Attaching BUG to sofia/internal/7202126254@xxx.xx.xxx.xx 2011-11-03 11:05:28.311249 [DEBUG] switch_ivr_play_say.c:1279 Codec Activated L16@8000hz 1 channels 20ms 2011-11-03 11:05:28.350313 [DEBUG] switch_rtp.c:3082 Correct ip/port confirmed. 2011-11-03 11:05:40.235535 [DEBUG] switch_ivr_play_say.c:1649 done playing file EXECUTE sofia/internal/7202126254@xxx.xx.xxx.xx avmd(stop) 2011-11-03 11:05:40.237488 [DEBUG] switch_core_media_bug.c:467 Removing BUG from sofia/internal/7202126254@xxx.xx.xxx.xx 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
Please note: mod_avmd is *not* answering machine detection. There is a private mod_amd specifically for this purpose. Contact consulting@freeswitch.org if you are interested in that. mod_avmd is designed to detect the "beep" played by voicemail systems and answering machines. If a beep is detected then mod_avmd emits an event to the FreeSWITCH event sub-system. I would attach with fs_cli and listen for the event. Try this at fs_cli: /log 0 /event plain CUSTOM Then make some test calls and see if there is actually a detection. Once you confirm positive detection then you can see what's up with the Lua input callback. -MC On Thu, Nov 3, 2011 at 10:39 AM, Dave <dave@clancysystems.com> wrote:
** 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:
------------------------------------------------------------------------------------------------------- EXECUTE sofia/internal/7202126254@xxx.xx.xxx.xx avmd(start) 2011-11-03 11:05:27.291678 [DEBUG] switch_core_media_bug.c:360 Attaching BUG to sofia/internal/7202126254@xxx.xx.xxx.xx<sofia/internal/3035649554@xxx.xx.xxx.xx> 2011-11-03 11:05:28.311249 [DEBUG] switch_ivr_play_say.c:1279 Codec Activated L16@8000hz 1 channels 20ms 2011-11-03 11:05:28.350313 [DEBUG] switch_rtp.c:3082 Correct ip/port confirmed. 2011-11-03 11:05:40.235535 [DEBUG] switch_ivr_play_say.c:1649 done playing file EXECUTE sofia/internal/7202126254@xxx.xx.xxx.xx<sofia/internal/3035649554@xxx.xx.xxx.xx>avmd(stop) 2011-11-03 11:05:40.237488 [DEBUG] switch_core_media_bug.c:467 Removing BUG from sofia/internal/7202126254@xxx.xx.xxx.xx<sofia/internal/3035649554@xxx.xx.xxx.xx>
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
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)
-
Dave
-
Michael Collins