summaryrefslogtreecommitdiff
path: root/main/callerid.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2008-12-04 16:45:06 +0000
committerMark Michelson <mmichelson@digium.com>2008-12-04 16:45:06 +0000
commit21a3c93ef21dd9736376ac8819ff0306fd836783 (patch)
tree043a28d1afbce9867ed256cdb594efed480246eb /main/callerid.c
parente21959884399480a3c60f157cd601c78aa3e6049 (diff)
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 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@160945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/callerid.c')
-rw-r--r--main/callerid.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main/callerid.c b/main/callerid.c
index 6a086adfc..603ac2722 100644
--- a/main/callerid.c
+++ b/main/callerid.c
@@ -1001,7 +1001,6 @@ int ast_is_shrinkable_phonenumber(const char *exten)
* 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)
@@ -1015,6 +1014,15 @@ int ast_callerid_parse(char *instr, char **name, char **location)
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);