Index: /pjproject/trunk/pjlib/include/pj/ssl_sock.h
===================================================================
--- /pjproject/trunk/pjlib/include/pj/ssl_sock.h	(revision 3109)
+++ /pjproject/trunk/pjlib/include/pj/ssl_sock.h	(revision 3110)
@@ -155,5 +155,6 @@
         pj_str_t	cn;	    /**< Common name		*/
         pj_str_t	info;	    /**< One line subject, fields
-					 are separated by slash */
+					 are separated by slash, e.g:
+					 "CN=sample.org/OU=HRD" */
     } subject;			    /**< Subject		*/
 
@@ -207,14 +208,15 @@
  *
  * @param ci		The certificate info.
- * @param prefix	Prefix string for each line.
+ * @param indent	String for left indentation.
  * @param buf		The buffer where certificate info will be printed on.
  * @param buf_size	The buffer size.
  *
- * @return		PJ_SUCCESS when successful.
- */
-PJ_DECL(pj_status_t) pj_ssl_cert_info_dump(const pj_ssl_cert_info *ci,
-					   const char *prefix,
-					   char *buf,
-					   pj_size_t buf_size);
+ * @return		The length of the dump result, or -1 when buffer size
+ *			is not sufficient.
+ */
+PJ_DECL(pj_ssize_t) pj_ssl_cert_info_dump(const pj_ssl_cert_info *ci,
+					  const char *indent,
+					  char *buf,
+					  pj_size_t buf_size);
 
 
@@ -231,5 +233,6 @@
  * @return		PJ_SUCCESS when successful.
  */
-PJ_DECL(pj_status_t) pj_ssl_cert_verify_error_st(pj_uint32_t verify_status, 
+PJ_DECL(pj_status_t) pj_ssl_cert_get_verify_status_strings(
+						 pj_uint32_t verify_status, 
 						 const char *error_strings[],
 						 unsigned *count);
@@ -242,75 +245,75 @@
 
     /* NULL */
-    TLS_NULL_WITH_NULL_NULL               = 0x00000000,
+    PJ_TLS_NULL_WITH_NULL_NULL               	= 0x00000000,
 
     /* TLS/SSLv3 */
-    TLS_RSA_WITH_NULL_MD5                 = 0x00000001,
-    TLS_RSA_WITH_NULL_SHA                 = 0x00000002,
-    TLS_RSA_WITH_NULL_SHA256              = 0x0000003B,
-    TLS_RSA_WITH_RC4_128_MD5              = 0x00000004,
-    TLS_RSA_WITH_RC4_128_SHA              = 0x00000005,
-    TLS_RSA_WITH_3DES_EDE_CBC_SHA         = 0x0000000A,
-    TLS_RSA_WITH_AES_128_CBC_SHA          = 0x0000002F,
-    TLS_RSA_WITH_AES_256_CBC_SHA          = 0x00000035,
-    TLS_RSA_WITH_AES_128_CBC_SHA256       = 0x0000003C,
-    TLS_RSA_WITH_AES_256_CBC_SHA256       = 0x0000003D,
-    TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA      = 0x0000000D,
-    TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA      = 0x00000010,
-    TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA     = 0x00000013,
-    TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA     = 0x00000016,
-    TLS_DH_DSS_WITH_AES_128_CBC_SHA       = 0x00000030,
-    TLS_DH_RSA_WITH_AES_128_CBC_SHA       = 0x00000031,
-    TLS_DHE_DSS_WITH_AES_128_CBC_SHA      = 0x00000032,
-    TLS_DHE_RSA_WITH_AES_128_CBC_SHA      = 0x00000033,
-    TLS_DH_DSS_WITH_AES_256_CBC_SHA       = 0x00000036,
-    TLS_DH_RSA_WITH_AES_256_CBC_SHA       = 0x00000037,
-    TLS_DHE_DSS_WITH_AES_256_CBC_SHA      = 0x00000038,
-    TLS_DHE_RSA_WITH_AES_256_CBC_SHA      = 0x00000039,
-    TLS_DH_DSS_WITH_AES_128_CBC_SHA256    = 0x0000003E,
-    TLS_DH_RSA_WITH_AES_128_CBC_SHA256    = 0x0000003F,
-    TLS_DHE_DSS_WITH_AES_128_CBC_SHA256   = 0x00000040,
-    TLS_DHE_RSA_WITH_AES_128_CBC_SHA256   = 0x00000067,
-    TLS_DH_DSS_WITH_AES_256_CBC_SHA256    = 0x00000068,
-    TLS_DH_RSA_WITH_AES_256_CBC_SHA256    = 0x00000069,
-    TLS_DHE_DSS_WITH_AES_256_CBC_SHA256   = 0x0000006A,
-    TLS_DHE_RSA_WITH_AES_256_CBC_SHA256   = 0x0000006B,
-    TLS_DH_anon_WITH_RC4_128_MD5          = 0x00000018,
-    TLS_DH_anon_WITH_3DES_EDE_CBC_SHA     = 0x0000001B,
-    TLS_DH_anon_WITH_AES_128_CBC_SHA      = 0x00000034,
-    TLS_DH_anon_WITH_AES_256_CBC_SHA      = 0x0000003A,
-    TLS_DH_anon_WITH_AES_128_CBC_SHA256   = 0x0000006C,
-    TLS_DH_anon_WITH_AES_256_CBC_SHA256   = 0x0000006D,
+    PJ_TLS_RSA_WITH_NULL_MD5                 	= 0x00000001,
+    PJ_TLS_RSA_WITH_NULL_SHA                 	= 0x00000002,
+    PJ_TLS_RSA_WITH_NULL_SHA256              	= 0x0000003B,
+    PJ_TLS_RSA_WITH_RC4_128_MD5              	= 0x00000004,
+    PJ_TLS_RSA_WITH_RC4_128_SHA              	= 0x00000005,
+    PJ_TLS_RSA_WITH_3DES_EDE_CBC_SHA         	= 0x0000000A,
+    PJ_TLS_RSA_WITH_AES_128_CBC_SHA          	= 0x0000002F,
+    PJ_TLS_RSA_WITH_AES_256_CBC_SHA          	= 0x00000035,
+    PJ_TLS_RSA_WITH_AES_128_CBC_SHA256       	= 0x0000003C,
+    PJ_TLS_RSA_WITH_AES_256_CBC_SHA256       	= 0x0000003D,
+    PJ_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA      	= 0x0000000D,
+    PJ_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA      	= 0x00000010,
+    PJ_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA     	= 0x00000013,
+    PJ_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA     	= 0x00000016,
+    PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA       	= 0x00000030,
+    PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA       	= 0x00000031,
+    PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA      	= 0x00000032,
+    PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA      	= 0x00000033,
+    PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA       	= 0x00000036,
+    PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA       	= 0x00000037,
+    PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA      	= 0x00000038,
+    PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA      	= 0x00000039,
+    PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA256    	= 0x0000003E,
+    PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA256    	= 0x0000003F,
+    PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256   	= 0x00000040,
+    PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256   	= 0x00000067,
+    PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA256    	= 0x00000068,
+    PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA256    	= 0x00000069,
+    PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256   	= 0x0000006A,
+    PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256   	= 0x0000006B,
+    PJ_TLS_DH_anon_WITH_RC4_128_MD5          	= 0x00000018,
+    PJ_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA     	= 0x0000001B,
+    PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA      	= 0x00000034,
+    PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA      	= 0x0000003A,
+    PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA256   	= 0x0000006C,
+    PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA256   	= 0x0000006D,
 
     /* TLS (deprecated) */
-    TLS_RSA_EXPORT_WITH_RC4_40_MD5        = 0x00000003,
-    TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5    = 0x00000006,
-    TLS_RSA_WITH_IDEA_CBC_SHA             = 0x00000007,
-    TLS_RSA_EXPORT_WITH_DES40_CBC_SHA     = 0x00000008,
-    TLS_RSA_WITH_DES_CBC_SHA              = 0x00000009,
-    TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA  = 0x0000000B,
-    TLS_DH_DSS_WITH_DES_CBC_SHA           = 0x0000000C,
-    TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA  = 0x0000000E,
-    TLS_DH_RSA_WITH_DES_CBC_SHA           = 0x0000000F,
-    TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x00000011,
-    TLS_DHE_DSS_WITH_DES_CBC_SHA          = 0x00000012,
-    TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x00000014,
-    TLS_DHE_RSA_WITH_DES_CBC_SHA          = 0x00000015,
-    TLS_DH_anon_EXPORT_WITH_RC4_40_MD5    = 0x00000017,
-    TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 0x00000019,
-    TLS_DH_anon_WITH_DES_CBC_SHA          = 0x0000001A,
+    PJ_TLS_RSA_EXPORT_WITH_RC4_40_MD5        	= 0x00000003,
+    PJ_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5    	= 0x00000006,
+    PJ_TLS_RSA_WITH_IDEA_CBC_SHA             	= 0x00000007,
+    PJ_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA     	= 0x00000008,
+    PJ_TLS_RSA_WITH_DES_CBC_SHA              	= 0x00000009,
+    PJ_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA  	= 0x0000000B,
+    PJ_TLS_DH_DSS_WITH_DES_CBC_SHA           	= 0x0000000C,
+    PJ_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA  	= 0x0000000E,
+    PJ_TLS_DH_RSA_WITH_DES_CBC_SHA           	= 0x0000000F,
+    PJ_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA 	= 0x00000011,
+    PJ_TLS_DHE_DSS_WITH_DES_CBC_SHA          	= 0x00000012,
+    PJ_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA 	= 0x00000014,
+    PJ_TLS_DHE_RSA_WITH_DES_CBC_SHA          	= 0x00000015,
+    PJ_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5    	= 0x00000017,
+    PJ_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA 	= 0x00000019,
+    PJ_TLS_DH_anon_WITH_DES_CBC_SHA          	= 0x0000001A,
 
     /* SSLv3 */
-    SSL_FORTEZZA_KEA_WITH_NULL_SHA        = 0x0000001C,
-    SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA= 0x0000001D,
-    SSL_FORTEZZA_KEA_WITH_RC4_128_SHA     = 0x0000001E,
+    PJ_SSL_FORTEZZA_KEA_WITH_NULL_SHA        	= 0x0000001C,
+    PJ_SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA	= 0x0000001D,
+    PJ_SSL_FORTEZZA_KEA_WITH_RC4_128_SHA     	= 0x0000001E,
     
     /* SSLv2 */
-    SSL_CK_RC4_128_WITH_MD5               = 0x00010080,
-    SSL_CK_RC4_128_EXPORT40_WITH_MD5      = 0x00020080,
-    SSL_CK_RC2_128_CBC_WITH_MD5           = 0x00030080,
-    SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5  = 0x00040080,
-    SSL_CK_IDEA_128_CBC_WITH_MD5          = 0x00050080,
-    SSL_CK_DES_64_CBC_WITH_MD5            = 0x00060040,
-    SSL_CK_DES_192_EDE3_CBC_WITH_MD5      = 0x000700C0
+    PJ_SSL_CK_RC4_128_WITH_MD5               	= 0x00010080,
+    PJ_SSL_CK_RC4_128_EXPORT40_WITH_MD5      	= 0x00020080,
+    PJ_SSL_CK_RC2_128_CBC_WITH_MD5           	= 0x00030080,
+    PJ_SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5  	= 0x00040080,
+    PJ_SSL_CK_IDEA_128_CBC_WITH_MD5          	= 0x00050080,
+    PJ_SSL_CK_DES_64_CBC_WITH_MD5            	= 0x00060040,
+    PJ_SSL_CK_DES_192_EDE3_CBC_WITH_MD5      	= 0x000700C0
 
 } pj_ssl_cipher;
