[asterisk-commits] kmoore: branch 11 r425153 - in /branches/11: ./ main/ tests/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 10 07:55:58 CDT 2014


Author: kmoore
Date: Fri Oct 10 07:55:56 2014
New Revision: 425153

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=425153
Log:
CallerID: Fix parsing regression

This fixes a regression in callerid parsing introduced when another bug
was fixed. This bug occurred when the name was composed entirely of
DTMF keys and quoted without a number section (<>). 

ASTERISK-24406 #close
Reported by: Etienne Lessard
Tested by: Etienne Lessard
Patches:
    callerid_fix.diff uploaded by Kinsey Moore
Review: https://reviewboard.asterisk.org/r/4067/
........

Merged revisions 425152 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/11/   (props changed)
    branches/11/main/callerid.c
    branches/11/tests/test_callerid.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/11/main/callerid.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/callerid.c?view=diff&rev=425153&r1=425152&r2=425153
==============================================================================
--- branches/11/main/callerid.c (original)
+++ branches/11/main/callerid.c Fri Oct 10 07:55:56 2014
@@ -1006,12 +1006,20 @@
 	return ast_is_valid_string(exten, "0123456789*#+()-.");
 }
 
-int ast_callerid_parse(char *instr, char **name, char **location)
-{
-	char *ls, *le, *name_start;
+int ast_callerid_parse(char *input_str, char **name, char **location)
+{
+	char *ls;
+	char *le;
+	char *name_start;
+	char *instr;
+	int quotes_stripped = 0;
 
 	/* Handle surrounding quotes */
-	instr = ast_strip_quoted(instr, "\"", "\"");
+	input_str = ast_strip(input_str);
+	instr = ast_strip_quoted(input_str, "\"", "\"");
+	if (instr != input_str) {
+		quotes_stripped = 1;
+	}
 
 	/* Try "name" <location> format or name <location> format or with a missing > */
 	if ((ls = strrchr(instr, '<'))) {
@@ -1027,7 +1035,7 @@
 
 		ast_copy_string(tmp, instr, sizeof(tmp));
 		ast_shrink_phone_number(tmp);
-		if (ast_isphonenumber(tmp)) {	/* Assume it's just a location */
+		if (!quotes_stripped && ast_isphonenumber(tmp)) {	/* Assume it's just a location */
 			name_start = NULL;
 			strcpy(instr, tmp); /* safe, because tmp will always be the same size or smaller than instr */
 			*location = instr;

Modified: branches/11/tests/test_callerid.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/tests/test_callerid.c?view=diff&rev=425153&r1=425152&r2=425153
==============================================================================
--- branches/11/tests/test_callerid.c (original)
+++ branches/11/tests/test_callerid.c Fri Oct 10 07:55:56 2014
@@ -56,10 +56,14 @@
 		{"\"\" <number>", NULL, "number"},
 		{"<number>", NULL, "number"},
 		{"name", "name", NULL},
+		{" name", "name", NULL},
 		{"\"name\"", "name", NULL},
+		{"\"*10\"", "*10", NULL},
+		{" \"*10\"", "*10", NULL},
 		{"\"name\" <>", "name", NULL},
 		{"name <>", "name", NULL},
 		{"1234", NULL, "1234"},
+		{" 1234", NULL, "1234"},
 		{"\"na\\\"me\" <number>", "na\"me", "number"},
 	};
 	char *name;




More information about the asterisk-commits mailing list