diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c index 2ace3ade38..721f47fae6 100644 --- a/channels/pjsip/dialplan_functions.c +++ b/channels/pjsip/dialplan_functions.c @@ -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; diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 621dd1676d..450c401c13 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -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);