From: George Joseph Date: Mon, 23 Oct 2017 17:23:04 +0000 (-0600) Subject: res_pjsip_sdp_rtp: Fix setting of address type for rtp_ipv6 X-Git-Tag: 13.19.0-rc1~190^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a2575a107f48423a1c677ff4f581b6d6287537f;p=thirdparty%2Fasterisk.git res_pjsip_sdp_rtp: Fix setting of address type for rtp_ipv6 create_outgoing_sdp_stream was setting "addr_type = STR_IP6" only when an ipv6 media_address was specified on the endpoint. If rtp_ipv6 was set and ast_sip_get_host_ip_string returned an ipv6 address, we were leaving the addr_type set at the default of STR_IP4. This caused the address type to be set incorrectly on the "o" and "c" SDP attributes even though the address was set correctly. Some clients don't like the mismatch. * Removed the test for endpoint/media_address and now check all addresses for ipv6. ASTERISK-27198 Reported by: Martin Cisárik Change-Id: I5214fc31b728117842243807e7927a319cf77592 --- diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 16ffaca3f4..0fcd509fb6 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -1167,6 +1167,7 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup); enum ast_media_type media_type = stream_to_media_type(session_media->stream_type); int use_override_prefs = ast_format_cap_count(session->req_caps); + pj_sockaddr ip; int direct_media_enabled = !ast_sockaddr_isnull(&session_media->direct_media_addr) && ast_format_cap_count(session->direct_media_cap); @@ -1223,13 +1224,9 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as media->conn->addr_type = STR_IP4; pj_strdup2(pool, &media->conn->addr, hostip); - if (!ast_strlen_zero(session->endpoint->media.address)) { - pj_sockaddr ip; - - if ((pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &media->conn->addr, &ip) == PJ_SUCCESS) && - (ip.addr.sa_family == pj_AF_INET6())) { - media->conn->addr_type = STR_IP6; - } + if ((pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &media->conn->addr, &ip) == PJ_SUCCESS) && + (ip.addr.sa_family == pj_AF_INET6())) { + media->conn->addr_type = STR_IP6; } ast_rtp_instance_get_local_address(session_media->rtp, &addr);