<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";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.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Just to clarify, that's by design?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></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;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] <b>On Behalf Of </b>Michael Collins<br><b>Sent:</b> Tuesday, June 07, 2011 10:55 AM<br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> Re: [Freeswitch-users] A DTMF issue<o:p></o:p></span></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Yes, this is by design.<o:p></o:p></p><div><p class=MsoNormal><o:p>&nbsp;</o:p></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?<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>-MC<o:p></o:p></p><div><p class=MsoNormal>On Tue, Jun 7, 2011 at 8:05 AM, Yungwei Chen wrote:<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;color:#1F497D'>That's how it's supposed to work and no workaround?</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;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>&nbsp;&nbsp;&nbsp; while(true) {<br>with:<br>&nbsp;&nbsp;&nbsp; while(session.ready()) {<br><br>-Steve<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>On 3 June 2011 23:35, Yungwei Chen wrote:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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>&nbsp; &nbsp; &nbsp; &nbsp;switch_ivr_play_say.c:1279 Codec Activated L16@8000hz 1 channels 20ms<br>&nbsp; &nbsp; &nbsp; &nbsp;switch_rtp.c:3302 RTP RECV DTMF 2:960<br>Thanks.<br><br>Here's the javascript program:<br>var dtmf_digits = &quot;&quot;;<br><br><br>function on_dtmf_28(session, type, digits, arg)<br>{<br>&nbsp; &nbsp;if (type == &quot;dtmf&quot;)<br>&nbsp; &nbsp;{<br><br>&nbsp; &nbsp; &nbsp; &nbsp;dtmf_digits = digits.digit;<br><br>&nbsp; &nbsp; &nbsp; &nbsp;console_log(&quot;dtmf_digits=&quot; + dtmf_digits + &quot;\n&quot;);<br><br>&nbsp; &nbsp; &nbsp; &nbsp;return false; // barge-in / done<br>&nbsp; &nbsp;}<br>&nbsp; &nbsp;return true;<br>}<br><br>while (true)<br>{<br>&nbsp; &nbsp; &nbsp; &nbsp;dtmf_digits = &quot;&quot;;<br>&nbsp; &nbsp; &nbsp; &nbsp;session.flushDigits();<br>&nbsp; &nbsp; &nbsp; &nbsp;session.streamFile(&quot;/usr/local/freeswitch/sounds/long-prompt.wav&quot;, on_dtmf_28, false);<br><br>&nbsp; &nbsp; &nbsp; &nbsp;if(dtmf_digits.length == 0)<br>&nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* no input */<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console_log(&quot;no input\n&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.speak('flite', 'kal', 'no input!', null);<br>&nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp;else if(dtmf_digits == &quot;1&quot; || dtmf_digits == &quot;2&quot;)<br>&nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console_log(&quot;match &quot;+dtmf_digits+&quot;\n&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.speak('flite', 'kal', 'you pressed ' + dtmf_digits+ '!', null);<br>&nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp;else<br>&nbsp; &nbsp; &nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* no match */<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console_log(&quot;no match\n&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.speak('flite', 'kal', &quot;no match!&quot;, null);<br>&nbsp; &nbsp; &nbsp; &nbsp;}<br><br>}<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></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">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><o:p></o:p></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></body></html>