[svn-commits] kmoore: branch 1.8 r331038 - /branches/1.8/res/res_musiconhold.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 8 15:52:50 CDT 2011


Author: kmoore
Date: Mon Aug  8 15:52:45 2011
New Revision: 331038

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=331038
Log:
In-queue MOH stops after a periodic announcement

If the seek value is past the end of file when resuming G.722 MOH, MOH will
cease to function for the duration of the MOH session through all starts and
stops until saved state is cleared.  Adjusting the code to guarantee a single
valid read (which is already assumed) fixes the bug.

(closes issue ASTERISK-18077)
Review: https://reviewboard.asterisk.org/r/1328/
Tested-by: Jonathan Rose <jrose at digium.com>

Modified:
    branches/1.8/res/res_musiconhold.c

Modified: branches/1.8/res/res_musiconhold.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_musiconhold.c?view=diff&rev=331038&r1=331037&r2=331038
==============================================================================
--- branches/1.8/res/res_musiconhold.c (original)
+++ branches/1.8/res/res_musiconhold.c Mon Aug  8 15:52:45 2011
@@ -338,7 +338,16 @@
 	ast_debug(1, "%s Opened file %d '%s'\n", chan->name, state->pos, state->class->filearray[state->pos]);
 
 	if (state->samples) {
+		size_t loc;
+		/* seek *SHOULD* be good since it's from a known location */
 		ast_seekstream(chan->stream, state->samples, SEEK_SET);
+		/* if the seek failed then recover because if there is not a valid read,
+		 * moh_files_generate will return -1 and MOH will stop */
+		loc = ast_tellstream(chan->stream);
+		if (state->samples > loc && loc) {
+			/* seek one sample from the end for one guaranteed valid read */
+			ast_seekstream(chan->stream, 1, SEEK_END);
+		}
 	}
 
 	return 0;




More information about the svn-commits mailing list