If session.ready isn't working then something else is causing the slowness...<br><br>-Steve<br><br><br><div class="gmail_quote">On 7 June 2011 18:06, Yungwei Chen <span dir="ltr"><<a href="mailto:yungwei@resolvity.com">yungwei@resolvity.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">I tried session.ready(), and that doesn't fix the problem: response to DTMF input gets slower and slower as time goes by when one interacts with the javascript program in my original post.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Just to clarify, that's by design?</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of </b>Michael Collins<br>
<b>Sent:</b> Tuesday, June 07, 2011 10:55 AM</span></p><div class="im"><br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> Re: [Freeswitch-users] A DTMF issue</div><p></p></div><p class="MsoNormal"> </p><p class="MsoNormal">
Yes, this is by design.</p><div class="im"><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">I think you might be trying to use the wrong tool for the task at hand. What is the problem that you are trying to solve? What function/feature are you trying to implement?</p>
</div><div><p class="MsoNormal"> </p></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">-MC</p><div><div></div><div class="h5"><div><p class="MsoNormal">On Tue, Jun 7, 2011 at 8:05 AM, Yungwei Chen wrote:</p>
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">That's how it's supposed to work and no workaround?</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of </b>Steven Ayre<br>
<b>Sent:</b> Friday, June 03, 2011 5:46 PM<br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> Re: [Freeswitch-users] A DTMF issue</span></p></div><p class="MsoNormal"> </p><p class="MsoNormal" style="margin-bottom:12.0pt">
You should be checking session.ready() in that loop, as it is I think you'll find the scripts are never ending when the channel is hung up.<br><br>streamFile/flushDigits probably return instantly, but then get called again on the next loop iteration. The problem would get slightly worse after each test call since there would be an extra copy of the script running.<br>
<br>Try replacing:<br> while(true) {<br>with:<br> while(session.ready()) {<br><br>-Steve</p><div><p class="MsoNormal">On 3 June 2011 23:35, Yungwei Chen wrote:</p><p class="MsoNormal">Hi,<br><br>When testing the following javascript program, I notice a problem that it takes longer and longer for freeswitch to respond to DTMF input for some reason.<br>
Please refer to <a href="http://pastebin.freeswitch.org/16435" target="_blank">http://pastebin.freeswitch.org/16435</a> for debug logs.<br>Notice that the difference in time between any adjacent pairs of the following is increasing as time goes by. Am I missing something here?<br>
switch_ivr_play_say.c:1279 Codec Activated L16@8000hz 1 channels 20ms<br> switch_rtp.c:3302 RTP RECV DTMF 2:960<br>Thanks.<br><br>Here's the javascript program:<br>var dtmf_digits = "";<br><br>
<br>
function on_dtmf_28(session, type, digits, arg)<br>{<br> if (type == "dtmf")<br> {<br><br> dtmf_digits = digits.digit;<br><br> console_log("dtmf_digits=" + dtmf_digits + "\n");<br>
<br> return false; // barge-in / done<br> }<br> return true;<br>}<br><br>while (true)<br>{<br> dtmf_digits = "";<br> session.flushDigits();<br> session.streamFile("/usr/local/freeswitch/sounds/long-prompt.wav", on_dtmf_28, false);<br>
<br> if(dtmf_digits.length == 0)<br> {<br> /* no input */<br> console_log("no input\n");<br> session.speak('flite', 'kal', 'no input!', null);<br>
}<br> else if(dtmf_digits == "1" || dtmf_digits == "2")<br> {<br> console_log("match "+dtmf_digits+"\n");<br> session.speak('flite', 'kal', 'you pressed ' + dtmf_digits+ '!', null);<br>
}<br> else<br> {<br> /* no match */<br> console_log("no match\n");<br> session.speak('flite', 'kal', "no match!", null);<br> }<br>
<br>}</p></div><p class="MsoNormal"> </p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><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></p></div><p class="MsoNormal"> </p></div></div></div></div></div><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 style="visibility: hidden; left: -5000px; position: absolute; z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 130%;" id="avg_ls_inline_popup">
</div>