summaryrefslogtreecommitdiff
path: root/apps/app_while.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_while.c')
-rw-r--r--apps/app_while.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/app_while.c b/apps/app_while.c
index e9a503aad..80359359e 100644
--- a/apps/app_while.c
+++ b/apps/app_while.c
@@ -163,7 +163,11 @@ static int find_matching_endwhile(struct ast_channel *chan)
/* This is the matching context we want */
int cur_priority = chan->priority + 1, level=1;
- for (e = find_matching_priority(c, chan->exten, cur_priority, chan->cid.cid_num); e; e = find_matching_priority(c, chan->exten, ++cur_priority, chan->cid.cid_num)) {
+ for (e = find_matching_priority(c, chan->exten, cur_priority,
+ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL));
+ e;
+ e = find_matching_priority(c, chan->exten, ++cur_priority,
+ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
if (!strcasecmp(ast_get_extension_app(e), "WHILE")) {
level++;
} else if (!strcasecmp(ast_get_extension_app(e), "ENDWHILE")) {