Index: /pjproject/trunk/pjlib/src/pj/ssl_sock_common.c
===================================================================
--- /pjproject/trunk/pjlib/src/pj/ssl_sock_common.c	(revision 3109)
+++ /pjproject/trunk/pjlib/src/pj/ssl_sock_common.c	(revision 3110)
@@ -31,75 +31,75 @@
 static cipher_name_t cipher_names[] =
 {
-    {TLS_NULL_WITH_NULL_NULL,               "NULL"},
+    {PJ_TLS_NULL_WITH_NULL_NULL,               "NULL"},
 
     /* TLS/SSLv3 */
-    {TLS_RSA_WITH_NULL_MD5,                 "TLS_RSA_WITH_NULL_MD5"},
-    {TLS_RSA_WITH_NULL_SHA,                 "TLS_RSA_WITH_NULL_SHA"},
-    {TLS_RSA_WITH_NULL_SHA256,              "TLS_RSA_WITH_NULL_SHA256"},
-    {TLS_RSA_WITH_RC4_128_MD5,              "TLS_RSA_WITH_RC4_128_MD5"},
-    {TLS_RSA_WITH_RC4_128_SHA,              "TLS_RSA_WITH_RC4_128_SHA"},
-    {TLS_RSA_WITH_3DES_EDE_CBC_SHA,         "TLS_RSA_WITH_3DES_EDE_CBC_SHA"},
-    {TLS_RSA_WITH_AES_128_CBC_SHA,          "TLS_RSA_WITH_AES_128_CBC_SHA"},
-    {TLS_RSA_WITH_AES_256_CBC_SHA,          "TLS_RSA_WITH_AES_256_CBC_SHA"},
-    {TLS_RSA_WITH_AES_128_CBC_SHA256,       "TLS_RSA_WITH_AES_128_CBC_SHA256"},
-    {TLS_RSA_WITH_AES_256_CBC_SHA256,       "TLS_RSA_WITH_AES_256_CBC_SHA256"},
-    {TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA,      "TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA"},
-    {TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA,      "TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA"},
-    {TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA,     "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA"},
-    {TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,     "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA"},
-    {TLS_DH_DSS_WITH_AES_128_CBC_SHA,       "TLS_DH_DSS_WITH_AES_128_CBC_SHA"},
-    {TLS_DH_RSA_WITH_AES_128_CBC_SHA,       "TLS_DH_RSA_WITH_AES_128_CBC_SHA"},
-    {TLS_DHE_DSS_WITH_AES_128_CBC_SHA,      "TLS_DHE_DSS_WITH_AES_128_CBC_SHA"},
-    {TLS_DHE_RSA_WITH_AES_128_CBC_SHA,      "TLS_DHE_RSA_WITH_AES_128_CBC_SHA"},
-    {TLS_DH_DSS_WITH_AES_256_CBC_SHA,       "TLS_DH_DSS_WITH_AES_256_CBC_SHA"},
-    {TLS_DH_RSA_WITH_AES_256_CBC_SHA,       "TLS_DH_RSA_WITH_AES_256_CBC_SHA"},
-    {TLS_DHE_DSS_WITH_AES_256_CBC_SHA,      "TLS_DHE_DSS_WITH_AES_256_CBC_SHA"},
-    {TLS_DHE_RSA_WITH_AES_256_CBC_SHA,      "TLS_DHE_RSA_WITH_AES_256_CBC_SHA"},
-    {TLS_DH_DSS_WITH_AES_128_CBC_SHA256,    "TLS_DH_DSS_WITH_AES_128_CBC_SHA256"},
-    {TLS_DH_RSA_WITH_AES_128_CBC_SHA256,    "TLS_DH_RSA_WITH_AES_128_CBC_SHA256"},
-    {TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,   "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256"},
-    {TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,   "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256"},
-    {TLS_DH_DSS_WITH_AES_256_CBC_SHA256,    "TLS_DH_DSS_WITH_AES_256_CBC_SHA256"},
-    {TLS_DH_RSA_WITH_AES_256_CBC_SHA256,    "TLS_DH_RSA_WITH_AES_256_CBC_SHA256"},
-    {TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,   "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256"},
-    {TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,   "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256"},
-    {TLS_DH_anon_WITH_RC4_128_MD5,          "TLS_DH_anon_WITH_RC4_128_MD5"},
-    {TLS_DH_anon_WITH_3DES_EDE_CBC_SHA,     "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA"},
-    {TLS_DH_anon_WITH_AES_128_CBC_SHA,      "TLS_DH_anon_WITH_AES_128_CBC_SHA"},
-    {TLS_DH_anon_WITH_AES_256_CBC_SHA,      "TLS_DH_anon_WITH_AES_256_CBC_SHA"},
-    {TLS_DH_anon_WITH_AES_128_CBC_SHA256,   "TLS_DH_anon_WITH_AES_128_CBC_SHA256"},
-    {TLS_DH_anon_WITH_AES_256_CBC_SHA256,   "TLS_DH_anon_WITH_AES_256_CBC_SHA256"},
+    {PJ_TLS_RSA_WITH_NULL_MD5,                 "TLS_RSA_WITH_NULL_MD5"},
+    {PJ_TLS_RSA_WITH_NULL_SHA,                 "TLS_RSA_WITH_NULL_SHA"},
+    {PJ_TLS_RSA_WITH_NULL_SHA256,              "TLS_RSA_WITH_NULL_SHA256"},
+    {PJ_TLS_RSA_WITH_RC4_128_MD5,              "TLS_RSA_WITH_RC4_128_MD5"},
+    {PJ_TLS_RSA_WITH_RC4_128_SHA,              "TLS_RSA_WITH_RC4_128_SHA"},
+    {PJ_TLS_RSA_WITH_3DES_EDE_CBC_SHA,         "TLS_RSA_WITH_3DES_EDE_CBC_SHA"},
+    {PJ_TLS_RSA_WITH_AES_128_CBC_SHA,          "TLS_RSA_WITH_AES_128_CBC_SHA"},
+    {PJ_TLS_RSA_WITH_AES_256_CBC_SHA,          "TLS_RSA_WITH_AES_256_CBC_SHA"},
+    {PJ_TLS_RSA_WITH_AES_128_CBC_SHA256,       "TLS_RSA_WITH_AES_128_CBC_SHA256"},
+    {PJ_TLS_RSA_WITH_AES_256_CBC_SHA256,       "TLS_RSA_WITH_AES_256_CBC_SHA256"},
+    {PJ_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA,      "TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA"},
+    {PJ_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA,      "TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA"},
+    {PJ_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA,     "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA"},
+    {PJ_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,     "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA"},
+    {PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA,       "TLS_DH_DSS_WITH_AES_128_CBC_SHA"},
+    {PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA,       "TLS_DH_RSA_WITH_AES_128_CBC_SHA"},
+    {PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA,      "TLS_DHE_DSS_WITH_AES_128_CBC_SHA"},
+    {PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA,      "TLS_DHE_RSA_WITH_AES_128_CBC_SHA"},
+    {PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA,       "TLS_DH_DSS_WITH_AES_256_CBC_SHA"},
+    {PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA,       "TLS_DH_RSA_WITH_AES_256_CBC_SHA"},
+    {PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA,      "TLS_DHE_DSS_WITH_AES_256_CBC_SHA"},
+    {PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA,      "TLS_DHE_RSA_WITH_AES_256_CBC_SHA"},
+    {PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA256,    "TLS_DH_DSS_WITH_AES_128_CBC_SHA256"},
+    {PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA256,    "TLS_DH_RSA_WITH_AES_128_CBC_SHA256"},
+    {PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,   "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256"},
+    {PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,   "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256"},
+    {PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA256,    "TLS_DH_DSS_WITH_AES_256_CBC_SHA256"},
+    {PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA256,    "TLS_DH_RSA_WITH_AES_256_CBC_SHA256"},
+    {PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,   "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256"},
+    {PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,   "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256"},
+    {PJ_TLS_DH_anon_WITH_RC4_128_MD5,          "TLS_DH_anon_WITH_RC4_128_MD5"},
+    {PJ_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA,     "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA"},
+    {PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA,      "TLS_DH_anon_WITH_AES_128_CBC_SHA"},
+    {PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA,      "TLS_DH_anon_WITH_AES_256_CBC_SHA"},
+    {PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA256,   "TLS_DH_anon_WITH_AES_128_CBC_SHA256"},
+    {PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA256,   "TLS_DH_anon_WITH_AES_256_CBC_SHA256"},
 
     /* TLS (deprecated) */
-    {TLS_RSA_EXPORT_WITH_RC4_40_MD5,        "TLS_RSA_EXPORT_WITH_RC4_40_MD5"},
-    {TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5,    "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5"},
-    {TLS_RSA_WITH_IDEA_CBC_SHA,             "TLS_RSA_WITH_IDEA_CBC_SHA"},
-    {TLS_RSA_EXPORT_WITH_DES40_CBC_SHA,     "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA"},
-    {TLS_RSA_WITH_DES_CBC_SHA,              "TLS_RSA_WITH_DES_CBC_SHA"},
-    {TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA,  "TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA"},
-    {TLS_DH_DSS_WITH_DES_CBC_SHA,           "TLS_DH_DSS_WITH_DES_CBC_SHA"},
-    {TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA,  "TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA"},
-    {TLS_DH_RSA_WITH_DES_CBC_SHA,           "TLS_DH_RSA_WITH_DES_CBC_SHA"},
-    {TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA, "TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"},
-    {TLS_DHE_DSS_WITH_DES_CBC_SHA,          "TLS_DHE_DSS_WITH_DES_CBC_SHA"},
-    {TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA"},
-    {TLS_DHE_RSA_WITH_DES_CBC_SHA,          "TLS_DHE_RSA_WITH_DES_CBC_SHA"},
-    {TLS_DH_anon_EXPORT_WITH_RC4_40_MD5,    "TLS_DH_anon_EXPORT_WITH_RC4_40_MD5"},
-    {TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA, "TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA"},
-    {TLS_DH_anon_WITH_DES_CBC_SHA,          "TLS_DH_anon_WITH_DES_CBC_SHA"},
+    {PJ_TLS_RSA_EXPORT_WITH_RC4_40_MD5,        "TLS_RSA_EXPORT_WITH_RC4_40_MD5"},
+    {PJ_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5,    "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5"},
+    {PJ_TLS_RSA_WITH_IDEA_CBC_SHA,             "TLS_RSA_WITH_IDEA_CBC_SHA"},
+    {PJ_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA,     "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA"},
+    {PJ_TLS_RSA_WITH_DES_CBC_SHA,              "TLS_RSA_WITH_DES_CBC_SHA"},
+    {PJ_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA,  "TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA"},
+    {PJ_TLS_DH_DSS_WITH_DES_CBC_SHA,           "TLS_DH_DSS_WITH_DES_CBC_SHA"},
+    {PJ_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA,  "TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA"},
+    {PJ_TLS_DH_RSA_WITH_DES_CBC_SHA,           "TLS_DH_RSA_WITH_DES_CBC_SHA"},
+    {PJ_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA, "TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"},
+    {PJ_TLS_DHE_DSS_WITH_DES_CBC_SHA,          "TLS_DHE_DSS_WITH_DES_CBC_SHA"},
+    {PJ_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA"},
+    {PJ_TLS_DHE_RSA_WITH_DES_CBC_SHA,          "TLS_DHE_RSA_WITH_DES_CBC_SHA"},
+    {PJ_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5,    "TLS_DH_anon_EXPORT_WITH_RC4_40_MD5"},
+    {PJ_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA, "TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA"},
+    {PJ_TLS_DH_anon_WITH_DES_CBC_SHA,          "TLS_DH_anon_WITH_DES_CBC_SHA"},
 
     /* SSLv3 */
-    {SSL_FORTEZZA_KEA_WITH_NULL_SHA,        "SSL_FORTEZZA_KEA_WITH_NULL_SHA"},
-    {SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA,"SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA"},
-    {SSL_FORTEZZA_KEA_WITH_RC4_128_SHA,     "SSL_FORTEZZA_KEA_WITH_RC4_128_SHA"},
+    {PJ_SSL_FORTEZZA_KEA_WITH_NULL_SHA,        "SSL_FORTEZZA_KEA_WITH_NULL_SHA"},
+    {PJ_SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA,"SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA"},
+    {PJ_SSL_FORTEZZA_KEA_WITH_RC4_128_SHA,     "SSL_FORTEZZA_KEA_WITH_RC4_128_SHA"},
 
     /* SSLv2 */
-    {SSL_CK_RC4_128_WITH_MD5,               "SSL_CK_RC4_128_WITH_MD5"},
-    {SSL_CK_RC4_128_EXPORT40_WITH_MD5,      "SSL_CK_RC4_128_EXPORT40_WITH_MD5"},
-    {SSL_CK_RC2_128_CBC_WITH_MD5,           "SSL_CK_RC2_128_CBC_WITH_MD5"},
-    {SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5,  "SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5"},
-    {SSL_CK_IDEA_128_CBC_WITH_MD5,          "SSL_CK_IDEA_128_CBC_WITH_MD5"},
-    {SSL_CK_DES_64_CBC_WITH_MD5,            "SSL_CK_DES_64_CBC_WITH_MD5"},
-    {SSL_CK_DES_192_EDE3_CBC_WITH_MD5,      "SSL_CK_DES_192_EDE3_CBC_WITH_MD5"}
+    {PJ_SSL_CK_RC4_128_WITH_MD5,               "SSL_CK_RC4_128_WITH_MD5"},
+    {PJ_SSL_CK_RC4_128_EXPORT40_WITH_MD5,      "SSL_CK_RC4_128_EXPORT40_WITH_MD5"},
+    {PJ_SSL_CK_RC2_128_CBC_WITH_MD5,           "SSL_CK_RC2_128_CBC_WITH_MD5"},
+    {PJ_SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5,  "SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5"},
+    {PJ_SSL_CK_IDEA_128_CBC_WITH_MD5,          "SSL_CK_IDEA_128_CBC_WITH_MD5"},
+    {PJ_SSL_CK_DES_64_CBC_WITH_MD5,            "SSL_CK_DES_64_CBC_WITH_MD5"},
+    {PJ_SSL_CK_DES_192_EDE3_CBC_WITH_MD5,      "SSL_CK_DES_192_EDE3_CBC_WITH_MD5"}
 };
 
@@ -147,5 +147,6 @@
 
 
-PJ_DEF(pj_status_t) pj_ssl_cert_verify_error_st(pj_uint32_t verify_status, 
+PJ_DEF(pj_status_t) pj_ssl_cert_get_verify_status_strings(
+						pj_uint32_t verify_status, 
 						const char *error_strings[],
 						unsigned *count)
Index: /pjproject/trunk/pjlib/src/pj/ssl_sock_dump.c
===================================================================
--- /pjproject/trunk/pjlib/src/pj/ssl_sock_dump.c	(revision 3109)
+++ /pjproject/trunk/pjlib/src/pj/ssl_sock_dump.c	(revision 3110)
@@ -28,14 +28,15 @@
 #define THIS_FILE	"ssl_sock_dump.c"
 
-#define CHECK_BUF_LEN()							\
-    if ((len < 0) || ((p+=len) >= end)) {				\
-	*(p-1) = '\0';							\
-	return PJ_ETOOSMALL;						\
-    }
+#define CHECK_BUF_LEN()						\
+    if ((len < 0) || (len >= end-p)) {				\
+	*p = '\0';						\
+	return -1;						\
+    }								\
+    p += len;
 
-PJ_DEF(pj_status_t) pj_ssl_cert_info_dump(const pj_ssl_cert_info *ci,
-					  const char *prefix,
-					  char *buf,
-					  pj_size_t buf_size)
+PJ_DEF(pj_ssize_t) pj_ssl_cert_info_dump(const pj_ssl_cert_info *ci,
+					 const char *indent,
+					 char *buf,
+					 pj_size_t buf_size)
 {
     const char *wdays[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
@@ -54,9 +55,9 @@
     /* Version */
     len = pj_ansi_snprintf(p, end-p, "%sVersion    : v%d\n", 
-			   prefix, ci->version);
+			   indent, ci->version);
     CHECK_BUF_LEN();
     
     /* Serial number */
-    len = pj_ansi_snprintf(p, end-p, "%sSerial     : ", prefix);
+    len = pj_ansi_snprintf(p, end-p, "%sSerial     : ", indent);
     CHECK_BUF_LEN();
 
@@ -69,9 +70,9 @@
     
     /* Subject */
-    len = pj_ansi_snprintf( p, end-p, "%sSubject    : %.*s\n", prefix,
+    len = pj_ansi_snprintf( p, end-p, "%sSubject    : %.*s\n", indent,
 			    ci->subject.cn.slen, 
 			    ci->subject.cn.ptr);
     CHECK_BUF_LEN();
-    len = pj_ansi_snprintf( p, end-p, "%s             %.*s\n", prefix,
+    len = pj_ansi_snprintf( p, end-p, "%s             %.*s\n", indent,
 			    ci->subject.info.slen,
 			    ci->subject.info.ptr);
@@ -79,9 +80,9 @@
 
     /* Issuer */
-    len = pj_ansi_snprintf( p, end-p, "%sIssuer     : %.*s\n", prefix,
+    len = pj_ansi_snprintf( p, end-p, "%sIssuer     : %.*s\n", indent,
 			    ci->issuer.cn.slen,
 			    ci->issuer.cn.ptr);
     CHECK_BUF_LEN();
-    len = pj_ansi_snprintf( p, end-p, "%s             %.*s\n", prefix,
+    len = pj_ansi_snprintf( p, end-p, "%s             %.*s\n", indent,
 			    ci->issuer.info.slen,
 			    ci->issuer.info.ptr);
@@ -90,5 +91,5 @@
     /* Validity period */
     len = pj_ansi_snprintf( p, end-p, "%sValid from : %s %4d-%02d-%02d "
-			    "%02d:%02d:%02d.%03d %s\n", prefix,
+			    "%02d:%02d:%02d.%03d %s\n", indent,
 			    wdays[pt1.wday], pt1.year, pt1.mon+1, pt1.day,
 			    pt1.hour, pt1.min, pt1.sec, pt1.msec,
@@ -97,5 +98,5 @@
 
     len = pj_ansi_snprintf( p, end-p, "%sValid to   : %s %4d-%02d-%02d "
-			    "%02d:%02d:%02d.%03d %s\n", prefix,
+			    "%02d:%02d:%02d.%03d %s\n", indent,
 			    wdays[pt2.wday], pt2.year, pt2.mon+1, pt2.day,
 			    pt2.hour, pt2.min, pt2.sec, pt2.msec,
@@ -108,5 +109,5 @@
 
 	len = pj_ansi_snprintf(p, end-p, "%ssubjectAltName extension\n", 
-			       prefix);
+			       indent);
 	CHECK_BUF_LEN();
 
@@ -131,5 +132,5 @@
 	    }
 	    if (type) {
-		len = pj_ansi_snprintf( p, end-p, "%s      %s : %.*s\n", prefix, 
+		len = pj_ansi_snprintf( p, end-p, "%s      %s : %.*s\n", indent, 
 					type, 
 					ci->subj_alt_name.entry[i].name.slen, 
@@ -140,5 +141,5 @@
     }
 
-    return PJ_SUCCESS;
+    return (p-buf);
 }
 
Index: /pjproject/trunk/pjlib/src/pj/ssl_sock_symbian.cpp
===================================================================
--- /pjproject/trunk/pjlib/src/pj/ssl_sock_symbian.cpp	(revision 3109)
+++ /pjproject/trunk/pjlib/src/pj/ssl_sock_symbian.cpp	(revision 3110)
@@ -445,11 +445,10 @@
 
 
-static pj_str_t get_cert_name(pj_pool_t *pool,
+static pj_str_t get_cert_name(char *buf, unsigned buf_len,
                               const CX500DistinguishedName &name)
 {
     TInt i;
-    char buf[1024];
     TUint8 *p;
-    TInt l = sizeof(buf);
+    TInt l = buf_len;
     
     p = (TUint8*)buf;
@@ -480,9 +479,8 @@
     }
     
-    pj_str_t src, res;
-    pj_strset(&src, buf, sizeof(buf) - l);
-    pj_strdup(pool, &res, &src);
-    
-    return res;
+    pj_str_t src;
+    pj_strset(&src, buf, buf_len - l);
+    
+    return src;
 }
                             
@@ -492,8 +490,12 @@
                           const CX509Certificate *x)
 {
+    enum { tmp_buf_len = 512 };
+    char *tmp_buf;
     unsigned len;
     
     pj_assert(pool && ci && x);
     
+    /* Init */
+    tmp_buf = new char[tmp_buf_len];
     pj_bzero(ci, sizeof(*ci));
     
@@ -519,5 +521,7 @@
 	    pj_strset(&ci->subject.cn, (char*)ptr8.Ptr(), ptr8.Length());
 	}
-	ci->subject.info = get_cert_name(pool, x->SubjectName());
+	pj_str_t tmp = get_cert_name(tmp_buf, tmp_buf_len,
+				     x->SubjectName());
+	pj_strdup(pool, &ci->subject.info, &tmp);
     }
 
@@ -533,5 +537,7 @@
 	    pj_strset(&ci->issuer.cn, (char*)ptr8.Ptr(), ptr8.Length());
 	}
-	ci->issuer.info = get_cert_name(pool, x->IssuerName());
+	pj_str_t tmp = get_cert_name(tmp_buf, tmp_buf_len,
+				     x->IssuerName());
+	pj_strdup(pool, &ci->issuer.info, &tmp);
     }
     
@@ -544,4 +550,7 @@
     valid_period.Finish().SecondsFrom(base_time, tmp_sec);
     ci->validity.end.sec = tmp_sec.Int();
+    
+    /* Deinit */
+    delete [] tmp_buf;
 }
 
Index: /pjproject/trunk/pjlib/src/pjlib-test/ssl_sock.c
===================================================================
--- /pjproject/trunk/pjlib/src/pjlib-test/ssl_sock.c	(revision 3109)
+++ /pjproject/trunk/pjlib/src/pjlib-test/ssl_sock.c	(revision 3110)
@@ -108,6 +108,6 @@
 	/* Dump remote TLS certificate verification result */
 	verif_msg_cnt = PJ_ARRAY_SIZE(verif_msgs);
-	pj_ssl_cert_verify_error_st(si->verify_status,
-				    verif_msgs, &verif_msg_cnt);
+	pj_ssl_cert_get_verify_status_strings(si->verify_status,
+					      verif_msgs, &verif_msg_cnt);
 	PJ_LOG(3,("", ".....Remote certificate verification result: %s",
 		  (verif_msg_cnt == 1? verif_msgs[0]:"")));
@@ -1154,14 +1154,14 @@
 #ifndef PJ_SYMBIAN
 
-    PJ_LOG(3,("", "..echo test w/ TLSv1 and TLS_RSA_WITH_DES_CBC_SHA cipher"));
+    PJ_LOG(3,("", "..echo test w/ TLSv1 and PJ_TLS_RSA_WITH_DES_CBC_SHA cipher"));
     ret = echo_test(PJ_SSL_SOCK_PROTO_TLS1, PJ_SSL_SOCK_PROTO_TLS1, 
-		    TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_DES_CBC_SHA, 
+		    PJ_TLS_RSA_WITH_DES_CBC_SHA, PJ_TLS_RSA_WITH_DES_CBC_SHA, 
 		    PJ_FALSE, PJ_FALSE);
     if (ret != 0)
 	return ret;
 
-    PJ_LOG(3,("", "..echo test w/ SSLv23 and TLS_RSA_WITH_AES_256_CBC_SHA cipher"));
+    PJ_LOG(3,("", "..echo test w/ SSLv23 and PJ_TLS_RSA_WITH_AES_256_CBC_SHA cipher"));
     ret = echo_test(PJ_SSL_SOCK_PROTO_SSL23, PJ_SSL_SOCK_PROTO_SSL23, 
-		    TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA,
+		    PJ_TLS_RSA_WITH_AES_256_CBC_SHA, PJ_TLS_RSA_WITH_AES_256_CBC_SHA,
 		    PJ_FALSE, PJ_FALSE);
     if (ret != 0)
@@ -1170,5 +1170,5 @@
     PJ_LOG(3,("", "..echo test w/ incompatible proto"));
     ret = echo_test(PJ_SSL_SOCK_PROTO_TLS1, PJ_SSL_SOCK_PROTO_SSL3, 
-		    TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_DES_CBC_SHA,
+		    PJ_TLS_RSA_WITH_DES_CBC_SHA, PJ_TLS_RSA_WITH_DES_CBC_SHA,
 		    PJ_FALSE, PJ_FALSE);
     if (ret == 0)
@@ -1177,5 +1177,5 @@
     PJ_LOG(3,("", "..echo test w/ incompatible ciphers"));
     ret = echo_test(PJ_SSL_SOCK_PROTO_DEFAULT, PJ_SSL_SOCK_PROTO_DEFAULT, 
-		    TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA,
+		    PJ_TLS_RSA_WITH_DES_CBC_SHA, PJ_TLS_RSA_WITH_AES_256_CBC_SHA,
 		    PJ_FALSE, PJ_FALSE);
     if (ret == 0)
@@ -1184,5 +1184,5 @@
     PJ_LOG(3,("", "..echo test w/ client cert required but not provided"));
     ret = echo_test(PJ_SSL_SOCK_PROTO_DEFAULT, PJ_SSL_SOCK_PROTO_DEFAULT, 
-		    TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA,
+		    PJ_TLS_RSA_WITH_AES_256_CBC_SHA, PJ_TLS_RSA_WITH_AES_256_CBC_SHA,
 		    PJ_TRUE, PJ_FALSE);
     if (ret == 0)
@@ -1191,5 +1191,5 @@
     PJ_LOG(3,("", "..echo test w/ client cert required and provided"));
     ret = echo_test(PJ_SSL_SOCK_PROTO_DEFAULT, PJ_SSL_SOCK_PROTO_DEFAULT, 
-		    TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA,
+		    PJ_TLS_RSA_WITH_AES_256_CBC_SHA, PJ_TLS_RSA_WITH_AES_256_CBC_SHA,
 		    PJ_TRUE, PJ_TRUE);
     if (ret != 0)
Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3109)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3110)
@@ -2791,6 +2791,7 @@
  * Transport status notification
  */
-static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
-				    const pjsip_transport_state_info *info)
+static void on_transport_state(pjsip_transport *tp, 
+			       pjsip_transport_state state,
+			       const pjsip_transport_state_info *info)
 {
     char host_port[128];
@@ -2801,25 +2802,24 @@
 		     tp->remote_name.port);
 
-    if (state & PJSIP_TP_STATE_CONNECTED) {
-	PJ_LOG(3,(THIS_FILE, "SIP transport %s is connected to %s", 
-		 tp->type_name, host_port));
-    } 
-    else if (state & PJSIP_TP_STATE_ACCEPTED) {
-	PJ_LOG(3,(THIS_FILE, "SIP transport %s accepted %s",
-		 tp->type_name, host_port));
-    } 
-    else if (state & PJSIP_TP_STATE_DISCONNECTED) {
-	char buf[100];
-
-	snprintf(buf, sizeof(buf), "SIP transport %s is disconnected from %s",
-		 tp->type_name, host_port);
-	pjsua_perror(THIS_FILE, buf, info->status);
-    }
-    else if (state & PJSIP_TP_STATE_REJECTED) {
-	char buf[100];
-
-	snprintf(buf, sizeof(buf), "SIP transport %s rejected %s",
-		 tp->type_name, host_port);
-	pjsua_perror(THIS_FILE, buf, info->status);
+    switch (state) {
+    case PJSIP_TP_STATE_CONNECTED:
+	{
+	    PJ_LOG(3,(THIS_FILE, "SIP transport %s is connected to %s", 
+		     tp->type_name, host_port));
+	}
+	break;
+
+    case PJSIP_TP_STATE_DISCONNECTED:
+	{
+	    char buf[100];
+
+	    snprintf(buf, sizeof(buf), "SIP transport %s is disconnected from %s",
+		     tp->type_name, host_port);
+	    pjsua_perror(THIS_FILE, buf, info->status);
+	}
+	break;
+
+    default:
+	break;
     }
 
@@ -2828,9 +2828,9 @@
     if (!pj_ansi_stricmp(tp->type_name, "tls") && info->ext_info &&
 	(state == PJSIP_TP_STATE_CONNECTED || 
-	 (state & PJSIP_TP_STATE_TLS_VERIF_ERROR)))
+	 ((pjsip_tls_state_info*)info->ext_info)->
+			         ssl_sock_info->verify_status != PJ_SUCCESS))
     {
 	pjsip_tls_state_info *tls_info = (pjsip_tls_state_info*)info->ext_info;
-	pj_ssl_sock_info *ssl_sock_info = (pj_ssl_sock_info*)
-					  tls_info->ssl_sock_info;
+	pj_ssl_sock_info *ssl_sock_info = tls_info->ssl_sock_info;
 	char buf[2048];
 	const char *verif_msgs[32];
@@ -2844,6 +2844,6 @@
 	/* Dump server TLS certificate verification result */
 	verif_msg_cnt = PJ_ARRAY_SIZE(verif_msgs);
-	pj_ssl_cert_verify_error_st(ssl_sock_info->verify_status,
-				    verif_msgs, &verif_msg_cnt);
+	pj_ssl_cert_get_verify_status_strings(ssl_sock_info->verify_status,
+					      verif_msgs, &verif_msg_cnt);
 	PJ_LOG(3,(THIS_FILE, "TLS cert verification result of %s : %s",
 			     host_port,
@@ -2855,5 +2855,5 @@
 	}
 
-	if (state & PJSIP_TP_STATE_TLS_VERIF_ERROR && 
+	if (ssl_sock_info->verify_status &&
 	    !app_config.udp_cfg.tls_setting.verify_server) 
 	{
@@ -2864,5 +2864,5 @@
 
 #endif
-    return PJ_TRUE;
+
 }
 
Index: /pjproject/trunk/pjsip-apps/src/symbian_ua/ua.cpp
===================================================================
--- /pjproject/trunk/pjsip-apps/src/symbian_ua/ua.cpp	(revision 3109)
+++ /pjproject/trunk/pjsip-apps/src/symbian_ua/ua.cpp	(revision 3110)
@@ -274,6 +274,7 @@
  * Transport status notification
  */
-static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
-				    const pjsip_transport_state_info *info)
+static void on_transport_state(pjsip_transport *tp, 
+                               pjsip_transport_state state,
+                               const pjsip_transport_state_info *info)
 {
     char host_port[128];
@@ -284,25 +285,24 @@
 		     tp->remote_name.port);
 
-    if (state & PJSIP_TP_STATE_CONNECTED) {
-	PJ_LOG(3,(THIS_FILE, "SIP transport %s is connected to %s", 
-		 tp->type_name, host_port));
-    } 
-    else if (state & PJSIP_TP_STATE_ACCEPTED) {
-	PJ_LOG(3,(THIS_FILE, "SIP transport %s accepted %s",
-		 tp->type_name, host_port));
-    } 
-    else if (state & PJSIP_TP_STATE_DISCONNECTED) {
-	char buf[100];
-
-	snprintf(buf, sizeof(buf), "SIP transport %s is disconnected from %s",
-		 tp->type_name, host_port);
-	pjsua_perror(THIS_FILE, buf, info->status);
-    }
-    else if (state & PJSIP_TP_STATE_REJECTED) {
-	char buf[100];
-
-	snprintf(buf, sizeof(buf), "SIP transport %s rejected %s",
-		 tp->type_name, host_port);
-	pjsua_perror(THIS_FILE, buf, info->status);
+    switch (state) {
+    case PJSIP_TP_STATE_CONNECTED:
+	{
+	    PJ_LOG(3,(THIS_FILE, "SIP transport %s is connected to %s", 
+		     tp->type_name, host_port));
+	}
+	break;
+
+    case PJSIP_TP_STATE_DISCONNECTED:
+	{
+	    char buf[100];
+
+	    snprintf(buf, sizeof(buf), "SIP transport %s is disconnected from %s",
+		     tp->type_name, host_port);
+	    pjsua_perror(THIS_FILE, buf, info->status);
+	}
+	break;
+
+    default:
+	break;
     }
 
@@ -310,6 +310,5 @@
 
     if (!pj_ansi_stricmp(tp->type_name, "tls") && info->ext_info &&
-	(state == PJSIP_TP_STATE_CONNECTED || 
-	 (state & PJSIP_TP_STATE_TLS_VERIF_ERROR)))
+	state == PJSIP_TP_STATE_CONNECTED) 
     {
 	pjsip_tls_state_info *tls_info = (pjsip_tls_state_info*)info->ext_info;
@@ -325,5 +324,4 @@
 
 #endif
-    return PJ_TRUE;
 }
 
Index: /pjproject/trunk/pjsip/include/pjsip/sip_errno.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_errno.h	(revision 3109)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_errno.h	(revision 3110)
@@ -505,4 +505,9 @@
  */
 #define PJSIP_TLS_ETIMEDOUT	(PJSIP_ERRNO_START_PJSIP+172)	/* 171172 */
+/**
+ * @hideinitializer
+ * SSL certificate verification error.
+ */
+#define PJSIP_TLS_ECERTVERIF	(PJSIP_ERRNO_START_PJSIP+173)	/* 171173 */
 
 
Index: /pjproject/trunk/pjsip/include/pjsip/sip_transport.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_transport.h	(revision 3109)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_transport.h	(revision 3110)
@@ -694,9 +694,4 @@
 
     /**
-     * Hash of host name.
-     */
-    pj_uint32_t		    hname;
-
-    /**
      * Destination address.
      */
@@ -704,4 +699,22 @@
 
 } pjsip_transport_key;
+
+
+/**
+ * Enumeration of transport direction types.
+ */
+typedef enum pjsip_transport_dir
+{
+    PJSIP_TP_DIR_NONE,		    /**< Direction not set, normally used by
+				         connectionless transports such as 
+					 UDP transport.			    */
+    PJSIP_TP_DIR_OUTGOING,	    /**< Outgoing connection or client mode,
+				         this is only for connection-oriented 
+					 transports.			    */
+    PJSIP_TP_DIR_INCOMING,	    /**< Incoming connection or server mode,
+					 this is only for connection-oriented
+					 transports.			    */
+} pjsip_transport_dir;
+
 
 /**
@@ -732,4 +745,5 @@
     pjsip_host_port	    local_name;	    /**< Published name (eg. STUN). */
     pjsip_host_port	    remote_name;    /**< Remote address name.	    */
+    pjsip_transport_dir	    dir;	    /**< Connection direction.	    */
     
     pjsip_endpoint	   *endpt;	    /**< Endpoint instance.	    */
@@ -1131,5 +1145,5 @@
  *
  * This is an internal function since normally application doesn't have access
- * to transport manager. Application should use pjsip_endpt_acquire_transport()
+ * to transport manager. Application should use pjsip_endpt_acquire_transport2()
  * instead.
  *
@@ -1245,26 +1259,17 @@
  * Enumeration of transport state types.
  */
-typedef enum pjsip_transport_state_type {
-
-    /** Transport connected.	*/
-    PJSIP_TP_STATE_CONNECTED	    = (1 << 0),
-
-    /** Transport accepted.	*/
-    PJSIP_TP_STATE_ACCEPTED	    = (1 << 1),
-
-    /** Transport disconnected.	*/
-    PJSIP_TP_STATE_DISCONNECTED	    = (1 << 2),
-
-    /** Incoming connection rejected.	*/
-    PJSIP_TP_STATE_REJECTED	    = (1 << 3),
-
-    /** TLS verification error.	*/
-    PJSIP_TP_STATE_TLS_VERIF_ERROR  = (1 << 8)
-
-} pjsip_transport_state_type;
-
-
-/**
- * Structure of transport state info.
+typedef enum pjsip_transport_state
+{
+    PJSIP_TP_STATE_CONNECTED,	    /**< Transport connected, applicable only
+					 to connection-oriented transports
+					 such as TCP and TLS.		    */
+    PJSIP_TP_STATE_DISCONNECTED	    /**< Transport disconnected, applicable
+					 only to connection-oriented 
+					 transports such as TCP and TLS.    */
+} pjsip_transport_state;
+
+
+/**
+ * Structure of transport state info passed by #pjsip_tp_state_callback.
  */
 typedef struct pjsip_transport_state_info {
@@ -1273,5 +1278,5 @@
      */
     pj_status_t		 status;
-    
+
     /**
      * Optional extended info, the content is specific for each transport type.
@@ -1283,21 +1288,14 @@
 /**
  * Type of callback to receive transport state notifications, such as
- * transport connected, disconnected or TLS verification error.
+ * transport connected/disconnected. Application may shutdown the transport
+ * in this callback.
  *
  * @param tp		The transport instance.
- * @param state		The transport state, this may contain single or 
- *			combination of transport state types defined in
- *			#pjsip_transport_state_type.
+ * @param state		The transport state.
  * @param info		The transport state info.
- *
- * @return		When TLS verification fails and peer verification in
- *			#pjsip_tls_setting is not set, application may return
- *			PJ_TRUE to ignore the verification result and continue
- *			using the transport. On other cases, this return value
- *			is currently not used and will be ignored.
- */
-typedef pj_bool_t (*pjsip_tp_state_callback)(
+ */
+typedef void (*pjsip_tp_state_callback)(
 				    pjsip_transport *tp,
-				    pj_uint32_t state,
+				    pjsip_transport_state state,
 				    const pjsip_transport_state_info *info);
 
@@ -1306,5 +1304,5 @@
  * Setting callback of transport state notification. The caller will be
  * notified whenever the state of transport is changed. The type of
- * events are defined in #pjsip_transport_state_type.
+ * events are defined in #pjsip_transport_state.
  * 
  * @param mgr	    Transport manager.
Index: /pjproject/trunk/pjsip/include/pjsip/sip_transport_tls.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_transport_tls.h	(revision 3109)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_transport_tls.h	(revision 3110)
@@ -123,19 +123,16 @@
 
     /**
-     * Specifies the action when verification of server TLS certificate
-     * resulting errors:
+     * Specifies TLS transport behavior on the server TLS certificate 
+     * verification result:
      * - If \a verify_server is disabled (set to PJ_FALSE), TLS transport 
      *   will just notify the application via #pjsip_tp_state_callback with
-     *   state (PJSIP_TP_STATE_CONNECTED | PJSIP_TP_STATE_TLS_VERIF_ERROR)
-     *   whenever there is any TLS verification error, the return value of 
-     *   the callback will be used to decide whether transport should be 
-     *   shutdown.
+     *   state PJSIP_TP_STATE_CONNECTED regardless TLS verification result.
      * - If \a verify_server is enabled (set to PJ_TRUE), TLS transport 
      *   will be shutdown and application will be notified with state
-     *   (PJSIP_TP_STATE_DISCONNECTED | PJSIP_TP_STATE_TLS_VERIF_ERROR)
-     *   whenever there is any TLS verification error.
-     *
-     * When the verification resulting success, application will be notified
-     * via #pjsip_tp_state_callback with state PJSIP_TP_STATE_CONNECTED.
+     *   PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification
+     *   error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.
+     *
+     * In any cases, application can inspect #pjsip_tls_state_info in the
+     * callback to see the verification detail.
      *
      * Default value is PJ_FALSE.
@@ -144,19 +141,16 @@
 
     /**
-     * Specifies the action when verification of server TLS certificate
-     * resulting errors:
+     * Specifies TLS transport behavior on the client TLS certificate 
+     * verification result:
      * - If \a verify_client is disabled (set to PJ_FALSE), TLS transport 
      *   will just notify the application via #pjsip_tp_state_callback with
-     *   state (PJSIP_TP_STATE_ACCEPTED | PJSIP_TP_STATE_TLS_VERIF_ERROR)
-     *   whenever there is any TLS verification error, the return value of 
-     *   the callback will be used to decide whether transport should be 
-     *   shutdown.
+     *   state PJSIP_TP_STATE_CONNECTED regardless TLS verification result.
      * - If \a verify_client is enabled (set to PJ_TRUE), TLS transport 
      *   will be shutdown and application will be notified with state
-     *   (PJSIP_TP_STATE_REJECTED | PJSIP_TP_STATE_TLS_VERIF_ERROR)
-     *   whenever there is any TLS verification error.
-     *
-     * When the verification resulting success, application will be notified
-     * via #pjsip_tp_state_callback with state PJSIP_TP_STATE_ACCEPTED.
+     *   PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification
+     *   error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.
+     *
+     * In any cases, application can inspect #pjsip_tls_state_info in the
+     * callback to see the verification detail.
      *
      * Default value is PJ_FALSE.
@@ -166,5 +160,5 @@
     /**
      * When acting as server (incoming TLS connections), reject inocming
-     * connection if client doesn't have a valid certificate.
+     * connection if client doesn't supply a TLS certificate.
      *
      * This setting corresponds to SSL_VERIFY_FAIL_IF_NO_PEER_CERT flag.
@@ -210,6 +204,7 @@
 
 /**
- * This structure defines transport state extended info specifically for
- * TLS transport.
+ * This structure defines TLS transport extended info in <tt>ext_info</tt>
+ * field of #pjsip_transport_state_info for the transport state notification
+ * callback #pjsip_tp_state_callback.
  */
 typedef struct pjsip_tls_state_info
Index: /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 3109)
+++ /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 3110)
@@ -847,19 +847,6 @@
      * This callback is called when transport state is changed. See also
      * #pjsip_tp_state_callback.
