<div dir="ltr">Thanks for checking it Michael. I thought i was trying execute &#39;speak&#39; 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&quot; % what)<br></div>
<div>    return</div><div><br></div><div>def input_callback(session, what, obj):</div><div><br></div><div>    if (what == &quot;dtmf&quot;):</div><div>        consoleLog(&quot;info&quot;, what + &quot; from callback &quot; + obj.digit + &quot;\n&quot;)</div>
<div>        return</div><div>    elif (what == &quot;event&quot; and session.getVariable(&#39;avmd_detect&#39;) == &quot;TRUE&quot;):</div><div>        consoleLog(&quot;info&quot;, &quot;Voicemail Detected\n&quot;)</div>
<div><br></div><div>    return &quot;TRUE&quot;</div><div><br></div><div>def handler(session, args):</div><div><br></div><div>    session.answer()</div><div>   # session.setVariable(&quot;hangup_after_bridge&quot;, &quot;false&quot;)</div>
<div>    callback = session.setInputCallback(&quot;input_callback&quot;)</div><div>    session.execute(&quot;avmd&quot;, &quot;start&quot;)</div><div>    consoleLog(&quot;info&quot;, &quot;AVMD start\n&quot;)</div><div>    session.execute(&quot;sleep&quot;, &quot;18000&quot;)</div>
<div>    consoleLog(&quot;info&quot;, &quot;AVMD status %s\n&quot; % session.getVariable(&#39;avmd_detect&#39;))</div><div><br></div><div>    if session.getVariable(&#39;avmd_detect&#39;):</div><div>         consoleLog(&quot;info&quot;, &quot;Beep Detected\n&quot;)</div>
<div>         session.execute(&quot;speak&quot;, &quot;flite|kal|&#39;Hi this is &#39;&quot;)</div><div>         session.execute(&quot;avmd&quot;, &quot;stop&quot;)</div><div><br></div><div>    session.execute(&quot;speak&quot;, &quot;flite|kal|&#39;Hi this is &#39;&quot;)</div>
<div>    consoleLog(&quot;info&quot;,&quot;callback returned   %s!!\n\n&quot; % callback)</div><div>    session.execute(&quot;avmd&quot;, &quot;stop&quot;)</div><div>    consoleLog(&quot;info&quot;, &quot;AVMD stop\n&quot;)</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>