From c6852c7563349b726d25b964998dd64eced54c9d Mon Sep 17 00:00:00 2001
From: Grzegorz Sluja <grzegorz.sluja@iopsys.eu>
Date: Tue, 28 Jun 2022 13:31:25 +0000
Subject: [PATCH] Fix call scenario when the CALL_REJECT is received for
 internal call

When the internal call "0000" is proceeded from any of DECT handset, busy tone is heared since we always use
extension_id=0 for the first outgoing call and the call is directed to the same extension_id = 0. In this
case CALL_REJECT is received by asterisk, but connection is not closed due to another channel_state value.
Fix it so that connection is properly closed in this case.
---
 channels/chan_brcm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/channels/chan_brcm.c b/channels/chan_brcm.c
index 65a5c8f3cb..a1d2220164 100644
--- a/channels/chan_brcm.c
+++ b/channels/chan_brcm.c
@@ -2993,6 +2993,8 @@ static void brcm_process_event(struct endpt_event *ev)
 				}
 
 				brcm_send_ubus_event("CALL_REJECTED", ev->line);
+			} else if (sub->channel_state == CALLENDED && owner) {
+					ast_queue_control(owner, AST_CONTROL_HANGUP);
 			}
 			break;
 		case EVENT_SWITCH:
-- 
GitLab