-     *
-     * @param tp	The transport instance.
-     * @param state	The transport state, this may contain single or 
-     *			combination of transport state types defined in
-     *			#pjsip_transport_state_type.
-     * @param info	The transport state info.
-     *
-     * @return		When TLS verification fails and peer verification in
-     *			#pjsip_tls_setting is not set, application may return
-     *			PJ_TRUE to ignore the verification result and continue
-     *			using the transport. On other cases, this return value
-     *			is currently not used and will be ignored.
-     */
-    pj_bool_t (*on_transport_state)(pjsip_transport *tp, pj_uint32_t state,
-				    const pjsip_transport_state_info *info);
+     */
+    pjsip_tp_state_callback on_transport_state;
 
 } pjsua_callback;
Index: /pjproject/trunk/pjsip/src/pjsip/sip_errno.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_errno.c	(revision 3109)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_errno.c	(revision 3110)
@@ -132,4 +132,5 @@
     PJ_BUILD_ERR( PJSIP_TLS_EREAD,	"Unknown error when reading SSL data"),
     PJ_BUILD_ERR( PJSIP_TLS_ETIMEDOUT,	"SSL negotiation has timed out"),
+    PJ_BUILD_ERR( PJSIP_TLS_ECERTVERIF,	"SSL certificate verification error"),
 };
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 3109)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 3110)
@@ -867,5 +867,5 @@
      * Register to hash table (see Trac ticket #42).
      */
-    key_len = sizeof(tp->key.type) + sizeof(tp->key.hname) + tp->addr_len;
+    key_len = sizeof(tp->key.type) + tp->addr_len;
     pj_lock_acquire(mgr->lock);
 
@@ -917,5 +917,5 @@
      * Unregister from hash table (see Trac ticket #42).
      */
-    key_len = sizeof(tp->key.type) + sizeof(tp->key.hname) + tp->addr_len;
+    key_len = sizeof(tp->key.type) + tp->addr_len;
     hval = 0;
     entry = pj_hash_get(mgr->table, &tp->key, key_len, &hval);
@@ -1592,32 +1592,10 @@
 	pjsip_transport *transport;
 
-	/*
-	 * Find factory that can create such transport.
-	 */
-	factory = mgr->factory_list.next;
-	while (factory != &mgr->factory_list) {
-	    if (factory->type == type)
-		break;
-	    factory = factory->next;
-	}
-	if (factory == &mgr->factory_list)
-	    factory = NULL;
-
 	pj_bzero(&key, sizeof(key));
-	key_len = sizeof(key.type) + sizeof(key.hname) + addr_len;
+	key_len = sizeof(key.type) + addr_len;
 
 	/* First try to get exact destination. */
 	key.type = type;
 	pj_memcpy(&key.rem_addr, remote, addr_len);
-	if (factory && factory->create_transport2 && 
-	    tdata && tdata->dest_info.name.slen)
-	{
-	    /* Only include hostname hash in the key when the factory support
-	     * create_transport2() and tdata is supplied.
-	     */
-	    key.hname = pj_hash_calc_tolower(0, 
-				    (char*)tdata->dest_info.name.ptr,
-				    &tdata->dest_info.name);
-	}
 
 	transport = (pjsip_transport*)
@@ -1636,5 +1614,5 @@
 
 		pj_bzero(addr, addr_len);
-		key_len = sizeof(key.type) + sizeof(key.hname) + addr_len;
+		key_len = sizeof(key.type) + addr_len;
 		transport = (pjsip_transport*) 
 			    pj_hash_get(mgr->table, &key, key_len, NULL);
@@ -1649,5 +1627,5 @@
 		addr->addr.sa_family = remote_addr->addr.sa_family;
 
-		key_len = sizeof(key.type) + sizeof(key.hname) + addr_len;
+		key_len = sizeof(key.type) + addr_len;
 		transport = (pjsip_transport*)
 			    pj_hash_get(mgr->table, &key, key_len, NULL);
@@ -1669,6 +1647,14 @@
 	/*
 	 * Transport not found!
+	 * Find factory that can create such transport.
 	 */
-	if (NULL == factory) {
+	factory = mgr->factory_list.next;
+	while (factory != &mgr->factory_list) {
+	    if (factory->type == type)
+		break;
+	    factory = factory->next;
+	}
+
+	if (factory == &mgr->factory_list) {
 	    /* No factory can create the transport! */
 	    pj_lock_release(mgr->lock);
@@ -1678,5 +1664,4 @@
     }
 
-    
     TRACE_((THIS_FILE, "Creating new transport from factory"));
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport_loop.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport_loop.c	(revision 3109)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport_loop.c	(revision 3110)
@@ -382,4 +382,5 @@
 						  loop->base.key.type);
     loop->base.addr_len = sizeof(pj_sockaddr_in);
+    loop->base.dir = PJSIP_TP_DIR_NONE;
     loop->base.endpt = endpt;
     loop->base.tpmgr = pjsip_endpt_get_tpmgr(endpt);
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c	(revision 3109)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c	(revision 3110)
@@ -585,4 +585,5 @@
     sockaddr_to_host_port(pool, &tcp->base.local_name, local);
     sockaddr_to_host_port(pool, &tcp->base.remote_name, remote);
+    tcp->base.dir = is_server? PJSIP_TP_DIR_INCOMING : PJSIP_TP_DIR_OUTGOING;
 
     tcp->base.endpt = listener->endpt;
@@ -1005,5 +1006,5 @@
             
 		pj_bzero(&state_info, sizeof(state_info));
-		(*state_cb)(&tcp->base, PJSIP_TP_STATE_ACCEPTED, &state_info);
+		(*state_cb)(&tcp->base, PJSIP_TP_STATE_CONNECTED, &state_info);
 	    }
 	}
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c	(revision 3109)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c	(revision 3110)
@@ -558,6 +558,4 @@
     tls->base.key.type = PJSIP_TRANSPORT_TLS;
     pj_memcpy(&tls->base.key.rem_addr, remote, sizeof(pj_sockaddr_in));
