<div dir="ltr">Thanks for checking it Michael. I thought i was trying execute 'speak' when AVMD detects a beep as below, but may be i am missing something. Please review the code and let me know if i am missing anything:<div>
<br></div><div><div>from freeswitch import *</div><div><br></div><div># WARNING: known bugs with hangup hooks, use with extreme caution</div><div>def hangup_hook(session, what):</div><div> %s!!\n\n" % what)<br></div>
<div> return</div><div><br></div><div>def input_callback(session, what, obj):</div><div><br></div><div> if (what == "dtmf"):</div><div> consoleLog("info", what + " from callback " + obj.digit + "\n")</div>
<div> return</div><div> elif (what == "event" and session.getVariable('avmd_detect') == "TRUE"):</div><div> consoleLog("info", "Voicemail Detected\n")</div>
<div><br></div><div> return "TRUE"</div><div><br></div><div>def handler(session, args):</div><div><br></div><div> session.answer()</div><div> # session.setVariable("hangup_after_bridge", "false")</div>
<div> callback = session.setInputCallback("input_callback")</div><div> session.execute("avmd", "start")</div><div> consoleLog("info", "AVMD start\n")</div><div> session.execute("sleep", "18000")</div>
<div> consoleLog("info", "AVMD status %s\n" % session.getVariable('avmd_detect'))</div><div><br></div><div> if session.getVariable('avmd_detect'):</div><div> consoleLog("info", "Beep Detected\n")</div>
<div> session.execute("speak", "flite|kal|'Hi this is '")</div><div> session.execute("avmd", "stop")</div><div><br></div><div> session.execute("speak", "flite|kal|'Hi this is '")</div>
<div> consoleLog("info","callback returned %s!!\n\n" % callback)</div><div> session.execute("avmd", "stop")</div><div> consoleLog("info", "AVMD stop\n")</div>
<div> session.setHangupHook(hangup_hook)</div><div> session.hangup() #hangup the call</div></div><div><br></div><div>Appreciate it!</div><div><br></div></div>