[asterisk-commits] mvanbaak: trunk r156120 - in /trunk: ./ channels/ configs/ funcs/ include/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 12 00:46:05 CST 2008


Author: mvanbaak
Date: Wed Nov 12 00:46:04 2008
New Revision: 156120

URL: http://svn.digium.com/view/asterisk?view=rev&rev=156120
Log:
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

Added:
    trunk/configs/cli_aliases.conf.sample   (with props)
    trunk/res/res_clialiases.c   (with props)
Modified:
    trunk/CHANGES
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/funcs/func_devstate.c
    trunk/include/asterisk/cli.h
    trunk/main/asterisk.c
    trunk/main/cdr.c
    trunk/main/cli.c
    trunk/main/pbx.c
    trunk/main/rtp.c
    trunk/main/udptl.c
    trunk/pbx/pbx_ael.c
    trunk/pbx/pbx_dundi.c
    trunk/res/res_agi.c
    trunk/res/res_jabber.c

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Nov 12 00:46:04 2008
@@ -58,6 +58,8 @@
      same  =>     n,SomethingElse()
  * musiconhold.conf classes of type 'files' can now use relative directory paths,
    which are interpreted as relative to the astvarlibdir setting in asterisk.conf.
+ * All deprecated CLI commands are removed from the sourcecode. They are now handled
+   by the new clialiases module. See cli_aliases.conf.sample file.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.0 to Asterisk 1.6.1  -------------

Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Wed Nov 12 00:46:04 2008
@@ -1139,31 +1139,6 @@
 	return CLI_SUCCESS;
 }
 
-static char *handle_mgcp_set_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "mgcp set debug [off]";
-		e->usage =
-			"Usage: mgcp set debug [off]\n"
-			"       Enables/Disables dumping of MGCP packets for debugging purposes\n";	
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc < 3 || a->argc > 4)
-		return CLI_SHOWUSAGE;
-	if (a->argc == 3) {
-		mgcpdebug = 1;
-		ast_cli(a->fd, "MGCP Debugging Enabled\n");
-	} else if (!strncasecmp(a->argv[3], "off", 3)) {
-		mgcpdebug = 0;
-		ast_cli(a->fd, "MGCP Debugging Disabled\n");
-	}
-	return CLI_SUCCESS;
-}
-
 static char *handle_mgcp_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
@@ -1192,11 +1167,10 @@
 	return CLI_SUCCESS;
 }
 
-static struct ast_cli_entry cli_mgcp_set_debug_deprecated = AST_CLI_DEFINE(handle_mgcp_set_debug_deprecated, "Enable/Disable MGCP debugging");
 static struct ast_cli_entry cli_mgcp[] = {
 	AST_CLI_DEFINE(handle_mgcp_audit_endpoint, "Audit specified MGCP endpoint"),
 	AST_CLI_DEFINE(handle_mgcp_show_endpoints, "List defined MGCP endpoints"),
-	AST_CLI_DEFINE(handle_mgcp_set_debug, "Enable/Disable MGCP debugging", .deprecate_cmd = &cli_mgcp_set_debug_deprecated),
+	AST_CLI_DEFINE(handle_mgcp_set_debug, "Enable/Disable MGCP debugging"),
 	AST_CLI_DEFINE(mgcp_reload, "Reload MGCP configuration"),
 };
 

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Nov 12 00:46:04 2008
@@ -2341,7 +2341,6 @@
 static char *sip_do_debug_peer(int fd, char *arg);
 static char *sip_do_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static char *sip_cli_notify(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-static char *sip_do_history_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static char *sip_set_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static int sip_dtmfmode(struct ast_channel *chan, void *data);
 static int sip_addheader(struct ast_channel *chan, void *data);
@@ -15365,36 +15364,6 @@
 		transmit_notify_custom(p, varlist);
 	}
 
-	return CLI_SUCCESS;
-}
-
-/*! \brief Enable/Disable SIP History logging (CLI) - deprecated. use sip_set_history instead */
-static char *sip_do_history_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "sip history [off]";
-		e->usage =
-			"Usage: sip history [off]\n"
-			"       Enables/Disables recording of SIP dialog history for debugging purposes.\n"
-			"       Use 'sip show history' to view the history of a call number.\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc < 2 || a->argc > 3) {
-		return CLI_SHOWUSAGE;
-	}
-	if (a->argc == 2) {
-		recordhistory = TRUE;
-		ast_cli(a->fd, "SIP History Recording Enabled (use 'sip show history')\n");
-	} else {
-		if (strncasecmp(a->argv[2], "off", 3))
-			return CLI_SHOWUSAGE;
-		recordhistory = FALSE;
-		ast_cli(a->fd, "SIP History Recording Disabled\n");
-	}
 	return CLI_SUCCESS;
 }
 
