Misc (re #1559): Require name-addr to have the quote if display name is given. Previously an URI like this will be accepted: "301 301" sip:301@host


git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@4288 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index ad8e519..40975e4 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -2729,7 +2729,8 @@
 
     /** 
      * The full SIP URL for the account. The value can take name address or 
-     * URL format, and will look something like "sip:account@serviceprovider".
+     * URL format, and will look something like "sip:account@serviceprovider"
+     * or "\"Display Name\" <sip:account@provider>".
      *
      * This field is mandatory.
      */
@@ -4534,7 +4535,8 @@
  * of the call transfer request.
  *
  * @param call_id	The call id to be transfered.
- * @param dest		Address of new target to be contacted.
+ * @param dest		URI of new target to be contacted. The URI may be
+ * 			in name address or addr-spec format.
  * @param msg_data	Optional message components to be sent with
  *			the request.
  *
diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c
index ccdf5d3..56ce484 100644
--- a/pjsip/src/pjsip/sip_parser.c
+++ b/pjsip/src/pjsip/sip_parser.c
@@ -1522,8 +1522,15 @@
 
     /* Get the SIP-URL */
     has_bracket = (*scanner->curptr == '<');
-    if (has_bracket)
+    if (has_bracket) {
 	pj_scan_get_char(scanner);
+    } else if (name_addr->display.slen) {
+	/* Must have bracket now (2012-10-26).
+	 * Allowing (invalid) name-addr to pass URI verification will
+	 * cause us to send invalid URI to the wire.
+	 */
+	PJ_THROW( PJSIP_SYN_ERR_EXCEPTION);
+    }
     name_addr->uri = int_parse_uri( scanner, pool, PJ_TRUE );
     if (has_bracket) {
 	if (pj_scan_get_char(scanner) != '>')