From 95b814553b44c7eda165f17f462dd986cc8c438f Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 28 Sep 2020 13:13:11 -0400 Subject: [PATCH] TT#94201 add ICE=default option Change-Id: If10e0aa284cc7cc5c1e69855733835bd5b52da31 --- README.md | 22 +++++++++++++++------- daemon/call.c | 7 ++++++- daemon/call_interfaces.c | 5 +++++ include/call_interfaces.h | 1 + 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ac5b59f45..9d00aed29 100644 --- a/README.md +++ b/README.md @@ -873,18 +873,26 @@ Optionally included keys are: * `ICE` - Contains a string, valid values are `remove`, `force` or `force-relay`. - With `remove`, any ICE attributes are - stripped from the SDP body. With `force`, ICE attributes are first stripped, then new attributes are - generated and inserted, which leaves the media proxy as the only ICE candidate. The default behavior - (no `ICE` key present at all) is: if no ICE attributes are present, a new set is generated and the - media proxy lists itself as ICE candidate; otherwise, the media proxy inserts itself as a - low-priority candidate. + Contains a string which must be one of the following values: + + With `remove`, any ICE attributes are stripped from the SDP body. + + With `force`, ICE attributes are first stripped, then new attributes are + generated and inserted, which leaves the media proxy as the only ICE candidate. + + With `default`, the behaviour will be the same as with `force` if the incoming SDP already + had ICE attributes listed. If the incoming SDP did not contain ICE attributes, then no + ICE attributes are added. With `force-relay`, existing ICE candidates are left in place except `relay` type candidates, and *rtpengine* inserts itself as a `relay` candidate. It will also leave SDP c= and m= lines unchanged. + The default behavior + (no `ICE` key present at all) is: if no ICE attributes are present, a new set is generated and the + media proxy lists itself as ICE candidate; otherwise, the media proxy inserts itself as a + low-priority candidate. + This flag operates independently of the `replace` flags. * `transport protocol` diff --git a/daemon/call.c b/daemon/call.c index d304851ee..11ac032b8 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1242,7 +1242,12 @@ static void __ice_offer(const struct sdp_ng_flags *flags, struct call_media *thi /* we offer ICE by default */ if (!MEDIA_ISSET(this, INITIALIZED)) MEDIA_SET(this, ICE); - if (flags->ice_remove) + // unless instructed not to + if (flags->ice_default) { + if (!MEDIA_ISSET(other, ICE)) + MEDIA_CLEAR(this, ICE); + } + else if (flags->ice_remove) MEDIA_CLEAR(this, ICE); if (flags->passthrough_on) { diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 7592708c6..19d0d7924 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -932,6 +932,11 @@ static void call_ng_process_flags(struct sdp_ng_flags *out, bencode_item_t *inpu case CSH_LOOKUP("force"): out->ice_force = 1; break; + case CSH_LOOKUP("default"): + out->ice_default = 1; + out->ice_force = 1; + out->ice_remove = 1; + break; case CSH_LOOKUP("force_relay"): case CSH_LOOKUP("force-relay"): case CSH_LOOKUP("force relay"): diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 4e43dc58f..587fb959b 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -58,6 +58,7 @@ struct sdp_ng_flags { ice_remove:1, ice_force:1, ice_force_relay:1, + ice_default:1, rtcp_mux_offer:1, rtcp_mux_require:1, rtcp_mux_demux:1,