@@ -23728,7 +23697,6 @@
 	return 1;
 }
 
-static struct ast_cli_entry cli_sip_do_history_deprecated = AST_CLI_DEFINE(sip_do_history_deprecated, "Enable/Disable SIP history");
 /*! \brief SIP Cli commands definition */
 static struct ast_cli_entry cli_sip[] = {
 	AST_CLI_DEFINE(sip_show_channels, "List active SIP channels or subscriptions"),
@@ -23749,7 +23717,7 @@
 	AST_CLI_DEFINE(sip_show_sched, "Present a report on the status of the sched queue"),
 	AST_CLI_DEFINE(sip_prune_realtime, "Prune cached Realtime users/peers"),
 	AST_CLI_DEFINE(sip_do_debug, "Enable/Disable SIP debugging"),
-	AST_CLI_DEFINE(sip_set_history, "Enable/Disable SIP history", .deprecate_cmd = &cli_sip_do_history_deprecated),
+	AST_CLI_DEFINE(sip_set_history, "Enable/Disable SIP history"),
 	AST_CLI_DEFINE(sip_reload, "Reload SIP configuration"),
 	AST_CLI_DEFINE(sip_show_tcp, "List TCP Connections")
 };

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Wed Nov 12 00:46:04 2008
@@ -2540,35 +2540,6 @@
 	.set_rtp_peer = skinny_set_rtp_peer,
 };
 
-static char *handle_skinny_set_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "skinny set debug [off]";
-		e->usage =
-			"Usage: skinny set debug [off]\n"
-			"       Enables/Disables dumping of Skinny packets for debugging purposes\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-	
-	if (a->argc < 3 || a->argc > 4)
-		return CLI_SHOWUSAGE;
-
-	if (a->argc == 3) {
-		skinnydebug = 1;
-		ast_cli(a->fd, "Skinny Debugging Enabled\n");
-		return CLI_SUCCESS;
-	} else if (!strncasecmp(a->argv[3], "off", 3)) {
-		skinnydebug = 0;
-		ast_cli(a->fd, "Skinny Debugging Disabled\n");
-		return CLI_SUCCESS;
-	} else {
-		return CLI_SHOWUSAGE;
-	}
-}
-
 static char *handle_skinny_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
@@ -3067,14 +3038,13 @@
 	return CLI_SUCCESS;
 }
 
-static struct ast_cli_entry cli_skinny_set_debug_deprecated = AST_CLI_DEFINE(handle_skinny_set_debug_deprecated, "Enable/Disable Skinny debugging");
 static struct ast_cli_entry cli_skinny[] = {
 	AST_CLI_DEFINE(handle_skinny_show_devices, "List defined Skinny devices"),
 	AST_CLI_DEFINE(handle_skinny_show_device, "List Skinny device information"),
 	AST_CLI_DEFINE(handle_skinny_show_lines, "List defined Skinny lines per device"),
 	AST_CLI_DEFINE(handle_skinny_show_line, "List Skinny line information"),
 	AST_CLI_DEFINE(handle_skinny_show_settings, "List global Skinny settings"),
-	AST_CLI_DEFINE(handle_skinny_set_debug, "Enable/Disable Skinny debugging", .deprecate_cmd = &cli_skinny_set_debug_deprecated),
+	AST_CLI_DEFINE(handle_skinny_set_debug, "Enable/Disable Skinny debugging"),
 	AST_CLI_DEFINE(handle_skinny_reset, "Reset Skinny device(s)"),
 };
 

