I'm doing some outbound dialing, and want to use mod_vmd to detect if a live person picks up or a voicemail picks up. I've read the wiki, and have been playing around with the dialplan implementation and the lua implementation, along with capturing the mod_vmd
vmd::beep event.
Using the examples on the wiki, I am able to call a number, sleep for 25 seconds, and mod_vmd usually detects a Beep (the answering machine beep right before you are to speak your message).
My question is, is there a way to use mod_vmd to detect if an answering machine or human has picked up within the first 1-2 seconds after being answered? If so, can I get an example of how to set this up?
my dialplan to test my lua implementation looks like
<!-- mod_vmd test extension (new mod)-->
<extension name="vmdtest">
<condition field="destination_number" expression="^1986$">
<action application="answer"/>
<action application="lua" data="matt_vmd.lua"/>
<action application="hangup"/>
</condition>
</extension>
and matt_vmd.lua looks like
print ("--matt_vmd.lua START--")
local human_detected = false;
local voicemail_detected = false;
function onInput(session, type, obj)
if type == "dtmf" and obj['digit'] == '1' and human_detected == false then
print('MATT--I detected a HUMAN');
human_detected = true;
return "break";
end
if type == "event" and voicemail_detected == false then
print('MATT--I detected a VOICEMAIL');
voicemail_detected = true;
return "break";
end
end
session:setInputCallback("onInput");
session:execute("vmd");
session:sleep(25000);
print ("--matt_vmd.lua FINISHED--")
Thanks.
--matt