diff options
author | Terry Wilson <twilson@digium.com> | 2011-11-23 16:12:34 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2011-11-23 16:12:34 +0000 |
commit | 6d05a31d9fb890d75acd93a9c8c7e3eaa0bc22e5 (patch) | |
tree | a40456f3acddb3463d785fa7ed0c45c502e9a26f /res/res_musiconhold.c | |
parent | f59322f724429baf5da709669394646143401819 (diff) |
Resume playing existing hold music for cached realtime MOH
As a result of the fix for ASTERISK-18039, realtime caching MOH no longer
properly resumes playing back a file between different holds in the same call.
This is because scanning for new files causes the existing file array to be
emptied and we were just comparing that the saved pointer to the filename
matched the pointer to the filename in a particular position in the array. An
easy fix is to save the filename instead of a pointer to it and then do a
strcmp instead of comparing the addresses.
(closes issue ASTERISK-18912)
Review: https://reviewboard.asterisk.org/r/1596/
........
Merged revisions 346030 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 346031 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346033 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_musiconhold.c')
-rw-r--r-- | res/res_musiconhold.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index a857b9ab7..d5f9e2c6f 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -163,7 +163,7 @@ struct moh_files_state { int pos; int save_pos; int save_total; - char *save_pos_filename; + char save_pos_filename[PATH_MAX]; }; #define MOH_QUIET (1 << 0) @@ -298,10 +298,10 @@ static int ast_moh_files_next(struct ast_channel *chan) return -1; } - if (state->pos == 0 && state->save_pos_filename == NULL) { + if (state->pos == 0 && ast_strlen_zero(state->save_pos_filename)) { /* First time so lets play the file. */ state->save_pos = -1; - } else if (state->save_pos >= 0 && state->save_pos < state->class->total_files && state->class->filearray[state->save_pos] == state->save_pos_filename) { + } else if (state->save_pos >= 0 && state->save_pos < state->class->total_files && !strcmp(state->class->filearray[state->save_pos], state->save_pos_filename)) { /* If a specific file has been saved confirm it still exists and that it is still valid */ state->pos = state->save_pos; state->save_pos = -1; @@ -338,7 +338,7 @@ static int ast_moh_files_next(struct ast_channel *chan) } /* Record the pointer to the filename for position resuming later */ - state->save_pos_filename = state->class->filearray[state->pos]; + ast_copy_string(state->save_pos_filename, state->class->filearray[state->pos], sizeof(state->save_pos_filename)); ast_debug(1, "%s Opened file %d '%s'\n", chan->name, state->pos, state->class->filearray[state->pos]); |