[Asterisk-code-review] Unknown media codec resulting a call disconnect (asterisk[13])

Salah Ahmed asteriskteam at digium.com
Tue Jan 14 22:01:46 CST 2020


Salah Ahmed has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13595 )


Change subject: Unknown media codec resulting a call disconnect
......................................................................

Unknown media codec resulting a call disconnect

While an unknown rtp payloads are received, than call getting
dropped due to codec translation initiation failed.

ASTERISK-28691

Change-Id: I8d2e5c7b16227c2cb07b322c8704d43c189ffae8
---
M channels/chan_pjsip.c
1 file changed, 7 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/95/13595/1

diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 33abe03..6474864 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -788,8 +788,13 @@
 			ao2_ref(caps, -1);
 		}
 
-		ast_set_write_format_path(ast, ast_channel_writeformat(ast), f->subclass.format);
-		ast_set_read_format_path(ast, ast_channel_readformat(ast), f->subclass.format);
+		int wr_fmt_status = ast_set_write_format_path(ast, ast_channel_writeformat(ast), f->subclass.format);
+		int rd_fmt_status = ast_set_read_format_path(ast, ast_channel_readformat(ast), f->subclass.format);
+
+		if (wr_fmt_status == -1 || rd_fmt_status == -1) {
+			ast_frfree(f);
+			return &ast_null_frame;
+		}
 
 		if (ast_channel_is_bridged(ast)) {
 			ast_channel_set_unbridged_nolock(ast, 1);

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I8d2e5c7b16227c2cb07b322c8704d43c189ffae8
Gerrit-Change-Number: 13595
Gerrit-PatchSet: 1
Gerrit-Owner: Salah Ahmed <txrubel at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200114/fe9d1d47/attachment-0001.html>


More information about the asterisk-code-review mailing list