Index: /pjproject/trunk/pjsip/build/test_pjsip.dsp
===================================================================
--- /pjproject/trunk/pjsip/build/test_pjsip.dsp	(revision 1609)
+++ /pjproject/trunk/pjsip/build/test_pjsip.dsp	(revision 1610)
@@ -43,5 +43,5 @@
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /Zi /O2 /Ob2 /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjnath/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "PJ_WIN32" /D "PJ_M_I386" /FR /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /Ob2 /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjnath/include" /I "../../pjmedia/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "PJ_WIN32" /D "PJ_M_I386" /FR /FD /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -68,5 +68,5 @@
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjnath/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "PJ_WIN32" /D "PJ_M_I386" /FR /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjnath/include" /I "../../pjmedia/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "PJ_WIN32" /D "PJ_M_I386" /FR /FD /GZ /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
Index: /pjproject/trunk/pjsip/src/pjsip/sip_msg.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_msg.c	(revision 1609)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_msg.c	(revision 1610)
@@ -1774,6 +1774,12 @@
     buf += hdr->transport.slen;
     *buf++ = ' ';
-    pj_memcpy(buf, hdr->sent_by.host.ptr, hdr->sent_by.host.slen);
-    buf += hdr->sent_by.host.slen;
+
+    /* Check if host contains IPv6 */
+    if (pj_memchr(hdr->sent_by.host.ptr, ':', hdr->sent_by.host.slen)) {
+	copy_advance_pair_quote_cond(buf, "", 0, hdr->sent_by.host, '[', ']');
+    } else {
+	copy_advance_check(buf, hdr->sent_by.host);
+    }
+
     if (hdr->sent_by.port != 0) {
 	*buf++ = ':';
@@ -1804,5 +1810,14 @@
 
 
-    copy_advance_pair(buf, ";maddr=", 7, hdr->maddr_param);
+    if (hdr->maddr_param.slen) {
+	/* Detect IPv6 IP address */
+	if (pj_memchr(hdr->maddr_param.ptr, ':', hdr->maddr_param.slen)) {
+	    copy_advance_pair_quote_cond(buf, ";maddr=", 7, hdr->maddr_param,
+				         '[', ']');
+	} else {
+	    copy_advance_pair(buf, ";maddr=", 7, hdr->maddr_param);
+	}
+    }
+
     copy_advance_pair(buf, ";received=", 10, hdr->recvd_param);
     copy_advance_pair(buf, ";branch=", 8, hdr->branch_param);
Index: /pjproject/trunk/pjsip/src/pjsip/sip_parser.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_parser.c	(revision 1609)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_parser.c	(revision 1610)
@@ -1078,4 +1078,12 @@
 		    pvalue->slen -= 2;
 		}
+	    } else if (*scanner->curptr == '[') {
+		/* pvalue can be a quoted IPv6; in this case, the
+		 * '[' and ']' quote characters are to be removed
+		 * from the pvalue. 
+		 */
+		pj_scan_get_char(scanner);
+		pj_scan_get_until_ch(scanner, ']', pvalue);
+		pj_scan_get_char(scanner);
 	    } else if(pj_cis_match(spec, *scanner->curptr)) {
 		parser_get_and_unescape(scanner, pool, spec, esc_spec, pvalue);
@@ -1158,9 +1166,25 @@
 }
 
