]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
PJSIP_MEDIA_OFFER: override configuration on refresh
authorKevin Harwell <kharwell@digium.com>
Tue, 30 Jun 2020 16:08:47 +0000 (11:08 -0500)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Mon, 6 Jul 2020 14:05:41 +0000 (09:05 -0500)
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

channels/pjsip/dialplan_functions.c
res/res_pjsip_session.c

index 2ace3ade3814717a7c735ba1fbde908276fdc0d7..721f47fae6d72830d1615a36a21c3ee41240c1f0 100644 (file)
@@ -1363,6 +1363,7 @@ static int media_offer_write_av(void *obj)
        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;
index 621dd1676d4253ca3c099c6b2ffa409858984ee5..450c401c13610a11b0567bb90db13a614deff37a 100644 (file)
@@ -1731,7 +1731,8 @@ static int sip_session_refresh(struct ast_sip_session *session,
                                }
 
                                /* 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);