diff --git a/daemon/call.c b/daemon/call.c index 3619d48a7..f0bd92df9 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1025,6 +1025,13 @@ static void __fill_stream(struct packet_stream *ps, const struct endpoint *epp, && !ice_ufrag_cmp(media->ice_agent, &sp->ice_ufrag)) return; + if (ps->selected_sfd && ep.address.family != ps->selected_sfd->socket.family) { + ilog(LOG_WARN, "Ignoring updated remote endpoint %s%s%s as the local " + "socket is %s", FMT_M(endpoint_print_buf(&ep)), + ps->selected_sfd->socket.family->name); + return; + } + ps->endpoint = ep; if (PS_ISSET(ps, FILLED) && !MEDIA_ISSET(media, DTLS)) { @@ -1033,8 +1040,8 @@ static void __fill_stream(struct packet_stream *ps, const struct endpoint *epp, dtls_shutdown(ps); } - ilog(LOG_DEBUG, "set FILLED flag for stream %s%s:%d%s", - FMT_M(sockaddr_print_buf(&ps->endpoint.address), ps->endpoint.port)); + ilog(LOG_DEBUG, "set FILLED flag for stream, remote %s%s%s", + FMT_M(endpoint_print_buf(&ps->endpoint))); PS_SET(ps, FILLED); if (flags && flags->pierce_nat) diff --git a/daemon/sdp.c b/daemon/sdp.c index f1357eca5..f81a223c3 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -1523,6 +1523,12 @@ int sdp_streams(const GQueue *sessions, GQueue *streams, struct sdp_ng_flags *fl sp->index = ++num; codec_store_init(&sp->codecs, NULL); + __sdp_ice(sp, media); + if (SP_ISSET(sp, ICE)) { + // ignore "received from" (SIP-source-address) when ICE is in use + flags->trust_address = 1; + } + errstr = "No address info found for stream"; if (!flags->fragment && fill_endpoint(&sp->rtp_endpoint, media, flags, NULL, media->port_num)) @@ -1626,7 +1632,6 @@ int sdp_streams(const GQueue *sessions, GQueue *streams, struct sdp_ng_flags *fl if (attr_get_by_id(&media->attributes, ATTR_RTCP_FB)) SP_SET(sp, RTCP_FB); - __sdp_ice(sp, media); __sdp_t38(sp, media); /* determine RTCP endpoint */