Added: trunk/configs/cli_aliases.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/cli_aliases.conf.sample?view=auto&rev=156120
==============================================================================
--- trunk/configs/cli_aliases.conf.sample (added)
+++ trunk/configs/cli_aliases.conf.sample Wed Nov 12 00:46:04 2008
@@ -1,0 +1,185 @@
+;
+; CLI Aliases configuration
+;
+; This module also registers a "cli show aliases" CLI command to list
+; configured CLI aliases.
+
+[general]
+; Here you define what alias templates you want to use. You can also define
+; multiple templates to use as well. If you do, and there is a conflict, then
+; the first alias defined will win.
+;
+template = friendly		; By default, include friendly aliases
+;template = asterisk12		; Asterisk 1.2 style syntax
+;template = asterisk14		; Asterisk 1.4 style syntax
+;template = individual_custom	; see [individual_custom] example below which
+				; includes a list of aliases from an external 
+				; file
+
+
+; Because the Asterisk CLI syntax follows a "module verb argument" syntax,
+; sometimes we run into an issue between being consistant with this format
+; in the core system, and maintaining system friendliness. In order to get
+; around this we're providing some useful aliases by default.
+;
+[friendly]
+hangup request=channel request hangup
+originate=channel originate
+help=core show help
+pri intense debug span=pri set debug 2 span
+
+; CLI Alias Templates
+; -------------------
+;
+; You can define several alias templates.
+; It works with context templates like all other configuration files
+;
+;[asterisk](!)
+; To create an alias you simply set the variable name as the alias and variable
+; value as the real CLI command you want executed
+;
+;die die die=stop now
+
+;[asterisk16](asterisk)
+; Alias for making voicemail reload actually do module reload app_voicemail.so
+;voicemail reload=module reload app_voicemail.so
+; This will make the CLI command "mr" behave as though it is "module reload".
+;mr=module reload
+;
+;
+; In addition, you could also include a flat file of aliases which is loaded by
+; the [individual_custom] template in the [general] section.
+;
+;[individual_custom]
+;#include "/etc/asterisk/aliases"
+
+; Implemented CLI Alias Templates
+; -------------------------------
+;
+; Below here we have provided you with some templates, easily allowing you to
+; utilize previous Asterisk CLI commands with any version of Asterisk. In this
+; way you will be able to use Asterisk 1.2 and 1.4 style CLI syntax with any
+; version Asterisk going forward into the future.
+;
+; We have also separated out the vanilla syntax into a context template which
+; allows you to keep your custom changes separate of the standard templates
+; we have provided you. In this way you can clearly see your custom changes,
+; and also allowing you to combine various templates as you see fit.
+;
+; The naming scheme we have used is recommended, but certainly is not enforced
+; by Asterisk. If you wish to use the provided templates, simply define the
+; context name which does not utilize the '_tpl' at the end. For example,
+; if you would like to use the Asterisk 1.2 style syntax, define in the
+; [general] section 
+
+[asterisk12_tpl](!)
+show channeltypes=core show channeltypes
+show channeltype=core show channeltype
+show manager command=manager show command
+show manager commands=manager show commands
+show manager connected=manager show connected
+show manager eventq=manager show eventq
+rtp no debug=rtp set debug off
+rtp rtcp debug ip=rtcp debug ip
+rtp rtcp debug=rtcp debug
+rtp rtcp no debug=rtcp debug off
+rtp rtcp stats=rtcp stats
+rtp rtcp no stats=rtcp stats off
+stun no debug=stun debug off
+udptl no debug=udptl debug off
+show image formats=core show image formats
+show file formats=core show file formats
+show applications=core show applications
+show functions=core show functions
+show switches=core show switches
+show hints=core show hints 
+show globals=core show globals
+show function=core show function
+show application=core show application
+set global=core set global
+show dialplan=dialplan show
+show codecs=core show codecs
+show audio codecs=core show audio codecs
+show video codecs=core show video codecs
+show image codecs=core show image codecs
+show codec=core show codec 
+moh classes show=moh show classes
+moh files show=moh show files
+agi no debug=agi debug off
+show agi=agi show
+dump agihtml=agi dumphtml
+show features=feature show
+show indications=indication show
+answer=console answer
+hangup=console hangup
+flash=console flash
+dial=console dial
+mute=console mute
+unmute=console unmute
+transfer=console transfer
+send text=console send text
+autoanswer=console autoanswer
+oss boost=console boost
+console=console active
+save dialplan=dialplan save
+add extension=dialplan add extension
+remove extension=dialplan remove extension
+add ignorepat=dialplan add ignorepat
+remove ignorepat=dialplan remove ignorepat
+include context=dialplan add include
+dont include=dialplan remove include
+extensions reload=dialplan reload
+show translation=core show translation
+convert=file convert
+show queue=queue show
+add queue member=queue add member
+remove queue member=queue remove member
+ael no debug=ael nodebug
+sip debug=sip set debug
+sip no debug=sip set debug off
+show voicemail users=voicemail show users
+show voicemail zones=voicemail show zones
+iax2 trunk debug=iax2 set debug trunk
+iax2 jb debug=iax2 set debug jb
+iax2 no debug=iax2 set debug off
+iax2 no trunk debug=iax2 set debug trunk off
+iax2 no jb debug=iax2 set debug jb off
+show agents=agent show
+show agents online=agent show online
+show memory allocations=memory show allocations
+show memory summary=memory show summary
+show version=core show version
+show version files=core show file version
+show profile=core show profile
+clear profile=core clear profile
+
+[asterisk12](asterisk12_tpl)
+; add any additional custom commands you want below here, for example:
+;die quickly=stop now
+
+[asterisk14_tpl](!)
+cdr status=cdr show status
+rtp debug=rtp set debug on
+rtcp debug=rtcp set debug on
+rtcp stats=rtcp set stats on
+stun debug=stun set debug on
+udptl debug=udptl set debug on
+core show globals=dialplan show globals
+core set global=dialplan set global
+core set chanvar=dialplan set chanvar
+agi dumphtml=agi dump html
+ael debug=ael set debug
+funcdevstate list=devstate list
+sip history=sip set history on
+skinny debug=skinny set debug on
+mgcp set debug=mgcp set debug on
+abort shutdown=core abort shutdown
+stop now=core stop now
+stop gracefully=core stop gracefully
+stop when convenient=core stop when convenient
+restart now=core restart now
+restart gracefully=core restart gracefully
+restart when convenient=core restart when convenient
+
+[asterisk14](asterisk14_tpl)
+; add any additional custom commands you want below here.

