Attended call transfer implementation. The changes involves:
- Added support for SIP Replaces extension (RFC 3891)
- Added pjsua_call_xfer_replaces() to perform attended call
  transfer.
- PJSUA checks and process Replaces header in incoming calls
- Added pjsip_ua_find_dialog() API.
- Added pjsip_endpt_has_capability() API.
- Added pjsip_endpt_send_response2() API.
- etc.



git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@797 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index 9750745..8c6b4cc 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -386,8 +386,10 @@
 
     /* Register the module. */
     status = pjsip_endpt_register_module(endpt, &mod_inv.mod);
+    if (status != PJ_SUCCESS)
+	return status;
 
-    return status;
+    return PJ_SUCCESS;
 }
 
 /*
@@ -680,8 +682,9 @@
     req_hdr = pjsip_msg_find_hdr(msg, PJSIP_H_REQUIRE, NULL);
     if (req_hdr) {
 	unsigned i;
-	pj_str_t STR_100REL = { "100rel", 6};
-	pj_str_t STR_TIMER = { "timer", 5 };
+	const pj_str_t STR_100REL = { "100rel", 6};
+	const pj_str_t STR_TIMER = { "timer", 5 };
+	const pj_str_t STR_REPLACES = { "replaces", 8 };
 	unsigned unsupp_cnt = 0;
 	pj_str_t unsupp_tags[PJSIP_GENERIC_ARRAY_MAX_COUNT];
 	
@@ -696,6 +699,14 @@
 	    {
 		rem_option |= PJSIP_INV_REQUIRE_TIMER;
 
+	    } else if (pj_stricmp(&req_hdr->values[i], &STR_REPLACES)==0) {
+		pj_bool_t supp;
+		
+		supp = pjsip_endpt_has_capability(endpt, PJSIP_H_SUPPORTED, 
+						  NULL, &STR_REPLACES);
+		if (!supp)
+		    unsupp_tags[unsupp_cnt++] = req_hdr->values[i];
+
 	    } else {
 		/* Unknown/unsupported extension tag!  */
 		unsupp_tags[unsupp_cnt++] = req_hdr->values[i];