From e769c19a31db0d9a64780c7370d22a6160b87ba3 Mon Sep 17 00:00:00 2001
From: Matt Jordan <mjordan@digium.com>
Date: Tue, 6 Sep 2016 15:25:28 -0500
Subject: [PATCH] res/res_stasis_playback: Cancel the entire playlist when a
 stop occurs

Prior to this patch, a stop issued by a delete of a Playback resource
(indicated by the control frame AST_CONTROL_STREAM_STOP) would only stop
the current media URI playing. Subsequent URIs specified by a playback
operation would then proceed on, even though we had just indicated to
the User that the Playback was finished *and* after they had just
'deleted' the resource. Whoops.

This patch corrects it by bailing out of the sequence of URIs to play if
one of them is terminated with an AST_CONTROL_STREAM_STOP indication.

ASTERISK-26341 #close

Change-Id: I2da9ec43545ba46cdfffe287c7e4907eae7fca42
---
 res/res_stasis_playback.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c
index a64ecffa70..cfddb3af56 100644
--- a/res/res_stasis_playback.c
+++ b/res/res_stasis_playback.c
@@ -370,6 +370,9 @@ static void play_on_channel(struct stasis_app_playback *playback,
 
 		playback_final_update(playback, offsetms, res,
 			ast_channel_uniqueid(chan));
+		if (res == AST_CONTROL_STREAM_STOP) {
+			break;
+		}
 
 		/* Reset offset for any subsequent media */
 		offsetms = 0;
-- 
GitLab