Browse Source

TT#91151 add new replace-zero-address option

closes #1185

Change-Id: I8cf6f4ff043649255dafa93b28fcb2127ce4d2bb
pull/1194/head
Richard Fuchs 5 years ago
parent
commit
1785f70637
5 changed files with 108 additions and 5 deletions
  1. +8
    -0
      README.md
  2. +8
    -5
      daemon/call.c
  3. +3
    -0
      daemon/call_interfaces.c
  4. +1
    -0
      include/call_interfaces.h
  5. +88
    -0
      t/auto-daemon-tests.pl

+ 8
- 0
README.md View File

@ -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


+ 8
- 5
daemon/call.c View File

@ -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 */


+ 3
- 0
daemon/call_interfaces.c View File

@ -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));


+ 1
- 0
include/call_interfaces.h View File

@ -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,


+ 88
- 0
t/auto-daemon-tests.pl View File

@ -130,6 +130,94 @@ SDP
new_call;
offer('null address test A w replace option',
{ replace => ['zero address'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.101.40
s=tester
t=0 0
m=audio 16478 RTP/AVP 8
c=IN IP4 0.0.0.0
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.101.40
s=tester
t=0 0
m=audio PORT RTP/AVP 8
c=IN IP4 203.0.113.1
a=rtpmap:8 PCMA/8000
a=sendonly
a=rtcp:PORT
SDP
new_call;
offer('null address test B w replace option',
{ replace => ['zero address'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.101.40
s=tester
c=IN IP4 0.0.0.0
t=0 0
m=audio 16478 RTP/AVP 8
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.101.40
s=tester
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8
a=rtpmap:8 PCMA/8000
a=sendonly
a=rtcp:PORT
SDP
new_call;
offer('null address test A trickle w replace option',
{ replace => ['zero address'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.101.40
s=tester
t=0 0
m=audio 9 RTP/AVP 8
c=IN IP4 0.0.0.0
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.101.40
s=tester
t=0 0
m=audio PORT RTP/AVP 8
c=IN IP4 203.0.113.1
a=rtpmap:8 PCMA/8000
a=sendonly
a=rtcp:PORT
SDP
new_call;
offer('null address test B trickle w replace option',
{ replace => ['zero address'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.101.40
s=tester
c=IN IP4 0.0.0.0
t=0 0
m=audio 9 RTP/AVP 8
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.101.40
s=tester
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8
a=rtpmap:8 PCMA/8000
a=sendonly
a=rtcp:PORT
SDP
new_call;
offer('null address test C',
{ }, <<SDP);
v=0


Loading…
Cancel
Save