I haven't played with events inside Lua yet, but here's an example:<br><a href="http://wiki.freeswitch.org/wiki/Examples_directory_lua_asr_tts">http://wiki.freeswitch.org/wiki/Examples_directory_lua_asr_tts</a><br>
<br>Look at the onInput() function in that example. There it gives the syntax for extracting the event header to see what event type has come in.<br><br>The other question I have: did you confirm that mod_vmd triggers properly when going to this mailbox? You could write a simple dialplan that sets mod_vmd, calls the phone, sleeps for 10 or so seconds, and then dumps the var ${vmd_detect} to see what it says. I've used mod_vmd from the XML dialplan with a fair amount of success, although to my knowledge I never actually tried it with a Verizon wireless VM box. <br>
<br>Confirm that mod_vmd works with just the dialplan before trying to debug the Lua script.<br><br>-MC<br><br><div class="gmail_quote">On Mon, Mar 1, 2010 at 7:17 PM, Michael De Lorenzo <span dir="ltr"><<a href="mailto:delorenzodesign@gmail.com">delorenzodesign@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I've got the following Lua script working in a sense, but the
InputCallback never seems to get called while the file is being
streamed to the call recipient. I've tried moving the "vmd start"
command and set input callback around a bit, but to no avail. I'm
testing this against a cell phone voice mailbox (Verizon).<br>
<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"><div style="margin-left: 40px;">
<span style="font-family: courier new,monospace;">freeswitch.consoleLog("info","########################################################\n\n");</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">
number_to_call = argv[1]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
message_to_play = "/opt/freeswitch/recordings/messages/" .. argv[2]</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
voicemail_detected = false;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
function onInput(s, type, obj)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
freeswitch.consoleLog("notice","*********** Type?: " .. type .. " *************\n");</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
-- freeswitch.consoleLog("notice","*********** VMD?: " .. session:getVariable("vmd_detect") .. " *************\n");</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">
if(type == "event" and voicemail_detected == false) then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
freeswitch.consoleLog("notice","************ VOICE MAIL/ANSWERING MACHINE DETECTED *************\n");</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
voicemail_detected = true;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
return "break";</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
end</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
function playbackMessage()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
sleep_time = 1000;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
if(voicemail_detected) then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
sleep_time = 2500;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
-- sleep a second</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
session:sleep(sleep_time);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
-- play a file</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
session:streamFile(message_to_play);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
end</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
function notify()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
session = freeswitch.Session("{ignore_early_media=true}sofia/gateway/voicenetwork/1" .. number_to_call)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
if(session:ready()) then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
-- answer the call</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
session:answer();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
session:setInputCallback("onInput", "");</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
session:execute("vmd","start");</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
playbackMessage();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
if(voicemail_detected) then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
freeswitch.consoleLog("notice","************ DOING PLAYBACK FOR VOICEMAIL/ANSWERING MACHINE *************\n");</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
playbackMessage();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
end</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
freeswitch.consoleLog("notice", "********* hanging up session **********\n");</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
-- hangup</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
session:hangup();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
end</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
notify();</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
freeswitch.consoleLog("info","########################################################\n\n");</span><br style="font-family: courier new,monospace;" clear="all"></div></blockquote>
<br>-- <br><font color="#888888">Michael De Lorenzo<br>
</font><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>