|
|
|
@ -758,15 +758,7 @@ void sdp_free(GQueue *sessions) { |
|
|
|
static int fill_stream_address(struct stream_input *si, struct sdp_media *media, struct sdp_ng_flags *flags) { |
|
|
|
struct sdp_session *session = media->session; |
|
|
|
|
|
|
|
if (flags->media_address.s) { |
|
|
|
if (is_addr_unspecified(&flags->parsed_media_address)) { |
|
|
|
if (__parse_address(&flags->parsed_media_address, NULL, NULL, |
|
|
|
&flags->media_address)) |
|
|
|
return -1; |
|
|
|
} |
|
|
|
si->stream.ip46 = flags->parsed_media_address; |
|
|
|
} |
|
|
|
else if (!flags->trust_address) { |
|
|
|
if (!flags->trust_address) { |
|
|
|
if (is_addr_unspecified(&flags->parsed_received_from)) { |
|
|
|
if (__parse_address(&flags->parsed_received_from, NULL, &flags->received_from_family, |
|
|
|
&flags->received_from_address)) |
|
|
|
@ -1095,7 +1087,7 @@ static int insert_ice_address_alt(struct sdp_chopper *chop, struct streamrelay * |
|
|
|
} |
|
|
|
|
|
|
|
static int replace_network_address(struct sdp_chopper *chop, struct network_address *address, |
|
|
|
struct streamrelay *sr) |
|
|
|
struct streamrelay *sr, struct sdp_ng_flags *flags) |
|
|
|
{ |
|
|
|
char buf[64]; |
|
|
|
int len; |
|
|
|
@ -1106,9 +1098,20 @@ static int replace_network_address(struct sdp_chopper *chop, struct network_addr |
|
|
|
if (copy_up_to(chop, &address->address_type)) |
|
|
|
return -1; |
|
|
|
|
|
|
|
mutex_lock(&sr->up->up->lock); |
|
|
|
call_stream_address(buf, sr->up, SAF_NG, &len); |
|
|
|
mutex_unlock(&sr->up->up->lock); |
|
|
|
if (!is_addr_unspecified(&flags->parsed_media_address)) { |
|
|
|
if (IN6_IS_ADDR_V4MAPPED(&flags->parsed_media_address)) |
|
|
|
len = sprintf(buf, "IP4 " IPF, IPP(flags->parsed_media_address.s6_addr32[3])); |
|
|
|
else { |
|
|
|
memcpy(buf, "IP6 ", 4); |
|
|
|
inet_ntop(AF_INET6, &flags->parsed_media_address, buf + 4, sizeof(buf)-4); |
|
|
|
len = strlen(buf); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
mutex_lock(&sr->up->up->lock); |
|
|
|
call_stream_address(buf, sr->up, SAF_NG, &len); |
|
|
|
mutex_unlock(&sr->up->up->lock); |
|
|
|
} |
|
|
|
chopper_append_dup(chop, buf, len); |
|
|
|
|
|
|
|
if (skip_over(chop, &address->address)) |
|
|
|
@ -1454,6 +1457,13 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call *call, |
|
|
|
off = opmode; |
|
|
|
m = call->callstreams->head; |
|
|
|
do_ice = (flags->ice_force || (!has_ice(sessions) && !flags->ice_remove)) ? 1 : 0; |
|
|
|
if (flags->media_address.s) { |
|
|
|
if (is_addr_unspecified(&flags->parsed_media_address)) { |
|
|
|
if (__parse_address(&flags->parsed_media_address, NULL, NULL, |
|
|
|
&flags->media_address)) |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (l = sessions->head; l; l = l->next) { |
|
|
|
session = l->data; |
|
|
|
@ -1474,11 +1484,11 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call *call, |
|
|
|
fill_relays(&rtp, &rtcp, m, off, NULL, NULL); |
|
|
|
|
|
|
|
if (session->origin.parsed && flags->replace_origin) { |
|
|
|
if (replace_network_address(chop, &session->origin.address, rtp)) |
|
|
|
if (replace_network_address(chop, &session->origin.address, rtp, flags)) |
|
|
|
goto error; |
|
|
|
} |
|
|
|
if (session->connection.parsed && sess_conn) { |
|
|
|
if (replace_network_address(chop, &session->connection.address, rtp)) |
|
|
|
if (replace_network_address(chop, &session->connection.address, rtp, flags)) |
|
|
|
goto error; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1515,7 +1525,7 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call *call, |
|
|
|
goto error; |
|
|
|
|
|
|
|
if (media->connection.parsed) { |
|
|
|
if (replace_network_address(chop, &media->connection.address, rtp)) |
|
|
|
if (replace_network_address(chop, &media->connection.address, rtp, flags)) |
|
|
|
goto error; |
|
|
|
} |
|
|
|
|
|
|
|
|