aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_record.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-06-19 02:35:40 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-06-19 02:35:40 +0000
commita6b48f353a2b6e799b893cb0cce4db6ccacd9a03 (patch)
tree3ff15e070e8ca74e6aca37f815772ec2f59b4e2f /apps/app_record.c
parent086b38c816adbabf3451bf9b7adee64bf2cb9c9b (diff)
Version 0.1.12 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@462 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_record.c')
-rwxr-xr-xapps/app_record.c13
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);