summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorThomas Guebels <tgu@escaux.com>2018-02-19 11:21:30 +0100
committerJoshua Colp <jcolp@digium.com>2018-02-19 07:38:02 -0600
commit4b555d7147f5180456eae4986df6344ee4142f06 (patch)
tree4a0001b860d1ba393f98d4f5d7e02b42e5521c7e /res
parentddc607f85a2a7f0cc8fbde4f30d09510c5e2f2cc (diff)
res_rtp_asterisk: Fix ICE candidate nomination
If the ICE role is not set right away, we might have a role conflict that stays undetected and ICE finishing with successful tests and no candidate nominated. This was introduced by ASTERISK-27088. To avoid this, we set the role as soon as before but only if the ICE state permits it: still checking and not yet nominating candidates or completed. ASTERISK-27646 Change-Id: I5dbc69ad63cacbb067922850fbb113d479bd729c
Diffstat (limited to 'res')
-rw-r--r--res/res_rtp_asterisk.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 913fbad1c..d3273b463 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -1036,6 +1036,15 @@ static void ast_rtp_ice_set_role(struct ast_rtp_instance *instance, enum ast_rtp
}
rtp->role = role;
+
+ if (!rtp->ice->real_ice->is_nominating && !rtp->ice->real_ice->is_complete) {
+ pj_thread_register_check();
+
+ pj_ice_sess_change_role(rtp->ice->real_ice, role == AST_RTP_ICE_ROLE_CONTROLLED ?
+ PJ_ICE_SESS_ROLE_CONTROLLED : PJ_ICE_SESS_ROLE_CONTROLLING);
+ } else {
+ ast_debug(3, "Not setting ICE role because state is %s\n", rtp->ice->real_ice->is_nominating ? "nominating" : "complete" );
+ }
}
/*! \pre instance is locked */