summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2014-02-27 19:54:19 +0000
committerJonathan Rose <jrose@digium.com>2014-02-27 19:54:19 +0000
commita40ea867cd902535465c8981578d942dd8d24b5b (patch)
tree9b17c26a5bbcce9131069a392d57eef5fb0a6d4d
parentbe3cab0a3aa1423c6789d5fe0b8b7f9adef6714f (diff)
Multiple revisions 409129-409130
........ r409129 | jrose | 2014-02-27 13:19:02 -0600 (Thu, 27 Feb 2014) | 15 lines res_rtp_asterisk: Fix checklist creating problems in ICE sessions Prior to this patch, local candidate lists including SRFLX would fail to start properly when building ICE candidate check lists. This patch fixes that problem by making sure that each SRFLX candidate is associated with the proper base address so that the check list can create matches properly. This patch was written by jcolp. The issue will be left open to await testing by the issue participants. (issue ASTERISK-23213) Reported by: Andrea Suisani Review: https://reviewboard.asterisk.org/r/3256/ ........ r409130 | jrose | 2014-02-27 13:38:10 -0600 (Thu, 27 Feb 2014) | 8 lines res_rtp_asterisk: correct build error from r409129 Accidentally placed a declaration below functional code (issue ASTERISK-23213) Reported by: Andrea Suisani Review: https://reviewboard.asterisk.org/r/3256/ ........ Merged revisions 409129-409130 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 409131 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--res/res_rtp_asterisk.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 1e9f0705d..fc0b05ad2 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -679,7 +679,7 @@ static void ast_rtp_ice_add_cand(struct ast_rtp *rtp, unsigned comp_id, unsigned
return;
}
- if (pj_ice_sess_add_cand(rtp->ice, comp_id, transport_id, type, local_pref, &foundation, addr, addr, rel_addr, addr_len, NULL) != PJ_SUCCESS) {
+ if (pj_ice_sess_add_cand(rtp->ice, comp_id, transport_id, type, local_pref, &foundation, addr, base_addr, rel_addr, addr_len, NULL) != PJ_SUCCESS) {
ao2_ref(candidate, -1);
return;
}
@@ -1684,15 +1684,19 @@ static void rtp_add_candidates_to_ice(struct ast_rtp_instance *instance, struct
}
/* If configured to use a STUN server to get our external mapped address do so */
- if (stunaddr.sin_addr.s_addr && ast_sockaddr_is_ipv4(addr)) {
+ if (stunaddr.sin_addr.s_addr && ast_sockaddr_is_ipv4(addr) && count) {
struct sockaddr_in answer;
- if (!ast_stun_request(rtp->s, &stunaddr, NULL, &answer)) {
+ if (!ast_stun_request(component == AST_RTP_ICE_COMPONENT_RTCP ? rtp->rtcp->s : rtp->s, &stunaddr, NULL, &answer)) {
+ pj_sockaddr base;
pj_str_t mapped = pj_str(ast_strdupa(ast_inet_ntoa(answer.sin_addr)));
+ /* Use the first local host candidate as the base */
+ pj_sockaddr_cp(&base, &address[0]);
+
pj_sockaddr_init(pj_AF_INET(), &address[0], &mapped, ntohs(answer.sin_port));
- ast_rtp_ice_add_cand(rtp, component, transport, PJ_ICE_CAND_TYPE_SRFLX, 65535, &address[0], &address[0],
+ ast_rtp_ice_add_cand(rtp, component, transport, PJ_ICE_CAND_TYPE_SRFLX, 65535, &address[0], &base,
NULL, pj_sockaddr_get_len(&address[0]));
}
}