[Asterisk-code-review] pbx.c: Ignore dashes in extensions when using extenpatternmatchnew (...asterisk[13])

Sean Bright asteriskteam at digium.com
Fri Apr 12 09:36:14 CDT 2019


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11275


Change subject: pbx.c: Ignore dashes in extensions when using extenpatternmatchnew
......................................................................

pbx.c: Ignore dashes in extensions when using extenpatternmatchnew

Because hyphens are not matched literally in Asterisk dialplan, we need
to ignore them in our candidate extensions as well.

ASTERISK-17695 #close
Reported by: test011

Change-Id: I227f02301577b1633e8a55b9fe9dc149935c03f0
---
M main/pbx.c
1 file changed, 9 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/75/11275/1

diff --git a/main/pbx.c b/main/pbx.c
index b4a5448..b374b76 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -1187,6 +1187,15 @@
 {
 	struct match_char *p; /* note minimal stack storage requirements */
 	struct ast_exten pattern = { .label = label };
+
+	/* When creating the trie, if we encounter any bare hyphens (ones that are not inside
+	 * brackets) we do _not_ insert them because we consider them "eye candy." So when we
+	 * are searching for them, we need to ensure that our subject extension doesn't have
+	 * any hyphens either */
+	while (*str == '-') {
+		str++;
+	}
+
 #ifdef DEBUG_THIS
 	if (tree)
 		ast_log(LOG_NOTICE,"new_find_extension called with %s on (sub)tree %s action=%s\n", str, tree->x, action2str(action));

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11275
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I227f02301577b1633e8a55b9fe9dc149935c03f0
Gerrit-Change-Number: 11275
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190412/315251a9/attachment-0001.html>


More information about the asterisk-code-review mailing list