From 195abe370e89d6f75e0a3c08f457eb4619c5ecf0 Mon Sep 17 00:00:00 2001
From: Igor Goncharovskiy <igor.goncharovsky@gmail.com>
Date: Thu, 16 Oct 2014 06:04:35 +0000
Subject: [PATCH] Fix loss of voice after second call drops (on a second line)
 in case using multiple lines on unistim phones. There is regression was
 introduced in r391379.

Reported by: Rustam Khankishyiev
(closes issue ASTERISK-23846)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@425667 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_unistim.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index e13cc97058..173230e47f 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -4841,18 +4841,20 @@ static int unistim_hangup(struct ast_channel *ast)
 	} else if (sub->subtype == SUB_RING) {
 		send_no_ring(s);
 		for (i = 0; i < FAVNUM; i++) {
-			if (!soft_key_visible(s->device, i))
+			if (!soft_key_visible(s->device, i)) {
 				continue;
-			if (d->ssub[i] != sub)
+			}
+			if (d->ssub[i] != sub) {
+				if (d->ssub[i] != NULL) { /* Found other subchannel active other then hangup'ed one */
+					end_call = 0;
+				}
 				continue;
+			}
 			if (is_key_line(d, i) && !strcmp(l->name, d->sline[i]->name)) {
 				send_favorite_short(i, FAV_LINE_ICON, s);
 				d->ssub[i] = NULL;
 				continue;
 			}
-			if (d->ssub[i] != NULL) { /* Found other subchannel active other then hangup'ed one */
-				end_call = 0;
-			}
 		}
 	}
 	if (end_call) {
-- 
GitLab