summaryrefslogtreecommitdiff
path: root/pjnath
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-04-15 13:36:55 +0000
committerBenny Prijono <bennylp@teluu.com>2009-04-15 13:36:55 +0000
commit6adc92ce701623103e8d79202b37e2a472e31a59 (patch)
treeb4f5f3145a3d6bb81f9d2848efbc032cece8f36c /pjnath
parentf373261af510a0bf0915533975977b7eaa8901c5 (diff)
More ticket #780: updated ICE to issue CreatePermission on the TURN socket before starting ICE negotiation
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2599 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath')
-rw-r--r--pjnath/src/pjnath/ice_strans.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index 3cb5f4e6..b244f0fc 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -900,10 +900,39 @@ PJ_DEF(pj_status_t) pj_ice_strans_start_ice( pj_ice_strans *ice_st,
if (status != PJ_SUCCESS)
return status;
+ /* If we have TURN candidate, now is the time to create the permissions */
+ if (ice_st->comp[0]->turn_sock) {
+ unsigned i;
+
+ for (i=0; i<ice_st->comp_cnt; ++i) {
+ pj_ice_strans_comp *comp = ice_st->comp[i];
+ pj_sockaddr addrs[PJ_ICE_ST_MAX_CAND];
+ unsigned j, count=0;
+
+ /* Gather remote addresses for this component */
+ for (j=0; j<rem_cand_cnt && count<PJ_ARRAY_SIZE(addrs); ++j) {
+ if (rem_cand[j].comp_id==i+1) {
+ pj_memcpy(&addrs[count++], &rem_cand[j].addr,
+ pj_sockaddr_get_len(&rem_cand[j].addr));
+ }
+ }
+
+ if (count) {
+ status = pj_turn_sock_set_perm(comp->turn_sock, count,
+ addrs, 0);
+ if (status != PJ_SUCCESS) {
+ pj_ice_strans_stop_ice(ice_st);
+ return status;
+ }
+ }
+ }
+ }
+
/* Start ICE negotiation! */
status = pj_ice_sess_start_check(ice_st->ice);
if (status != PJ_SUCCESS) {
pj_ice_strans_stop_ice(ice_st);
+ return status;
}
return status;
@@ -1060,6 +1089,14 @@ static void on_ice_complete(pj_ice_sess *ice, pj_status_t status)
sizeof(rip), 3);
if (check->lcand->transport_id == TP_TURN) {
+ /* Activate channel binding for the remote address
+ * for more efficient data transfer using TURN.
+ */
+ status = pj_turn_sock_bind_channel(
+ ice_st->comp[i]->turn_sock,
+ &check->rcand->addr,
+ sizeof(check->rcand->addr));
+
/* Disable logging for Send/Data indications */
PJ_LOG(5,(ice_st->obj_name,
"Disabling STUN Indication logging for "