+/* Parse host part:
+ *   host =  hostname / IPv4address / IPv6reference
+ */
+static void int_parse_host(pj_scanner *scanner, pj_str_t *host)
+{
+    if (*scanner->curptr == '[') {
+	/* Note: the '[' and ']' characters are removed from the host */
+	pj_scan_get_char(scanner);
+	pj_scan_get_until_ch(scanner, ']', host);
+	pj_scan_get_char(scanner);
+    } else {
+	pj_scan_get( scanner, &pconst.pjsip_HOST_SPEC, host);
+    }
+}
+
 /* Parse host:port in URI. */
 static void int_parse_uri_host_port( pj_scanner *scanner, 
 				     pj_str_t *host, int *p_port)
 {
-    pj_scan_get( scanner, &pconst.pjsip_HOST_SPEC, host);
+    int_parse_host(scanner, host);
+
     /* RFC3261 section 19.1.2: host don't need to be unescaped */
     if (*scanner->curptr == ':') {
@@ -1843,5 +1867,12 @@
 	pj_str_t pname, pvalue;
 
-	int_parse_param( scanner, pool, &pname, &pvalue, 0);
+	//Parse with PARAM_CHAR instead, to allow IPv6
+	//int_parse_param( scanner, pool, &pname, &pvalue, 0);
+	/* Get ';' character */
+	pj_scan_get_char(scanner);
+
+	parse_param_imp(scanner, pool, &pname, &pvalue, 
+			&pconst.pjsip_PARAM_CHAR_SPEC,
+			&pconst.pjsip_PARAM_CHAR_SPEC_ESC, 0);
 
 	if (!parser_stricmp(pname, pconst.pjsip_BRANCH_STR) && pvalue.slen) {
@@ -1984,5 +2015,5 @@
 
 	pj_scan_get( scanner, &pconst.pjsip_TOKEN_SPEC, &hdr->transport);
-	pj_scan_get( scanner, &pconst.pjsip_HOST_SPEC, &hdr->sent_by.host);
+	int_parse_host(scanner, &hdr->sent_by.host);
 
 	if (*scanner->curptr==':') {
Index: /pjproject/trunk/pjsip/src/pjsip/sip_resolve.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_resolve.c	(revision 1609)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_resolve.c	(revision 1610)
@@ -226,5 +226,5 @@
     if (ip_addr_ver || resolver->res == NULL) {
 
-	pj_in_addr ip_addr;
+	char ip_addr[PJ_INET6_ADDRSTRLEN];
 	int af;
 	pj_addrinfo ai;
@@ -272,20 +272,21 @@
 
 	/* Call the callback. */
-	ip_addr = ((pj_sockaddr_in*)&svr_addr.entry[0].addr)->sin_addr;
 	PJ_LOG(5,(THIS_FILE, 
 		  "Target '%.*s:%d' type=%s resolved to "
-		  "'%s:%d' type=%s",
+		  "'%s:%d' type=%s (%s)",
 		  (int)target->addr.host.slen,
 		  target->addr.host.ptr,
 		  target->addr.port,
 		  pjsip_transport_get_type_name(target->type),
-		  pj_inet_ntoa(ip_addr),
+		  pj_inet_ntop2(af, pj_sockaddr_get_addr(&svr_addr.entry[0].addr),
+				ip_addr, sizeof(ip_addr)),
 		  srv_port,
-		  pjsip_transport_get_type_name(type)));
+		  pjsip_transport_get_type_name(type),
+		  pjsip_transport_get_type_desc(type)));
 	svr_addr.count = 1;
 	svr_addr.entry[0].priority = 0;
 	svr_addr.entry[0].weight = 0;
 	svr_addr.entry[0].type = type;
-	svr_addr.entry[0].addr_len = sizeof(pj_sockaddr_in);
+	svr_addr.entry[0].addr_len = pj_sockaddr_get_len(&svr_addr.entry[0].addr);
 	(*cb)(status, token, &svr_addr);
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 1609)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 1610)
@@ -273,5 +273,5 @@
 PJ_DEF(int) pjsip_transport_type_get_af(pjsip_transport_type_e type)
 {
-    if (type | PJSIP_TRANSPORT_IPV6)
+    if (type & PJSIP_TRANSPORT_IPV6)
 	return pj_AF_INET6();
     else
@@ -1159,5 +1159,5 @@
     }
 
-    return PJ_SUCCESS;
+    return status;
 }
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_uri.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_uri.c	(revision 1609)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_uri.c	(revision 1610)
@@ -266,5 +266,10 @@
     /* Print host. */
     pj_assert(url->host.slen != 0);
-    copy_advance_check(buf, url->host);
+    /* Detect IPv6 IP address */
+    if (pj_memchr(url->host.ptr, ':', url->host.slen)) {
+	copy_advance_pair_quote_cond(buf, "", 0, url->host, '[', ']');
+    } else {
+	copy_advance_check(buf, url->host);
+    }
 
     /* Only print port if it is explicitly specified. 
@@ -312,7 +317,13 @@
 
     /* maddr param is not allowed in From and To header. */
