Index: /pjproject/branches/1.x/pjlib/include/pj/guid.h
===================================================================
--- /pjproject/branches/1.x/pjlib/include/pj/guid.h	(revision 4384)
+++ /pjproject/branches/1.x/pjlib/include/pj/guid.h	(revision 4385)
@@ -84,4 +84,15 @@
 
 /**
+ * Create a globally unique string in lowercase, which length is
+ * PJ_GUID_STRING_LENGTH characters. Caller is responsible for preallocating
+ * the storage used in the string.
+ *
+ * @param str       The string to store the result.
+ *
+ * @return          The string.
+ */
+PJ_DECL(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str);
+
+/**
  * Generate a unique string.
  *
@@ -90,4 +101,12 @@
  */
 PJ_DECL(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str);
+
+/**
+ * Generate a unique string in lowercase.
+ *
+ * @param pool	    Pool to allocate memory from.
+ * @param str	    The string.
+ */
+PJ_DECL(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str);
 
 
Index: /pjproject/branches/1.x/pjlib/include/pj/hash.h
===================================================================
--- /pjproject/branches/1.x/pjlib/include/pj/hash.h	(revision 4384)
+++ /pjproject/branches/1.x/pjlib/include/pj/hash.h	(revision 4385)
@@ -76,6 +76,6 @@
  *
  * @param hval      The initial hash value, normally zero.
- * @param result    Buffer to store the result, which must be enough to hold
- *                  the string.
+ * @param result    Optional. Buffer to store the result, which must be enough
+ *                  to hold the string.
  * @param key       The input key to be converted and calculated.
  *
@@ -114,4 +114,15 @@
 			     const void *key, unsigned keylen,
 			     pj_uint32_t *hval );
+
+
+/**
+ * Variant of #pj_hash_get() with the key being converted to lowercase when
+ * calculating the hash value.
+ *
+ * @see pj_hash_get()
+ */
+PJ_DECL(void *) pj_hash_get_lower( pj_hash_table_t *ht,
+			           const void *key, unsigned keylen,
+			           pj_uint32_t *hval );
 
 
@@ -143,4 +154,15 @@
 
 /**
+ * Variant of #pj_hash_set() with the key being converted to lowercase when
+ * calculating the hash value.
+ *
+ * @see pj_hash_set()
+ */
+PJ_DECL(void) pj_hash_set_lower( pj_pool_t *pool, pj_hash_table_t *ht,
+			         const void *key, unsigned keylen,
+                                 pj_uint32_t hval, void *value );
+
+
+/**
  * Associate/disassociate a value with the specified key. This function works
  * like #pj_hash_set(), except that it doesn't use pool (hence the np -- no 
@@ -166,4 +188,16 @@
 
 /**
+ * Variant of #pj_hash_set_np() with the key being converted to lowercase
+ * when calculating the hash value.
+ *
+ * @see pj_hash_set_np()
+ */
+PJ_DECL(void) pj_hash_set_np_lower(pj_hash_table_t *ht,
+			           const void *key, unsigned keylen,
+			           pj_uint32_t hval,
+                                   pj_hash_entry_buf entry_buf,
+			           void *value);
+
+/**
  * Get the total number of entries in the hash table.
  *
Index: /pjproject/branches/1.x/pjlib/src/pj/guid.c
===================================================================
--- /pjproject/branches/1.x/pjlib/src/pj/guid.c	(revision 4384)
+++ /pjproject/branches/1.x/pjlib/src/pj/guid.c	(revision 4385)
@@ -18,6 +18,18 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
  */
+#include <pj/ctype.h>
 #include <pj/guid.h>
 #include <pj/pool.h>
+
+PJ_DEF(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str)
+{
+    int i;
+
+    pj_generate_unique_string(str);
+    for (i = 0; i < str->slen; i++)
+	str->ptr[i] = (char)pj_tolower(str->ptr[i]);
+
+    return str;
+}
 
 PJ_DEF(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str)
@@ -26,2 +38,11 @@
     pj_generate_unique_string(str);
 }
