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); } }
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 <yungwei@resolvity.com> 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
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()) { -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@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); } }
It's a simple fix. Always check session.ready when you loop. Yes, that's how it's designed to work. -Steve On 7 June 2011 16:05, Yungwei Chen <yungwei@resolvity.com> 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()) {
-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@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
- checks whether the session is still active (true anytime between call starts and hangup) - also session:ready will return false if the call is being transferred. *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.* [http://wiki.freeswitch.org/wiki/Mod_lua#session:ready] On 7 June 2011 16:54, Steven Ayre <steveayre@gmail.com> wrote:
It's a simple fix. Always check session.ready when you loop. Yes, that's how it's designed to work.
-Steve
On 7 June 2011 16:05, Yungwei Chen <yungwei@resolvity.com> 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()) {
-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@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
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 <yungwei@resolvity.com> 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()) {
-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@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
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> [mailto: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()) { -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@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<mailto: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
If session.ready isn't working then something else is causing the slowness... -Steve On 7 June 2011 18:06, Yungwei Chen <yungwei@resolvity.com> wrote:
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()) {
-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@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
participants (3)
-
Michael Collins
-
Steven Ayre
-
Yungwei Chen