summaryrefslogtreecommitdiff
path: root/main/pbx.c
diff options
context:
space:
mode:
authorSteve Murphy <murf@digium.com>2006-10-05 01:40:06 +0000
committerSteve Murphy <murf@digium.com>2006-10-05 01:40:06 +0000
commit3d323f5345583c7d380d79d1773a5625f0b441d1 (patch)
tree77e3c1c2a0db4dee32e111ad819061f2b36f444b /main/pbx.c
parent975ef9de9df8d751f11bc66f0b5f9781b76eaeb0 (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: https://origsvn.digium.com/svn/asterisk/trunk@44435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/main/pbx.c b/main/pbx.c
index d3fb389da..d6f2ad8a2 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -5023,12 +5023,14 @@ static void wait_for_hangup(struct ast_channel *chan, void *data)
{
int res;
struct ast_frame *f;
+ double waitsec;
int waittime;
- if (ast_strlen_zero(data) || (sscanf(data, "%d", &waittime) != 1) || (waittime < 0))
- waittime = -1;
- if (waittime > -1) {
- ast_safe_sleep(chan, waittime * 1000);
+ if (ast_strlen_zero(data) || (sscanf(data, "%lg", &waitsec) != 1) || (waitsec < 0))
+ waitsec = -1;
+ if (waitsec > -1) {
+ waittime = waitsec * 1000.0;
+ ast_safe_sleep(chan, waittime);
} else do {
res = ast_waitfor(chan, -1);
if (res < 0)
@@ -5246,11 +5248,12 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, void *data)
*/
static int pbx_builtin_wait(struct ast_channel *chan, void *data)
{
+ double s;
int ms;
/* Wait for "n" seconds */
- if (data && (ms = atof(data)) > 0) {
- ms *= 1000;
+ if (data && (s = atof(data)) > 0.0) {
+ ms = s*1000.0;
return ast_safe_sleep(chan, ms);
}
return 0;
@@ -5262,6 +5265,7 @@ static int pbx_builtin_wait(struct ast_channel *chan, void *data)
static int pbx_builtin_waitexten(struct ast_channel *chan, void *data)
{
int ms, res;
+ double s;
struct ast_flags flags = {0};
char *opts[1] = { NULL };
char *parse;
@@ -5285,12 +5289,13 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, void *data)
ast_indicate_data(chan, AST_CONTROL_HOLD, opts[0], strlen(opts[0]));
/* Wait for "n" seconds */
- if (args.timeout && (ms = atof(args.timeout)) > 0)
- ms *= 1000;
+ if (args.timeout && (s = atof(args.timeout)) > 0)
+ ms = s * 1000.0;
else if (chan->pbx)
ms = chan->pbx->rtimeout * 1000;
else
ms = 10000;
+
res = ast_waitfordigit(chan, ms);
if (!res) {
if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) {