Some changes to REFER handling in PJSUA-LIB:
 - added callback to report call transfer progress
 - changed the call transfer request callback name in pjsua
 - added "--norefersub" option in pjsua.
 - fixed bug when call transfer is done more than once in
   the same dialog (dialog usage can not be added)

Also removed 7xx status from the SIP status codes.

And added pjsip_parse_status_line() to parse sipfrag.




git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@780 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip/include/pjsip/sip_msg.h b/pjsip/include/pjsip/sip_msg.h
index b27b270..6ae3308 100644
--- a/pjsip/include/pjsip/sip_msg.h
+++ b/pjsip/include/pjsip/sip_msg.h
@@ -431,9 +431,9 @@
     PJSIP_SC_DOES_NOT_EXIST_ANYWHERE = 604,
     PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE = 606,
 
-    PJSIP_SC_TSX_TIMEOUT = 701,
+    PJSIP_SC_TSX_TIMEOUT = PJSIP_SC_REQUEST_TIMEOUT,
     /*PJSIP_SC_TSX_RESOLVE_ERROR = 702,*/
-    PJSIP_SC_TSX_TRANSPORT_ERROR = 703
+    PJSIP_SC_TSX_TRANSPORT_ERROR = PJSIP_SC_SERVICE_UNAVAILABLE
 
 } pjsip_status_code;
 
diff --git a/pjsip/include/pjsip/sip_parser.h b/pjsip/include/pjsip/sip_parser.h
index d0eb838..72c103a 100644
--- a/pjsip/include/pjsip/sip_parser.h
+++ b/pjsip/include/pjsip/sip_parser.h
@@ -24,7 +24,7 @@
  * @brief SIP Message Parser
  */
 
-#include <pjsip/sip_types.h>
+#include <pjsip/sip_msg.h>
 #include <pjlib-util/scanner.h>
 #include <pj/list.h>
 
@@ -191,6 +191,19 @@
 				     unsigned options);
 
 /**
+ * Parse SIP status line.
+ *
+ * @param buf		Text buffer to parse.
+ * @param size		The size of the buffer.
+ * @param status_line	Structure to receive the parsed elements.
+ *
+ * @return		PJ_SUCCESS if a status line is parsed successfully.
+ */
+PJ_DECL(pj_status_t) pjsip_parse_status_line(char *buf, pj_size_t size,
+					     pjsip_status_line *status_line);
+
+
+/**
  * Parse a packet buffer and build a full SIP message from the packet. This
  * function parses all parts of the message, including request/status line,
  * all headers, and the message body. The message body however is only 
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 2b11df0..39d5caf 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -309,9 +309,32 @@
      * is not defined, the default behavior is to accept the
      * transfer.
      */
-    void (*on_call_transfered)(pjsua_call_id call_id,
-			       const pj_str_t *dst,
-			       pjsip_status_code *code);
+    void (*on_call_transfer_request)(pjsua_call_id call_id,
+				     const pj_str_t *dst,
+				     pjsip_status_code *code);
+
+    /**
+     * Notify application of the status of previously sent call
+     * transfer request. Application can monitor the status of the
+     * call transfer request, for example to decide whether to 
+     * terminate existing call.
+     *
+     * @param call_id	    Call ID.
+     * @param status_code   Status progress of the transfer request.
+     * @param status_text   Status progress text.
+     * @param final	    If non-zero, no further notification will
+     *			    be reported. The status_code specified in
+     *			    this callback is the final status.
+     * @param p_cont	    Initially will be set to non-zero, application
+     *			    can set this to FALSE if it no longer wants
+     *			    to receie further notification (for example,
+     *			    after it hangs up the call).
+     */
+    void (*on_call_transfer_status)(pjsua_call_id call_id,
+				    int status_code,
+				    const pj_str_t *status_text,
+				    pj_bool_t final,
+				    pj_bool_t *p_cont);
 
     /**
      * Notify application when registration status has changed.