Added the ability to do "meetme concise" with the "meetme" CLI command.
authorRussell Bryant <russell@russellbryant.com>
Tue, 6 Nov 2007 23:44:39 +0000 (23:44 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 6 Nov 2007 23:44:39 +0000 (23:44 +0000)
This extends the concise capabilities of this CLI command to include
listing all conferences, instead of an addition to the other sub commands
for the "meetme" command.

(closes issue #11078)
Reported by: jthomas
Patches:
      meetme-concise.patch uploaded by jthomas (license 293)

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

CHANGES
apps/app_meetme.c

diff --git a/CHANGES b/CHANGES
index d8fb291..f443f86 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -190,6 +190,10 @@ MeetMe Changes
      much identical to the S() and L() options to Dial().  They let you set
      timeouts for the conference, as well as have warning sounds played to
      let the caller know how much time is left, and when it is running out.
      much identical to the S() and L() options to Dial().  They let you set
      timeouts for the conference, as well as have warning sounds played to
      let the caller know how much time is left, and when it is running out.
+  * Added the ability to do "meetme concise" with the "meetme" CLI command.
+     This extends the concise capabilities of this CLI command to include
+     listing all conferences, instead of an addition to the other sub commands
+     for the "meetme" command.
 
 Music On Hold Changes
 ---------------------
 
 Music On Hold Changes
 ---------------------
index cd8b377..48014ed 100644 (file)
@@ -887,7 +887,7 @@ cnfout:
 
 static char *complete_meetmecmd(const char *line, const char *word, int pos, int state)
 {
 
 static char *complete_meetmecmd(const char *line, const char *word, int pos, int state)
 {
-       static char *cmds[] = {"lock", "unlock", "mute", "unmute", "kick", "list", NULL};
+       static char *cmds[] = {"concise", "lock", "unlock", "mute", "unmute", "kick", "list", NULL};
 
        int len = strlen(word);
        int which = 0;
 
        int len = strlen(word);
        int which = 0;
@@ -963,7 +963,7 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
        case CLI_INIT:
                e->command = "meetme";
                e->usage =
        case CLI_INIT:
                e->command = "meetme";
                e->usage =
-                       "Usage: meetme (un)lock|(un)mute|kick|list [concise] <confno> <usernumber>\n"
+                       "Usage: meetme concise|(un)lock|(un)mute|kick|list [concise] <confno> <usernumber>\n"
                        "       Executes a command for the conference or on a conferee\n";
                return NULL;
        case CLI_GENERATE:
                        "       Executes a command for the conference or on a conferee\n";
                return NULL;
        case CLI_GENERATE:
@@ -977,16 +977,19 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
                if (strlen(a->argv[i]) > 100)
                        ast_cli(a->fd, "Invalid Arguments.\n");
        }
                if (strlen(a->argv[i]) > 100)
                        ast_cli(a->fd, "Invalid Arguments.\n");
        }
-       if (a->argc == 1) {
+       if (a->argc == 1  || ( a->argc == 2 && !strcasecmp(a->argv[1], "concise") )) {
                /* 'MeetMe': List all the conferences */        
                /* 'MeetMe': List all the conferences */        
+               int concise = ( a->argc == 2 && !strcasecmp(a->argv[1], "concise") );
                now = time(NULL);
                AST_LIST_LOCK(&confs);
                if (AST_LIST_EMPTY(&confs)) {
                now = time(NULL);
                AST_LIST_LOCK(&confs);
                if (AST_LIST_EMPTY(&confs)) {
-                       ast_cli(a->fd, "No active MeetMe conferences.\n");
+                       if (!concise)
+                               ast_cli(a->fd, "No active MeetMe conferences.\n");
                        AST_LIST_UNLOCK(&confs);
                        return CLI_SUCCESS;
                }
                        AST_LIST_UNLOCK(&confs);
                        return CLI_SUCCESS;
                }
-               ast_cli(a->fd, header_format, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked");
+               if (!concise)
+                       ast_cli(a->fd, header_format, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked");
                AST_LIST_TRAVERSE(&confs, cnf, list) {
                        if (cnf->markedusers == 0)
                                strcpy(cmdline, "N/A ");
                AST_LIST_TRAVERSE(&confs, cnf, list) {
                        if (cnf->markedusers == 0)
                                strcpy(cmdline, "N/A ");
@@ -995,13 +998,23 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
                        hr = (now - cnf->start) / 3600;
                        min = ((now - cnf->start) % 3600) / 60;
                        sec = (now - cnf->start) % 60;
                        hr = (now - cnf->start) / 3600;
                        min = ((now - cnf->start) % 3600) / 60;
                        sec = (now - cnf->start) % 60;
-
-                       ast_cli(a->fd, data_format, cnf->confno, cnf->users, cmdline, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No");
+                       if (!concise)
+                               ast_cli(a->fd, data_format, cnf->confno, cnf->users, cmdline, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No");
+                       else {
+                               ast_cli(a->fd, "%s!%d!%d!%02d:%02d:%02d!%d!%d\n", 
+                                       cnf->confno, 
+                                       cnf->users, 
+                                       cnf->markedusers, 
+                                       hr, min, sec,
+                                       cnf->isdynamic, 
+                                       cnf->locked);
+                       }
 
                        total += cnf->users;    
                }
                AST_LIST_UNLOCK(&confs);
 
                        total += cnf->users;    
                }
                AST_LIST_UNLOCK(&confs);
-               ast_cli(a->fd, "* Total number of MeetMe users: %d\n", total);
+               if (!concise)
+                       ast_cli(a->fd, "* Total number of MeetMe users: %d\n", total);
                return CLI_SUCCESS;
        }
        if (a->argc < 3)
                return CLI_SUCCESS;
        }
        if (a->argc < 3)