<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hello,</div><div><br></div><div>I can start mod_avmd and it detects voicemail beep when calling my cellphone. However, when I pickup the phone and press a key to use IVR, I would like to stop mod_avmd. I copied the input callback example from FreeSWITCH Wiki. My issue is that my input handler is never triggered, neither when I key a DTMF nor when beep is detected.&nbsp;</div><div><br></div><div><b>1) My handler is:&nbsp;</b></div><div><font class="Apple-style-span" color="#00aa45">function onInput(s, type, obj)</font></div><div><font class="Apple-style-span" color="#00aa45">&nbsp; &nbsp; if (type == "dtmf") then<span class="Apple-tab-span" style="white-space:pre">                                                                </span></font></div><div><font class="Apple-style-span" color="#00aa45">&nbsp; &nbsp; &nbsp; &nbsp; avmd_result = 1;</font></div><div><font class="Apple-style-span" color="#00aa45"><span class="Apple-tab-span" style="white-space:pre">                </span>if ( debug_mode &gt; 0 ) then&nbsp;</font></div><div><font class="Apple-style-span" color="#00aa45"><span class="Apple-tab-span" style="white-space:pre">                        </span>print("onInput - Human detected");<span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div><font class="Apple-style-span" color="#00aa45"><span class="Apple-tab-span" style="white-space:pre">                </span>end</font></div><div><font class="Apple-style-span" color="#00aa45">&nbsp; &nbsp; &nbsp; &nbsp; return "break";</font></div><div><font class="Apple-style-span" color="#00aa45">&nbsp; &nbsp; end</font></div><div><font class="Apple-style-span" color="#00aa45">&nbsp; &nbsp; if (type == "event" ) then<span class="Apple-tab-span" style="white-space:pre">                                                        </span></font></div><div><font class="Apple-style-span" color="#00aa45">&nbsp; &nbsp; &nbsp; &nbsp; avmd_result = 2;</font></div><div><font class="Apple-style-span" color="#00aa45"><span class="Apple-tab-span" style="white-space:pre">                </span>if ( debug_mode &gt; 0 ) then&nbsp;</font></div><div><font class="Apple-style-span" color="#00aa45"><span class="Apple-tab-span" style="white-space:pre">                        </span>print("onInput - Voicemail detected");<span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div><font class="Apple-style-span" color="#00aa45"><span class="Apple-tab-span" style="white-space:pre">                </span>end</font></div><div><font class="Apple-style-span" color="#00aa45">&nbsp; &nbsp; &nbsp; &nbsp; avmd_result = 2;</font></div><div><font class="Apple-style-span" color="#00aa45">&nbsp; &nbsp; &nbsp; &nbsp; return "break";</font></div><div><font class="Apple-style-span" color="#00aa45">&nbsp; &nbsp; end</font></div><div><font class="Apple-style-span" color="#00aa45">end</font></div><div><br></div><div><b>2) To start mod_avmd, play file and collect digits:</b></div><div><div><i><font class="Apple-style-span" color="#00aa45"><span class="Apple-tab-span" style="white-space: pre; ">                </span>session:setInputCallback("onInput");</font></i></div><div><i><font class="Apple-style-span" color="#00aa45"><span class="Apple-tab-span" style="white-space: pre; ">                </span>session:execute("avmd","start");</font></i></div></div><div><br></div><div><div><span class="Apple-tab-span" style="white-space: pre; ">                </span><font class="Apple-style-span" color="#00aa12">digits = session:playAndGetDigits(…….);</font></div></div><div><br></div><div><b>3) To stop mod_avmd:</b></div><div><div><font class="Apple-style-span" color="#00aa12"><span class="Apple-tab-span" style="white-space:pre">                </span>session:execute("avmd","stop");</font></div></div><div><br></div><div><b>4) Output when keying DTMF (*3 in this case). Input handler does not kick off upon DTMF:&nbsp;</b></div><div>EXECUTE sofia/external/+19543307528 avmd(start)</div><div>012-07-23 18:13:28.025981 [INFO] mod_avmd.c:538 &lt;&lt;&lt; AVMD v=0.073060 f=0.900987 1147.172790Hz sma=0.090099 sqa=0.081178 &gt;&gt;&gt;</div><div>...&nbsp;</div><div><div>012-07-23 18:13:30.492866 [INFO] mod_avmd.c:538 &lt;&lt;&lt; AVMD v=0.052551 f=0.764130 972.920758Hz sma=0.076413 sqa=0.058389 &gt;&gt;&gt;</div><div><font class="Apple-style-span" color="#fb0047">2012-07-23 18:13:30.586854 [DEBUG] switch_rtp.c:3795 RTP RECV DTMF *:800</font></div><div>2012-07-23 18:13:30.605660 [INFO] mod_avmd.c:538 &lt;&lt;&lt; AVMD v=0.067196 f=0.864073 1100.171521Hz sma=0.086407 sqa=0.074662 &gt;&gt;&gt;</div></div><div>…</div><div><div>2012-07-23 18:13:30.998715 [INFO] mod_avmd.c:538 &lt;&lt;&lt; AVMD v=0.030803 f=0.585023 744.874518Hz sma=0.058502 sqa=0.034225 &gt;&gt;&gt;</div><div><font class="Apple-style-span" color="#fb0047">2012-07-23 18:13:31.085676 [DEBUG] switch_rtp.c:3795 RTP RECV DTMF 3:640</font></div></div><div>...</div><div>012-07-23 18:13:36.645609 [INFO] mod_avmd.c:538 &lt;&lt;&lt; AVMD v=0.030380 f=0.580996 739.747695Hz sma=0.058100 sqa=0.033756 &gt;&gt;&gt;</div><div><br></div><div><b>5) Output when beep is detected - Mod_avmd stops output after beep detection but input handler does not kick off</b></div><div><div>2012-07-23 18:04:04.992856 [INFO] mod_avmd.c:538 &lt;&lt;&lt; AVMD v=0.000048 f=0.812668 1034.721179Hz sma=0.811125 sqa=0.657971 &gt;&gt;&gt;</div><div>2012-07-23 18:04:04.992856 [INFO] mod_avmd.c:561 &lt;&lt;&lt; AVMD - Beep Detected &gt;&gt;&gt;</div></div><div><br></div><div>What am I missing?</div><div><br></div><div>Thank you</div><div><br></div><div>Bernard</div><div><br></div><div><br></div><div><br></div><br><div><div>On Jul 23, 2012, at 2:16 PM, Bernard Fluixa wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">OK. I'm clear now. Thanks again.<br><div><div>On Jul 23, 2012, at 1:17 PM, Michael Collins wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Precisely. <br>-MC<br><br><div class="gmail_quote">On Mon, Jul 23, 2012 at 9:59 AM, Bernard Fluixa <span dir="ltr">&lt;<a href="mailto:fluixab@bellsouth.net" target="_blank">fluixab@bellsouth.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Michael,<div><br></div><div>Thank you or your response. So it is my responsibility to do whatever needs to be done while mod_avmd attempts to detect a beep and to manually stop it after a beep as been detected or after a certain timeout. Correct?</div>
<div><br></div><div>Bernard</div><div><br></div><div>&nbsp;&nbsp;</div><div><br></div><div><br><div><div>On Jul 23, 2012, at 11:59 AM, Michael Collins wrote:</div><br><blockquote type="cite">Bernard,<br><br>Keep in mind that avmd is non-blocking, that is, it won't cause your dialplan or script to pause while it is attempting to detect the beep. Your dialplan will keep doing what it normally does, and if avmd detects a beep then it will throw an event which you catch and handle in your onInput function.<br>

