[Asterisk-code-review] chan_pjsip: Prevent segfault when running PlayDTMF on hungup channel (...asterisk[16])

Friendly Automation asteriskteam at digium.com
Thu Oct 10 07:26:23 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/12992 )

Change subject: chan_pjsip: Prevent segfault when running PlayDTMF on hungup channel
......................................................................

chan_pjsip: Prevent segfault when running PlayDTMF on hungup channel

ASTERISK-28086 #close

Change-Id: Ib3baadc89b9f0477a6f25a63861433812368c5ea
---
M channels/chan_pjsip.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 5b91dfd..a54f6d9 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -2267,6 +2267,12 @@
 	struct ast_sip_session_media *media;
 	int res = 0;
 
+	if (!channel || !channel->session) {
+		/* This happens when the channel is hungup while a DTMF digit is playing. See ASTERISK-28086 */
+		ast_debug(3, "Channel %s disappeared while calling digit_end\n", ast_channel_name(ast));
+		return -1;
+	}
+
 	media = channel->session->active_media_state->default_session[AST_MEDIA_TYPE_AUDIO];
 
 	switch (channel->session->dtmf) {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12992
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ib3baadc89b9f0477a6f25a63861433812368c5ea
Gerrit-Change-Number: 12992
Gerrit-PatchSet: 2
Gerrit-Owner: lvl <digium at lvlconsultancy.nl>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191010/4105e3e5/attachment-0001.html>


More information about the asterisk-code-review mailing list