+
+PJ_DEF(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str)
+{
+    int i;
+
+    pj_create_unique_string(pool, str);
+    for (i = 0; i < str->slen; i++)
+	str->ptr[i] = (char)pj_tolower(str->ptr[i]);
+}
Index: /pjproject/branches/1.x/pjlib/src/pj/hash.c
===================================================================
--- /pjproject/branches/1.x/pjlib/src/pj/hash.c	(revision 4384)
+++ /pjproject/branches/1.x/pjlib/src/pj/hash.c	(revision 4385)
@@ -80,14 +80,19 @@
     for (i=0; i<key->slen; ++i) {
 	pj_uint8_t c = key->ptr[i];
+        char lower;
 	if (c & 64)
-	    result[i] = (char)(c | 32);
+	    lower = (char)(c | 32);
 	else
-	    result[i] = (char)c;
-	hval = hval * PJ_HASH_MULTIPLIER + result[i];
+	    lower = (char)c;
+	if (result)
+            result[i] = lower;
+	hval = hval * PJ_HASH_MULTIPLIER + lower;
     }
 #else
     for (i=0; i<key->slen; ++i) {
-	result[i] = (char)pj_tolower(key->ptr[i]);
-	hval = hval * PJ_HASH_MULTIPLIER + result[i];
+        char lower = (char)pj_tolower(key->ptr[i]);
+	if (result)
+            result[i] = lower;
+	hval = hval * PJ_HASH_MULTIPLIER + lower;
     }
 #endif
@@ -129,5 +134,5 @@
 				   const void *key, unsigned keylen,
 				   void *val, pj_uint32_t *hval,
-				   void *entry_buf)
+				   void *entry_buf, pj_bool_t lower)
 {
     pj_uint32_t hash;
@@ -147,5 +152,8 @@
 	    const pj_uint8_t *p = (const pj_uint8_t*)key;
 	    for ( ; *p; ++p ) {
-		hash = hash * PJ_HASH_MULTIPLIER + *p;
+                if (lower)
+                    hash = hash * PJ_HASH_MULTIPLIER + pj_tolower(*p);
+                else 
+		    hash = hash * PJ_HASH_MULTIPLIER + *p;
 	    }
 	    keylen = p - (const unsigned char*)key;
@@ -154,5 +162,8 @@
 				  *end = p + keylen;
 	    for ( ; p!=end; ++p) {
-		hash = hash * PJ_HASH_MULTIPLIER + *p;
+		if (lower)
+                    hash = hash * PJ_HASH_MULTIPLIER + pj_tolower(*p);
+                else
+                    hash = hash * PJ_HASH_MULTIPLIER + *p;
 	    }
 	}
@@ -169,7 +180,9 @@
     {
 	if (entry->hash==hash && entry->keylen==keylen &&
-	    pj_memcmp(entry->key, key, keylen)==0) 
+            ((lower && pj_ansi_strnicmp((const char*)entry->key,
+        			        (const char*)key, keylen)==0) ||
+	     (!lower && pj_memcmp(entry->key, key, keylen)==0)))
 	{
-	    break;	
+	    break;
 	}
     }
@@ -215,15 +228,25 @@
 {
     pj_hash_entry *entry;
-    entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL);
+    entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL, PJ_FALSE);
     return entry ? entry->value : NULL;
 }
 
