[Freeswitch-users] A DTMF issue

Yungwei Chen yungwei at resolvity.com
Tue Jun 7 19:05:50 MSD 2011


That's how it's supposed to work and no workaround?

From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Steven Ayre
Sent: Friday, June 03, 2011 5:46 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] A DTMF issue

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.

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.

Try replacing:
    while(true) {
with:
    while(session.ready()) {

-Steve

On 3 June 2011 23:35, Yungwei Chen wrote:
Hi,

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.
Please refer to http://pastebin.freeswitch.org/16435 for debug logs.
Notice that the difference in time between any adjacent pairs of the following is increasing as time goes by. Am I missing something here?
       switch_ivr_play_say.c:1279 Codec Activated L16 at 8000hz 1 channels 20ms
       switch_rtp.c:3302 RTP RECV DTMF 2:960
Thanks.

Here's the javascript program:
var dtmf_digits = "";


function on_dtmf_28(session, type, digits, arg)
{
   if (type == "dtmf")
   {

       dtmf_digits = digits.digit;

       console_log("dtmf_digits=" + dtmf_digits + "\n");

       return false; // barge-in / done
   }
   return true;
}

while (true)
{
       dtmf_digits = "";
       session.flushDigits();
       session.streamFile("/usr/local/freeswitch/sounds/long-prompt.wav", on_dtmf_28, false);

       if(dtmf_digits.length == 0)
       {
           /* no input */
           console_log("no input\n");
           session.speak('flite', 'kal', 'no input!', null);
       }
       else if(dtmf_digits == "1" || dtmf_digits == "2")
       {
               console_log("match "+dtmf_digits+"\n");
               session.speak('flite', 'kal', 'you pressed ' + dtmf_digits+ '!', null);
       }
       else
       {
           /* no match */
           console_log("no match\n");
           session.speak('flite', 'kal', "no match!", null);
       }

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110607/2ba290f1/attachment.html 


More information about the FreeSWITCH-users mailing list