[asterisk-commits] pbx.c: Additional fixes to ast context remove extension call... (asterisk[11])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 16 02:38:45 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

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(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/main/pbx.c b/main/pbx.c
index 4da298a..41094c5 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7444,9 +7444,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 */
@@ -7458,7 +7460,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/3557
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I17ea6881a18f40840ae9c1f5394aab1fbb3769f1
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list