-    tls->base.key.hname = pj_hash_calc_tolower(0, (char*)tls->remote_name.ptr,
-					       &tls->remote_name);
     tls->base.type_name = "tls";
     tls->base.flag = pjsip_transport_get_flag_from_type(PJSIP_TRANSPORT_TLS);
@@ -569,4 +567,5 @@
 
     tls->base.addr_len = sizeof(pj_sockaddr_in);
+    tls->base.dir = is_server? PJSIP_TP_DIR_INCOMING : PJSIP_TP_DIR_OUTGOING;
     
     /* Set initial local address */
@@ -979,8 +978,7 @@
     pj_ssl_sock_info ssl_info;
     char addr[PJ_INET6_ADDRSTRLEN+10];
+    pjsip_tp_state_callback *state_cb;
+    pj_bool_t is_shutdown;
     pj_status_t status;
-
-    pjsip_tp_state_callback *state_cb;
-    pj_bool_t tls_verif_ignored;
 
     PJ_UNUSED_ARG(src_addr_len);
@@ -1022,5 +1020,17 @@
     pj_ssl_sock_set_user_data(new_ssock, tls);
 
-    tls_verif_ignored = !listener->tls_setting.verify_client;
+    /* Prevent immediate transport destroy as application may access it 
+     * (getting info, etc) in transport state notification callback.
+     */
+    pjsip_transport_add_ref(&tls->base);
+
+    /* If there is verification error and verification is mandatory, shutdown
+     * and destroy the transport.
+     */
+    if (ssl_info.verify_status && listener->tls_setting.verify_client) {
+	if (tls->close_reason == PJ_SUCCESS) 
+	    tls->close_reason = PJSIP_TLS_ECERTVERIF;
+	pjsip_transport_shutdown(&tls->base);
+    }
 
     /* Notify transport state to application */
