summaryrefslogtreecommitdiff
path: root/apps/app_macro.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_macro.c')
-rw-r--r--apps/app_macro.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/apps/app_macro.c b/apps/app_macro.c
index f3ff81db5..e5ab2bc21 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -298,7 +298,8 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
}
snprintf(fullmacro, sizeof(fullmacro), "macro-%s", macro);
- if (!ast_exists_extension(chan, fullmacro, "s", 1, chan->cid.cid_num)) {
+ if (!ast_exists_extension(chan, fullmacro, "s", 1,
+ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
if (!ast_context_find(fullmacro))
ast_log(LOG_WARNING, "No such context '%s' for macro '%s'\n", fullmacro, macro);
else
@@ -370,7 +371,8 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
ast_channel_unlock(chan);
autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
- while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
+ while (ast_exists_extension(chan, chan->context, chan->exten, chan->priority,
+ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
struct ast_context *c;
struct ast_exten *e;
int foundx;
@@ -386,7 +388,8 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
if (ast_rdlock_context(c)) {
ast_log(LOG_WARNING, "Unable to lock context?\n");
} else {
- e = find_matching_priority(c, chan->exten, chan->priority, chan->cid.cid_num);
+ e = find_matching_priority(c, chan->exten, chan->priority,
+ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL));
if (e) { /* This will only be undefined for pbx_realtime, which is majorly broken. */
ast_copy_string(runningapp, ast_get_extension_app(e), sizeof(runningapp));
ast_copy_string(runningdata, ast_get_extension_app_data(e), sizeof(runningdata));
@@ -402,7 +405,10 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
/* Reset the macro depth, if it was changed in the last iteration */
pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
- if ((res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num, &foundx,1))) {
+ res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority,
+ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL),
+ &foundx, 1);
+ if (res) {
/* Something bad happened, or a hangup has been requested. */
if (((res >= '0') && (res <= '9')) || ((res >= 'A') && (res <= 'F')) ||
(res == '*') || (res == '#')) {
@@ -544,7 +550,9 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
/* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
normally if there is any problem */
if (sscanf(offsets, "%30d", &offset) == 1) {
- if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + offset + 1, chan->cid.cid_num)) {
+ if (ast_exists_extension(chan, chan->context, chan->exten,
+ chan->priority + offset + 1,
+ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
chan->priority += offset;
}
}