diff --git a/README.md b/README.md index 8de6658fc..6f479fc90 100644 --- a/README.md +++ b/README.md @@ -858,6 +858,14 @@ Optionally included keys are: Take control of the version field in the SDP and make sure it's increased every time the SDP changes, and left unchanged if the SDP is the same. + - `zero address` + + Using a zero endpoint address is an obsolete way to signal a + muted or sendonly stream. Streams with zero addresses are + normally flagged as sendonly and the zero address in the SDP is + passed through. With this option set, the zero address is + replaced with a real address. + * `direction` Contains a list of two strings and corresponds to the *rtpproxy* `e` and `i` flags. Each element must diff --git a/daemon/call.c b/daemon/call.c index f2c0f0fb2..28d17ac6b 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1153,7 +1153,8 @@ void __rtp_stats_update(GHashTable *dst, GHashTable *src) { /* we leave previously added but now removed payload types in place */ } -static int __init_streams(struct call_media *A, struct call_media *B, const struct stream_params *sp) { +static int __init_streams(struct call_media *A, struct call_media *B, const struct stream_params *sp, + const struct sdp_ng_flags *flags) { GList *la, *lb; struct packet_stream *a, *ax, *b; unsigned int port_off = 0; @@ -1182,7 +1183,8 @@ static int __init_streams(struct call_media *A, struct call_media *B, const stru PS_CLEAR(b, ZERO_ADDR); if (is_addr_unspecified(&a->advertised_endpoint.address) && !(is_trickle_ice_address(&a->advertised_endpoint) - && MEDIA_ISSET(A, TRICKLE_ICE))) + && MEDIA_ISSET(A, TRICKLE_ICE)) + && !(flags && flags->replace_zero_address)) PS_SET(b, ZERO_ADDR); if (__init_stream(a)) @@ -1239,7 +1241,8 @@ static int __init_streams(struct call_media *A, struct call_media *B, const stru PS_CLEAR(a, ZERO_ADDR); if (is_addr_unspecified(&b->advertised_endpoint.address) && !(is_trickle_ice_address(&b->advertised_endpoint) - && MEDIA_ISSET(B, TRICKLE_ICE))) + && MEDIA_ISSET(B, TRICKLE_ICE)) + && !(flags && flags->replace_zero_address)) PS_SET(a, ZERO_ADDR); if (__init_stream(a)) @@ -2291,9 +2294,9 @@ int monologue_offer_answer(struct call_monologue *other_ml, GQueue *streams, } init: - if (__init_streams(media, other_media, NULL)) + if (__init_streams(media, other_media, NULL, NULL)) return -1; - if (__init_streams(other_media, media, sp)) + if (__init_streams(other_media, media, sp, flags)) return -1; /* we are now ready to fire up ICE if so desired and requested */ diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index b4ffb8eb5..040d2d0ea 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -719,6 +719,9 @@ static void call_ng_flags_replace(struct sdp_ng_flags *out, str *s, void *dummy) case CSH_LOOKUP("SDP-version"): out->replace_sdp_version = 1; break; + case CSH_LOOKUP("zero-address"): + out->replace_zero_address = 1; + break; default: ilog(LOG_WARN, "Unknown 'replace' flag encountered: '" STR_FORMAT "'", STR_FMT(s)); diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 110de1f31..a28d90a26 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -72,6 +72,7 @@ struct sdp_ng_flags { replace_origin:1, replace_sess_conn:1, replace_sdp_version:1, + replace_zero_address:1, rtcp_mux_offer:1, rtcp_mux_require:1, rtcp_mux_demux:1, diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 68957e647..cea7cd5ac 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -130,6 +130,94 @@ SDP new_call; +offer('null address test A w replace option', + { replace => ['zero address'] }, < ['zero address'] }, < ['zero address'] }, < ['zero address'] }, <