[asterisk-commits] file: branch 1.4 r174218 - /branches/1.4/res/res_musiconhold.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 9 08:48:22 CST 2009


Author: file
Date: Mon Feb  9 08:48:21 2009
New Revision: 174218

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174218
Log:
Don't overwrite our pointer to the music class when music on hold stops. We will use this if it starts again to see if we can resume the music where it left off.
(closes issue #14407)
Reported by: mostyn

Modified:
    branches/1.4/res/res_musiconhold.c

Modified: branches/1.4/res/res_musiconhold.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/res/res_musiconhold.c?view=diff&rev=174218&r1=174217&r2=174218
==============================================================================
--- branches/1.4/res/res_musiconhold.c (original)
+++ branches/1.4/res/res_musiconhold.c Mon Feb  9 08:48:21 2009
@@ -202,7 +202,7 @@
 
 	state->save_pos = state->pos;
 
-	state->class = mohclass_unref(state->class);
+	mohclass_unref(state->class);
 }
 
 
@@ -307,8 +307,6 @@
 
 	if (!chan->music_state && (state = ast_calloc(1, sizeof(*state)))) {
 		chan->music_state = state;
-		state->class = mohclass_ref(class);
-		state->save_pos = -1;
 	} else {
 		state = chan->music_state;
 	}
@@ -318,17 +316,13 @@
 	}
 
 	if (state->class != class) {
-		/* (re-)initialize */
-		if (state->class) {
-			state->class = mohclass_unref(state->class);
-		}
 		memset(state, 0, sizeof(*state));
-		state->class = mohclass_ref(class);
-		if (ast_test_flag(state->class, MOH_RANDOMIZE) && class->total_files) {
+		if (ast_test_flag(class, MOH_RANDOMIZE) && class->total_files) {
 			state->pos = ast_random() % class->total_files;
 		}
 	}
 
+	state->class = mohclass_ref(class);
 	state->origwfmt = chan->writeformat;
 
 	if (option_verbose > 2) {




More information about the asterisk-commits mailing list