diff --git a/daemon/call.c b/daemon/call.c index bdb5904e2..ee6e22043 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -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; diff --git a/daemon/call_flags.c b/daemon/call_flags.c index 0246731d1..1bda1580d 100644 --- a/daemon/call_flags.c +++ b/daemon/call_flags.c @@ -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`"); diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 37feaea76..89d3cd301 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -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; diff --git a/docs/ng_control_protocol.md b/docs/ng_control_protocol.md index ebe58e35c..470c9532f 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -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 diff --git a/include/call.h b/include/call.h index f88365650..b5861a4d6 100644 --- a/include/call.h +++ b/include/call.h @@ -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) diff --git a/include/call_flags.h b/include/call_flags.h index 1000af767..09ab29d37 100644 --- a/include/call_flags.h +++ b/include/call_flags.h @@ -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; };