[Asterisk-code-review] pbx.c: Additional fixes to ast context remove extension call... (asterisk[13])

Corey Farrell asteriskteam at digium.com
Mon Aug 15 11:12:32 CDT 2016


Corey Farrell has uploaded a new change for review.

  https://gerrit.asterisk.org/3558

Change subject: pbx.c: Additional fixes to ast_context_remove_extension_callerid2.
......................................................................

pbx.c: Additional fixes to ast_context_remove_extension_callerid2.

Do not check registrar of the first extension head.  We should only check
the registrar when we match the priority.

Additionally fix a couple calls to strcmp which used the input callerid
instead of the clean version ex.cidmatch.

ASTERISK-26233

Change-Id: I17ea6881a18f40840ae9c1f5394aab1fbb3769f1
---
M main/pbx.c
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/58/3558/1

diff --git a/main/pbx.c b/main/pbx.c
index 40a97a3..3b9594a 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -4992,9 +4992,11 @@
 	/* scan the extension list to find first matching extension-registrar */
 	for (exten = con->root; exten; prev_exten = exten, exten = exten->next) {
 		if (!strcmp(exten->exten, ex.exten) &&
-			(!registrar || !strcmp(exten->registrar, registrar)) &&
-			(!matchcallerid || (!ast_strlen_zero(callerid) && !ast_strlen_zero(exten->cidmatch) && !strcmp(exten->cidmatch, callerid)) || (ast_strlen_zero(callerid) && ast_strlen_zero(exten->cidmatch))))
+			(!matchcallerid ||
+				(!ast_strlen_zero(ex.cidmatch) && !ast_strlen_zero(exten->cidmatch) && !strcmp(exten->cidmatch, ex.cidmatch)) ||
+				(ast_strlen_zero(ex.cidmatch) && ast_strlen_zero(exten->cidmatch)))) {
 			break;
+		}
 	}
 	if (!exten) {
 		/* we can't find right extension */
@@ -5006,7 +5008,7 @@
 	/* scan the priority list to remove extension with exten->priority == priority */
 	for (peer = exten, next_peer = exten->peer ? exten->peer : exten->next;
 		 peer && !strcmp(peer->exten, ex.exten) &&
-			(!callerid || (!matchcallerid && !peer->matchcid) || (matchcallerid && peer->matchcid && !strcmp(peer->cidmatch, callerid))) ;
+			(!callerid || (!matchcallerid && !peer->matchcid) || (matchcallerid && peer->matchcid && !strcmp(peer->cidmatch, ex.cidmatch))) ;
 			peer = next_peer, next_peer = next_peer ? (next_peer->peer ? next_peer->peer : next_peer->next) : NULL) {
 
 		if ((priority == 0 || peer->priority == priority) &&

-- 
To view, visit https://gerrit.asterisk.org/3558
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I17ea6881a18f40840ae9c1f5394aab1fbb3769f1
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Corey Farrell <git at cfware.com>



More information about the asterisk-code-review mailing list