diff --git a/daemon/call.c b/daemon/call.c index 9d87e2972..d304851ee 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1245,6 +1245,19 @@ static void __ice_offer(const struct sdp_ng_flags *flags, struct call_media *thi if (flags->ice_remove) MEDIA_CLEAR(this, ICE); + if (flags->passthrough_on) { + ilog(LOG_DEBUG, "enabling passthrough mode"); + MEDIA_SET(this, PASSTHRU); + MEDIA_SET(other, PASSTHRU); + return; + } + if (flags->passthrough_off) { + ilog(LOG_DEBUG, "disabling passthrough mode"); + MEDIA_CLEAR(this, PASSTHRU); + MEDIA_CLEAR(other, PASSTHRU); + return; + } + if (!flags->ice_force) { /* special case: if doing ICE on both sides and ice_force is not set, we cannot * be sure that media will pass through us, so we have to disable certain features */ diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index a18481d9c..7592708c6 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -825,6 +825,12 @@ static void call_ng_flags_flags(struct sdp_ng_flags *out, str *s, void *dummy) { case CSH_LOOKUP("pad-crypto"): out->sdes_pad = 1; break; + case CSH_LOOKUP("passthrough"): + out->passthrough_on = 1; + break; + case CSH_LOOKUP("no-passthrough"): + out->passthrough_off = 1; + break; default: // handle values aliases from other dictionaries if (call_ng_flags_prefix(out, s, "SDES-no-", call_ng_flags_str_ht, &out->sdes_no)) @@ -971,6 +977,26 @@ static void call_ng_process_flags(struct sdp_ng_flags *out, bencode_item_t *inpu } } + if (bencode_dictionary_get_str(input, "passthrough", &s)) { + switch (__csh_lookup(&s)) { + case CSH_LOOKUP("on"): + case CSH_LOOKUP("yes"): + case CSH_LOOKUP("enable"): + case CSH_LOOKUP("enabled"): + out->passthrough_on = 1; + break; + case CSH_LOOKUP("no"): + case CSH_LOOKUP("off"): + case CSH_LOOKUP("disable"): + case CSH_LOOKUP("disabled"): + out->passthrough_off = 1; + break; + default: + ilog(LOG_WARN, "Unknown 'passthrough' flag encountered: '"STR_FORMAT"'", + STR_FMT(&s)); + } + } + call_ng_flags_list(out, input, "rtcp-mux", call_ng_flags_rtcp_mux, NULL); call_ng_flags_list(out, input, "SDES", ng_sdes_option, NULL); call_ng_flags_list(out, input, "OSRTP", ng_osrtp_option, NULL); diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 071edaeda..4e43dc58f 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -105,7 +105,9 @@ struct sdp_ng_flags { sdes_lifetime:1, sdes_pad:1, drop_traffic_start:1, - drop_traffic_stop:1; + drop_traffic_stop:1, + passthrough_on:1, + passthrough_off:1; };