aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-05 01:40:06 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-05 01:40:06 +0000
commit6c89612673f099a5cba008adb03d04447b18784c (patch)
tree77e3c1c2a0db4dee32e111ad819061f2b36f444b /apps
parent21d6951aa4abd26c96ddaac072a099d26ff97143 (diff)
As per ToDo list, I have made it so that Wait(), WaitExten(), Congestion(), Busy(), Read(), WaitForRing(), will now either actually handle a floating point argument as advertised, or has been upgraded to accept a floating point [timeout] arg.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44435 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_read.c11
-rw-r--r--apps/app_speech_utils.c2
-rw-r--r--apps/app_waitforring.c5
3 files changed, 10 insertions, 8 deletions
diff --git a/apps/app_read.c b/apps/app_read.c
index bb3dd669b..5db886b03 100644
--- a/apps/app_read.c
+++ b/apps/app_read.c
@@ -77,8 +77,8 @@ static char *descrip =
" 'n' to read digits even if the line is not up.\n"
" attempts -- if greater than 1, that many attempts will be made in the \n"
" event no data is entered.\n"
-" timeout -- An integer number of seconds to wait for a digit response. If greater\n"
-" than 0, that value will override the default timeout.\n\n"
+" timeout -- The number of seconds to wait for a digit response. If greater\n"
+" than 0, that value will override the default timeout. Can be floating point.\n\n"
"Read should disconnect if the function fails or errors out.\n";
@@ -91,6 +91,7 @@ static int read_exec(struct ast_channel *chan, void *data)
char tmp[256] = "";
int maxdigits = 255;
int tries = 1, to = 0, x = 0;
+ double tosec;
char *argcopy = NULL;
struct tone_zone_sound *ts;
struct ast_flags flags = {0};
@@ -126,11 +127,11 @@ static int read_exec(struct ast_channel *chan, void *data)
}
if (!ast_strlen_zero(arglist.timeout)) {
- to = atoi(arglist.timeout);
- if (to <= 0)
+ tosec = atof(arglist.timeout);
+ if (tosec <= 0)
to = 0;
else
- to *= 1000;
+ to = tosec * 1000.0;
}
if (ast_strlen_zero(arglist.filename)) {
diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c
index 525aa0af4..42b7fb031 100644
--- a/apps/app_speech_utils.c
+++ b/apps/app_speech_utils.c
@@ -64,7 +64,7 @@ static char *speechbackground_descrip =
"Once they stop talking the processing sound is played to indicate the speech recognition engine is working.\n"
"Once results are available the application returns and results (score and text) are available using dialplan functions.\n"
"The first text and score are ${SPEECH_TEXT(0)} AND ${SPEECH_SCORE(0)} while the second are ${SPEECH_TEXT(1)} and ${SPEECH_SCORE(1)}.\n"
-"The first argument is the sound file and the second is the timeout. Note the timeout will only start once the sound file has stopped playing.\n";
+"The first argument is the sound file and the second is the timeout integer in seconds. Note the timeout will only start once the sound file has stopped playing.\n";
static char *speechdeactivategrammar_descrip =
"SpeechDeactivateGrammar(Grammar Name)\n"
diff --git a/apps/app_waitforring.c b/apps/app_waitforring.c
index a4f69ae77..d59644bac 100644
--- a/apps/app_waitforring.c
+++ b/apps/app_waitforring.c
@@ -58,16 +58,17 @@ static int waitforring_exec(struct ast_channel *chan, void *data)
struct ast_module_user *u;
struct ast_frame *f;
int res = 0;
+ double s;
int ms;
- if (!data || (sscanf(data, "%d", &ms) != 1)) {
+ if (!data || (sscanf(data, "%lg", &s) != 1)) {
ast_log(LOG_WARNING, "WaitForRing requires an argument (minimum seconds)\n");
return 0;
}
u = ast_module_user_add(chan);
- ms *= 1000;
+ ms = s*1000.0;
while(ms > 0) {
ms = ast_waitfor(chan, ms);
if (ms < 0) {