Propchange: trunk/configs/cli_aliases.conf.sample
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/configs/cli_aliases.conf.sample
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: trunk/configs/cli_aliases.conf.sample
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: trunk/funcs/func_devstate.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_devstate.c?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/funcs/func_devstate.c (original)
+++ trunk/funcs/func_devstate.c Wed Nov 12 00:46:04 2008
@@ -188,50 +188,6 @@
 	return ast_devstate_val(buf);
 }
 
-static char *handle_cli_funcdevstate_list(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	struct ast_db_entry *db_entry, *db_tree;
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "funcdevstate list";
-		e->usage =
-			"Usage: funcdevstate list\n"
-			"       List all custom device states that have been set by using\n"
-			"       the DEVICE_STATE dialplan function.\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc != e->args)
-		return CLI_SHOWUSAGE;
-
-	ast_cli(a->fd, "\n"
-	        "---------------------------------------------------------------------\n"
-	        "--- Custom Device States --------------------------------------------\n"
-	        "---------------------------------------------------------------------\n"
-	        "---\n");
-
-	db_entry = db_tree = ast_db_gettree(astdb_family, NULL);
-	for (; db_entry; db_entry = db_entry->next) {
-		const char *dev_name = strrchr(db_entry->key, '/') + 1;
-		if (dev_name <= (const char *) 1)
-			continue;
-		ast_cli(a->fd, "--- Name: 'Custom:%s'  State: '%s'\n"
-		               "---\n", dev_name, db_entry->data);
-	}
-	ast_db_freetree(db_tree);
-	db_tree = NULL;
-
-	ast_cli(a->fd,
-	        "---------------------------------------------------------------------\n"
-	        "---------------------------------------------------------------------\n"
-	        "\n");
-
-	return CLI_SUCCESS;
-}
-
 static char *handle_cli_devstate_list(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_db_entry *db_entry, *db_tree;
@@ -339,9 +295,8 @@
 	return CLI_SUCCESS;
 }
 
-static struct ast_cli_entry cli_funcdevstate_list_deprecated = AST_CLI_DEFINE(handle_cli_funcdevstate_list, "List currently known custom device states");
 static struct ast_cli_entry cli_funcdevstate[] = {
-	AST_CLI_DEFINE(handle_cli_devstate_list, "List currently known custom device states", .deprecate_cmd = &cli_funcdevstate_list_deprecated),
+	AST_CLI_DEFINE(handle_cli_devstate_list, "List currently known custom device states"),
 	AST_CLI_DEFINE(handle_cli_devstate_change, "Change a custom device state"),
 };
 

