If session.ready isn't working then something else is causing the slowness...
-Steve
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.
Just to clarify, that's by design?
From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins
Sent: Tuesday, June 07, 2011 10:55 AM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] A DTMF issue
Yes, this is by design.
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?
-MC
On Tue, Jun 7, 2011 at 8:05 AM, Yungwei Chen wrote:
That's how it's supposed to work and no workaround?
From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@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()) {
-SteveOn 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@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);
}
}
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org