-PJ_DEF(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht,
-			  const void *key, unsigned keylen, pj_uint32_t hval,
-			  void *value )
+PJ_DEF(void *) pj_hash_get_lower( pj_hash_table_t *ht,
+			          const void *key, unsigned keylen,
+			          pj_uint32_t *hval)
+{
+    pj_hash_entry *entry;
+    entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL, PJ_TRUE);
+    return entry ? entry->value : NULL;
+}
+
+static void hash_set( pj_pool_t *pool, pj_hash_table_t *ht,
+	              const void *key, unsigned keylen, pj_uint32_t hval,
+		      void *value, void *entry_buf, pj_bool_t lower )
 {
     pj_hash_entry **p_entry;
 
-    p_entry = find_entry( pool, ht, key, keylen, value, &hval, NULL);
+    p_entry = find_entry( pool, ht, key, keylen, value, &hval, entry_buf,
+                          lower);
     if (*p_entry) {
 	if (value == NULL) {
@@ -242,4 +265,18 @@
 }
 
+PJ_DEF(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht,
+			  const void *key, unsigned keylen, pj_uint32_t hval,
+			  void *value )
+{
+    hash_set(pool, ht, key, keylen, hval, value, NULL, PJ_FALSE);
+}
+
+PJ_DEF(void) pj_hash_set_lower( pj_pool_t *pool, pj_hash_table_t *ht,
+			        const void *key, unsigned keylen,
+                                pj_uint32_t hval, void *value )
+{
+    hash_set(pool, ht, key, keylen, hval, value, NULL, PJ_TRUE);
+}
+
 PJ_DEF(void) pj_hash_set_np( pj_hash_table_t *ht,
 			     const void *key, unsigned keylen, 
@@ -247,22 +284,14 @@
 			     void *value)
 {
-    pj_hash_entry **p_entry;
-
-    p_entry = find_entry( NULL, ht, key, keylen, value, &hval, 
-			 (void*)entry_buf );
-    if (*p_entry) {
-	if (value == NULL) {
-	    /* delete entry */
-	    PJ_LOG(6, ("hashtbl", "%p: p_entry %p deleted", ht, *p_entry));
-	    *p_entry = (*p_entry)->next;
-	    --ht->count;
-	    
-	} else {
-	    /* overwrite */
-	    (*p_entry)->value = value;
-	    PJ_LOG(6, ("hashtbl", "%p: p_entry %p value set to %p", ht, 
-		       *p_entry, value));
-	}
-    }
+    hash_set(NULL, ht, key, keylen, hval, value, (void *)entry_buf, PJ_FALSE);
+}
+
+PJ_DEF(void) pj_hash_set_np_lower( pj_hash_table_t *ht,
+			           const void *key, unsigned keylen,
+			           pj_uint32_t hval,
+                                   pj_hash_entry_buf entry_buf,
+			           void *value)
+{
+    hash_set(NULL, ht, key, keylen, hval, value, (void *)entry_buf, PJ_TRUE);
 }
 
Index: /pjproject/branches/1.x/pjsip/src/pjsip-ua/sip_100rel.c
===================================================================
--- /pjproject/branches/1.x/pjsip/src/pjsip-ua/sip_100rel.c	(revision 4384)
+++ /pjproject/branches/1.x/pjsip/src/pjsip-ua/sip_100rel.c	(revision 4385)
@@ -273,5 +273,5 @@
     uac_state = dd->uac_state_list;
     while (uac_state) {
-	if (pj_strcmp(&uac_state->tag, to_tag)==0)
+	if (pj_stricmp(&uac_state->tag, to_tag)==0)
 	    break;
 	uac_state = uac_state->next;
@@ -320,5 +320,5 @@
      * update the req URI (https://trac.pjsip.org/repos/ticket/1364)
      */
-    if (pj_strcmp(&uac_state->tag, &dd->inv->dlg->remote.info->tag)) {
+    if (pj_stricmp(&uac_state->tag, &dd->inv->dlg->remote.info->tag)) {
 	const pjsip_contact_hdr *mhdr;
 
Index: /pjproject/branches/1.x/pjsip/src/pjsip-ua/sip_inv.c
===================================================================
--- /pjproject/branches/1.x/pjsip/src/pjsip-ua/sip_inv.c	(revision 4384)
+++ /pjproject/branches/1.x/pjsip/src/pjsip-ua/sip_inv.c	(revision 4385)
@@ -1712,5 +1712,5 @@
 	    rdata->msg_info.msg->line.status.code/100 == 2 &&
 	    tsx_inv_data->done_early &&
-	    pj_strcmp(&tsx_inv_data->done_tag, &res_tag))
+	    pj_stricmp(&tsx_inv_data->done_tag, &res_tag))
 	{
 	    const pjmedia_sdp_session *reoffer_sdp = NULL;
Index: /pjproject/branches/1.x/pjsip/src/pjsip/sip_dialog.c
===================================================================
--- /pjproject/branches/1.x/pjsip/src/pjsip/sip_dialog.c	(revision 4384)
+++ /pjproject/branches/1.x/pjsip/src/pjsip/sip_dialog.c	(revision 4385)
@@ -207,6 +207,6 @@
 
     /* Calculate hash value of local tag. */
-    dlg->local.tag_hval = pj_hash_calc(0, dlg->local.info->tag.ptr,
-				       dlg->local.info->tag.slen);
+    dlg->local.tag_hval = pj_hash_calc_tolower(0, NULL,
+                                               &dlg->local.info->tag);
 
     /* Randomize local CSeq. */
@@ -375,6 +375,5 @@
 
     /* Calculate hash value of local tag. */
-    dlg->local.tag_hval = pj_hash_calc(0, dlg->local.info->tag.ptr,
-				       dlg->local.info->tag.slen);
+    dlg->local.tag_hval = pj_hash_calc_tolower(0, NULL, &dlg->local.info->tag);
 
 
@@ -523,6 +522,5 @@
 
     /* Calculate hash value of remote tag. */
-    dlg->remote.tag_hval = pj_hash_calc(0, dlg->remote.info->tag.ptr, 
-					dlg->remote.info->tag.slen);
+    dlg->remote.tag_hval = pj_hash_calc_tolower(0, NULL, &dlg->remote.info->tag);
 
     /* Update remote capabilities info */
@@ -1777,5 +1775,5 @@
 	 res_code/100 <= 2 &&
 	 pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) &&
-	 pj_strcmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag)))
+	 pj_stricmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag)))
     {
 	pjsip_contact_hdr *contact;
@@ -1786,5 +1784,5 @@
 	 */
 	pjsip_dlg_update_remote_cap(dlg, rdata->msg_info.msg,
-				    pj_strcmp(&dlg->remote.info->tag,
+				    pj_stricmp(&dlg->remote.info->tag,
 					      &rdata->msg_info.to->tag));
 
Index: /pjproject/branches/1.x/pjsip/src/pjsip/sip_transaction.c
===================================================================
--- /pjproject/branches/1.x/pjsip/src/pjsip/sip_transaction.c	(revision 4384)
+++ /pjproject/branches/1.x/pjsip/src/pjsip/sip_transaction.c	(revision 4385)
@@ -404,5 +404,5 @@
     const pj_str_t *branch = &rdata->msg_info.via->branch_param;
 
-    if (pj_strncmp(branch,&rfc3261_branch,PJSIP_RFC3261_BRANCH_LEN)==0) {
+    if (pj_strnicmp(branch,&rfc3261_branch,PJSIP_RFC3261_BRANCH_LEN)==0) {
 
 	/* Create transaction key. */
@@ -549,8 +549,8 @@
      * twice!
      */
-    if(pj_hash_get(mod_tsx_layer.htable, 
-		   tsx->transaction_key.ptr,
-		   tsx->transaction_key.slen, 
-		   NULL))
+    if(pj_hash_get_lower(mod_tsx_layer.htable, 
+		         tsx->transaction_key.ptr,
+		         tsx->transaction_key.slen, 
+		         NULL))
     {
 	pj_mutex_unlock(mod_tsx_layer.mutex);
@@ -569,9 +569,11 @@
     /* Register the transaction to the hash table. */
 #ifdef PRECALC_HASH
-    pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr,
-    		 tsx->transaction_key.slen, tsx->hashed_key, tsx);
+    pj_hash_set_lower( tsx->pool, mod_tsx_layer.htable,
+                       tsx->transaction_key.ptr,
+    		       tsx->transaction_key.slen, tsx->hashed_key, tsx);
 #else
-    pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr,
-    		 tsx->transaction_key.slen, 0, tsx);
+    pj_hash_set_lower( tsx->pool, mod_tsx_layer.htable,
+                       tsx->transaction_key.ptr,
+    		       tsx->transaction_key.slen, 0, tsx);
 #endif
 
@@ -605,9 +607,9 @@
     /* Register the transaction to the hash table. */
 #ifdef PRECALC_HASH
-    pj_hash_set( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr,
-    		 tsx->transaction_key.slen, tsx->hashed_key, NULL);
+    pj_hash_set_lower( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr,
+    		       tsx->transaction_key.slen, tsx->hashed_key, NULL);
 #else
-    pj_hash_set( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr,
-    		 tsx->transaction_key.slen, 0, NULL);
+    pj_hash_set_lower( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr,
+    		       tsx->transaction_key.slen, 0, NULL);
 #endif
 
@@ -652,5 +654,6 @@
     pj_mutex_lock(mod_tsx_layer.mutex);
     tsx = (pjsip_transaction*)
-    	  pj_hash_get( mod_tsx_layer.htable, key->ptr, key->slen, &hval );
+    	  pj_hash_get_lower( mod_tsx_layer.htable, key->ptr, key->slen,
+                             &hval );
     pj_mutex_unlock(mod_tsx_layer.mutex);
 
@@ -786,5 +789,5 @@
 
     tsx = (pjsip_transaction*) 
-    	  pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, &hval );
+    	  pj_hash_get_lower( mod_tsx_layer.htable, key.ptr, key.slen, &hval );
 
 
@@ -835,5 +838,5 @@
 
     tsx = (pjsip_transaction*) 
-    	  pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, &hval );
+    	  pj_hash_get_lower( mod_tsx_layer.htable, key.ptr, key.slen, &hval );
 
 
@@ -1294,6 +1297,5 @@
     /* Calculate hashed key value. */
 #ifdef PRECALC_HASH
-    tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr,
-				   tsx->transaction_key.slen);
+    tsx->hashed_key = pj_hash_calc_tolower(0, NULL, &tsx->transaction_key);
 #endif
 
