diff options
author | Mark Spencer <markster@digium.com> | 2002-06-19 02:35:40 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2002-06-19 02:35:40 +0000 |
commit | ed6b4c821e61d95afb7aefd2ca9b179a1a6d98c9 (patch) | |
tree | 3ff15e070e8ca74e6aca37f815772ec2f59b4e2f /apps/app_record.c | |
parent | ede7bca2a7f0c64b0244626bbbbfbcc4dbd946eb (diff) |
Version 0.1.12 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_record.c')
-rwxr-xr-x | apps/app_record.c | 13 |
1 files changed, 8 insertions, 5 deletions
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 <asterisk/lock.h> #include <asterisk/file.h> #include <asterisk/logger.h> #include <asterisk/channel.h> @@ -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); |