From 80a705c1212ad9ce3e59fff363f405bc8e79a2c1 Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Mon, 15 May 2006 15:30:21 +0000
Subject: [PATCH] Make sure that the channel is answered before doing
 SpeechBackground. (issue #josh-wait-I-dont-have-issue-numbers)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@27194 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_speech_utils.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c
index 8b1194c397..94c48668f7 100644
--- a/apps/app_speech_utils.c
+++ b/apps/app_speech_utils.c
@@ -512,6 +512,12 @@ static int speech_background(struct ast_channel *chan, void *data)
                 return -1;
         }
 
+	/* If channel is not already answered, then answer it */
+	if (chan->_state != AST_STATE_UP && ast_answer(chan)) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
+
         /* Record old read format */
         oldreadformat = chan->readformat;
 
-- 
GitLab