From: Scott Griepentrog Date: Tue, 10 Jun 2014 22:31:04 +0000 (+0000) Subject: CLI: add presence information to core show hints X-Git-Tag: 13.0.0-beta1~223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7ed0a1ece9484aa05da3549a1ca3b0a20866c3f;p=thirdparty%2Fasterisk.git 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 --- diff --git a/main/pbx.c b/main/pbx.c index ba985199f9..d6b11c71d0 100644 --- a/main/pbx.c +++ b/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++; }