MT#55283 Add `force strip extmap` flag

RTP header extensions are only processed, and unknown ones stripped, if
at least one side of the call negotiated header extensions through
`a=extmap` attributes. Otherwise RTP is forwarded untouched, including
any header extensions an endpoint may include without having announced
them.

Add a `force strip extmap` flag which selects header extension
processing for all streams of a call regardless of whether any
extensions were negotiated, so that unannounced header extensions are
removed. This is useful when forwarding media from sources that always
include header extensions towards endpoints that do not cope with them.

Change-Id: I57e14389c3610550a6859ac08e65ad866283554f
pull/2166/head
dnygate 1 week ago committed by Richard Fuchs
parent 2e74b43c62
commit fdbc23c87d

@ -2759,6 +2759,8 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c
call->last_signal_us = rtpe_now;
call->deleted_us = 0;
if (flags->force_strip_extmap)
CALL_SET(call, FORCE_STRIP_EXTMAP);
call->media_rec_slots = (flags->media_rec_slots > 0 && call->media_rec_slots == 0)
? flags->media_rec_slots
: call->media_rec_slots;

@ -976,6 +976,10 @@ const char *call_ng_flags_flags(str *s, unsigned int idx, helper_arg arg) {
case CSH_LOOKUP("strip-extmap"):
case CSH_LOOKUP("strip extmap"):
return call_ng_flags_str_ht(STR_PTR("all"), 0, &out->rtpext_strip);
case CSH_LOOKUP("force-strip-extmap"):
case CSH_LOOKUP("force strip extmap"):
out->force_strip_extmap = true;
break;
case CSH_LOOKUP("symmetric-codecs"):
case CSH_LOOKUP("symmetric codecs"):
ilog(LOG_INFO, "Ignoring obsolete flag `symmetric-codecs`");

@ -2545,7 +2545,10 @@ static void __determine_rtpext_handler(struct call_media *in, struct call_media
if (!sh || !out)
return;
if (in->extmap.length || out->extmap.length)
/* With `force strip extmap` set on the call, use the extmap printer even
* if no header extensions were negotiated, so that unannounced header
* extensions are removed from forwarded RTP. */
if (in->extmap.length || out->extmap.length || CALL_ISSET(out->call, FORCE_STRIP_EXTMAP))
sh->rtpext = &rtpext_printer_extmap;
else
sh->rtpext = &rtpext_printer_copy;

@ -1367,6 +1367,15 @@ Spaces in each string may be replaced by hyphens.
Legacy alias for `extmap=[strip=[all]]` to remove all `a=rtpmap` attributes
from the outgoing SDP.
* `force strip extmap`
Process RTP header extensions of forwarded media even if no header
extensions were negotiated in the SDP. Normally, RTP header extensions
are passed through untouched if neither side included any `a=extmap`
attributes. With this flag set, header extensions that were not
negotiated are removed from forwarded RTP. Once set, the flag remains
in effect for the lifetime of the call.
* `strict source`
Normally, *rtpengine* attempts to learn the correct endpoint address for every stream during

@ -255,6 +255,7 @@ enum {
#define CALL_FLAG_BLOCK_MEDIA (1LL << 28)
#define CALL_FLAG_SILENCE_MEDIA (1LL << 29)
#define CALL_FLAG_NO_REC_DB (1LL << 30)
#define CALL_FLAG_FORCE_STRIP_EXTMAP (1LL << 31)
/* access macros */
#define SP_ISSET(p, f) bf_isset(&(p)->sp_flags, SP_FLAG_ ## f)

@ -325,7 +325,9 @@ RTPE_NG_FLAGS_STR_CASE_HT_PARAMS
moh_sendrecv:1,
moh_reflect:1,
/* prevents double MoH holds */
moh_double_hold:1;
moh_double_hold:1,
/* process RTP header extensions even if none were negotiated */
force_strip_extmap:1;
};

Loading…
Cancel
Save