diff options
author | Michiel van Baak <michiel@vanbaak.info> | 2008-11-12 06:46:04 +0000 |
---|---|---|
committer | Michiel van Baak <michiel@vanbaak.info> | 2008-11-12 06:46:04 +0000 |
commit | 86f900b20105bf5e918d8347cab8557f33d5fdae (patch) | |
tree | 95cbe393b660ef9b967378388db5bd09c7a890f4 /main | |
parent | 5b25c263181989a1f86be2c2c94c4425ec30721a (diff) |
This commit does two things:
- Add CLI aliases module to asterisk.
- Remove all deprecated CLI commands from the code
Initial work done by file.
Junk-Y and lmadsen did a lot of work and testing to
get the list of deprecated commands into the configuration file.
Deprecated CLI commands are now handled by this new module,
see cli_aliases.conf for more info about that.
ok russellb@ via reviewboard
(closes issue #13735)
Reported by: mvanbaak
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@156120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/asterisk.c | 80 | ||||
-rw-r--r-- | main/cdr.c | 11 | ||||
-rw-r--r-- | main/cli.c | 118 | ||||
-rw-r--r-- | main/pbx.c | 39 | ||||
-rw-r--r-- | main/rtp.c | 130 | ||||
-rw-r--r-- | main/udptl.c | 63 |
6 files changed, 40 insertions, 401 deletions
diff --git a/main/asterisk.c b/main/asterisk.c index 27c221353..79e5e7be0 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1590,14 +1590,6 @@ static char *handle_stop_now(struct ast_cli_entry *e, int cmd, struct ast_cli_ar return CLI_SUCCESS; } -static char *handle_stop_now_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_stop_now(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "stop now"; - return res; -} - static char *handle_stop_gracefully(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -1618,14 +1610,6 @@ static char *handle_stop_gracefully(struct ast_cli_entry *e, int cmd, struct ast return CLI_SUCCESS; } -static char *handle_stop_gracefully_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_stop_gracefully(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "stop gracefully"; - return res; -} - static char *handle_stop_when_convenient(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -1646,14 +1630,6 @@ static char *handle_stop_when_convenient(struct ast_cli_entry *e, int cmd, struc return CLI_SUCCESS; } -static char *handle_stop_when_convenient_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_stop_when_convenient(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "stop when convenient"; - return res; -} - static char *handle_restart_now(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -1674,14 +1650,6 @@ static char *handle_restart_now(struct ast_cli_entry *e, int cmd, struct ast_cli return CLI_SUCCESS; } -static char *handle_restart_now_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_restart_now(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "restart now"; - return res; -} - static char *handle_restart_gracefully(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -1702,14 +1670,6 @@ static char *handle_restart_gracefully(struct ast_cli_entry *e, int cmd, struct return CLI_SUCCESS; } -static char *handle_restart_gracefully_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_restart_gracefully(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "restart gracefully"; - return res; -} - static char *handle_restart_when_convenient(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -1730,14 +1690,6 @@ static char *handle_restart_when_convenient(struct ast_cli_entry *e, int cmd, st return CLI_SUCCESS; } -static char *handle_restart_when_convenient_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_restart_when_convenient(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "restart when convenient"; - return res; -} - static char *handle_abort_shutdown(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -1759,14 +1711,6 @@ static char *handle_abort_shutdown(struct ast_cli_entry *e, int cmd, struct ast_ return CLI_SUCCESS; } -static char *handle_abort_shutdown_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_abort_shutdown(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "abort shutdown"; - return res; -} - static char *handle_bang(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -1866,24 +1810,14 @@ static char *show_license(struct ast_cli_entry *e, int cmd, struct ast_cli_args #define ASTERISK_PROMPT2 "%s*CLI> " -/* deprecated cli entries */ -static struct ast_cli_entry cli_abort_shutdown_deprecated = AST_CLI_DEFINE(handle_abort_shutdown_deprecated, "Cancel a running shutdown."); -static struct ast_cli_entry cli_stop_now_deprecated = AST_CLI_DEFINE(handle_stop_now_deprecated, "Shut down Asterisk immediately."); -static struct ast_cli_entry cli_stop_gracefully_deprecated = AST_CLI_DEFINE(handle_stop_gracefully_deprecated, "Gracefully shut down Asterisk."); -static struct ast_cli_entry cli_stop_when_convenient_deprecated = AST_CLI_DEFINE(handle_stop_when_convenient_deprecated, "Shut down Asterisk at empty call volume."); -static struct ast_cli_entry cli_restart_now_deprecated = AST_CLI_DEFINE(handle_restart_now_deprecated, "Restart Asterisk immediately."); -static struct ast_cli_entry cli_restart_gracefully_deprecated = AST_CLI_DEFINE(handle_restart_gracefully_deprecated, "Restart Asterisk gracefully."); -static struct ast_cli_entry cli_restart_when_convenient_deprecated = AST_CLI_DEFINE(handle_restart_when_convenient_deprecated, "Restart Asterisk at empty call volume."); -/* end deprecated cli entries */ - static struct ast_cli_entry cli_asterisk[] = { - AST_CLI_DEFINE(handle_abort_shutdown, "Cancel a running shutdown", .deprecate_cmd = &cli_abort_shutdown_deprecated), - AST_CLI_DEFINE(handle_stop_now, "Shut down Asterisk immediately", .deprecate_cmd = &cli_stop_now_deprecated), - AST_CLI_DEFINE(handle_stop_gracefully, "Gracefully shut down Asterisk", .deprecate_cmd = &cli_stop_gracefully_deprecated), - AST_CLI_DEFINE(handle_stop_when_convenient, "Shut down Asterisk at empty call volume", .deprecate_cmd = &cli_stop_when_convenient_deprecated), - AST_CLI_DEFINE(handle_restart_now, "Restart Asterisk immediately", .deprecate_cmd = &cli_restart_now_deprecated), - AST_CLI_DEFINE(handle_restart_gracefully, "Restart Asterisk gracefully", .deprecate_cmd = &cli_restart_gracefully_deprecated), - AST_CLI_DEFINE(handle_restart_when_convenient, "Restart Asterisk at empty call volume", .deprecate_cmd = &cli_restart_when_convenient_deprecated), + AST_CLI_DEFINE(handle_abort_shutdown, "Cancel a running shutdown"), + AST_CLI_DEFINE(handle_stop_now, "Shut down Asterisk immediately"), + AST_CLI_DEFINE(handle_stop_gracefully, "Gracefully shut down Asterisk"), + AST_CLI_DEFINE(handle_stop_when_convenient, "Shut down Asterisk at empty call volume"), + AST_CLI_DEFINE(handle_restart_now, "Restart Asterisk immediately"), + AST_CLI_DEFINE(handle_restart_gracefully, "Restart Asterisk gracefully"), + AST_CLI_DEFINE(handle_restart_when_convenient, "Restart Asterisk at empty call volume"), AST_CLI_DEFINE(show_warranty, "Show the warranty (if any) for this copy of Asterisk"), AST_CLI_DEFINE(show_license, "Show the license(s) for this copy of Asterisk"), AST_CLI_DEFINE(handle_version, "Display version info"), diff --git a/main/cdr.c b/main/cdr.c index e73148399..e4d5f759d 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -1334,14 +1334,6 @@ static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_ return CLI_SUCCESS; } -static char *handle_cli_status_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_cli_status(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "cdr status"; - return res; -} - static char *handle_cli_submit(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -1364,8 +1356,7 @@ static char *handle_cli_submit(struct ast_cli_entry *e, int cmd, struct ast_cli_ } static struct ast_cli_entry cli_submit = AST_CLI_DEFINE(handle_cli_submit, "Posts all pending batched CDR data"); -static struct ast_cli_entry cli_status_deprecated = AST_CLI_DEFINE(handle_cli_status_deprecated, "Display the CDR status"); -static struct ast_cli_entry cli_status = AST_CLI_DEFINE(handle_cli_status, "Display the CDR status", .deprecate_cmd = &cli_status_deprecated); +static struct ast_cli_entry cli_status = AST_CLI_DEFINE(handle_cli_status, "Display the CDR status"); static int do_reload(int reload) { diff --git a/main/cli.c b/main/cli.c index f9535c40d..979254d04 100644 --- a/main/cli.c +++ b/main/cli.c @@ -166,14 +166,6 @@ static char *handle_load(struct ast_cli_entry *e, int cmd, struct ast_cli_args * return CLI_SUCCESS; } -static char *handle_load_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_load(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "load"; - return res; -} - static char *handle_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { int x; @@ -209,14 +201,6 @@ static char *handle_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args return CLI_SUCCESS; } -static char *handle_reload_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *s = handle_reload(e, cmd, a); - if (cmd == CLI_INIT) /* override command name */ - e->command = "reload"; - return s; -} - /*! * \brief Find the debug or verbose file setting * \arg debug 1 for debug, 0 for verbose @@ -428,14 +412,6 @@ static char *handle_unload(struct ast_cli_entry *e, int cmd, struct ast_cli_args return CLI_SUCCESS; } -static char *handle_unload_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_unload(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "unload"; /* XXX override */ - return res; -} - #define MODLIST_FORMAT "%-30s %-40.40s %-10d\n" #define MODLIST_FORMAT2 "%-30s %-40.40s %-10s\n" @@ -948,18 +924,6 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str return CLI_SUCCESS; } -static char *handle_debugchan_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res; - - if (cmd == CLI_HANDLER && a->argc != e->args + 1) - return CLI_SHOWUSAGE; - res = handle_core_set_debug_channel(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "debug channel"; - return res; -} - static char *handle_nodebugchan_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { char *res; @@ -1175,11 +1139,6 @@ static char *group_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl #undef FORMAT_STRING } -static struct ast_cli_entry cli_debug_channel_deprecated = AST_CLI_DEFINE(handle_debugchan_deprecated, "Enable debugging on channel"); -static struct ast_cli_entry cli_module_load_deprecated = AST_CLI_DEFINE(handle_load_deprecated, "Load a module"); -static struct ast_cli_entry cli_module_reload_deprecated = AST_CLI_DEFINE(handle_reload_deprecated, "reload modules by name"); -static struct ast_cli_entry cli_module_unload_deprecated = AST_CLI_DEFINE(handle_unload_deprecated, "unload modules by name"); - static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); static struct ast_cli_entry cli_cli[] = { @@ -1196,8 +1155,7 @@ static struct ast_cli_entry cli_cli[] = { AST_CLI_DEFINE(handle_showchan, "Display information on a specific channel"), - AST_CLI_DEFINE(handle_core_set_debug_channel, "Enable/disable debugging on a channel", - .deprecate_cmd = &cli_debug_channel_deprecated), + AST_CLI_DEFINE(handle_core_set_debug_channel, "Enable/disable debugging on a channel"), AST_CLI_DEFINE(handle_verbose, "Set level of debug/verbose chattiness"), @@ -1209,11 +1167,11 @@ static struct ast_cli_entry cli_cli[] = { AST_CLI_DEFINE(handle_modlist, "List modules and info"), - AST_CLI_DEFINE(handle_load, "Load a module by name", .deprecate_cmd = &cli_module_load_deprecated), + AST_CLI_DEFINE(handle_load, "Load a module by name"), - AST_CLI_DEFINE(handle_reload, "Reload configuration", .deprecate_cmd = &cli_module_reload_deprecated), + AST_CLI_DEFINE(handle_reload, "Reload configuration"), - AST_CLI_DEFINE(handle_unload, "Unload a module by name", .deprecate_cmd = &cli_module_unload_deprecated ), + AST_CLI_DEFINE(handle_unload, "Unload a module by name"), AST_CLI_DEFINE(handle_showuptime, "Show uptime information"), @@ -1340,14 +1298,17 @@ static char *is_prefix(const char *word, const char *token, } /*! + * \internal * \brief locate a cli command in the 'helpers' list (which must be locked). - * exact has 3 values: + * The search compares word by word taking care of regexps in e->cmda + * This function will return NULL when nothing is matched, or the ast_cli_entry that matched. + * \param cmds + * \param match_type has 3 possible values: * 0 returns if the search key is equal or longer than the entry. - * note that trailing optional arguments are skipped. + * note that trailing optional arguments are skipped. * -1 true if the mismatch is on the last word XXX not true! * 1 true only on complete, exact match. * - * The search compares word by word taking care of regexps in e->cmda */ static struct ast_cli_entry *find_cli(char *const cmds[], int match_type) { @@ -1389,6 +1350,7 @@ static struct ast_cli_entry *find_cli(char *const cmds[], int match_type) cand = e; } } + return e ? e : cand; } @@ -1413,9 +1375,6 @@ static char *find_best(char *argv[]) static int __ast_cli_unregister(struct ast_cli_entry *e, struct ast_cli_entry *ed) { - if (e->deprecate_cmd) { - __ast_cli_unregister(e->deprecate_cmd, e); - } if (e->inuse) { ast_log(LOG_WARNING, "Can't remove command that is in use\n"); } else { @@ -1462,24 +1421,11 @@ static int __ast_cli_register(struct ast_cli_entry *e, struct ast_cli_entry *ed) AST_RWLIST_WRLOCK(&helpers); if (find_cli(e->cmda, 1)) { - ast_log(LOG_WARNING, "Command '%s' already registered (or something close enough)\n", e->_full_cmd); + ast_log(LOG_WARNING, "Command '%s' already registered (or something close enough)\n", S_OR(e->_full_cmd, e->command)); goto done; } if (set_full_cmd(e)) goto done; - if (!ed) { - e->deprecated = 0; - } else { - e->deprecated = 1; - e->summary = ed->summary; - e->usage = ed->usage; - /* XXX If command A deprecates command B, and command B deprecates command C... - Do we want to show command A or command B when telling the user to use new syntax? - This currently would show command A. - To show command B, you just need to always use ed->_full_cmd. - */ - e->_deprecated_by = S_OR(ed->_deprecated_by, ed->_full_cmd); - } lf = e->cmdlen; AST_RWLIST_TRAVERSE_SAFE_BEGIN(&helpers, cur, list) { @@ -1500,11 +1446,6 @@ static int __ast_cli_register(struct ast_cli_entry *e, struct ast_cli_entry *ed) done: AST_RWLIST_UNLOCK(&helpers); - if (e->deprecate_cmd) { - /* This command deprecates another command. Register that one also. */ - __ast_cli_register(e->deprecate_cmd, e); - } - return ret; } @@ -1564,9 +1505,6 @@ static char *help1(int fd, char *match[], int locked) /* Hide commands that start with '_' */ if (e->_full_cmd[0] == '_') continue; - /* Hide commands that are marked as deprecated. */ - if (e->deprecated) - continue; if (match && strncasecmp(matchstr, e->_full_cmd, len)) continue; ast_cli(fd, "%30.30s %s\n", e->_full_cmd, S_OR(e->summary, "<no description available>")); @@ -1586,37 +1524,39 @@ static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args * char *res = CLI_SUCCESS; if (cmd == CLI_INIT) { - e->command = "help"; + e->command = "core show help"; e->usage = - "Usage: help [topic]\n" + "Usage: core show help [topic]\n" " When called with a topic as an argument, displays usage\n" " information on the given command. If called without a\n" " topic, it provides a list of commands.\n"; return NULL; } else if (cmd == CLI_GENERATE) { - /* skip first 4 or 5 chars, "help " */ + /* skip first 14 or 15 chars, "core show help " */ int l = strlen(a->line); - if (l > 5) - l = 5; + if (l > 15) { + l = 15; + } /* XXX watch out, should stop to the non-generator parts */ return __ast_cli_generator(a->line + l, a->word, a->n, 0); } - if (a->argc == 1) + if (a->argc == e->args) { return help1(a->fd, NULL, 0); + } AST_RWLIST_RDLOCK(&helpers); - my_e = find_cli(a->argv + 1, 1); /* try exact match first */ + my_e = find_cli(a->argv + 3, 1); /* try exact match first */ if (!my_e) { - res = help1(a->fd, a->argv + 1, 1 /* locked */); + res = help1(a->fd, a->argv + 3, 1 /* locked */); AST_RWLIST_UNLOCK(&helpers); return res; } if (my_e->usage) ast_cli(a->fd, "%s", my_e->usage); else { - ast_join(fullcmd, sizeof(fullcmd), a->argv+1); + ast_join(fullcmd, sizeof(fullcmd), a->argv + 3); ast_cli(a->fd, "No help text available for '%s'.\n", fullcmd); } AST_RWLIST_UNLOCK(&helpers); @@ -1877,7 +1817,7 @@ int ast_cli_command(int fd, const char *s) ast_atomic_fetchadd_int(&e->inuse, 1); AST_RWLIST_UNLOCK(&helpers); if (e == NULL) { - ast_cli(fd, "No such command '%s' (type 'help %s' for other possible commands)\n", s, find_best(args + 1)); + ast_cli(fd, "No such command '%s' (type 'core show help %s' for other possible commands)\n", s, find_best(args + 1)); goto done; } /* @@ -1890,19 +1830,9 @@ int ast_cli_command(int fd, const char *s) if (retval == CLI_SHOWUSAGE) { ast_cli(fd, "%s", S_OR(e->usage, "Invalid usage, but no usage information available.\n")); - AST_RWLIST_RDLOCK(&helpers); - if (e->deprecated) - ast_cli(fd, "The '%s' command is deprecated and will be removed in a future release. Please use '%s' instead.\n", e->_full_cmd, e->_deprecated_by); - AST_RWLIST_UNLOCK(&helpers); } else { if (retval == CLI_FAILURE) ast_cli(fd, "Command '%s' failed.\n", s); - AST_RWLIST_RDLOCK(&helpers); - if (e->deprecated == 1) { - ast_cli(fd, "The '%s' command is deprecated and will be removed in a future release. Please use '%s' instead.\n", e->_full_cmd, e->_deprecated_by); - e->deprecated = 2; - } - AST_RWLIST_UNLOCK(&helpers); } ast_atomic_fetchadd_int(&e->inuse, -1); done: diff --git a/main/pbx.c b/main/pbx.c index 737fe6d53..f38b7a0f1 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -6058,15 +6058,6 @@ static char *handle_show_globals(struct ast_cli_entry *e, int cmd, struct ast_cl return CLI_SUCCESS; } -static char *handle_show_globals_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - - char *res = handle_show_globals(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "core show globals"; - return res; -} - /*! \brief CLI support for listing chanvar's variables in a parseable way */ static char *handle_show_chanvar(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { @@ -6122,14 +6113,6 @@ static char *handle_set_global(struct ast_cli_entry *e, int cmd, struct ast_cli_ return CLI_SUCCESS; } -static char *handle_set_global_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_set_global(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "core set global"; - return res; -} - static char *handle_set_chanvar(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { struct ast_channel *chan; @@ -6165,14 +6148,6 @@ static char *handle_set_chanvar(struct ast_cli_entry *e, int cmd, struct ast_cli return CLI_SUCCESS; } -static char *handle_set_chanvar_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - char *res = handle_set_chanvar(e, cmd, a); - if (cmd == CLI_INIT) - e->command = "core set chanvar"; - return res; -} - static char *handle_set_extenpatternmatchnew(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { int oldval = 0; @@ -6230,14 +6205,6 @@ static char *handle_unset_extenpatternmatchnew(struct ast_cli_entry *e, int cmd, } /* - * Deprecated CLI commands - */ - -static struct ast_cli_entry cli_show_globals_deprecated = AST_CLI_DEFINE(handle_show_globals_deprecated, "Show global dialplan variables."); -static struct ast_cli_entry cli_set_chanvar_deprecated = AST_CLI_DEFINE(handle_set_chanvar_deprecated, "Set a channel variable."); -static struct ast_cli_entry cli_set_global_deprecated = AST_CLI_DEFINE(handle_set_global_deprecated, "Set global dialplan variable."); - -/* * CLI entries for upper commands ... */ static struct ast_cli_entry pbx_cli[] = { @@ -6246,12 +6213,12 @@ static struct ast_cli_entry pbx_cli[] = { AST_CLI_DEFINE(handle_show_switches, "Show alternative switches"), AST_CLI_DEFINE(handle_show_hints, "Show dialplan hints"), AST_CLI_DEFINE(handle_show_hint, "Show dialplan hint"), - AST_CLI_DEFINE(handle_show_globals, "Show global dialplan variables", .deprecate_cmd = &cli_show_globals_deprecated), + AST_CLI_DEFINE(handle_show_globals, "Show global dialplan variables"), AST_CLI_DEFINE(handle_show_chanvar, "Show channel variables"), AST_CLI_DEFINE(handle_show_function, "Describe a specific dialplan function"), AST_CLI_DEFINE(handle_show_application, "Describe a specific dialplan application"), - AST_CLI_DEFINE(handle_set_global, "Set global dialplan variable", .deprecate_cmd = &cli_set_global_deprecated), - AST_CLI_DEFINE(handle_set_chanvar, "Set a channel variable", .deprecate_cmd = &cli_set_chanvar_deprecated), + AST_CLI_DEFINE(handle_set_global, "Set global dialplan variable"), + AST_CLI_DEFINE(handle_set_chanvar, "Set a channel variable"), AST_CLI_DEFINE(handle_show_dialplan, "Show dialplan"), AST_CLI_DEFINE(handle_debug_dialplan, "Show fast extension pattern matching data structures"), AST_CLI_DEFINE(handle_unset_extenpatternmatchnew, "Use the Old extension pattern matching algorithm."), diff --git a/main/rtp.c b/main/rtp.c index 33ea83da5..3da025a2b 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -4439,41 +4439,6 @@ static char *rtcp_do_debug_ip(struct ast_cli_args *a) return CLI_SUCCESS; } -static char *handle_cli_rtp_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - switch (cmd) { - case CLI_INIT: - e->command = "rtp debug [off|ip]"; - e->usage = - "Usage: rtp debug [off]|[ip host[:port]]\n" - " Enable/Disable dumping of all RTP packets. If 'ip' is\n" - " specified, limit the dumped packets to those to and from\n" - " the specified 'host' with optional port.\n"; - return NULL; - case CLI_GENERATE: - return NULL; - } - - if (a->argc < 2 || a->argc > 4) - return CLI_SHOWUSAGE; - if (a->argc == 2) { - rtpdebug = 1; - memset(&rtpdebugaddr, 0, sizeof(rtpdebugaddr)); - ast_cli(a->fd, "RTP Debugging Enabled\n"); - } else if (a->argc == 3) { - if (strncasecmp(a->argv[2], "off", 3)) - return CLI_SHOWUSAGE; - rtpdebug = 0; - ast_cli(a->fd, "RTP Debugging Disabled\n"); - } else { - if (strncasecmp(a->argv[2], "ip", 2)) - return CLI_SHOWUSAGE; - return rtp_do_debug_ip(a); - } - - return CLI_SUCCESS; -} - static char *handle_cli_rtp_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -4507,41 +4472,6 @@ static char *handle_cli_rtp_set_debug(struct ast_cli_entry *e, int cmd, struct a return CLI_SHOWUSAGE; /* default, failure */ } -static char *handle_cli_rtcp_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - switch (cmd) { - case CLI_INIT: - e->command = "rtcp debug [off|ip]"; - e->usage = - "Usage: rtcp debug [off]|[ip host[:port]]\n" - " Enable/Disable dumping of all RTCP packets. If 'ip' is\n" - " specified, limit the dumped packets to those to and from\n" - " the specified 'host' with optional port.\n"; - return NULL; - case CLI_GENERATE: - return NULL; - } - - if (a->argc < 2 || a->argc > 4) - return CLI_SHOWUSAGE; - if (a->argc == 2) { - rtcpdebug = 1; - memset(&rtcpdebugaddr, 0, sizeof(rtcpdebugaddr)); - ast_cli(a->fd, "RTCP Debugging Enabled\n"); - } else if (a->argc == 3) { - if (strncasecmp(a->argv[2], "off", 3)) - return CLI_SHOWUSAGE; - rtcpdebug = 0; - ast_cli(a->fd, "RTCP Debugging Disabled\n"); - } else { - if (strncasecmp(a->argv[2], "ip", 2)) - return CLI_SHOWUSAGE; - return rtcp_do_debug_ip(a); - } - - return CLI_SUCCESS; -} - static char *handle_cli_rtcp_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -4575,29 +4505,6 @@ static char *handle_cli_rtcp_set_debug(struct ast_cli_entry *e, int cmd, struct return CLI_SHOWUSAGE; /* default, failure */ } -static char *handle_cli_rtcp_stats_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - switch (cmd) { - case CLI_INIT: - e->command = "rtcp stats [off]"; - e->usage = - "Usage: rtcp stats [off]\n" - " Enable/Disable dumping of RTCP stats.\n"; - return NULL; - case CLI_GENERATE: - return NULL; - } - - if (a->argc < 2 || a->argc > 3) - return CLI_SHOWUSAGE; - if (a->argc == 3 && strncasecmp(a->argv[2], "off", 3)) - return CLI_SHOWUSAGE; - - rtcpstats = (a->argc == 3) ? 0 : 1; - ast_cli(a->fd, "RTCP Stats %s\n", rtcpstats ? "Enabled" : "Disabled"); - return CLI_SUCCESS; -} - static char *handle_cli_rtcp_set_stats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -4625,30 +4532,6 @@ static char *handle_cli_rtcp_set_stats(struct ast_cli_entry *e, int cmd, struct return CLI_SUCCESS; } -static char *handle_cli_stun_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - switch (cmd) { - case CLI_INIT: - e->command = "stun debug [off]"; - e->usage = - "Usage: stun debug [off]\n" - " Enable/Disable STUN (Simple Traversal of UDP through NATs)\n" - " debugging\n"; - return NULL; - case CLI_GENERATE: - return NULL; - } - - if (a->argc < 2 || a->argc > 3) - return CLI_SHOWUSAGE; - if (a->argc == 3 && strncasecmp(a->argv[2], "off", 3)) - return CLI_SHOWUSAGE; - - stundebug = (a->argc == 3) ? 0 : 1; - ast_cli(a->fd, "STUN Debugging %s\n", stundebug ? "Enabled" : "Disabled"); - return CLI_SUCCESS; -} - static char *handle_cli_stun_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -4677,16 +4560,11 @@ static char *handle_cli_stun_set_debug(struct ast_cli_entry *e, int cmd, struct return CLI_SUCCESS; } -static struct ast_cli_entry cli_rtp_debug_deprecated = AST_CLI_DEFINE(handle_cli_rtp_debug_deprecated, "Enable/Disable RTP debugging"); -static struct ast_cli_entry cli_rtcp_debug_deprecated = AST_CLI_DEFINE(handle_cli_rtcp_debug_deprecated, "Enable/Disable RTCP debugging"); -static struct ast_cli_entry cli_rtcp_stats_deprecated = AST_CLI_DEFINE(handle_cli_rtcp_stats_deprecated, "Enable/Disable RTCP stats"); -static struct ast_cli_entry cli_stun_debug_deprecated = AST_CLI_DEFINE(handle_cli_stun_debug_deprecated, "Enable/Disable STUN debugging"); - static struct ast_cli_entry cli_rtp[] = { - AST_CLI_DEFINE(handle_cli_rtp_set_debug, "Enable/Disable RTP debugging", .deprecate_cmd = &cli_rtp_debug_deprecated), - AST_CLI_DEFINE(handle_cli_rtcp_set_debug, "Enable/Disable RTCP debugging", .deprecate_cmd = &cli_rtcp_debug_deprecated), - AST_CLI_DEFINE(handle_cli_rtcp_set_stats, "Enable/Disable RTCP stats", .deprecate_cmd = &cli_rtcp_stats_deprecated), - AST_CLI_DEFINE(handle_cli_stun_set_debug, "Enable/Disable STUN debugging", .deprecate_cmd = &cli_stun_debug_deprecated), + AST_CLI_DEFINE(handle_cli_rtp_set_debug, "Enable/Disable RTP debugging"), + AST_CLI_DEFINE(handle_cli_rtcp_set_debug, "Enable/Disable RTCP debugging"), + AST_CLI_DEFINE(handle_cli_rtcp_set_stats, "Enable/Disable RTCP stats"), + AST_CLI_DEFINE(handle_cli_stun_set_debug, "Enable/Disable STUN debugging"), }; static int __ast_rtp_reload(int reload) diff --git a/main/udptl.c b/main/udptl.c index ad1c96d63..620734b60 100644 --- a/main/udptl.c +++ b/main/udptl.c @@ -1089,66 +1089,6 @@ int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, return -1; } -static char *handle_cli_udptl_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - struct hostent *hp; - struct ast_hostent ahp; - int port; - char *p; - char *arg; - - switch (cmd) { - case CLI_INIT: - e->command = "udptl debug [off|ip]"; - e->usage = - "Usage: udptl debug [off]|[ip host[:port]]\n" - " Enable or disable dumping of UDPTL packets.\n" - " If ip is specified, limit the dumped packets to those to and from\n" - " the specified 'host' with optional port.\n"; - return NULL; - case CLI_GENERATE: - return NULL; - } - - if (a->argc < 2 || a->argc > 4) - return CLI_SHOWUSAGE; - - if (a->argc == 2) { - udptldebug = 1; - memset(&udptldebugaddr, 0, sizeof(udptldebugaddr)); - ast_cli(a->fd, "UDPTL Debugging Enabled\n"); - } else if (a->argc == 3) { - if (strncasecmp(a->argv[2], "off", 3)) - return CLI_SHOWUSAGE; - udptldebug = 0; - ast_cli(a->fd, "UDPTL Debugging Disabled\n"); - } else { - if (strncasecmp(a->argv[2], "ip", 2)) - return CLI_SHOWUSAGE; - port = 0; - arg = a->argv[3]; - p = strstr(arg, ":"); - if (p) { - *p = '\0'; - p++; - port = atoi(p); - } - hp = ast_gethostbyname(arg, &ahp); - if (hp == NULL) - return CLI_SHOWUSAGE; - udptldebugaddr.sin_family = AF_INET; - memcpy(&udptldebugaddr.sin_addr, hp->h_addr, sizeof(udptldebugaddr.sin_addr)); - udptldebugaddr.sin_port = htons(port); - if (port == 0) - ast_cli(a->fd, "UDPTL Debugging Enabled for IP: %s\n", ast_inet_ntoa(udptldebugaddr.sin_addr)); - else - ast_cli(a->fd, "UDPTL Debugging Enabled for IP: %s:%d\n", ast_inet_ntoa(udptldebugaddr.sin_addr), port); - udptldebug = 1; - } - - return CLI_SUCCESS; -} - static char *handle_cli_udptl_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { struct hostent *hp; @@ -1211,10 +1151,9 @@ static char *handle_cli_udptl_set_debug(struct ast_cli_entry *e, int cmd, struct return CLI_SUCCESS; } -static struct ast_cli_entry cli_handle_udptl_debug_deprecated = AST_CLI_DEFINE(handle_cli_udptl_debug_deprecated, "Enable/Disable UDPTL debugging"); static struct ast_cli_entry cli_udptl[] = { - AST_CLI_DEFINE(handle_cli_udptl_set_debug, "Enable/Disable UDPTL debugging", .deprecate_cmd = &cli_handle_udptl_debug_deprecated) + AST_CLI_DEFINE(handle_cli_udptl_set_debug, "Enable/Disable UDPTL debugging") }; static void __ast_udptl_reload(int reload) |