Index: /pjproject/trunk/pjlib/include/pj/doxygen.h
===================================================================
--- /pjproject/trunk/pjlib/include/pj/doxygen.h	(revision 1449)
+++ /pjproject/trunk/pjlib/include/pj/doxygen.h	(revision 1450)
@@ -56,5 +56,5 @@
  * @subsection doc_ver_subsec Version
  *
- * This document corresponds to PJLIB version 0.5.10.
+ * This document corresponds to PJLIB version 0.7.0-trunk.
  *
  *
Index: /pjproject/trunk/pjlib/src/pj/ip_helper_win32.c
===================================================================
--- /pjproject/trunk/pjlib/src/pj/ip_helper_win32.c	(revision 1449)
+++ /pjproject/trunk/pjlib/src/pj/ip_helper_win32.c	(revision 1450)
@@ -35,4 +35,8 @@
 #include <pj/string.h>
 
+#ifndef PJ_IP_HELPER_IGNORE_LOOPBACK_IF
+#   define PJ_IP_HELPER_IGNORE_LOOPBACK_IF	1
+#endif
+
 typedef DWORD (WINAPI *PFN_GetIpAddrTable)(PMIB_IPADDRTABLE pIpAddrTable, 
 					   PULONG pdwSize, 
@@ -41,8 +45,10 @@
 					      PULONG pdwSize, 
 					      BOOL bOrder);
+typedef DWORD (WINAPI *PFN_GetIfEntry)(PMIB_IFROW pIfRow);
 
 static HANDLE s_hDLL;
 static PFN_GetIpAddrTable s_pfnGetIpAddrTable;
 static PFN_GetIpForwardTable s_pfnGetIpForwardTable;
+static PFN_GetIfEntry s_pfnGetIfEntry;
 
 static void unload_iphlp_module(void)
@@ -84,4 +90,21 @@
     return ERROR_NOT_SUPPORTED;
 }