@@ -1029,37 +1039,33 @@
 	pjsip_transport_state_info state_info;
 	pjsip_tls_state_info tls_info;
-	pj_uint32_t tp_state = 0;
-
-	/* Init transport state notification callback */
+	pjsip_transport_state tp_state;
+
+	/* Init transport state info */
 	pj_bzero(&tls_info, sizeof(tls_info));
 	pj_bzero(&state_info, sizeof(state_info));
-
-	/* Set transport state based on verification status */
-	if (ssl_info.verify_status) {
-	    state_info.status = PJSIP_TLS_EACCEPT;
-	    tp_state |= PJSIP_TP_STATE_TLS_VERIF_ERROR;
-	    if (listener->tls_setting.verify_client)
-		tp_state |= PJSIP_TP_STATE_REJECTED;
-	    else
-		tp_state |= PJSIP_TP_STATE_ACCEPTED;
-	} else {
-	    tp_state |= PJSIP_TP_STATE_ACCEPTED;
-	}
-
 	tls_info.ssl_sock_info = &ssl_info;
 	state_info.ext_info = &tls_info;
 
-	tls_verif_ignored = (*state_cb)(&tls->base, tp_state, &state_info);
-    }
-
-    /* Transport should be destroyed when there is TLS verification error
-     * and application doesn't want to ignore it.
-     */
-    if (ssl_info.verify_status && 
-	(listener->tls_setting.verify_client || !tls_verif_ignored))
-    {
-	tls_destroy(&tls->base, PJSIP_TLS_EACCEPT);
+	/* Set transport state based on verification status */
+	if (ssl_info.verify_status && listener->tls_setting.verify_client)
+	{
+	    tp_state = PJSIP_TP_STATE_DISCONNECTED;
+	    state_info.status = PJSIP_TLS_ECERTVERIF;
+	} else {
+	    tp_state = PJSIP_TP_STATE_CONNECTED;
+	    state_info.status = PJ_SUCCESS;
+	}
+
+	(*state_cb)(&tls->base, tp_state, &state_info);
+    }
+
+    /* Release transport reference. If transport is shutting down, it may
+     * get destroyed here.
+     */
+    is_shutdown = tls->base.is_shutdown;
+    pjsip_transport_dec_ref(&tls->base);
+    if (is_shutdown)
 	return PJ_TRUE;
