aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_musiconhold.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-27 16:16:25 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-27 16:16:25 +0000
commit8b54d69657a6d79760704703482980e559adffcc (patch)
tree0c6119e16fdadd283b4cd42db33111b4147f570b /res/res_musiconhold.c
parent9fed3ea0722a5480ed9ed76bf2c385d70a98d277 (diff)
(closes issue #10419)
Reported by: mustardman Patches: asterisk-mohposition.diff.txt uploaded by jamesgolovich (license 176) This patch fixes a few problems with music on hold. * Fix issues with starting at the beginning of a file when it shouldn't. * Fix the inuse counter to be decremented even if the class had not been set to be deleted when not in use anymore * Don't arbitrarily limit the number of MOH files to 255 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@81042 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_musiconhold.c')
-rw-r--r--res/res_musiconhold.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 08dda0c5f..8949317d3 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -118,8 +118,8 @@ struct moh_files_state {
int origwfmt;
int samples;
int sample_queue;
- unsigned char pos;
- unsigned char save_pos;
+ int pos;
+ int save_pos;
};
#define MOH_QUIET (1 << 0)
@@ -215,7 +215,7 @@ static void moh_files_release(struct ast_channel *chan, void *data)
}
state->save_pos = state->pos;
}
- if (state->class->delete && ast_atomic_dec_and_test(&state->class->inuse))
+ if (ast_atomic_dec_and_test(&state->class->inuse) && state->class->delete)
ast_moh_destroy_one(state->class);
}
@@ -232,9 +232,9 @@ static int ast_moh_files_next(struct ast_channel *chan)
}
/* If a specific file has been saved, use it */
- if (state->save_pos) {
+ if (state->save_pos >= 0) {
state->pos = state->save_pos;
- state->save_pos = 0;
+ state->save_pos = -1;
} else if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
/* Get a random file and ensure we can open it */
for (tries = 0; tries < 20; tries++) {