<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7332">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_rtp_asterisk: ICE server-reflexive candidates (srflx) with Dual-Stack.<br><br>Previously, Asterisk sent srflx only when configured exclusively for IPv4. Now,<br>srflx is gathered and sent via SDP, even when Asterisk is enabled for<br>Dual Stack (IPv4+IPv6) and an IPv4 interface is available/used.<br><br>ASTERISK-27437<br><br>Change-Id: Ie07d8e2bfa7b6fe06fcdc73d390a7a9a4d8c0bc1<br>---<br>M res/res_rtp_asterisk.c<br>1 file changed, 31 insertions(+), 18 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c<br>index a9bdf68..fc31967 100644<br>--- a/res/res_rtp_asterisk.c<br>+++ b/res/res_rtp_asterisk.c<br>@@ -2910,8 +2910,8 @@<br> }<br> <br> /* If configured to use a STUN server to get our external mapped address do so */<br>- if (stunaddr.sin_addr.s_addr && count && ast_sockaddr_is_ipv4(addr)<br>- && !stun_address_is_blacklisted(addr)) {<br>+ if (count && stunaddr.sin_addr.s_addr && !stun_address_is_blacklisted(addr) &&<br>+ (ast_sockaddr_is_ipv4(addr) || ast_sockaddr_is_any(addr))) {<br> struct sockaddr_in answer;<br> int rsp;<br> <br>@@ -2925,27 +2925,40 @@<br> ao2_lock(instance);<br> if (!rsp) {<br> pj_sockaddr base;<br>- pj_sockaddr ext;<br>- pj_str_t mapped = pj_str(ast_strdupa(ast_inet_ntoa(answer.sin_addr)));<br>- int srflx = 1;<br> <br>- /* Use the first local host candidate as the base */<br>- pj_sockaddr_cp(&base, &address[basepos]);<br>-<br>- pj_sockaddr_init(pj_AF_INET(), &ext, &mapped, ntohs(answer.sin_port));<br>-<br>- /* If the returned address is the same as one of our host candidates, don't send the srflx */<br>- for (pos = 0; pos < count; pos++) {<br>- if ((pj_sockaddr_cmp(&address[pos], &ext) == 0) && !rtp_address_is_ice_blacklisted(&address[pos])) {<br>- srflx = 0;<br>+ /* Use the first local IPv4 host candidate as the base */<br>+ for (pos = basepos; pos < count; pos++) {<br>+ if (address[pos].addr.sa_family == PJ_AF_INET &&<br>+ !rtp_address_is_ice_blacklisted(&address[pos])) {<br>+ pj_sockaddr_cp(&base, &address[pos]);<br> break;<br> }<br> }<br> <br>- if (srflx) {<br>- ast_rtp_ice_add_cand(instance, rtp, component, transport,<br>- PJ_ICE_CAND_TYPE_SRFLX, 65535, &ext, &base, &base,<br>- pj_sockaddr_get_len(&ext));<br>+ if (pos < count) {<br>+ pj_sockaddr ext;<br>+ pj_str_t mapped = pj_str(ast_strdupa(ast_inet_ntoa(answer.sin_addr)));<br>+ int srflx = 1;<br>+<br>+ pj_sockaddr_init(pj_AF_INET(), &ext, &mapped, ntohs(answer.sin_port));<br>+<br>+ /*<br>+ * If the returned address is the same as one of our host<br>+ * candidates, don't send the srflx<br>+ */<br>+ for (pos = 0; pos < count; pos++) {<br>+ if (pj_sockaddr_cmp(&address[pos], &ext) == 0 &&<br>+ !rtp_address_is_ice_blacklisted(&address[pos])) {<br>+ srflx = 0;<br>+ break;<br>+ }<br>+ }<br>+<br>+ if (srflx) {<br>+ ast_rtp_ice_add_cand(instance, rtp, component, transport,<br>+ PJ_ICE_CAND_TYPE_SRFLX, 65535, &ext, &base, &base,<br>+ pj_sockaddr_get_len(&ext));<br>+ }<br> }<br> }<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7332">change 7332</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7332"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ie07d8e2bfa7b6fe06fcdc73d390a7a9a4d8c0bc1 </div>
<div style="display:none"> Gerrit-Change-Number: 7332 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>