-    }
+
 
     status = tls_start_read(tls);
@@ -1332,7 +1338,6 @@
     pj_ssl_sock_info ssl_info;
     pj_sockaddr_in addr, *tp_addr;
-
     pjsip_tp_state_callback *state_cb;
-    pj_bool_t tls_verif_ignored;
+    pj_bool_t is_shutdown;
 
     tls = (struct tls_transport*) pj_ssl_sock_get_user_data(ssock);
@@ -1433,5 +1438,17 @@
     }
 
-    tls_verif_ignored = !tls->verify_server;
+    /* Prevent immediate transport destroy as application may access it 
+     * (getting info, etc) in transport state notification callback.
+     */
+    pjsip_transport_add_ref(&tls->base);
+
+    /* If there is verification error and verification is mandatory, shutdown
+     * and destroy the transport.
+     */
+    if (ssl_info.verify_status && tls->verify_server) {
+	if (tls->close_reason == PJ_SUCCESS) 
+	    tls->close_reason = PJSIP_TLS_ECERTVERIF;
+	pjsip_transport_shutdown(&tls->base);
+    }
 
     /* Notify transport state to application */
@@ -1442,38 +1459,31 @@
 	pj_uint32_t tp_state = 0;
 
-	/* Init transport state notification callback */
+	/* Init transport state info */
 	pj_bzero(&state_info, sizeof(state_info));
 	pj_bzero(&tls_info, sizeof(tls_info));
