diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index e4ea1647948c03eb9ef15553f7c360cf5cc0d4f7..6024e9da846c611de7659e6e35b484fdc060b062 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -318,10 +318,17 @@ static int ast_moh_files_next(struct ast_channel *chan)
 		state->samples = 0;
 	}
 
-	if (!ast_openstream_full(chan, state->class->filearray[state->pos], chan->language, 1)) {
+	for (tries = 0; tries < state->class->total_files; ++tries) {
+		if (ast_openstream_full(chan, state->class->filearray[state->pos], chan->language, 1)) {
+			break;
+		}
+
 		ast_log(LOG_WARNING, "Unable to open file '%s': %s\n", state->class->filearray[state->pos], strerror(errno));
 		state->pos++;
 		state->pos %= state->class->total_files;
+	}
+
+	if (tries == state->class->total_files) {
 		return -1;
 	}