-    if (context != PJSIP_URI_IN_FROMTO_HDR) {
-	copy_advance_pair_escape(buf, ";maddr=", 7, url->maddr_param,
-				 pc->pjsip_PARAM_CHAR_SPEC);
+    if (context != PJSIP_URI_IN_FROMTO_HDR && url->maddr_param.slen) {
+	/* Detect IPv6 IP address */
+	if (pj_memchr(url->maddr_param.ptr, ':', url->maddr_param.slen)) {
+	    copy_advance_pair_quote_cond(buf, ";maddr=", 7, url->maddr_param,
+				         '[', ']');
+	} else {
+	    copy_advance_pair_escape(buf, ";maddr=", 7, url->maddr_param,
+				     pc->pjsip_PARAM_CHAR_SPEC);
+	}
     }
 
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 1609)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 1610)
@@ -326,4 +326,6 @@
     pjsua_acc_config cfg;
     pjsua_transport_data *t = &pjsua_var.tpdata[tid];
+    const char *beginquote, *endquote;
+    char transport_param[32];
     char uri[PJSIP_MAX_URL_SIZE];
 
@@ -340,11 +342,30 @@
     --cfg.priority;
 
+    /* Enclose IPv6 address in square brackets */
+    if (t->type & PJSIP_TRANSPORT_IPV6) {
+	beginquote = "[";
+	endquote = "]";
+    } else {
+	beginquote = endquote = "";
+    }
+
+    /* Don't add transport parameter if it's UDP */
+    if ((t->type & PJSIP_TRANSPORT_UDP) == 0) {
+	pj_ansi_snprintf(transport_param, sizeof(transport_param),
+		         ";transport=%s",
+			 pjsip_transport_get_type_name(t->type));
+    } else {
+	transport_param[0] = '\0';
+    }
+
     /* Build URI for the account */
     pj_ansi_snprintf(uri, PJSIP_MAX_URL_SIZE,
-		     "<sip:%.*s:%d;transport=%s>", 
+		     "<sip:%s%.*s%s:%d%s>", 
+		     beginquote,
 		     (int)t->local_name.host.slen,
 		     t->local_name.host.ptr,
+		     endquote,
 		     t->local_name.port,
-		     pjsip_transport_get_type_name(t->type));
+		     transport_param);
 
     cfg.id = pj_str(uri);
@@ -1362,4 +1383,7 @@
     int secure;
     int local_port;
+    const char *beginquote, *endquote;
+    char transport_param[32];
+
     
     PJ_ASSERT_RETURN(pjsua_acc_is_valid(acc_id), PJ_EINVAL);
@@ -1406,4 +1430,10 @@
 	return PJSIP_EUNSUPTRANSPORT;
 
+    /* If destination URI specifies IPv6, then set transport type
+     * to use IPv6 as well.
+     */
+    if (pj_strchr(suri, ':'))
+	tp_type = (pjsip_transport_type_e)(((int)tp_type) + PJSIP_TRANSPORT_IPV6);
+
     flag = pjsip_transport_get_flag_from_type(tp_type);
     secure = (flag & PJSIP_TRANSPORT_SECURE) != 0;
@@ -1419,8 +1449,26 @@
 	return status;
 
+    /* Enclose IPv6 address in square brackets */
+    if (tp_type & PJSIP_TRANSPORT_IPV6) {
+	beginquote = "[";
+	endquote = "]";
+    } else {
+	beginquote = endquote = "";
+    }
+
+    /* Don't add transport parameter if it's UDP */
+    if ((tp_type & PJSIP_TRANSPORT_UDP) == 0) {
+	pj_ansi_snprintf(transport_param, sizeof(transport_param),
+		         ";transport=%s",
+			 pjsip_transport_get_type_name(tp_type));
+    } else {
+	transport_param[0] = '\0';
+    }
+
+
     /* Create the contact header */
     contact->ptr = (char*)pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
     contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE,
-				     "%.*s%s<%s:%.*s%s%.*s:%d;transport=%s>",
+				     "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s>",
 				     (int)acc->display.slen,
 				     acc->display.ptr,
@@ -1430,8 +1478,10 @@
 				     acc->user_part.ptr,
 				     (acc->user_part.slen?"@":""),
+				     beginquote,
 				     (int)local_addr.slen,
 				     local_addr.ptr,
+				     endquote,
 				     local_port,
-				     pjsip_transport_get_type_name(tp_type));
+				     transport_param);
 
     return PJ_SUCCESS;
@@ -1462,4 +1512,6 @@
     int secure;
     int local_port;
+    const char *beginquote, *endquote;
+    char transport_param[32];
     
     PJ_ASSERT_RETURN(pjsua_acc_is_valid(acc_id), PJ_EINVAL);
@@ -1509,7 +1561,13 @@
     } else
 	tp_type = pjsip_transport_get_type_from_name(&sip_uri->transport_param);
-    
+
     if (tp_type == PJSIP_TRANSPORT_UNSPECIFIED)
 	return PJSIP_EUNSUPTRANSPORT;
+
+    /* If destination URI specifies IPv6, then set transport type
+     * to use IPv6 as well.
+     */
+    if (pj_strchr(&sip_uri->host, ':'))
+	tp_type = (pjsip_transport_type_e)(((int)tp_type) + PJSIP_TRANSPORT_IPV6);
 
     flag = pjsip_transport_get_flag_from_type(tp_type);
@@ -1526,8 +1584,26 @@
 	return status;
 
+    /* Enclose IPv6 address in square brackets */
+    if (tp_type & PJSIP_TRANSPORT_IPV6) {
+	beginquote = "[";
+	endquote = "]";
+    } else {
+	beginquote = endquote = "";
+    }
+
+    /* Don't add transport parameter if it's UDP */
+    if ((tp_type & PJSIP_TRANSPORT_UDP) == 0) {
+	pj_ansi_snprintf(transport_param, sizeof(transport_param),
+		         ";transport=%s",
+			 pjsip_transport_get_type_name(tp_type));
+    } else {
+	transport_param[0] = '\0';
+    }
+
+
     /* Create the contact header */
     contact->ptr = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
     contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE,
-				     "%.*s%s<%s:%.*s%s%.*s:%d;transport=%s>",
+				     "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s>",
 				     (int)acc->display.slen,
 				     acc->display.ptr,
@@ -1537,8 +1613,10 @@
 				     acc->user_part.ptr,
 				     (acc->user_part.slen?"@":""),
+				     beginquote,
 				     (int)local_addr.slen,
 				     local_addr.ptr,
+				     endquote,
 				     local_port,
-				     pjsip_transport_get_type_name(tp_type));
+				     transport_param);
 
     return PJ_SUCCESS;
Index: /pjproject/trunk/pjsip/src/test-pjsip/msg_test.c
===================================================================
--- /pjproject/trunk/pjsip/src/test-pjsip/msg_test.c	(revision 1609)
+++ /pjproject/trunk/pjsip/src/test-pjsip/msg_test.c	(revision 1610)
@@ -701,4 +701,5 @@
 
 
+#if INCLUDE_BENCHMARKS
 static int msg_benchmark(unsigned *p_detect, unsigned *p_parse, 
 			 unsigned *p_print)
@@ -776,4 +777,5 @@
     return status;
 }
+#endif	/* INCLUDE_BENCHMARKS */
 
 /*****************************************************************************/
@@ -796,10 +798,12 @@
 static int hdr_test_to(pjsip_hdr *h);
 static int hdr_test_via(pjsip_hdr *h);
-
+static int hdr_test_via_ipv6_1(pjsip_hdr *h);
+static int hdr_test_via_ipv6_2(pjsip_hdr *h);
+static int hdr_test_via_ipv6_3(pjsip_hdr *h);
 
 
 #define GENERIC_PARAM	     "p0=a;p1=\"ab:;cd\";p2=ab%3acd;p3"
 #define GENERIC_PARAM_PARSED "p0=a;p1=\"ab:;cd\";p2=ab:cd;p3"
