From 858fa5eb2c96149fffda629b727f8009e3b367fc Mon Sep 17 00:00:00 2001
From: Alexander Traud <pabstraud@compuserve.com>
Date: Fri, 26 Aug 2016 15:41:16 +0200
Subject: [PATCH] channel: No hung-up on failing security requirements.

In your Diaplan, if you specify
 same => n,Set(CHANNEL(secure_bridge_media)=1)
 same => n,Set(CHANNEL(secure_bridge_signaling)=1)
only the SIP channel driver chan_sip supports this. All other channels drivers
like res_pjsip fail. In case of failure, the original sRTP source code released
the whole channel, even if not hung-up, yet. This change does not release the
channel but instead hangs-up the channel.

ASTERISK-26306

Change-Id: I0489f0cb660fab6673b0db8af027d116e70a66db
---
 main/channel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/channel.c b/main/channel.c
index 1f18d53b15..94505ad0e8 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -6093,7 +6093,7 @@ struct ast_channel *ast_request(const char *type, struct ast_format_cap *request
 
 		if (set_security_requirements(requestor, c)) {
 			ast_log(LOG_WARNING, "Setting security requirements failed\n");
-			c = ast_channel_release(c);
+			ast_hangup(c);
 			*cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
 			return NULL;
 		}
-- 
GitLab