Skip to content
Snippets Groups Projects
Commit e2353869 authored by Russell Bryant's avatar Russell Bryant
Browse files

Merged revisions 81042 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81042 | russell | 2007-08-27 11:16:25 -0500 (Mon, 27 Aug 2007) | 11 lines

(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: https://origsvn.digium.com/svn/asterisk/trunk@81043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 263b7763
Branches
Tags
No related merge requests found
...@@ -117,8 +117,8 @@ struct moh_files_state { ...@@ -117,8 +117,8 @@ struct moh_files_state {
int origwfmt; int origwfmt;
int samples; int samples;
int sample_queue; int sample_queue;
unsigned char pos; int pos;
unsigned char save_pos; int save_pos;
}; };
#define MOH_QUIET (1 << 0) #define MOH_QUIET (1 << 0)
...@@ -214,7 +214,7 @@ static void moh_files_release(struct ast_channel *chan, void *data) ...@@ -214,7 +214,7 @@ static void moh_files_release(struct ast_channel *chan, void *data)
} }
state->save_pos = state->pos; 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); ast_moh_destroy_one(state->class);
} }
...@@ -231,9 +231,9 @@ static int ast_moh_files_next(struct ast_channel *chan) ...@@ -231,9 +231,9 @@ static int ast_moh_files_next(struct ast_channel *chan)
} }
/* If a specific file has been saved, use it */ /* If a specific file has been saved, use it */
if (state->save_pos) { if (state->save_pos >= 0) {
state->pos = state->save_pos; state->pos = state->save_pos;
state->save_pos = 0; state->save_pos = -1;
} else if (ast_test_flag(state->class, MOH_RANDOMIZE)) { } else if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
/* Get a random file and ensure we can open it */ /* Get a random file and ensure we can open it */
for (tries = 0; tries < 20; tries++) { for (tries = 0; tries < 20; tries++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment