[asterisk-commits] mmichelson: branch 1.6.0 r160946 - in /branches/1.6.0: ./ main/callerid.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 4 10:47:19 CST 2008


Author: mmichelson
Date: Thu Dec  4 10:47:19 2008
New Revision: 160946

URL: http://svn.digium.com/view/asterisk?view=rev&rev=160946
Log:
Merged revisions 160945 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r160945 | mmichelson | 2008-12-04 10:45:06 -0600 (Thu, 04 Dec 2008) | 23 lines

Merged revisions 160943 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r160943 | mmichelson | 2008-12-04 10:44:18 -0600 (Thu, 04 Dec 2008) | 15 lines

Fix a callerid parsing issue. If someone formatted callerid like the
following: "name <number>" (including the quotation marks), then the parts
would be parsed as 

name: "name
number: number

This is because the closing quotation mark was not discovered since the number
and everything after was parsed out of the string earlier. Now, there is a check
to see if the closing quote occurs after the number, so that we can know if we
should strip off the opening quote on the name.

Closes AST-158


........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/main/callerid.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/main/callerid.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/callerid.c?view=diff&rev=160946&r1=160945&r2=160946
==============================================================================
--- branches/1.6.0/main/callerid.c (original)
+++ branches/1.6.0/main/callerid.c Thu Dec  4 10:47:19 2008
@@ -976,7 +976,6 @@
 	input			location	name
 	" foo bar " <123>	123		' foo bar ' (with spaces around)
 	" foo bar "		NULL		'foo bar' (without spaces around)
-	" foo bar  <123>"	123		'" foo bar'
   The parsing of leading and trailing space/quotes should be more consistent.
 */
 int ast_callerid_parse(char *instr, char **name, char **location)
@@ -990,6 +989,15 @@
 		if ((ns = strchr(instr, '"')) && (ne = strchr(ns + 1, '"'))) {
 			*ns = *ne = '\0';	/* trim off the quotes */
 			*name = ns + 1;		/* and this is the name */
+		} else if (ns) {
+			/* An opening quote was found but no closing quote was. The closing
+			 * quote may actually be after the end of the bracketed number
+			 */
+			if (strchr(le + 1, '\"')) {
+				*ns = '\0';
+				*name = ns + 1;
+				ast_trim_blanks(*name);
+			}
 		} else { /* no quotes, trim off leading and trailing spaces */
 			*name = ast_skip_blanks(instr);
 			ast_trim_blanks(*name);




More information about the asterisk-commits mailing list