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/branches/1.4@81042
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
int origwfmt;
int samples;
int sample_queue;
- unsigned char pos;
- unsigned char save_pos;
+ int pos;
+ int save_pos;
};
#define MOH_QUIET (1 << 0)
}
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);
}
}
/* 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++) {