summaryrefslogtreecommitdiff
path: root/res/res_features.c
diff options
context:
space:
mode:
authorJason Parker <jparker@digium.com>2007-09-18 22:43:45 +0000
committerJason Parker <jparker@digium.com>2007-09-18 22:43:45 +0000
commitc7a9ec1691ebce1ff4786e74285ceea62b6782e8 (patch)
treed49317ce7050cdca6ecef46706a320e879421c61 /res/res_features.c
parent0c8381a1f58c866a3a4f324509678b3983487dd4 (diff)
(issue #10724)
Reported by: eliel Patches: res_features.c.patch uploaded by eliel (license 64) res_agi.c.patch uploaded by seanbright (license 71) res_musiconhold.c.patch uploaded by seanbright (license 71) pbx.c.patch uploaded by moy (license 222) logger.c.patch uploaded by moy (license 222) frame.c.patch uploaded by moy (license 222) manager.c.patch uploaded by moy (license 222) http.c.patch uploaded by moy (license 222) dnsmgr.c.patch uploaded by moy (license 222) res_realtime.c.patch uploaded by eliel (license 64) res_odbc.c.patch uploaded by seanbright (license 71) res_jabber.c.patch uploaded by eliel (license 64) chan_local.c.patch uploaded by eliel (license 64) chan_agent.c.patch uploaded by eliel (license 64) chan_alsa.c.patch uploaded by eliel (license 64) chan_features.c.patch uploaded by eliel (license 64) chan_sip.c.patch uploaded by eliel (license 64) RollUp.1.patch (includes all of the above patches) uploaded by seanbright (license 71) Convert many CLI commands to the NEW_CLI format. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82930 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_features.c')
-rw-r--r--res/res_features.c67
1 files changed, 40 insertions, 27 deletions
diff --git a/res/res_features.c b/res/res_features.c
index d0a177794..71c5addb1 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -2364,41 +2364,61 @@ static int park_exec(struct ast_channel *chan, void *data)
return res;
}
-static int handle_showfeatures(int fd, int argc, char *argv[])
-{
+/*!
+ * \brief CLI command to list configured features
+ * \param e
+ * \param cmd
+ * \param a
+ *
+ * \retval CLI_SUCCESS on success.
+ * \retval NULL when tab completion is used.
+ */
+static char *handle_feature_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) {
int i;
struct ast_call_feature *feature;
char format[] = "%-25s %-7s %-7s\n";
- ast_cli(fd, format, "Builtin Feature", "Default", "Current");
- ast_cli(fd, format, "---------------", "-------", "-------");
+ switch (cmd) {
+
+ case CLI_INIT:
+ e->command = "features show";
+ e->usage =
+ "Usage: features show\n"
+ " Lists configured features\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ ast_cli(a->fd, format, "Builtin Feature", "Default", "Current");
+ ast_cli(a->fd, format, "---------------", "-------", "-------");
- ast_cli(fd, format, "Pickup", "*8", ast_pickup_ext()); /* default hardcoded above, so we'll hardcode it here */
+ ast_cli(a->fd, format, "Pickup", "*8", ast_pickup_ext()); /* default hardcoded above, so we'll hardcode it here */
ast_rwlock_rdlock(&features_lock);
for (i = 0; i < FEATURES_COUNT; i++)
- ast_cli(fd, format, builtin_features[i].fname, builtin_features[i].default_exten, builtin_features[i].exten);
+ ast_cli(a->fd, format, builtin_features[i].fname, builtin_features[i].default_exten, builtin_features[i].exten);
ast_rwlock_unlock(&features_lock);
- ast_cli(fd, "\n");
- ast_cli(fd, format, "Dynamic Feature", "Default", "Current");
- ast_cli(fd, format, "---------------", "-------", "-------");
+ ast_cli(a->fd, "\n");
+ ast_cli(a->fd, format, "Dynamic Feature", "Default", "Current");
+ ast_cli(a->fd, format, "---------------", "-------", "-------");
if (AST_LIST_EMPTY(&feature_list))
- ast_cli(fd, "(none)\n");
+ ast_cli(a->fd, "(none)\n");
else {
AST_LIST_LOCK(&feature_list);
AST_LIST_TRAVERSE(&feature_list, feature, feature_entry)
- ast_cli(fd, format, feature->sname, "no def", feature->exten);
+ ast_cli(a->fd, format, feature->sname, "no def", feature->exten);
AST_LIST_UNLOCK(&feature_list);
}
- ast_cli(fd, "\nCall parking\n");
- ast_cli(fd, "------------\n");
- ast_cli(fd,"%-20s: %s\n", "Parking extension", parking_ext);
- ast_cli(fd,"%-20s: %s\n", "Parking context", parking_con);
- ast_cli(fd,"%-20s: %d-%d\n", "Parked call extensions", parking_start, parking_stop);
- ast_cli(fd,"\n");
-
- return RESULT_SUCCESS;
+ ast_cli(a->fd, "\nCall parking\n");
+ ast_cli(a->fd, "------------\n");
+ ast_cli(a->fd,"%-20s: %s\n", "Parking extension", parking_ext);
+ ast_cli(a->fd,"%-20s: %s\n", "Parking context", parking_con);
+ ast_cli(a->fd,"%-20s: %d-%d\n", "Parked call extensions", parking_start, parking_stop);
+ ast_cli(a->fd,"\n");
+
+ return CLI_SUCCESS;
}
static char mandescr_bridge[] =
@@ -2542,10 +2562,6 @@ static int action_bridge(struct mansession *s, const struct message *m)
return 0;
}
-static char showfeatures_help[] =
-"Usage: feature list\n"
-" Lists currently configured features.\n";
-
/*!
* \brief CLI command to list parked calls
* \param e
@@ -2605,10 +2621,7 @@ static char *handle_parkedcalls_deprecated(struct ast_cli_entry *e, int cmd, str
static struct ast_cli_entry cli_show_parkedcalls_deprecated = NEW_CLI(handle_parkedcalls_deprecated, "List currently parked calls.");
static struct ast_cli_entry cli_features[] = {
- { { "feature", "show", NULL },
- handle_showfeatures, "Lists configured features",
- showfeatures_help },
-
+ NEW_CLI(handle_feature_show, "Lists configured features"),
NEW_CLI(handle_parkedcalls, "List currently parked calls", .deprecate_cmd = &cli_show_parkedcalls_deprecated),
};