@@ -1425,6 +1427,5 @@
     /* Calculate hashed key value. */
 #ifdef PRECALC_HASH
-    tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr,
-				   tsx->transaction_key.slen);
+    tsx->hashed_key = pj_hash_calc_tolower(0, NULL, &tsx->transaction_key);
 #endif
 
Index: /pjproject/branches/1.x/pjsip/src/pjsip/sip_ua_layer.c
===================================================================
--- /pjproject/branches/1.x/pjsip/src/pjsip/sip_ua_layer.c	(revision 4384)
+++ /pjproject/branches/1.x/pjsip/src/pjsip/sip_ua_layer.c	(revision 4385)
@@ -303,7 +303,8 @@
 
 	dlg_set = (struct dlg_set*)
-		  pj_hash_get( mod_ua.dlg_table, dlg->local.info->tag.ptr, 
-			       dlg->local.info->tag.slen,
-			       &dlg->local.tag_hval);
+		  pj_hash_get_lower( mod_ua.dlg_table,
+                                     dlg->local.info->tag.ptr, 
+			             dlg->local.info->tag.slen,
+			             &dlg->local.tag_hval);
 
 	if (dlg_set) {
@@ -327,7 +328,9 @@
 
 	    /* Register the dialog set in the hash table. */
-	    pj_hash_set_np(mod_ua.dlg_table, 
-			   dlg->local.info->tag.ptr, dlg->local.info->tag.slen,
-			   dlg->local.tag_hval, dlg_set->ht_entry, dlg_set);
+	    pj_hash_set_np_lower(mod_ua.dlg_table, 
+			         dlg->local.info->tag.ptr,
+                                 dlg->local.info->tag.slen,
+			         dlg->local.tag_hval, dlg_set->ht_entry,
+                                 dlg_set);
 	}
 
