You should be checking session.ready() in that loop, as it is I think you&#39;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<br><br><br><div class="gmail_quote">On 3 June 2011 23:35, Yungwei Chen <span dir="ltr">&lt;<a href="mailto:yungwei@resolvity.com">yungwei@resolvity.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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&#39;s the javascript program:<br>
var dtmf_digits = &quot;&quot;;<br>
<br>
<br>
function on_dtmf_28(session, type, digits, arg)<br>
{<br>
    if (type == &quot;dtmf&quot;)<br>
    {<br>
<br>
        dtmf_digits = digits.digit;<br>
<br>
        console_log(&quot;dtmf_digits=&quot; + dtmf_digits + &quot;\n&quot;);<br>
<br>
        return false; // barge-in / done<br>
    }<br>
    return true;<br>
}<br>
<br>
while (true)<br>
{<br>
        dtmf_digits = &quot;&quot;;<br>
        session.flushDigits();<br>
        session.streamFile(&quot;/usr/local/freeswitch/sounds/long-prompt.wav&quot;, on_dtmf_28, false);<br>
<br>
        if(dtmf_digits.length == 0)<br>
        {<br>
            /* no input */<br>
            console_log(&quot;no input\n&quot;);<br>
            session.speak(&#39;flite&#39;, &#39;kal&#39;, &#39;no input!&#39;, null);<br>
        }<br>
        else if(dtmf_digits == &quot;1&quot; || dtmf_digits == &quot;2&quot;)<br>
        {<br>
                console_log(&quot;match &quot;+dtmf_digits+&quot;\n&quot;);<br>
                session.speak(&#39;flite&#39;, &#39;kal&#39;, &#39;you pressed &#39; + dtmf_digits+ &#39;!&#39;, null);<br>
        }<br>
        else<br>
        {<br>
            /* no match */<br>
            console_log(&quot;no match\n&quot;);<br>
            session.speak(&#39;flite&#39;, &#39;kal&#39;, &quot;no match!&quot;, null);<br>
        }<br>
<br>
}<br>
<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>
</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>