[Freeswitch-users] Help with Using Mod_AVMD

Dave dave at clancysystems.com
Thu Nov 3 20:39:54 MSK 2011


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 at 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 at xxx.xx.xxx.xx
2011-11-03 11:05:28.311249 [DEBUG] switch_ivr_play_say.c:1279 Codec Activated L16 at 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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20111103/f63c8566/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list