[Asterisk-code-review] PJSIP_MEDIA_OFFER: override configuration on refresh (asterisk[17])

Joshua Colp asteriskteam at digium.com
Mon Jul 6 10:51:05 CDT 2020


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14618 )

Change subject: PJSIP_MEDIA_OFFER: override configuration on refresh
......................................................................

PJSIP_MEDIA_OFFER: override configuration on refresh

When using the PSJIP_MEDIA_OFFER dialplan function it was not
overriding an endpoint's configured codecs on refresh unless
they had a shared codec between the two.

This patch makes it so whatever is set using PJSIP_MEDIA_OFFER
is used when creating the SDP for a refresh no matter what.

ASTERISK-28878 #close

Change-Id: I0f7dc86fd0fb607c308e6f98ede303c54d1eacb6
---
M channels/pjsip/dialplan_functions.c
M res/res_pjsip_session.c
2 files changed, 3 insertions(+), 1 deletion(-)

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



diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c
index 2ace3ad..721f47f 100644
--- a/channels/pjsip/dialplan_functions.c
+++ b/channels/pjsip/dialplan_functions.c
@@ -1363,6 +1363,7 @@
 	ast_format_cap_remove_by_type(caps, data->media_type);
 	ast_format_cap_update_by_allow_disallow(caps, data->value, 1);
 	ast_stream_set_formats(stream, caps);
+	ast_stream_set_metadata(stream, "pjsip_session_refresh", "force");
 	ao2_ref(caps, -1);
 
 	return 0;
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 2bf69f1..980a1e9 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1730,7 +1730,8 @@
 				}
 
 				/* Enforce the configured allowed codecs on audio and video streams */
-				if (ast_stream_get_type(stream) == AST_MEDIA_TYPE_AUDIO || ast_stream_get_type(stream) == AST_MEDIA_TYPE_VIDEO) {
+				if ((ast_stream_get_type(stream) == AST_MEDIA_TYPE_AUDIO || ast_stream_get_type(stream) == AST_MEDIA_TYPE_VIDEO) &&
+					!ast_stream_get_metadata(stream, "pjsip_session_refresh")) {
 					struct ast_format_cap *joint_cap;
 
 					joint_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);

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

Gerrit-Project: asterisk
Gerrit-Branch: 17
Gerrit-Change-Id: I0f7dc86fd0fb607c308e6f98ede303c54d1eacb6
Gerrit-Change-Number: 14618
Gerrit-PatchSet: 2
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200706/98ebbf9e/attachment.html>


More information about the asterisk-code-review mailing list