diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-10-31 17:56:21 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-10-31 17:56:21 +0000 |
commit | 27c7c3edf544bd0c3dfa1a98870463fb46de080a (patch) | |
tree | ee39df134bd5025e4e5b628c86d51c4c29c9d0d1 | |
parent | 99a3354d8fb683c6a766684d054f8c2eaf56a302 (diff) |
Restore operation of the option that only writes when the channel is bridged.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@87850 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | apps/app_mixmonitor.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 6db3b02f0..16f216c47 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -98,6 +98,7 @@ struct mixmonitor { char *post_process; char *name; unsigned int flags; + struct ast_channel *chan; }; enum { @@ -165,26 +166,28 @@ static void *mixmonitor_thread(void *obj) if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR))) continue; - /* Initialize the file if not already done so */ - if (!fs && !errflag) { - oflags = O_CREAT | O_WRONLY; - oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC; - - if ((ext = strrchr(mixmonitor->filename, '.'))) - *(ext++) = '\0'; - else - ext = "raw"; - - if (!(fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0644))) { - ast_log(LOG_ERROR, "Cannot open %s.%s\n", mixmonitor->filename, ext); - errflag = 1; + if (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED) || ast_bridged_channel(mixmonitor->chan)) { + /* Initialize the file if not already done so */ + if (!fs && !errflag) { + oflags = O_CREAT | O_WRONLY; + oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC; + + if ((ext = strrchr(mixmonitor->filename, '.'))) + *(ext++) = '\0'; + else + ext = "raw"; + + if (!(fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0644))) { + ast_log(LOG_ERROR, "Cannot open %s.%s\n", mixmonitor->filename, ext); + errflag = 1; + } } + + /* Write out frame */ + if (fs) + ast_writestream(fs, fr); } - /* Write out frame */ - if (fs) - ast_writestream(fs, fr); - /* All done! free it. */ ast_frame_free(fr, 0); @@ -245,6 +248,7 @@ static void launch_monitor_thread(struct ast_channel *chan, const char *filename /* Copy over flags and channel name */ mixmonitor->flags = flags; + mixmonitor->chan = chan; mixmonitor->name = (char *) mixmonitor + sizeof(*mixmonitor); strcpy(mixmonitor->name, chan->name); if (!ast_strlen_zero(postprocess2)) { |