-
-	/* Set transport state info */
 	state_info.ext_info = &tls_info;
 	tls_info.ssl_sock_info = &ssl_info;
 
 	/* Set transport state based on verification status */
-	if (ssl_info.verify_status) {
-	    state_info.status = PJSIP_TLS_ECONNECT;
-	    tp_state |= PJSIP_TP_STATE_TLS_VERIF_ERROR;
-	    if (tls->verify_server)
-		tp_state |= PJSIP_TP_STATE_DISCONNECTED;
-	    else
-		tp_state |= PJSIP_TP_STATE_CONNECTED;
+	if (ssl_info.verify_status && tls->verify_server)
+	{
+	    tp_state = PJSIP_TP_STATE_DISCONNECTED;
+	    state_info.status = PJSIP_TLS_ECERTVERIF;
 	} else {
-	    tp_state |= PJSIP_TP_STATE_CONNECTED;
+	    tp_state = PJSIP_TP_STATE_CONNECTED;
+	    state_info.status = PJ_SUCCESS;
 	}
 
-	tls_verif_ignored = (*state_cb)(&tls->base, tp_state, &state_info);
-    }
-
-    /* Transport should be shutdown when there is TLS verification error
-     * and application doesn't want to ignore it.
-     */
-    if (ssl_info.verify_status && 
-	(tls->verify_server || !tls_verif_ignored))
-    {
-	if (tls->close_reason == PJ_SUCCESS) 
-	    tls->close_reason = PJSIP_TLS_ECONNECT;
-	pjsip_transport_shutdown(&tls->base);
+	(*state_cb)(&tls->base, tp_state, &state_info);
+    }
+
+    /* Release transport reference. If transport is shutting down, it may
+     * get destroyed here.
+     */
+    is_shutdown = tls->base.is_shutdown;
+    pjsip_transport_dec_ref(&tls->base);
+    if (is_shutdown)
 	return PJ_FALSE;
-    }
+
 
     /* Mark that pending connect() operation has completed. */
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c	(revision 3109)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c	(revision 3110)
@@ -737,4 +737,7 @@
     tp->base.remote_name.port = 0;
 
+    /* Init direction */
+    tp->base.dir = PJSIP_TP_DIR_NONE;
+
     /* Set endpoint. */
     tp->base.endpt = endpt;