Modified: trunk/include/asterisk/cli.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/cli.h?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/include/asterisk/cli.h (original)
+++ trunk/include/asterisk/cli.h Wed Nov 12 00:46:04 2008
@@ -154,21 +154,15 @@
 	const char *summary; 			/*!< Summary of the command (< 60 characters) */
 	const char *usage; 			/*!< Detailed usage information */
 
-	struct ast_cli_entry *deprecate_cmd;
-
 	int inuse; 				/*!< For keeping track of usage */
 	struct module *module;			/*!< module this belongs to */
 	char *_full_cmd;			/*!< built at load time from cmda[] */
 	int cmdlen;				/*!< len up to the first invalid char [<{% */
 	/*! \brief This gets set in ast_cli_register()
-	  It then gets set to something different when the deprecated command
-	  is run for the first time (ie; after we warn the user that it's deprecated)
 	 */
 	int args;				/*!< number of non-null entries in cmda */
 	char *command;				/*!< command, non-null for new-style entries */
-	int deprecated;
 	cli_fn handler;
-	char *_deprecated_by;			/*!< copied from the "parent" _full_cmd, on deprecated commands */
 	/*! For linking */
 	AST_LIST_ENTRY(ast_cli_entry) list;
 };

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Wed Nov 12 00:46:04 2008
@@ -1590,14 +1590,6 @@
 	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 @@
 	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) {
@@ -1644,14 +1628,6 @@
 	ast_cli(a->fd, "Waiting for inactivity to perform halt\n");
 	quit_handler(0, 2 /* really nicely */, 1 /* safely */, 0 /* don't restart */);
 	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)
@@ -1674,14 +1650,6 @@
 	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 @@
 	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) {
@@ -1728,14 +1688,6 @@
 	ast_cli(a->fd, "Waiting for inactivity to perform restart\n");
 	quit_handler(0, 2 /* really nicely */, 1 /* safely */, 1 /* restart */);
 	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)
@@ -1757,14 +1709,6 @@
 	ast_cancel_shutdown();
 	shuttingdown = 0;
 	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)
@@ -1866,24 +1810,14 @@
 
 #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"),

Modified: trunk/main/cdr.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cdr.c?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Wed Nov 12 00:46:04 2008
@@ -1334,14 +1334,6 @@
 	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 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)
 {

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Wed Nov 12 00:46:04 2008
@@ -166,14 +166,6 @@
 	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;
@@ -207,14 +199,6 @@
 		}
 	}
 	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;
 }
 
 /*! 
@@ -426,14 +410,6 @@
 		}
 	}
 	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"
@@ -946,18 +922,6 @@
 	}
 	ast_cli(a->fd, "Debugging on new channels is %s\n", is_off ? "disabled" : "enabled");
 	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)
@@ -1175,11 +1139,6 @@
 #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 @@
 
 	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 @@
 
 	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_reload, "Reload configuration", .deprecate_cmd = &cli_module_reload_deprecated),
-
-	AST_CLI_DEFINE(handle_unload, "Unload a module by name", .deprecate_cmd = &cli_module_unload_deprecated ),
+	AST_CLI_DEFINE(handle_load, "Load a module by name"),
+
+	AST_CLI_DEFINE(handle_reload, "Reload configuration"),
+
+	AST_CLI_DEFINE(handle_unload, "Unload a module by name"),
 
 	AST_CLI_DEFINE(handle_showuptime, "Show uptime information"),
 
@@ -1340,14 +1298,17 @@
 }
 
 /*!
+ * \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 @@
 			cand = e;
 		}
 	}
+
 	return e ? e : cand;
 }
 
@@ -1413,9 +1375,6 @@
 
 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 @@
 	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 @@
 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 @@
 		/* 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 @@
 	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 @@
 		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 @@
 
 	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:

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=156120&r1=156119&r2=156120
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Wed Nov 12 00:46:04 2008
@@ -6058,15 +6058,6 @@
 	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 @@
 	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;
@@ -6163,14 +6146,6 @@
 	ast_cli(a->fd, "\n    -- Channel variable '%s' set to '%s' for '%s'\n",  var_name, var_value, chan_name);
 
 	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)
@@ -6230,14 +6205,6 @@
 }
 
 /*
- * 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 @@
 	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."),

Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?view=diff&rev=156120&r1=156119&r2=156120

[... 868 lines stripped ...]



More information about the asterisk-commits mailing list