Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1617)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1618)
@@ -91,4 +91,6 @@
 static pjsua_call_id	current_call = PJSUA_INVALID_ID;
 static pj_str_t		uri_arg;
+
+static pjsua_transport_id   tls_id;
 
 #ifdef STEREO_DEMO
@@ -568,6 +570,6 @@
 	case OPT_NO_UDP: /* no-udp */
 	    if (cfg->no_tcp) {
-	      PJ_LOG(1,(THIS_FILE,"Error: can not disable both TCP and UDP"));
-	      return PJ_EINVAL;
+	      //PJ_LOG(1,(THIS_FILE,"Error: cannot disable both TCP and UDP"));
+	      //return PJ_EINVAL;
 	    }
 
@@ -581,6 +583,6 @@
 	case OPT_NO_TCP: /* no-tcp */
 	    if (cfg->no_udp) {
-	      PJ_LOG(1,(THIS_FILE,"Error: can not disable both TCP and UDP"));
-	      return PJ_EINVAL;
+	      //PJ_LOG(1,(THIS_FILE,"Error: cannot disable both TCP and UDP"));
+	      //return PJ_EINVAL;
 	    }
 
@@ -2217,10 +2219,13 @@
 
     status = pjsua_acc_create_request(current_acc, &method, dst_uri, &tdata);
-
-    status = pjsip_endpt_send_request(endpt, tdata, -1, NULL, NULL);
+    if (status == PJ_SUCCESS) {
+	status = pjsip_endpt_send_request(endpt, tdata, -1, NULL, NULL);
+    }
+
     if (status != PJ_SUCCESS) {
-	pjsua_perror(THIS_FILE, "Unable to send request", status);
+	pjsua_perror(THIS_FILE, "Unable to create/send request", status);
 	return;
     }
+
 }
 
@@ -3425,4 +3430,32 @@
     }
 
+    /* Add IPv6 UDP */
+#if 0 && defined(PJ_HAS_IPV6) && PJ_HAS_IPV6
+    if (1) {
+	pjsua_acc_id aid;
+
+	status = pjsua_transport_create(PJSIP_TRANSPORT_UDP6,
+					&app_config.udp_cfg, 
+					&transport_id);
+	if (status != PJ_SUCCESS)
+	    goto on_error;
+
+	/* Add local account */
+	pjsua_acc_add_local(transport_id, PJ_TRUE, &aid);
+	//pjsua_acc_set_transport(aid, transport_id);
+	pjsua_acc_set_online_status(current_acc, PJ_TRUE);
+
+	if (app_config.udp_cfg.port == 0) {
+	    pjsua_transport_info ti;
+	    pj_sockaddr_in *a;
+
+	    pjsua_transport_get_info(transport_id, &ti);
+	    a = (pj_sockaddr_in*)&ti.local_addr;
+
+	    tcp_cfg.port = pj_ntohs(a->sin_port);
+	}
+    }
+#endif	/* PJ_HAS_IPV6 */
+
     /* Add TCP transport unless it's disabled */
     if (!app_config.no_tcp) {
@@ -3455,4 +3488,6 @@
 	    goto on_error;
 	
+	tls_id = transport_id;
+
 	/* Add local account */
 	pjsua_acc_add_local(transport_id, PJ_FALSE, &acc_id);
@@ -3556,4 +3591,6 @@
 	app_config.pool = NULL;
     }
+
+    pjsua_transport_close(tls_id, 0);
 
     status = pjsua_destroy();
Index: /pjproject/trunk/pjsip-apps/src/samples/debug.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/samples/debug.c	(revision 1617)
+++ /pjproject/trunk/pjsip-apps/src/samples/debug.c	(revision 1618)
@@ -29,6 +29,58 @@
  */
 //#include "aectest.c"
+//#include "strerror.c"
+
 #include <pjlib.h>
+#include <pjlib-util.h>
 
+#define THIS_FILE   "test.c"
+
+void check_error(const char *func, pj_status_t status)
+{
+    if (status != PJ_SUCCESS) {
+	char errmsg[PJ_ERR_MSG_SIZE];
+	pj_strerror(status, errmsg, sizeof(errmsg));
+	PJ_LOG(1,(THIS_FILE, "%s error: %s", func, errmsg));
+	exit(1);
+    }
+}
+
+#define DO(func)  status = func; check_error(#func, status);
+
+int main()
+{
+    pj_sock_t sock;
+    pj_sockaddr_in addr;
+    pj_str_t stun_srv = pj_str("stun.fwdnet.net");
+    pj_caching_pool cp;
+    pj_status_t status;
+
+    DO( pj_init() );
+
+    pj_caching_pool_init(&cp, NULL, 0);
+
+    DO( pjlib_util_init() );
+    DO( pj_sock_socket(pj_AF_INET(), pj_SOCK_DGRAM(), 0, &sock) );
+    DO( pj_sock_bind_in(sock, 0, 0) );
+
+    DO( pjstun_get_mapped_addr(&cp.factory, 1, &sock,
+			       &stun_srv, 3478,
+			       &stun_srv, 3478,
+			       &addr) );
+
+    PJ_LOG(3,(THIS_FILE, "Mapped address is %s:%d",
+	      pj_inet_ntoa(addr.sin_addr),
+	      (int)pj_ntohs(addr.sin_port)));
+
+    DO( pj_sock_close(sock) );
+    pj_caching_pool_destroy(&cp);
+    pj_shutdown();
+
+    return 0;
+}
+
+
+#if 0
+#include <pjlib.h>
 
 static void on_accept_complete(pj_ioqueue_key_t *key, 
@@ -88,2 +140,3 @@
 }
 
+#endif
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1617)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1618)
@@ -1347,5 +1347,5 @@
 
     /* Create the transport */
-    if (type & PJSIP_TRANSPORT_UDP) {
+    if (type==PJSIP_TRANSPORT_UDP || type==PJSIP_TRANSPORT_UDP6) {
 	/*
 	 * Create UDP transport (IPv4 or IPv6).
@@ -1408,5 +1408,5 @@
 #if defined(PJ_HAS_TCP) && PJ_HAS_TCP!=0
 
-    } else if (type == PJSIP_TRANSPORT_TCP) {
+    } else if (type == PJSIP_TRANSPORT_TCP || type == PJSIP_TRANSPORT_TCP6) {
 	/*
 	 * Create TCP transport.
