Index: pjproject/trunk/pjsip/include/pjsip/sip_uri.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsip/sip_uri.h	(revision 3241)
+++ pjproject/trunk/pjsip/include/pjsip/sip_uri.h	(revision 3242)
@@ -67,20 +67,31 @@
  * @return		The parameter if found, or NULL.
  */
-PJ_DECL(pjsip_param*) pjsip_param_find( pjsip_param *param_list,
+PJ_DECL(pjsip_param*) pjsip_param_find( const pjsip_param *param_list,
 					const pj_str_t *name );
 
 
 /**
- * Find the specified parameter name in the list. The name will be compared
- * in case-insensitive comparison.
- *
- * @param param_list	List of parameters to find.
- * @param name		Parameter/header name to find.
- *
- * @return		The parameter if found, or NULL.
- */
-PJ_DECL(const pjsip_param*) pjsip_param_cfind(const pjsip_param *param_list,
-					      const pj_str_t *name );
-
+ * Alias for pjsip_param_find()
+ */
+PJ_INLINE(pjsip_param*) pjsip_param_cfind(const pjsip_param *param_list,
+					  const pj_str_t *name)
+{
+    return pjsip_param_find(param_list, name);
+}
+
+/**
+ * Compare two parameter lists.
+ *
+ * @param param_list1	First parameter list.
+ * @param param_list2	Second parameter list.
+ * @param ig_nf		If set to 1, do not compare parameters that only
+ * 			appear in one of the list.
+ *
+ * @return		Zero if the parameter list are equal, non-zero
+ * 			otherwise.
+ */
+PJ_DECL(int) pjsip_param_cmp(const pjsip_param *param_list1,
+			     const pjsip_param *param_list2,
+			     pj_bool_t ig_nf);
 
 /**
Index: pjproject/trunk/pjsip/src/pjsip/sip_uri.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_uri.c	(revision 3241)
+++ pjproject/trunk/pjsip/src/pjsip/sip_uri.c	(revision 3242)
@@ -31,8 +31,8 @@
  * Generic parameter manipulation.
  */
-PJ_DEF(pjsip_param*) pjsip_param_find(  pjsip_param *param_list,
+PJ_DEF(pjsip_param*) pjsip_param_find(  const pjsip_param *param_list,
 					const pj_str_t *name )
 {
-    pjsip_param *p = param_list->next;
+    pjsip_param *p = (pjsip_param*)param_list->next;
     while (p != param_list) {
 	if (pj_stricmp(&p->name, name)==0)
@@ -43,14 +43,28 @@
 }
 
-PJ_DEF(const pjsip_param*) pjsip_param_cfind( const pjsip_param *param_list,
-					      const pj_str_t *name )
-{
-    const pjsip_param *p = param_list->next;
-    while (p != param_list) {
-	if (pj_stricmp_alnum(&p->name, name)==0)
-	    return p;
-	p = p->next;
-    }
-    return NULL;
+PJ_DEF(int) pjsip_param_cmp( const pjsip_param *param_list1,
+			     const pjsip_param *param_list2,
+			     pj_bool_t ig_nf)
+{
+    const pjsip_param *p1;
+
+    if ((ig_nf & 1)==0 && pj_list_size(param_list1)!=pj_list_size(param_list2))
+	return 1;
+
+    p1 = param_list1->next;
+    while (p1 != param_list1) {
+	const pjsip_param *p2;
+	p2 = pjsip_param_find(param_list2, &p1->name);
+	if (p2 ) {
+	    int rc = pj_stricmp(&p1->value, &p2->value);
+	    if (rc != 0)
+		return rc;
+	} else if ((ig_nf & 1)==0)
+	    return 1;
+
+	p1 = p1->next;
+    }
+
+    return 0;
 }
 
@@ -61,5 +75,5 @@
 
     pj_list_init(dst_list);
-    while (p != src_list) {
+    while (p && p != src_list) {
 	pjsip_param *new_param = PJ_POOL_ALLOC_T(pool, pjsip_param);
 	pj_strdup(pool, &new_param->name, &p->name);
@@ -99,5 +113,5 @@
 
     p = param_list->next;
-    if (p == param_list)
+    if (p == NULL || p == param_list)
 	return 0;
 
@@ -456,15 +470,6 @@
      * comparing the URIs.
      */
-    p1 = url1->other_param.next;
-    while (p1 != &url1->other_param) {
-	const pjsip_param *p2;
-	p2 = pjsip_param_cfind(&url2->other_param, &p1->name);
-	if (p2 ) {
-	    if (pj_stricmp(&p1->value, &p2->value) != 0)
-		return PJSIP_ECMPOTHERPARAM;
-	}
-
-	p1 = p1->next;
-    }
+    if (pjsip_param_cmp(&url1->other_param, &url2->other_param, 1)!=0)
+	return PJSIP_ECMPOTHERPARAM;
 
     /* URI header components are never ignored. Any present header component
@@ -475,5 +480,5 @@
     while (p1 != &url1->header_param) {
 	const pjsip_param *p2;
-	p2 = pjsip_param_cfind(&url2->header_param, &p1->name);
+	p2 = pjsip_param_find(&url2->header_param, &p1->name);
 	if (p2) {
 	    /* It seems too much to compare two header params according to
