[Asterisk-code-review] chan pjsip: Don't change formats when frame of unsupported f... (asterisk[certified/13.1])

Joshua Colp asteriskteam at digium.com
Thu Jul 16 10:56:00 CDT 2015


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/904

Change subject: chan_pjsip: Don't change formats when frame of unsupported format is received.
......................................................................

chan_pjsip: Don't change formats when frame of unsupported format is received.

Receipt of an RTP packet currently causes the formats on a PJSIP channel to
change to the format of the RTP packet. In some off-nominal cases it's possible
for this to be a format that has not been configured or negotiated. This change
makes it so only formats explicitly configured on the endpoint are allowed.

ASTERISK-25258 #close

Change-Id: If93d641fb6418a285928839300d7854cab8c1020
---
M channels/chan_pjsip.c
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/04/904/2

diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 2907d46..ff301db 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -627,7 +627,14 @@
 		return f;
 	}
 
-	if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
+
+	if (ast_format_cap_iscompatible_format(channel->session->endpoint->media.codecs, f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
+		ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when endpoint '%s' is not configured for it\n",
+			ast_format_get_name(f->subclass.format), ast_channel_name(ast),
+			ast_sorcery_object_get_id(channel->session->endpoint));
+
+		return &ast_null_frame;
+	} else if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
 		struct ast_format_cap *caps;
 
 		ast_debug(1, "Oooh, format changed to %s\n", ast_format_get_name(f->subclass.format));

-- 
To view, visit https://gerrit.asterisk.org/904
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If93d641fb6418a285928839300d7854cab8c1020
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list