mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 07:01:09 +00:00
CLI: add presence information to core show hints
Adds presence state value to output of core show hints. Also reformats the output slightly so it doesn't use as much space as it would otherwise. Was: 1000@demo : SIP/1000 State:Unavailable Watchers 0 Now: 1000@demo : SIP/1000 State:Unavailable Presence:Idle Watchers 0 AFS-53 #close Review: https://reviewboard.asterisk.org/r/3604/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
13
main/pbx.c
13
main/pbx.c
@@ -7367,6 +7367,7 @@ static char *handle_show_hints(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
||||
int num = 0;
|
||||
int watchers;
|
||||
struct ao2_iterator i;
|
||||
char buf[AST_MAX_EXTENSION+AST_MAX_CONTEXT+2];
|
||||
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
@@ -7395,11 +7396,17 @@ static char *handle_show_hints(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
||||
continue;
|
||||
}
|
||||
watchers = ao2_container_count(hint->callbacks);
|
||||
ast_cli(a->fd, " %20s@%-20.20s: %-20.20s State:%-15.15s Watchers %2d\n",
|
||||
sprintf(buf, "%s@%s",
|
||||
ast_get_extension_name(hint->exten),
|
||||
ast_get_context_name(ast_get_extension_context(hint->exten)),
|
||||
ast_get_context_name(ast_get_extension_context(hint->exten)));
|
||||
|
||||
ast_cli(a->fd, "%-20.20s: %-20.20s State:%-15.15s Presence:%-15.15s Watchers %2d\n",
|
||||
buf,
|
||||
ast_get_extension_app(hint->exten),
|
||||
ast_extension_state2str(hint->laststate), watchers);
|
||||
ast_extension_state2str(hint->laststate),
|
||||
ast_extension_state2str(hint->last_presence_state),
|
||||
watchers);
|
||||
|
||||
ao2_unlock(hint);
|
||||
num++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user