Index: pjproject/branches/projects/ice-turn07/pjnath/src/pjnath/ice_session.c
===================================================================
--- pjproject/branches/projects/ice-turn07/pjnath/src/pjnath/ice_session.c	(revision 1931)
+++ pjproject/branches/projects/ice-turn07/pjnath/src/pjnath/ice_session.c	(revision 1932)
@@ -107,5 +107,6 @@
 struct msg_data
 {
-    pj_bool_t			     is_request;
+    pj_bool_t	is_request;
+    unsigned	cand_id;
 
     union data {
@@ -115,8 +116,4 @@
 	    unsigned		     ckid;
 	} req;
-
-	struct response_data {
-	    unsigned		     cand_id;
-	} res;
     } data;
 };
@@ -1401,6 +1398,7 @@
      * completes and on_stun_request_complete() callback is called.
      */
-    msg_data = PJ_POOL_ZALLOC_T(check->tdata->pool, struct msg_data);
+    msg_data = PJ_POOL_ZALLOC_T(ice->pool, struct msg_data);
     msg_data->is_request = PJ_TRUE;
+    msg_data->cand_id = lcand - ice->lcand;
     msg_data->data.req.ice = ice;
     msg_data->data.req.clist = clist;
@@ -1668,13 +1666,5 @@
     unsigned cand_id;
     
-    if (msg_data->is_request) {
-	pj_ice_sess_checklist *clist = msg_data->data.req.clist;
-	pj_ice_sess_cand *lcand = clist->checks[msg_data->data.req.ckid].lcand;
-
-	cand_id = lcand - ice->lcand;
-	
-    } else {
-	cand_id = msg_data->data.res.cand_id;
-    }
+    cand_id = msg_data->cand_id;
 
     return (*ice->cb.on_tx_pkt)(ice, sd->comp_id, cand_id,
@@ -1940,5 +1930,5 @@
 {
     stun_data *sd;
-    unsigned *param_cand_id;
+    //unsigned *param_cand_id;
     const pj_stun_msg *msg = rdata->msg;
     struct msg_data *msg_data;
@@ -1962,5 +1952,5 @@
      *  whether to send packet using local socket or the relay.
      */
-    param_cand_id = (unsigned*)token;
+    //param_cand_id = (unsigned*)token;
 
     /* Reject any requests except Binding request */
@@ -2073,7 +2063,7 @@
 
     /* Create a msg_data to be associated with this response */
-    msg_data = PJ_POOL_ZALLOC_T(tdata->pool, struct msg_data);
+    msg_data = PJ_POOL_ZALLOC_T(ice->pool, struct msg_data);
     msg_data->is_request = PJ_FALSE;
-    msg_data->data.res.cand_id = *param_cand_id;
+    msg_data->cand_id = ((struct msg_data*)token)->cand_id;
 
     /* Send the response */
@@ -2389,4 +2379,5 @@
     pj_status_t status = PJ_SUCCESS;
     pj_ice_sess_comp *comp;
+    struct msg_data *msg_data;
     pj_status_t stun_status;
 
@@ -2401,9 +2392,13 @@
     }
 
+    msg_data = PJ_POOL_ZALLOC_T(ice->pool, struct msg_data);
+    msg_data->is_request = PJ_FALSE;
+    msg_data->cand_id = cand_id;
+
     stun_status = pj_stun_msg_check((const pj_uint8_t*)pkt, pkt_size, 
     				    PJ_STUN_IS_DATAGRAM);
     if (stun_status == PJ_SUCCESS) {
 	status = pj_stun_session_on_rx_pkt(comp->stun_sess, pkt, pkt_size,
-					   PJ_STUN_IS_DATAGRAM, &cand_id,
+					   PJ_STUN_IS_DATAGRAM, msg_data,
 					   NULL, src_addr, src_addr_len);
 	if (status != PJ_SUCCESS) {
Index: pjproject/branches/projects/ice-turn07/pjnath/src/pjnath/ice_strans.c
===================================================================
--- pjproject/branches/projects/ice-turn07/pjnath/src/pjnath/ice_strans.c	(revision 1931)
+++ pjproject/branches/projects/ice-turn07/pjnath/src/pjnath/ice_strans.c	(revision 1932)
@@ -954,4 +954,12 @@
 	    }
 
+	    /* Skip if candidate has no address */
+	    if (!pj_sockaddr_has_addr(&cand->addr)) {
+		PJ_LOG(5,(ice_st->obj_name, 
+			  "Candidate %d in component %d is not added",
+			  j, i));
+		continue;
+	    }
+
 	    if (cand->type == PJ_ICE_CAND_TYPE_RELAYED) {
 		local_addr = &cand->addr;
@@ -964,5 +972,5 @@
 					  cand->type, cand->local_pref, 
 					  &cand->foundation, &cand->addr, 
-					  &comp->local_addr, NULL, 
+					  local_addr, relay_addr, 
 					  sizeof(pj_sockaddr_in), 
 					  (unsigned*)&cand->ice_cand_id);
@@ -1316,4 +1324,9 @@
     }
 
+    if (comp->ice_st->ice == NULL) {
+	/* The session is gone */
+	return;
+    }
+
     /* Find candidate ID for this packet */
     for (cand_id=0; cand_id<comp->cand_cnt; ++cand_id) {
Index: pjproject/branches/projects/ice-turn07/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- pjproject/branches/projects/ice-turn07/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1931)
+++ pjproject/branches/projects/ice-turn07/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1932)
@@ -23,12 +23,21 @@
 #define NO_LIMIT	(int)0x7FFFFFFF
 
-#if 1
+#if 0
 #define TURN_SERVER	"turn.pjsip.org"
 #define TURN_PORT	34780
-#define TURN_TCP	0
 #define TURN_REALM	"pjsip.org"
 #define TURN_USER	"700"
 #define TURN_PASSWD	"700"
 #endif
+
+#if 1
+/* Eyeball test */
+#define TURN_SERVER	"216.187.87.78"
+#define TURN_PORT	3478
+#define TURN_REALM	"test.eyeball.com"
+#define TURN_USER	"sipit6"
+#define TURN_PASSWD	"password"
+#endif
+
 
 
@@ -240,9 +249,9 @@
 static void default_config(struct app_config *cfg)
 {
-    char tmp[80];
+    char tmp[120];
     unsigned i;
 
     pjsua_config_default(&cfg->cfg);
-    pj_ansi_sprintf(tmp, "PJSUA v%s/%s", pj_get_version(), PJ_OS_NAME);
+    pj_ansi_sprintf(tmp, "PJSUA v%s/%s (http://pjsip.org)", pj_get_version(), PJ_OS_NAME);
     pj_strdup2_with_null(app_config.pool, &cfg->cfg.user_agent, tmp);
 