@@ -342,7 +345,8 @@
 	dlg->dlg_set = dlg_set;
 
-	pj_hash_set_np(mod_ua.dlg_table, 
-		       dlg->local.info->tag.ptr, dlg->local.info->tag.slen,
-		       dlg->local.tag_hval, dlg_set->ht_entry, dlg_set);
+	pj_hash_set_np_lower(mod_ua.dlg_table, 
+		             dlg->local.info->tag.ptr,
+                             dlg->local.info->tag.slen,
+		             dlg->local.tag_hval, dlg_set->ht_entry, dlg_set);
     }
 
@@ -388,6 +392,7 @@
     /* If dialog list is empty, remove the dialog set from the hash table. */
     if (pj_list_empty(&dlg_set->dlg_list)) {
-	pj_hash_set(NULL, mod_ua.dlg_table, dlg->local.info->tag.ptr,
-		    dlg->local.info->tag.slen, dlg->local.tag_hval, NULL);
+	pj_hash_set_lower(NULL, mod_ua.dlg_table, dlg->local.info->tag.ptr,
+		          dlg->local.info->tag.slen, dlg->local.tag_hval,
+                          NULL);
 
 	/* Return dlg_set to free nodes. */
@@ -450,6 +455,6 @@
     /* Lookup the dialog set. */
     dlg_set = (struct dlg_set*)
-    	      pj_hash_get(mod_ua.dlg_table, local_tag->ptr, local_tag->slen,
-			  NULL);
+    	      pj_hash_get_lower(mod_ua.dlg_table, local_tag->ptr,
+                                local_tag->slen, NULL);
     if (dlg_set == NULL) {
 	/* Not found */
@@ -463,5 +468,5 @@
     dlg = dlg_set->dlg_list.next;
     while (dlg != (pjsip_dialog*)&dlg_set->dlg_list) {	
-	if (pj_strcmp(&dlg->remote.info->tag, remote_tag) == 0)
+	if (pj_stricmp(&dlg->remote.info->tag, remote_tag) == 0)
 	    break;
 	dlg = dlg->next;
@@ -564,5 +569,6 @@
 	/* Lookup the dialog set. */
 	dlg_set = (struct dlg_set*)
-		  pj_hash_get(mod_ua.dlg_table, tag->ptr, tag->slen, NULL);
+		  pj_hash_get_lower(mod_ua.dlg_table, tag->ptr, tag->slen,
+                                    NULL);
 	return dlg_set;
     }
@@ -621,5 +627,5 @@
     while (dlg != (pjsip_dialog*)&dlg_set->dlg_list) {
 	
-	if (pj_strcmp(&dlg->remote.info->tag, from_tag) == 0)
+	if (pj_stricmp(&dlg->remote.info->tag, from_tag) == 0)
 	    break;
 
@@ -758,8 +764,8 @@
 	/* Get the dialog set. */
 	dlg_set = (struct dlg_set*)
-		  pj_hash_get(mod_ua.dlg_table, 
-			      rdata->msg_info.from->tag.ptr,
-			      rdata->msg_info.from->tag.slen,
-			      NULL);
+		  pj_hash_get_lower(mod_ua.dlg_table, 
+			            rdata->msg_info.from->tag.ptr,
+			            rdata->msg_info.from->tag.slen,
+			            NULL);
 
 	if (!dlg_set) {
@@ -809,5 +815,5 @@
 
 	    /* Otherwise find the one with matching To tag. */
-	    if (pj_strcmp(to_tag, &dlg->remote.info->tag) == 0)
+	    if (pj_stricmp(to_tag, &dlg->remote.info->tag) == 0)
 		break;
 
Index: /pjproject/branches/1.x/pjsip/src/pjsip/sip_util_proxy.c
===================================================================
--- /pjproject/branches/1.x/pjsip/src/pjsip/sip_util_proxy.c	(revision 4384)
+++ /pjproject/branches/1.x/pjsip/src/pjsip/sip_util_proxy.c	(revision 4385)
@@ -346,5 +346,5 @@
      * a branch value from GUID .
      */
-    if (pj_strncmp(&rdata->msg_info.via->branch_param, 
+    if (pj_strnicmp(&rdata->msg_info.via->branch_param, 
 		   &rfc3261_branch, PJSIP_RFC3261_BRANCH_LEN) != 0 ) 
     {
Index: /pjproject/branches/1.x/pjsip/src/test/tsx_uac_test.c
===================================================================
--- /pjproject/branches/1.x/pjsip/src/test/tsx_uac_test.c	(revision 4384)
+++ /pjproject/branches/1.x/pjsip/src/test/tsx_uac_test.c	(revision 4385)
@@ -160,5 +160,5 @@
 static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e)
 {
-    if (pj_strcmp2(&tsx->branch, TEST1_BRANCH_ID)==0) {
+    if (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0) {
 	/*
 	 * Transaction with TEST1_BRANCH_ID should terminate with transaction
@@ -214,5 +214,5 @@
 	}
 
-    } else if (pj_strcmp2(&tsx->branch, TEST2_BRANCH_ID)==0) {
+    } else if (pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0) {
 	/*
 	 * Transaction with TEST2_BRANCH_ID should terminate with transport error.
@@ -232,5 +232,5 @@
 	}
 
-    } else if (pj_strcmp2(&tsx->branch, TEST3_BRANCH_ID)==0) {
+    } else if (pj_stricmp2(&tsx->branch, TEST3_BRANCH_ID)==0) {
 	/*
 	 * This test terminates the transaction while resolver is still
@@ -257,5 +257,5 @@
 	}
 
-    } else if (pj_strcmp2(&tsx->branch, TEST4_BRANCH_ID)==0) {
+    } else if (pj_stricmp2(&tsx->branch, TEST4_BRANCH_ID)==0) {
 	/* 
 	 * This test simulates transport failure after several 
@@ -285,5 +285,5 @@
 
 
-    } else if (pj_strcmp2(&tsx->branch, TEST5_BRANCH_ID)==0) {
+    } else if (pj_stricmp2(&tsx->branch, TEST5_BRANCH_ID)==0) {
 	/* 
 	 * This test simulates transport failure after several 
@@ -313,5 +313,5 @@
 
 
-    } else if (pj_strcmp2(&tsx->branch, TEST6_BRANCH_ID)==0) {
+    } else if (pj_stricmp2(&tsx->branch, TEST6_BRANCH_ID)==0) {
 	/* 
 	 * Successfull non-INVITE transaction.
@@ -356,5 +356,5 @@
 	}
 
-    } else if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID)==0) {
+    } else if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID)==0) {
 	/* 
 	 * Successfull non-INVITE transaction.
@@ -409,5 +409,5 @@
 
 
-    } else if (pj_strcmp2(&tsx->branch, TEST8_BRANCH_ID)==0) {
+    } else if (pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0) {
 	/* 
 	 * Failed INVITE transaction.
@@ -469,5 +469,5 @@
 
 
-    } else if (pj_strcmp2(&tsx->branch, TEST9_BRANCH_ID)==0) {
+    } else if (pj_stricmp2(&tsx->branch, TEST9_BRANCH_ID)==0) {
 	/* 
 	 * Failed INVITE transaction with provisional response.
@@ -584,5 +584,5 @@
 static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata)
 {
-    if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST1_BRANCH_ID) == 0) {
+    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST1_BRANCH_ID) == 0) {
 	/*
 	 * The TEST1_BRANCH_ID test performs the verifications for transaction
@@ -652,5 +652,5 @@
 
     } else
-    if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST4_BRANCH_ID) == 0) {
+    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST4_BRANCH_ID) == 0) {
 	/*
 	 * The TEST4_BRANCH_ID test simulates transport failure after several
@@ -673,5 +673,5 @@
 
     } else
-    if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST5_BRANCH_ID) == 0) {
+    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST5_BRANCH_ID) == 0) {
 	/*
 	 * The TEST5_BRANCH_ID test simulates user terminating the transaction
@@ -704,5 +704,5 @@
 
     } else
-    if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST6_BRANCH_ID) == 0) {
+    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST6_BRANCH_ID) == 0) {
 	/*
 	 * The TEST6_BRANCH_ID test successfull non-INVITE transaction.
@@ -729,5 +729,5 @@
 
     } else
-    if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST7_BRANCH_ID) == 0) {
+    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST7_BRANCH_ID) == 0) {
 	/*
 	 * The TEST7_BRANCH_ID test successfull non-INVITE transaction
@@ -779,5 +779,5 @@
 
     } else
-    if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST8_BRANCH_ID) == 0) {
+    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST8_BRANCH_ID) == 0) {
 	/*
 	 * The TEST8_BRANCH_ID test failed INVITE transaction.
@@ -842,5 +842,5 @@
 
     } else
-    if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST9_BRANCH_ID) == 0) {
+    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST9_BRANCH_ID) == 0) {
 	/*
 	 * The TEST9_BRANCH_ID test failed INVITE transaction with
Index: /pjproject/branches/1.x/pjsip/src/test/tsx_uas_test.c
===================================================================
--- /pjproject/branches/1.x/pjsip/src/test/tsx_uas_test.c	(revision 4384)
+++ /pjproject/branches/1.x/pjsip/src/test/tsx_uas_test.c	(revision 4385)
@@ -353,6 +353,6 @@
 static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e)
 {
-    if (pj_strcmp2(&tsx->branch, TEST1_BRANCH_ID)==0 ||
-	pj_strcmp2(&tsx->branch, TEST2_BRANCH_ID)==0) 
+    if (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0 ||
+	pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0) 
     {
 	/*
@@ -363,5 +363,5 @@
 	 * TEST2_BRANCH_ID does similar test for non-2xx final response.
 	 */
-	int status_code = (pj_strcmp2(&tsx->branch, TEST1_BRANCH_ID)==0) ?
+	int status_code = (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0) ?
 			  TEST1_STATUS_CODE : TEST2_STATUS_CODE;
 
@@ -393,5 +393,5 @@
     }
     else
-    if (pj_strcmp2(&tsx->branch, TEST3_BRANCH_ID)==0) {
+    if (pj_stricmp2(&tsx->branch, TEST3_BRANCH_ID)==0) {
 	/*
 	 * TEST3_BRANCH_ID tests sending provisional response.
@@ -456,5 +456,5 @@
 
     } else
-    if (pj_strcmp2(&tsx->branch, TEST4_BRANCH_ID)==0) {
+    if (pj_stricmp2(&tsx->branch, TEST4_BRANCH_ID)==0) {
 	/*
 	 * TEST4_BRANCH_ID tests receiving retransmissions in TRYING state.
@@ -489,5 +489,5 @@
 
     } else
-    if (pj_strcmp2(&tsx->branch, TEST5_BRANCH_ID)==0) {
+    if (pj_stricmp2(&tsx->branch, TEST5_BRANCH_ID)==0) {
 	/*
 	 * TEST5_BRANCH_ID tests receiving retransmissions in PROCEEDING state
@@ -526,5 +526,5 @@
 
     } else
-    if (pj_strcmp2(&tsx->branch, TEST6_BRANCH_ID)==0) {
+    if (pj_stricmp2(&tsx->branch, TEST6_BRANCH_ID)==0) {
 	/*
 	 * TEST6_BRANCH_ID tests receiving retransmissions in COMPLETED state
@@ -561,6 +561,6 @@
 
     } else
-    if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID)==0 ||
-	pj_strcmp2(&tsx->branch, TEST8_BRANCH_ID)==0) 
+    if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID)==0 ||
+	pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0) 
     {
 	/*
@@ -570,5 +570,5 @@
 	int code;
 
-	if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID) == 0)
+	if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID) == 0)
 	    code = TEST7_STATUS_CODE;
 	else
@@ -638,5 +638,5 @@
 
     } else
-    if (pj_strcmp2(&tsx->branch, TEST9_BRANCH_ID)==0)  {
+    if (pj_stricmp2(&tsx->branch, TEST9_BRANCH_ID)==0)  {
 	/*
 	 * TEST9_BRANCH_ID tests that retransmission of INVITE final response
@@ -702,7 +702,7 @@
 
     } else
-    if (pj_strcmp2(&tsx->branch, TEST10_BRANCH_ID)==0 ||
-	pj_strcmp2(&tsx->branch, TEST11_BRANCH_ID)==0 ||
-	pj_strcmp2(&tsx->branch, TEST12_BRANCH_ID)==0)  
+    if (pj_stricmp2(&tsx->branch, TEST10_BRANCH_ID)==0 ||
+	pj_stricmp2(&tsx->branch, TEST11_BRANCH_ID)==0 ||
+	pj_stricmp2(&tsx->branch, TEST12_BRANCH_ID)==0)  
     {
 	if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
@@ -740,6 +740,6 @@
     pj_status_t status;
 
-    if (pj_strcmp2(&branch_param, TEST1_BRANCH_ID) == 0 ||
-	pj_strcmp2(&branch_param, TEST2_BRANCH_ID) == 0) 
+    if (pj_stricmp2(&branch_param, TEST1_BRANCH_ID) == 0 ||
+	pj_stricmp2(&branch_param, TEST2_BRANCH_ID) == 0) 
     {
 	/*
@@ -750,5 +750,5 @@
 	 * TEST2_BRANCH_ID performs similar test for non-2xx final response.
 	 */
-	int status_code = (pj_strcmp2(&branch_param, TEST1_BRANCH_ID) == 0) ?
+	int status_code = (pj_stricmp2(&branch_param, TEST1_BRANCH_ID) == 0) ?
 			  TEST1_STATUS_CODE : TEST2_STATUS_CODE;
 
@@ -790,5 +790,5 @@
 	return PJ_TRUE;
 
-    } else if (pj_strcmp2(&branch_param, TEST3_BRANCH_ID) == 0) {
+    } else if (pj_stricmp2(&branch_param, TEST3_BRANCH_ID) == 0) {
 
 	/* TEST3_BRANCH_ID tests provisional response. */
@@ -839,7 +839,7 @@
 	return PJ_TRUE;
 
-    } else if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0 ||
-	       pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0 ||
-	       pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) 
+    } else if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0 ||
+	       pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0 ||
+	       pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) 
     {
 
@@ -864,10 +864,10 @@
 	    save_key(tsx);
 
-	    if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) {
-
-	    } else if (pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0) {
+	    if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0) {
+
+	    } else if (pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0) {
 		send_response(rdata, tsx, TEST5_PROVISIONAL_CODE);
 
-	    } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) {
+	    } else if (pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) {
 		PJ_LOG(4,(THIS_FILE, "    sending provisional response"));
 		send_response(rdata, tsx, TEST6_PROVISIONAL_CODE);
@@ -883,9 +883,9 @@
 	    ++recv_count;
 
-	    if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) {
+	    if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0) {
 		PJ_LOG(3,(THIS_FILE, "    error: not expecting response!"));
 		test_complete = -132;
 
-	    } else if (pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0) {
+	    } else if (pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0) {
 
 		if (rdata->msg_info.msg->line.status.code!=TEST5_PROVISIONAL_CODE) {
@@ -899,5 +899,5 @@
 		}
 
-	    } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) {
+	    } else if (pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) {
 
 		int code = rdata->msg_info.msg->line.status.code;
@@ -928,6 +928,6 @@
 
 
-    } else if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0 ||
-	       pj_strcmp2(&branch_param, TEST8_BRANCH_ID) == 0) 
+    } else if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0 ||
+	       pj_stricmp2(&branch_param, TEST8_BRANCH_ID) == 0) 
     {
 
@@ -951,5 +951,5 @@
 	    save_key(tsx);
 
-	    if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) {
+	    if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0) {
 
 		send_response(rdata, tsx, TEST7_STATUS_CODE);
@@ -966,5 +966,5 @@
 	    ++recv_count;
 
-	    if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0)
+	    if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0)
 		code = TEST7_STATUS_CODE;
 	    else