-#define PARAM_CHAR	     "[]/:&+$"
+#define PARAM_CHAR	     "][/:&+$"
 #define SIMPLE_ADDR_SPEC     "sip:host"
 #define ADDR_SPEC	     SIMPLE_ADDR_SPEC ";"PARAM_CHAR"="PARAM_CHAR ";p1=\";\""
@@ -948,4 +952,25 @@
 	"SIP/2.0/XYZ host" ";" GENERIC_PARAM,
 	&hdr_test_via
+    },
+
+    {
+	/* Via with IPv6 */
+	"Via", "v",
+	"SIP/2.0/UDP [::1]",
+	&hdr_test_via_ipv6_1
+    },
+
+    {
+	/* Via with IPv6 */
+	"Via", "v",
+	"SIP/2.0/UDP [::1]:5061",
+	&hdr_test_via_ipv6_2
+    },
+
+    {
+	/* Via with IPv6 */
+	"Via", "v",
+	"SIP/2.0/UDP [::1];rport=5061;received=::2",
+	&hdr_test_via_ipv6_3
     }
 };
@@ -1112,5 +1137,5 @@
 
 /* 
-#define PARAM_CHAR	    "[]/:&+$"
+#define PARAM_CHAR	    "][/:&+$"
 #define SIMPLE_ADDR_SPEC    "sip:host"
 #define ADDR_SPEC	     SIMPLE_ADDR_SPEC ";"PARAM_CHAR"="PARAM_CHAR ";p1=\";\""
@@ -1433,4 +1458,72 @@
 }
 
+
+/*
+    "SIP/2.0/UDP [::1]"
+ */
+static int hdr_test_via_ipv6_1(pjsip_hdr *h)
+{
+    pjsip_via_hdr *hdr = (pjsip_via_hdr*)h;
+
+    if (h->type != PJSIP_H_VIA)
+	return -2610;
+
+    if (pj_strcmp2(&hdr->transport, "UDP"))
+	return -2615;
+
+    if (pj_strcmp2(&hdr->sent_by.host, "::1"))
+	return -2620;
+
+    if (hdr->sent_by.port != 0)
+	return -2630;
+
+    return 0;
+}
+
+/* "SIP/2.0/UDP [::1]:5061" */
+static int hdr_test_via_ipv6_2(pjsip_hdr *h)
+{
+    pjsip_via_hdr *hdr = (pjsip_via_hdr*)h;
+
+    if (h->type != PJSIP_H_VIA)
+	return -2710;
+
+    if (pj_strcmp2(&hdr->transport, "UDP"))
+	return -2715;
+
+    if (pj_strcmp2(&hdr->sent_by.host, "::1"))
+	return -2720;
+
+    if (hdr->sent_by.port != 5061)
+	return -2730;
+
+    return 0;
+}
+
+/* "SIP/2.0/UDP [::1];rport=5061;received=::2" */
+static int hdr_test_via_ipv6_3(pjsip_hdr *h)
+{
+    pjsip_via_hdr *hdr = (pjsip_via_hdr*)h;
+
+    if (h->type != PJSIP_H_VIA)
+	return -2810;
+
+    if (pj_strcmp2(&hdr->transport, "UDP"))
+	return -2815;
+
+    if (pj_strcmp2(&hdr->sent_by.host, "::1"))
+	return -2820;
+
+    if (hdr->sent_by.port != 0)
+	return -2830;
+
+    if (pj_strcmp2(&hdr->recvd_param, "::2"))
+	return -2840;
+
+    if (hdr->rport_param != 5061)
+	return -2850;
+
+    return 0;
+}
 
 static int hdr_test(void)
@@ -1534,12 +1627,13 @@
     pj_status_t status;
 
+    status = hdr_test();
+    if (status != 0)
+	return status;
+
     status = simple_test();
     if (status != PJ_SUCCESS)
 	return status;
 
