<div dir="ltr">Can you please tell how callback works, my understanding is that it handles user input, not sure how it works when we are trying to catch voicemails?<div><br></div><div>Thanks</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Jul 26, 2013 at 1:25 PM, Michael Collins <span dir="ltr"><<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>I would do your "voicemail" stuff in the callback where you detect that the avmd detected true. I would also put the avmd_stop app in that code block.<br></div>-MC<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Jul 25, 2013 at 7:33 PM, Raghu <span dir="ltr"><<a href="mailto:srraghu45@gmail.com" target="_blank">srraghu45@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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 class="im"><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><div class="im">
<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><div> # session.setVariable("hangup_after_bridge", "false")</div>
<div class="im">
<div> callback = session.setInputCallback("input_callback")</div><div> session.execute("avmd", "start")</div><div> consoleLog("info", "AVMD start\n")</div></div>
<div> session.execute("sleep", "18000")</div><div class="im">
<div> consoleLog("info", "AVMD status %s\n" % session.getVariable('avmd_detect'))</div><div><br></div><div> if session.getVariable('avmd_detect'):</div></div><div class="im"><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><div> consoleLog("info","callback returned %s!!\n\n" % callback)</div><div class="im"><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><div><br></div><div>Appreciate it!</div><div><br></div></div><div class="im">
<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>
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>
<br></div></blockquote></div><div class="im"><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>
</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>
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></div>