diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2001-08-05 21:56:28 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2001-08-05 21:56:28 +0000 |
commit | 747329c2c909b6e54b2158c060410bb392ba1c55 (patch) | |
tree | 74336a5e905286265df4cf00dc74282ec1faa3ad /app.c | |
parent | e3b8316f38648e50c0a7c52cba5fbfa1aaedcf5a (diff) |
Version 0.1.9 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@350 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'app.c')
-rwxr-xr-x | app.c | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -0,0 +1,43 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Channel Management + * + * Copyright (C) 1999, Mark Spencer + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +#include <stdio.h> +#include <stdlib.h> +#include <pthread.h> +#include <string.h> +#include <sys/time.h> +#include <signal.h> +#include <errno.h> +#include <unistd.h> +#include <asterisk/channel.h> +#include <asterisk/file.h> +#include <asterisk/app.h> + +/* set timeout to 0 for "standard" timeouts. Set timeout to -1 for + "ludicrous time" (essentially never times out) */ +int ast_app_getdata(struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout) +{ + int res,to,fto; + if (prompt) { + res = ast_streamfile(c, prompt, c->language); + if (res < 0) + return res; + } + fto = 6000; + to = 2000; + if (timeout > 0) fto = to = timeout; + if (timeout < 0) fto = to = 1000000000; + res = ast_readstring(c, s, maxlen, to, fto, "#"); + return res; +} + |