diff options
-rw-r--r-- | main/app.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/main/app.c b/main/app.c index bcecff568..2c448d549 100644 --- a/main/app.c +++ b/main/app.c @@ -731,8 +731,16 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, * off the recording. However, if we ended with '#', we don't want * to trim ANY part of the recording. */ - if (res > 0 && totalsilence) + if (res > 0 && totalsilence) { ast_stream_rewind(others[x], totalsilence - 200); + /* Reduce duration by a corresponding amount */ + if (x == 0 && *duration) { + *duration -= (totalsilence - 200) / 1000; + if (*duration < 0) { + *duration = 0; + } + } + } ast_truncstream(others[x]); ast_closestream(others[x]); } |