@@ -1014,5 +1014,5 @@
 	return PJ_TRUE;
 
-    } else if (pj_strcmp2(&branch_param, TEST9_BRANCH_ID) == 0) {
+    } else if (pj_stricmp2(&branch_param, TEST9_BRANCH_ID) == 0) {
 
 	/*
@@ -1119,13 +1119,13 @@
 	return PJ_TRUE;
 
-    } else if (pj_strcmp2(&branch_param, TEST10_BRANCH_ID) == 0 ||
-	       pj_strcmp2(&branch_param, TEST11_BRANCH_ID) == 0 ||
-	       pj_strcmp2(&branch_param, TEST12_BRANCH_ID) == 0) 
+    } else if (pj_stricmp2(&branch_param, TEST10_BRANCH_ID) == 0 ||
+	       pj_stricmp2(&branch_param, TEST11_BRANCH_ID) == 0 ||
+	       pj_stricmp2(&branch_param, TEST12_BRANCH_ID) == 0) 
     {
 	int test_num, code1, code2;
 
-	if (pj_strcmp2(&branch_param, TEST10_BRANCH_ID) == 0)
+	if (pj_stricmp2(&branch_param, TEST10_BRANCH_ID) == 0)
 	    test_num=10, code1 = 100, code2 = 0;
-	else if (pj_strcmp2(&branch_param, TEST11_BRANCH_ID) == 0)
+	else if (pj_stricmp2(&branch_param, TEST11_BRANCH_ID) == 0)
 	    test_num=11, code1 = 100, code2 = 200;
 	else