-    status = hdr_test();
-    if (status != 0)
-	return status;
-
+#if INCLUDE_BENCHMARKS
     for (i=0; i<COUNT; ++i) {
 	PJ_LOG(3,(THIS_FILE, "  benchmarking (%d of %d)..", i+1, COUNT));
@@ -1609,4 +1703,5 @@
 		"The value is derived from msg-print-per-sec above.");
 
+#endif	/* INCLUDE_BENCHMARKS */
 
     return PJ_SUCCESS;
Index: /pjproject/trunk/pjsip/src/test-pjsip/test.h
===================================================================
--- /pjproject/trunk/pjsip/src/test-pjsip/test.h	(revision 1609)
+++ /pjproject/trunk/pjsip/src/test-pjsip/test.h	(revision 1610)
@@ -41,4 +41,6 @@
 #define INCLUDE_TSX_GROUP	    1
 #define INCLUDE_INV_GROUP	    1
+
+#define INCLUDE_BENCHMARKS	    1
 
 /*
Index: /pjproject/trunk/pjsip/src/test-pjsip/uri_test.c
===================================================================
--- /pjproject/trunk/pjsip/src/test-pjsip/uri_test.c	(revision 1609)
+++ /pjproject/trunk/pjsip/src/test-pjsip/uri_test.c	(revision 1610)
@@ -77,5 +77,6 @@
 static pjsip_uri *create_uri33( pj_pool_t *pool );
 static pjsip_uri *create_uri34( pj_pool_t *pool );
-//static pjsip_uri *create_uri35( pj_pool_t *pool );
+static pjsip_uri *create_uri35( pj_pool_t *pool );
+static pjsip_uri *create_uri36( pj_pool_t *pool );
 static pjsip_uri *create_dummy( pj_pool_t *pool );
 
@@ -319,5 +320,19 @@
 	"tel:911;p1=p1;p2=p2"
     },
-    
+    {
+	/* 35: IPv6 in host and maddr parameter */
+	PJ_SUCCESS,
+	"sip:user@[::1];maddr=[::01]",
+	&create_uri35,
+	"sip:user@[::1];maddr=[::01]"
+    },
+    {
+	/* 36: IPv6 in host and maddr, without username */
+	PJ_SUCCESS,
+	"sip:[::1];maddr=[::01]",
+	&create_uri36,
+	"sip:[::1];maddr=[::01]"
+    }
+
 };
 
@@ -670,4 +685,25 @@
 }
 
+/* "sip:user@[::1];maddr=[::01]" */
+static pjsip_uri *create_uri35( pj_pool_t *pool )
+{
+    pjsip_sip_uri *url;
+    url = pjsip_sip_uri_create(pool, 0);
+    url->user = pj_str("user");
+    url->host = pj_str("::1");
+    url->maddr_param = pj_str("::01");
+    return (pjsip_uri*)url;
+}
+
+/* "sip:[::1];maddr=[::01]" */
+static pjsip_uri *create_uri36( pj_pool_t *pool )
+{
+    pjsip_sip_uri *url;
+    url = pjsip_sip_uri_create(pool, 0);
+    url->host = pj_str("::1");
+    url->maddr_param = pj_str("::01");
+    return (pjsip_uri*)url;
+
+}
 
 static pjsip_uri *create_dummy(pj_pool_t *pool)
@@ -825,4 +861,5 @@
 }
 
+#if INCLUDE_BENCHMARKS
 static int uri_benchmark(unsigned *p_parse, unsigned *p_print, unsigned *p_cmp)
 {
@@ -910,5 +947,5 @@
     return status;
 }
-
+#endif	/* INCLUDE_BENCHMARKS */
 
 /*****************************************************************************/
@@ -930,4 +967,5 @@
 	return status;
 
+#if INCLUDE_BENCHMARKS
     for (i=0; i<COUNT; ++i) {
 	PJ_LOG(3,(THIS_FILE, "  benchmarking (%d of %d)...", i+1, COUNT));
@@ -994,4 +1032,6 @@
     report_ival("uri-cmp-per-sec", max, "URI/sec", desc);
 
+#endif	/* INCLUDE_BENCHMARKS */
+
     return PJ_SUCCESS;
 }
