[Asterisk-code-review] A non negotiated rtp frame causes call disconnection when there is a ... (asterisk[13])

Paulo Vicentini asteriskteam at digium.com
Tue Feb 25 18:34:29 CST 2020


Paulo Vicentini has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13846 )


Change subject: A non negotiated rtp frame causes call disconnection when there is a SSRC change
......................................................................

A non negotiated rtp frame causes call disconnection when there is a SSRC change

For a non negotiated rtp frame, when there was a SSRC change, the frame
would be marked as a control frame and it would be queued to be written
and then leading to a disconnection (ast_channel_softhangup_internal_flag_add)

ASTERISK-28759

Change-Id: I6d854cc523f343e299a615636fc65bdbd5f809ec
---
M channels/chan_pjsip.c
M res/res_rtp_asterisk.c
2 files changed, 10 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/46/13846/1

diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index c4281c3..99dfb2e 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -797,14 +797,6 @@
 		}
 	}
 
-	if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
-		ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when it has not been negotiated\n",
-			ast_format_get_name(f->subclass.format), ast_channel_name(ast));
-
-		ast_frfree(f);
-		return &ast_null_frame;
-	}
-
 	if (session->dsp) {
 		int dsp_features;
 
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index e5bb94e..6c37d9a 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -5421,6 +5421,7 @@
 	RAII_VAR(struct ast_rtp_payload_type *, payload, NULL, ao2_cleanup);
 	struct ast_sockaddr remote_address = { {0,} };
 	struct frame_list frames;
+	struct ast_channel *ast;
 
 	/* If this is actually RTCP let's hop on over and handle it */
 	if (rtcp) {
@@ -5965,6 +5966,15 @@
 		return &ast_null_frame;;
 	}
 
+	ast = ast_channel_get_by_name(ast_rtp_instance_get_channel_id(instance));
+	if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast),
+				rtp->f.subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
+		ast_debug(1, "Got a frame with format of %s on channel '%s' when it has not been negotiated - seqno=%u\n",
+				ast_format_get_name(rtp->f.subclass.format), ast_channel_name(ast), rtp->f.seqno);
+
+		return &ast_null_frame;
+	}
+
 	AST_LIST_INSERT_TAIL(&frames, &rtp->f, frame_list);
 	return AST_LIST_FIRST(&frames);
 }

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I6d854cc523f343e299a615636fc65bdbd5f809ec
Gerrit-Change-Number: 13846
Gerrit-PatchSet: 1
Gerrit-Owner: Paulo Vicentini <paulo.vicentini at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200225/f646025a/attachment.html>


More information about the asterisk-code-review mailing list