aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-09 14:50:50 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-09 14:50:50 +0000
commit9fbe20af6c50cdd88fb90b3f47eca9fea4c6161a (patch)
treea7ca2ff6f66f209bb62eed32dd71147ca58ff961 /res
parent00c534ba474a02ff29198226ef609440337fbb28 (diff)
Merged revisions 174219 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r174219 | file | 2009-02-09 10:49:24 -0400 (Mon, 09 Feb 2009) | 11 lines Merged revisions 174218 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r174218 | file | 2009-02-09 10:48:21 -0400 (Mon, 09 Feb 2009) | 4 lines Don't overwrite our pointer to the music class when music on hold stops. We will use this if it starts again to see if we can resume the music where it left off. (closes issue #14407) Reported by: mostyn ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@174221 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_musiconhold.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 6bde1dbe0..c59cdb92d 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -213,7 +213,7 @@ static void moh_files_release(struct ast_channel *chan, void *data)
state->save_pos = state->pos;
- state->class = mohclass_unref(state->class);
+ mohclass_unref(state->class);
}
static int ast_moh_files_next(struct ast_channel *chan)
@@ -314,8 +314,6 @@ static void *moh_files_alloc(struct ast_channel *chan, void *params)
if (!chan->music_state && (state = ast_calloc(1, sizeof(*state)))) {
chan->music_state = state;
- state->class = mohclass_ref(class);
- state->save_pos = -1;
} else {
state = chan->music_state;
}
@@ -325,17 +323,13 @@ static void *moh_files_alloc(struct ast_channel *chan, void *params)
}
if (state->class != class) {
- /* (re-)initialize */
- if (state->class) {
- state->class = mohclass_unref(state->class);
- }
memset(state, 0, sizeof(*state));
- state->class = mohclass_ref(class);
- if (ast_test_flag(state->class, MOH_RANDOMIZE) && class->total_files) {
+ if (ast_test_flag(class, MOH_RANDOMIZE) && class->total_files) {
state->pos = ast_random() % class->total_files;
}
}
+ state->class = mohclass_ref(class);
state->origwfmt = chan->writeformat;
ast_verb(3, "Started music on hold, class '%s', on %s\n", class->name, chan->name);