+
+
+#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF
+static DWORD MyGetIfEntry(MIB_IFROW *pIfRow)
+{
+    if(NULL == s_pfnGetIfEntry) {
+	s_pfnGetIfEntry = (PFN_GetIfEntry) 
+	    GetIpHlpApiProc(PJ_T("GetIfEntry"));
+    }
+    
+    if(NULL != s_pfnGetIfEntry) {
+	return s_pfnGetIfEntry(pIfRow);
+    }
+    
+    return ERROR_NOT_SUPPORTED;
+}
+#endif
 
 
@@ -135,7 +158,21 @@
     *p_cnt = 0;
     for (i=0; i<count; ++i) {
+	MIB_IFROW ifRow;
+
 	/* Some Windows returns 0.0.0.0! */
 	if (pTab->table[i].dwAddr == 0)
 	    continue;
+
+#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF
+	/* Investigate the type of this interface */
+	pj_bzero(&ifRow, sizeof(ifRow));
+	ifRow.dwIndex = pTab->table[i].dwIndex;
+	if (MyGetIfEntry(&ifRow) != 0)
+	    continue;
+
+	if (ifRow.dwType == MIB_IF_TYPE_LOOPBACK)
+	    continue;
+#endif
+
 	ifs[*p_cnt].s_addr = pTab->table[i].dwAddr;
 	(*p_cnt)++;
Index: /pjproject/trunk/pjmedia/include/pjmedia/doxygen.h
===================================================================
--- /pjproject/trunk/pjmedia/include/pjmedia/doxygen.h	(revision 1449)
+++ /pjproject/trunk/pjmedia/include/pjmedia/doxygen.h	(revision 1450)
@@ -92,6 +92,6 @@
  * @ref plc_codec, 
  * @ref PJMEDIA_CONF, 
- * @ref PJMED_G711 "G711/G.711 (PCMA/PCMU) codec with PLC",
- * @ref PJMED_GSM "GSM codec with PLC", 
+ * @ref PJMED_G711 "G711/G.711 (PCMA/PCMU) codec",
+ * @ref PJMED_GSM "GSM codec", 
  * @ref PJMED_L16 "linear codecs (multiple clockrate, stereo support, etc)",
  * @ref PJMED_SPEEX "Speex codec (narrowband, wideband, ultra-wideband)",
Index: /pjproject/trunk/pjnath/include/pjnath/config.h
===================================================================
--- /pjproject/trunk/pjnath/include/pjnath/config.h	(revision 1449)
+++ /pjproject/trunk/pjnath/include/pjnath/config.h	(revision 1450)
@@ -235,4 +235,14 @@
 
 
+/**
+ * This constant specifies the length of random string generated for ICE
+ * ufrag and password.
+ *
+ * Default: 8 (characters)
+ */
+#ifndef PJ_ICE_UFRAG_LEN
+#   define PJ_ICE_UFRAG_LEN			    8
+#endif
+
 
 /**
Index: /pjproject/trunk/pjnath/include/pjnath/types.h
===================================================================
--- /pjproject/trunk/pjnath/include/pjnath/types.h	(revision 1449)
+++ /pjproject/trunk/pjnath/include/pjnath/types.h	(revision 1450)
@@ -158,6 +158,6 @@
  * methodology for traversing Network Address Translator (NAT), and
  * is described in 
- * <A HREF="http://www.ietf.org/internet-drafts/draft-ietf-mmusic-ice-14.txt">
- * <B>draft-ietf-mmusic-ice-14.txt</B></A> draft. The PJNATH ICE
+ * <A HREF="http://www.ietf.org/internet-drafts/draft-ietf-mmusic-ice-18.txt">
+ * <B>draft-ietf-mmusic-ice-18.txt</B></A> draft. The PJNATH ICE
  * implementation is aimed to provide a usable and generic ICE transports
  * for different types of application, including but not limited to
Index: /pjproject/trunk/pjnath/src/pjnath/ice_session.c
===================================================================
--- /pjproject/trunk/pjnath/src/pjnath/ice_session.c	(revision 1449)
+++ /pjproject/trunk/pjnath/src/pjnath/ice_session.c	(revision 1450)
@@ -215,5 +215,5 @@
     /* Create STUN session for this candidate */
     status = pj_stun_session_create(&ice->stun_cfg, NULL, 
-			            &sess_cb, PJ_FALSE,
+			            &sess_cb, PJ_TRUE,
 				    &comp->stun_sess);
     if (status != PJ_SUCCESS)
@@ -297,7 +297,7 @@
 
     if (local_ufrag == NULL) {
-	ice->rx_ufrag.ptr = (char*) pj_pool_alloc(ice->pool, 16);
-	pj_create_random_string(ice->rx_ufrag.ptr, 16);
-	ice->rx_ufrag.slen = 16;
+	ice->rx_ufrag.ptr = (char*) pj_pool_alloc(ice->pool, PJ_ICE_UFRAG_LEN);
+	pj_create_random_string(ice->rx_ufrag.ptr, PJ_ICE_UFRAG_LEN);
+	ice->rx_ufrag.slen = PJ_ICE_UFRAG_LEN;
     } else {
 	pj_strdup(ice->pool, &ice->rx_ufrag, local_ufrag);
@@ -305,7 +305,7 @@
 
     if (local_passwd == NULL) {
-	ice->rx_pass.ptr = (char*) pj_pool_alloc(ice->pool, 16);
-	pj_create_random_string(ice->rx_pass.ptr, 16);
-	ice->rx_pass.slen = 16;
+	ice->rx_pass.ptr = (char*) pj_pool_alloc(ice->pool, PJ_ICE_UFRAG_LEN);
+	pj_create_random_string(ice->rx_pass.ptr, PJ_ICE_UFRAG_LEN);
+	ice->rx_pass.slen = PJ_ICE_UFRAG_LEN;
     } else {
 	pj_strdup(ice->pool, &ice->rx_pass, local_passwd);
Index: /pjproject/trunk/pjnath/src/pjnath/ice_strans.c
===================================================================
--- /pjproject/trunk/pjnath/src/pjnath/ice_strans.c	(revision 1449)
+++ /pjproject/trunk/pjnath/src/pjnath/ice_strans.c	(revision 1450)
@@ -591,5 +591,7 @@
 
 	/* Send STUN binding request */
-	PJ_LOG(5,(ice_st->obj_name, "Sending STUN keep-alive"));
+	PJ_LOG(5,(ice_st->obj_name, "Sending STUN keep-alive from %s;%d",
+		  pj_inet_ntoa(comp->local_addr.ipv4.sin_addr),
+		  pj_ntohs(comp->local_addr.ipv4.sin_port)));
 	status = pj_stun_session_send_msg(comp->stun_sess, PJ_FALSE, 
 					  &ice_st->stun_srv, 
@@ -1138,12 +1140,17 @@
     }
 
+    /* Save IP address for logging */
+    pj_ansi_strcpy(ip, pj_inet_ntoa(comp->local_addr.ipv4.sin_addr));
+
     /* Ignore response if it reports the same address */
-    if (cand->addr.ipv4.sin_addr.s_addr == mapped_addr->ipv4.sin_addr.s_addr &&
-	cand->addr.ipv4.sin_port == mapped_addr->ipv4.sin_port)
+    if (comp->local_addr.ipv4.sin_addr.s_addr == mapped_addr->ipv4.sin_addr.s_addr &&
+	comp->local_addr.ipv4.sin_port == mapped_addr->ipv4.sin_port)
     {
+	PJ_LOG(4,(comp->ice_st->obj_name, 
+		  "Candidate %s:%d is directly connected to Internet, "
+		  "STUN mapped address is ignored",
+		  ip, pj_ntohs(comp->local_addr.ipv4.sin_port)));
 	return;
     }
-
-    pj_ansi_strcpy(ip, pj_inet_ntoa(comp->local_addr.ipv4.sin_addr));
 
     PJ_LOG(4,(comp->ice_st->obj_name, 
Index: /pjproject/trunk/pjnath/src/pjnath/stun_msg_dump.c
===================================================================
--- /pjproject/trunk/pjnath/src/pjnath/stun_msg_dump.c	(revision 1449)
+++ /pjproject/trunk/pjnath/src/pjnath/stun_msg_dump.c	(revision 1450)
@@ -116,5 +116,5 @@
 	    attr = (const pj_stun_uint_attr*)ahdr;
 	    len = pj_ansi_snprintf(p, end-p,
-				   ", value=%d (0x%x)\n",
+				   ", value=%u (0x%x)\n",
 				   (pj_uint32_t)attr->value,
 				   (pj_uint32_t)attr->value);
