From a6b48f353a2b6e799b893cb0cce4db6ccacd9a03 Mon Sep 17 00:00:00 2001 From: markster Date: Wed, 19 Jun 2002 02:35:40 +0000 Subject: Version 0.1.12 from FTP git-svn-id: http://svn.digium.com/svn/asterisk/trunk@462 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_record.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'apps') diff --git a/apps/app_record.c b/apps/app_record.c index d5937b6ee..4ad4a15fd 100755 --- a/apps/app_record.c +++ b/apps/app_record.c @@ -11,6 +11,7 @@ * the GNU General Public License */ +#include #include #include #include @@ -51,7 +52,7 @@ static int record_exec(struct ast_channel *chan, void *data) struct ast_filestream *s = '\0'; struct localuser *u; - struct ast_frame *f; + struct ast_frame *f = NULL; vdata = data; /* explained above */ @@ -103,10 +104,8 @@ static int record_exec(struct ast_channel *chan, void *data) /* Some code to play a nice little beep to signify the start of the record operation */ res = ast_streamfile(chan, "beep", chan->language); if (!res) { - printf("Waiting on stream\n"); res = ast_waitstream(chan, ""); } else { - printf("streamfile failed\n"); ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", chan->name); } ast_stopstream(chan); @@ -114,8 +113,12 @@ static int record_exec(struct ast_channel *chan, void *data) s = ast_writefile( tmp, ext, NULL, O_CREAT|O_TRUNC|O_WRONLY , 0, 0644); if (s) { - - while ((f = ast_read(chan))) { + while (ast_waitfor(chan, -1) > -1) { + f = ast_read(chan); + if (!f) { + res = -1; + break; + } if (f->frametype == AST_FRAME_VOICE) { res = ast_writestream(s, f); -- cgit v1.2.3