CLI: correct presence information on core show hints
authorScott Griepentrog <sgriepentrog@digium.com>
Wed, 11 Jun 2014 20:22:23 +0000 (20:22 +0000)
committerScott Griepentrog <sgriepentrog@digium.com>
Wed, 11 Jun 2014 20:22:23 +0000 (20:22 +0000)
Adds presence to core show hint and changes presence
string conversion to use the correct function.

ASTERISK-23858 #close
Review: https://reviewboard.asterisk.org/r/3611/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415715 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/pbx.c

index d6b11c7..67108f6 100644 (file)
@@ -7404,7 +7404,7 @@ static char *handle_show_hints(struct ast_cli_entry *e, int cmd, struct ast_cli_
                        buf,
                        ast_get_extension_app(hint->exten),
                        ast_extension_state2str(hint->laststate),
-                       ast_extension_state2str(hint->last_presence_state),
+                       ast_presence_state2str(hint->last_presence_state),
                        watchers);
 
                ao2_unlock(hint);
@@ -7460,6 +7460,7 @@ static char *handle_show_hint(struct ast_cli_entry *e, int cmd, struct ast_cli_a
        int watchers;
        int num = 0, extenlen;
        struct ao2_iterator i;
+       char buf[AST_MAX_EXTENSION+AST_MAX_CONTEXT+2];
 
        switch (cmd) {
        case CLI_INIT:
@@ -7491,11 +7492,15 @@ static char *handle_show_hint(struct ast_cli_entry *e, int cmd, struct ast_cli_a
                }
                if (!strncasecmp(ast_get_extension_name(hint->exten), a->argv[3], extenlen)) {
                        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_presence_state2str(hint->last_presence_state), 
+                               watchers);
                        num++;
                }
                ao2_unlock(hint);