aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/app.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main/app.c b/main/app.c
index 2384a7d33..a81038804 100644
--- a/main/app.c
+++ b/main/app.c
@@ -830,8 +830,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]);
}