[Asterisk-code-review] chan_sip+native_bridge_rtp: no directmedia for ptime other than defau... (asterisk[13])

Friendly Automation asteriskteam at digium.com
Wed Dec 4 18:04:03 CST 2019


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13350 )

Change subject: chan_sip+native_bridge_rtp: no directmedia for ptime other than default ptime.
......................................................................

chan_sip+native_bridge_rtp: no directmedia for ptime other than default ptime.

During capabilities selection (joint capabilities of us and peer,
configured capability for this peer, or general configured
capabilities), if sip_new() does not keep framing information,
then directmedia activation will fail for any framing different
from default framing.

ASTERISK-28637

Change-Id: I99257502788653c2816fc991cac7946453082466
---
M bridges/bridge_native_rtp.c
M channels/chan_sip.c
2 files changed, 9 insertions(+), 1 deletion(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c
index 34a6a64..3581ab9 100644
--- a/bridges/bridge_native_rtp.c
+++ b/bridges/bridge_native_rtp.c
@@ -715,6 +715,8 @@
 				framing_inst0, framing_inst1);
 			return 0;
 		}
+		ast_debug(3, "Symmetric ptimes on the two call legs (%u). May be able to native bridge in RTP\n",
+			framing_inst0);
 	}
 
 	read_ptime0 = ast_format_cap_get_format_framing(cap0, ast_channel_rawreadformat(bc0->chan));
@@ -728,6 +730,9 @@
 			read_ptime0, write_ptime1, read_ptime1, write_ptime0);
 		return 0;
 	}
+	ast_debug(3, "Bridge '%s': Packetization comparison success between RTP streams (read_ptime0:%d == write_ptime1:%d and read_ptime1:%d == write_ptime0:%d).\n",
+		bridge->uniqueid,
+		read_ptime0, write_ptime1, read_ptime1, write_ptime0);
 
 	return 1;
 }
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 4a8d344..eb147ae 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -8143,8 +8143,11 @@
 	/* Use only the preferred audio format, which is stored at the '0' index */
 	fmt = ast_format_cap_get_best_by_type(what, AST_MEDIA_TYPE_AUDIO); /* get the best audio format */
 	if (fmt) {
+		int framing;
+
 		ast_format_cap_remove_by_type(caps, AST_MEDIA_TYPE_AUDIO); /* remove only the other audio formats */
-		ast_format_cap_append(caps, fmt, 0); /* add our best choice back */
+		framing = ast_format_cap_get_format_framing(what, fmt);
+		ast_format_cap_append(caps, fmt, framing); /* add our best choice back */
 	} else {
 		/* If we don't have an audio format, try to get something */
 		fmt = ast_format_cap_get_format(caps, 0);

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I99257502788653c2816fc991cac7946453082466
Gerrit-Change-Number: 13350
Gerrit-PatchSet: 1
Gerrit-Owner: Frederic LE FOLL <frederic.lefoll at c-s.fr>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191204/2b93a053/attachment.html>


More information about the asterisk-code-review mailing list