<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> </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> </o:p></p><p class=MsoNormal>Yes, this is by design.<o:p></o:p></p><div><p class=MsoNormal><o:p> </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> </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'> </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'> <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> while(true) {<br>with:<br> 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> 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>}<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <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> </o:p></p></div></div></body></html>