summaryrefslogtreecommitdiff
path: root/res/res_rtp_asterisk.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2014-10-16 01:26:18 +0000
committerJoshua Colp <jcolp@digium.com>2014-10-16 01:26:18 +0000
commitbfee1b4bc54ba808a54434d8e6862c9b2b949b8c (patch)
treec631cda195ab48b263e41368515db2f47b54f289 /res/res_rtp_asterisk.c
parent28c11fff78d0d653bff96435427e7550f2481c2f (diff)
res_rtp_asterisk: Fix a bug where ICE state would get reset when it shouldn't.
In the case where the ICE negotiation had not yet started current state would get wiped when it shouldn't. This also removes channel binding as in practice this does not work well with other implementations. ........ Merged revisions 425644 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 425645 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 425646 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r--res/res_rtp_asterisk.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 0c52ce2ad..017d0cc32 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -463,18 +463,6 @@ static void update_address_with_ice_candidate(struct ast_rtp *rtp, enum ast_rtp_
ast_sockaddr_set_port(cand_address, pj_sockaddr_get_port(&rtp->ice->comp[component - 1].valid_check->rcand->addr));
}
-/*! \brief Helper function which sets up channel binding on a TURN session if applicable */
-static void turn_enable_bind_channel(struct ast_rtp *rtp, pj_turn_sock *turn, int component, int transport)
-{
- if (!rtp->ice || !turn || (component < 1) || !rtp->ice->comp[component - 1].valid_check ||
- (rtp->ice->comp[component - 1].valid_check->lcand->transport_id != transport)) {
- return;
- }
-
- pj_turn_sock_bind_channel(turn, &rtp->ice->comp[component - 1].valid_check->rcand->addr,
- sizeof(rtp->ice->comp[component - 1].valid_check->rcand->addr));
-}
-
/*! \brief Destructor for locally created ICE candidates */
static void ast_rtp_ice_candidate_destroy(void *obj)
{
@@ -600,6 +588,10 @@ static int ice_reset_session(struct ast_rtp_instance *instance)
pj_ice_sess_role role = rtp->ice->role;
int res;
+ if (!rtp->ice->is_nominating && !rtp->ice->is_complete) {
+ return 0;
+ }
+
ast_rtp_ice_stop(instance);
res = ice_create(instance, &rtp->ice_original_rtp_addr, rtp->ice_port, 1);
@@ -1625,11 +1617,9 @@ static void ast_rtp_on_ice_complete(pj_ice_sess *ice, pj_status_t status)
update_address_with_ice_candidate(rtp, AST_RTP_ICE_COMPONENT_RTP, &remote_address);
ast_rtp_instance_set_remote_address(instance, &remote_address);
- turn_enable_bind_channel(rtp, rtp->turn_rtp, AST_RTP_ICE_COMPONENT_RTP, TRANSPORT_TURN_RTP);
if (rtp->rtcp) {
update_address_with_ice_candidate(rtp, AST_RTP_ICE_COMPONENT_RTCP, &rtp->rtcp->them);
- turn_enable_bind_channel(rtp, rtp->turn_rtcp, AST_RTP_ICE_COMPONENT_RTCP, TRANSPORT_TURN_RTCP);
}
}