<br>-MC<br><br><div class="gmail_quote">On Mon, Jul 23, 2012 at 6:47 AM, BF <span dir="ltr">&lt;<a href="mailto:bfmtl@hotmail.com" target="_blank">bfmtl@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hello,<br>
<br>
I'm trying to use it from a Lua script. My understanding is that mod_avmd detects beep from voicemail systems and is CPU intensive, please correct me if I'm wrong.<br>
<br>
The Lua example at FreeSWITCH Wiki is<br>
local human_detected = false;<br>
local voicemail_detected = false;<br>
<br>
function onInput(session, type, obj)<br>
&nbsp; &nbsp; if type == "dtmf" and obj['digit'] == '1' and human_detected == false then<br>
&nbsp; &nbsp; &nbsp; &nbsp; human_detected = true;<br>
&nbsp; &nbsp; &nbsp; &nbsp; return "break";<br>
&nbsp; &nbsp; end<br>
<br>
&nbsp; &nbsp; if type == "event" and voicemail_detected == false then<br>
&nbsp; &nbsp; &nbsp; &nbsp; voicemail_detected = true;<br>
&nbsp; &nbsp; &nbsp; &nbsp; return "break";<br>
&nbsp; &nbsp; end<br>
end<br>
<br>
session:setInputCallback("onInput");<br>
session:execute("avmd","start");<br>
In order to implement this example, the script must wait for the beep to be detected or not to process the case accordingly. What is no beep is detected? How can I prevent called party to hear only silence while potential beep detection is being executed?<br>


<br>
Thank you<br>
<br>
Bernard<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a><br>
<br>
Join Us At ClueCon - Aug 7-9, 2012<br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">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>
</blockquote></div><br><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.FreeSWITCH.org/" target="_blank">http://www.FreeSWITCH.org</a><br><a href="http://www.ClueCon.com/" target="_blank">http://www.ClueCon.com</a><br>

<a href="http://www.OSTAG.org/" target="_blank">http://www.OSTAG.org</a><br><br><br>
_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br><a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br><a href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br><a href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a><br><br>Official FreeSWITCH Sites<br><a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a><br><a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a><br><br>Join Us At ClueCon - Aug 7-9, 2012<br><br>FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">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>
</blockquote></div><br></div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a><br>
<br>
Join Us At ClueCon - Aug 7-9, 2012<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><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.FreeSWITCH.org/" target="_blank">http://www.FreeSWITCH.org</a><br><a href="http://www.ClueCon.com/" target="_blank">http://www.ClueCon.com</a><br>
<a href="http://www.OSTAG.org/" target="_blank">http://www.OSTAG.org</a><br><br><br>
_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br><a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a><br><br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>http://www.cudatel.com<br><br>Official FreeSWITCH Sites<br>http://www.freeswitch.org<br>http://wiki.freeswitch.org<br>http://www.cluecon.com<br><br>Join Us At ClueCon - Aug 7-9, 2012<br><br>FreeSWITCH-users mailing list<br>FreeSWITCH-users@lists.freeswitch.org<br>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br>http://www.freeswitch.org<br></blockquote></div><br></div>_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>http://www.freeswitchsolutions.com<br><br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>http://www.cudatel.com<br><br>Official FreeSWITCH Sites<br>http://www.freeswitch.org<br>http://wiki.freeswitch.org<br>http://www.cluecon.com<br><br>Join Us At ClueCon - Aug 7-9, 2012<br><br>FreeSWITCH-users mailing list<br>FreeSWITCH-users@lists.freeswitch.org<br>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br>http://www.freeswitch.org<br></blockquote></div><br></body></html>