- checks whether the session is still active (true anytime between call starts and hangup)<br>
- also session:ready will return false if the call is being transferred.
<b>  Bottom line is you should always be checking session:ready on any 
loops and periodicly throughout your script and exit asap if it returns 
false.</b><br><br>[<a href="http://wiki.freeswitch.org/wiki/Mod_lua#session:ready">http://wiki.freeswitch.org/wiki/Mod_lua#session:ready</a>]<br><br><br><br><div class="gmail_quote">On 7 June 2011 16:54, Steven Ayre <span dir="ltr">&lt;<a href="mailto:steveayre@gmail.com">steveayre@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">It&#39;s a simple fix. Always check session.ready when you loop. Yes, that&#39;s how it&#39;s designed to work.<br><br>

-Steve<br><br><br><br><div class="gmail_quote"><div><div></div><div class="h5">On 7 June 2011 16:05, Yungwei Chen <span dir="ltr">&lt;<a href="mailto:yungwei@resolvity.com" target="_blank">yungwei@resolvity.com</a>&gt;</span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">That&#39;s how it&#39;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><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&#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></p></div><div><div></div><div><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&#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>}</p></div>


<p class="MsoNormal"> </p></div></div></div></div><br></div></div><div class="im">_______________________________________________<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><br><div style="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%">
</div>
</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>