From: Sean Bright Date: Fri, 18 Sep 2020 20:02:27 +0000 (-0400) Subject: res_musiconhold: Start playlist after initial announcement X-Git-Tag: 17.9.0-rc1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ba11fed7e47c660c34e4fcdfbf05d42130516da;p=thirdparty%2Fasterisk.git res_musiconhold: Start playlist after initial announcement Only track our sample offset if we are playing a non-announcement file, otherwise we will skip that number of samples when we start playing the first MoH file. ASTERISK-24329 #close Change-Id: Ib6b3c84fcaa1063889ab38ba7e7fc50050a3ccfc --- diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 3749d7b98c..46bc4b905d 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -477,7 +477,12 @@ static int moh_files_generator(struct ast_channel *chan, void *data, int len, in return -1; } - state->samples += f->samples; + /* Only track our offset within the current file if we are not in the + * the middle of an announcement */ + if (!state->announcement) { + state->samples += f->samples; + } + state->sample_queue -= f->samples; if (ast_format_cmp(f->subclass.format, state->mohwfmt) == AST_FORMAT_CMP_NOT_EQUAL) { ao2_replace(state->mohwfmt, f->subclass.format);