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

Kevin Harwell asteriskteam at digium.com
Tue Jun 30 11:34:27 CDT 2020


Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14623 )


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/23/14623/1

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 cda0953..f34f7c9 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/+/14623
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I0f7dc86fd0fb607c308e6f98ede303c54d1eacb6
Gerrit-Change-Number: 14623
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200630/4c226e48/attachment.html>


More information about the asterisk-code-review mailing list