[Asterisk-code-review] pbx.c: Additional fixes to ast context remove extension call... (asterisk[14])
Joshua Colp
asteriskteam at digium.com
Tue Aug 16 05:33:23 CDT 2016
Joshua Colp 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
Joshua Colp: Looks good to me, but someone else must approve; Verified
diff --git a/main/pbx.c b/main/pbx.c
index 3ed6ccc..3c56362 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -5033,9 +5033,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 */
@@ -5047,7 +5049,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/3559
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I17ea6881a18f40840ae9c1f5394aab1fbb3769f1
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
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-code-review
mailing list