diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/cli.c | 16 | ||||
-rw-r--r-- | main/manager.c | 8 | ||||
-rw-r--r-- | main/pbx.c | 17 |
3 files changed, 36 insertions, 5 deletions
diff --git a/main/cli.c b/main/cli.c index 1335ec6b7..6cbaf9a72 100644 --- a/main/cli.c +++ b/main/cli.c @@ -628,6 +628,20 @@ static char *handle_showcalls(struct ast_cli_entry *e, int cmd, struct ast_cli_a return RESULT_SUCCESS; } +/*! \brief Add a marker before the app if the channel is controlled by AGI/FastAGI or AsyncAGI + Used for "show channels" +*/ +static const char *agi_flag(struct ast_channel *chan) +{ + if (ast_test_flag(chan, AST_FLAG_AGI)) + return "[AGI] "; + if (ast_test_flag(chan, AST_FLAG_FASTAGI)) + return "[FAGI] "; + if (ast_test_flag(chan, AST_FLAG_ASYNCAGI)) + return "[AAGI] "; + return ""; +} + static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { #define FORMAT_STRING "%-20.20s %-20.20s %-7.7s %-30.30s\n" @@ -723,7 +737,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar if (!ast_strlen_zero(c->context) && !ast_strlen_zero(c->exten)) snprintf(locbuf, sizeof(locbuf), "%s@%s:%d", c->exten, c->context, c->priority); if (c->appl) - snprintf(appdata, sizeof(appdata), "%s(%s)", c->appl, S_OR(c->data, "")); + snprintf(appdata, sizeof(appdata), "%s%s(%s)", agi_flag(c), c->appl, S_OR(c->data, "")); ast_cli(fd, FORMAT_STRING, c->name, locbuf, ast_state2str(c->_state), appdata); } } diff --git a/main/manager.c b/main/manager.c index 15fbbc841..fa9240817 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2718,9 +2718,13 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m "AccountCode: %s\r\n" "BridgedChannel: %s\r\n" "BridgedUniqueID: %s\r\n" - "\r\n", c->name, c->uniqueid, c->context, c->exten, c->priority, c->_state, ast_state2str(c->_state), + "AGIstate: %s\r\n" + "\r\n", + c->name, c->uniqueid, c->context, c->exten, c->priority, c->_state, ast_state2str(c->_state), c->appl ? c->appl : "", c->data ? S_OR(c->data, ""): "", - S_OR(c->cid.cid_num, ""), durbuf, S_OR(c->accountcode, ""), bc ? bc->name : "", bc ? bc->uniqueid : ""); + S_OR(c->cid.cid_num, ""), durbuf, S_OR(c->accountcode, ""), bc ? bc->name : "", bc ? bc->uniqueid : "", + agi_state(c) + ); ast_channel_unlock(c); numchans++; } diff --git a/main/pbx.c b/main/pbx.c index 4bffe8665..dfd4f5f0b 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -2901,6 +2901,18 @@ static void pbx_substitute_variables(char *passdata, int datalen, struct ast_cha pbx_substitute_variables_helper(c, e->data, passdata, datalen - 1); } +/*! \brief report AGI state for channel */ +const char *agi_state(struct ast_channel *chan) +{ + if (ast_test_flag(chan, AST_FLAG_AGI)) + return "AGI"; + if (ast_test_flag(chan, AST_FLAG_FASTAGI)) + return "FASTAGI"; + if (ast_test_flag(chan, AST_FLAG_ASYNCAGI)) + return "ASYNCAGI"; + return ""; +} + /*! * \brief The return value depends on the action: * @@ -2981,8 +2993,9 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, "Priority: %d\r\n" "Application: %s\r\n" "AppData: %s\r\n" - "Uniqueid: %s\r\n", - c->name, c->context, c->exten, c->priority, app->name, passdata, c->uniqueid); + "Uniqueid: %s\r\n" + "AGIstate: %s\r\n", + c->name, c->context, c->exten, c->priority, app->name, passdata, c->uniqueid, agi_state(c)); return pbx_exec(c, app, passdata); /* 0 on success, -1 on failure */ } } else if (q.swo) { /* not found here, but in another switch */ |