From 691363656fbdc83edf04b125317aebae6525c9e7 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Fri, 10 Nov 2006 17:01:06 +0000 Subject: Merged revisions 47436 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r47436 | tilghman | 2006-11-10 10:51:55 -0600 (Fri, 10 Nov 2006) | 2 lines Discussion of these CLI changes resulted in more consistency (Bug 8236) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47439 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_h323.c | 37 ++++++++++++++++++++++++++----------- channels/chan_iax2.c | 36 ++++++++++++++++++------------------ channels/chan_mgcp.c | 12 ++++++------ channels/chan_sip.c | 40 +++++++++++++++++----------------------- channels/chan_skinny.c | 10 +++++----- 5 files changed, 72 insertions(+), 63 deletions(-) (limited to 'channels') diff --git a/channels/chan_h323.c b/channels/chan_h323.c index b07400541..06c9b9d3a 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -2611,17 +2611,17 @@ static int restart_monitor(void) static int h323_do_trace(int fd, int argc, char *argv[]) { - if (argc != 3) { + if (argc != 4) { return RESULT_SHOWUSAGE; } - h323_debug(1, atoi(argv[2])); + h323_debug(1, atoi(argv[3])); ast_cli(fd, "H.323 trace set to level %s\n", argv[2]); return RESULT_SUCCESS; } static int h323_no_trace(int fd, int argc, char *argv[]) { - if (argc != 3) { + if (argc < 3 || argc > 4) { return RESULT_SHOWUSAGE; } h323_debug(0,0); @@ -2631,7 +2631,7 @@ static int h323_no_trace(int fd, int argc, char *argv[]) static int h323_do_debug(int fd, int argc, char *argv[]) { - if (argc != 2) { + if (argc < 2 || argc > 3) { return RESULT_SHOWUSAGE; } h323debug = 1; @@ -2641,7 +2641,7 @@ static int h323_do_debug(int fd, int argc, char *argv[]) static int h323_no_debug(int fd, int argc, char *argv[]) { - if (argc != 3) { + if (argc < 3 || argc > 4) { return RESULT_SHOWUSAGE; } h323debug = 0; @@ -2725,7 +2725,7 @@ static struct ast_cli_entry cli_h323_trace_deprecated = trace_usage }; static struct ast_cli_entry cli_h323_no_trace_deprecated = - { { "h.323", "no", "trace", NULL }, + { "h.323", "no", "trace", NULL }, h323_no_trace, "Disable H.323 Stack Tracing", no_trace_usage }; }; @@ -2736,7 +2736,7 @@ static struct ast_cli_entry cli_h323_debug_deprecated = debug_usage }; static struct ast_cli_entry cli_h323_no_debug_deprecated = - { { "h.323", "no", "debug", NULL }, + { "h.323", "no", "debug", NULL }, h323_no_debug, "Disable H.323 debug", no_debug_usage }; }; @@ -2756,20 +2756,35 @@ static struct ast_cli_entry cli_h323_show_tokens_deprecated = h323_tokens_show, "Show all active call tokens", show_tokens_usage }; +static struct ast_cli_entry cli_h323_debug_deprecated = { + { "h.323", "debug", NULL }, + h323_do_debug, "Enable H.323 debug", + debug_usage }; + +static struct ast_cli_entry cli_h323_trace_deprecated = { + { "h.323", "trace", NULL }, + h323_do_trace, "Enable H.323 Stack Tracing", + trace_usage }; + +static struct ast_cli_entry cli_h323_gk_cycle_deprecated = { + { "h323", "cycle", "gk", NULL }, + h323_gk_cycle, "Manually re-register with the Gatekeper", + show_cycle_usage }; + static struct ast_cli_entry cli_h323[] = { - { { "h323", "trace", NULL }, + { { "h323", "set", "trace", NULL }, h323_do_trace, "Enable H.323 Stack Tracing", trace_usage, NULL, &cli_h323_trace_deprecated }, - { { "h323", "trace", "off", NULL }, + { { "h323", "set", "trace", "off", NULL }, h323_no_trace, "Disable H.323 Stack Tracing", no_trace_usage, NULL, &cli_h323_no_trace_deprecated }, - { { "h323", "debug", NULL }, + { { "h323", "set", "debug", NULL }, h323_do_debug, "Enable H.323 debug", debug_usage, NULL, &cli_h323_debug_deprecated }, - { { "h323", "debug", "off", NULL }, + { { "h323", "set", "debug", "off", NULL }, h323_no_debug, "Disable H.323 debug", no_debug_usage, NULL, &cli_h323_no_debug_deprecated }, diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index d3ce281f9..c8f185e72 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -4449,7 +4449,7 @@ static int iax2_show_netstats(int fd, int argc, char *argv[]) static int iax2_do_debug(int fd, int argc, char *argv[]) { - if (argc != 2) + if (argc < 2 || argc > 3) return RESULT_SHOWUSAGE; iaxdebug = 1; ast_cli(fd, "IAX2 Debugging Enabled\n"); @@ -4458,7 +4458,7 @@ static int iax2_do_debug(int fd, int argc, char *argv[]) static int iax2_do_trunk_debug(int fd, int argc, char *argv[]) { - if (argc != 3) + if (argc < 3 || argc > 4) return RESULT_SHOWUSAGE; iaxtrunkdebug = 1; ast_cli(fd, "IAX2 Trunk Debug Requested\n"); @@ -4467,7 +4467,7 @@ static int iax2_do_trunk_debug(int fd, int argc, char *argv[]) static int iax2_do_jb_debug(int fd, int argc, char *argv[]) { - if (argc != 3) + if (argc < 3 || argc > 4) return RESULT_SHOWUSAGE; jb_setoutput(jb_error_output, jb_warning_output, jb_debug_output); ast_cli(fd, "IAX2 Jitterbuffer Debugging Enabled\n"); @@ -4476,7 +4476,7 @@ static int iax2_do_jb_debug(int fd, int argc, char *argv[]) static int iax2_no_debug(int fd, int argc, char *argv[]) { - if (argc != 3) + if (argc < 3 || argc > 4) return RESULT_SHOWUSAGE; iaxdebug = 0; ast_cli(fd, "IAX2 Debugging Disabled\n"); @@ -4485,7 +4485,7 @@ static int iax2_no_debug(int fd, int argc, char *argv[]) static int iax2_no_trunk_debug(int fd, int argc, char *argv[]) { - if (argc != 4) + if (argc < 4 || argc > 5) return RESULT_SHOWUSAGE; iaxtrunkdebug = 0; ast_cli(fd, "IAX2 Trunk Debugging Disabled\n"); @@ -4494,7 +4494,7 @@ static int iax2_no_trunk_debug(int fd, int argc, char *argv[]) static int iax2_no_jb_debug(int fd, int argc, char *argv[]) { - if (argc != 4) + if (argc < 4 || argc > 5) return RESULT_SHOWUSAGE; iaxtrunkdebug = 0; ast_cli(fd, "IAX2 Trunk Debugging Disabled\n"); @@ -9699,27 +9699,27 @@ static char show_reg_usage[] = " Lists all registration requests and status.\n"; static char debug_usage[] = -"Usage: iax2 debug\n" +"Usage: iax2 set debug\n" " Enables dumping of IAX packets for debugging purposes\n"; static char no_debug_usage[] = -"Usage: iax2 nodebug\n" +"Usage: iax2 set debug off\n" " Disables dumping of IAX packets for debugging purposes\n"; static char debug_trunk_usage[] = -"Usage: iax2 debug trunk\n" +"Usage: iax2 set debug trunk\n" " Requests current status of IAX trunking\n"; static char no_debug_trunk_usage[] = -"Usage: iax2 nodebug trunk\n" +"Usage: iax2 set debug trunk off\n" " Requests current status of IAX trunking\n"; static char debug_jb_usage[] = -"Usage: iax2 debug jb\n" +"Usage: iax2 set debug jb\n" " Enables jitterbuffer debugging information\n"; static char no_debug_jb_usage[] = -"Usage: iax2 nodebug jb\n" +"Usage: iax2 set debug jb off\n" " Disables jitterbuffer debugging information\n"; static char iax2_test_losspct_usage[] = @@ -9793,27 +9793,27 @@ static struct ast_cli_entry cli_iax2[] = { iax2_show_peer, "Show details on specific IAX peer", show_peer_usage, complete_iax2_show_peer }, - { { "iax2", "debug", NULL }, + { { "iax2", "set", "debug", NULL }, iax2_do_debug, "Enable IAX debugging", debug_usage }, - { { "iax2", "debug", "trunk", NULL }, + { { "iax2", "set", "debug", "trunk", NULL }, iax2_do_trunk_debug, "Enable IAX trunk debugging", debug_trunk_usage }, - { { "iax2", "debug", "jb", NULL }, + { { "iax2", "set", "debug", "jb", NULL }, iax2_do_jb_debug, "Enable IAX jitterbuffer debugging", debug_jb_usage }, - { { "iax2", "debug", "off", NULL }, + { { "iax2", "set", "debug", "off", NULL }, iax2_no_debug, "Disable IAX debugging", no_debug_usage }, - { { "iax2", "debug", "trunk", "off", NULL }, + { { "iax2", "set", "debug", "trunk", "off", NULL }, iax2_no_trunk_debug, "Disable IAX trunk debugging", no_debug_trunk_usage }, - { { "iax2", "debug", "jb", "off", NULL }, + { { "iax2", "set", "debug", "jb", "off", NULL }, iax2_no_jb_debug, "Disable IAX jitterbuffer debugging", no_debug_jb_usage }, diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 2e8011acc..f798bbd06 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1054,11 +1054,11 @@ static char audit_endpoint_usage[] = " mgcp debug MUST be on to see the results of this command.\n"; static char debug_usage[] = -"Usage: mgcp debug\n" +"Usage: mgcp set debug\n" " Enables dumping of MGCP packets for debugging purposes\n"; static char no_debug_usage[] = -"Usage: mgcp debug off\n" +"Usage: mgcp set debug off\n" " Disables dumping of MGCP packets for debugging purposes\n"; static char mgcp_reload_usage[] = @@ -1121,7 +1121,7 @@ static int mgcp_audit_endpoint(int fd, int argc, char *argv[]) static int mgcp_do_debug(int fd, int argc, char *argv[]) { - if (argc != 2) + if (argc != 3) return RESULT_SHOWUSAGE; mgcpdebug = 1; ast_cli(fd, "MGCP Debugging Enabled\n"); @@ -1130,7 +1130,7 @@ static int mgcp_do_debug(int fd, int argc, char *argv[]) static int mgcp_no_debug(int fd, int argc, char *argv[]) { - if (argc != 3) + if (argc != 4) return RESULT_SHOWUSAGE; mgcpdebug = 0; ast_cli(fd, "MGCP Debugging Disabled\n"); @@ -1146,11 +1146,11 @@ static struct ast_cli_entry cli_mgcp[] = { mgcp_show_endpoints, "List defined MGCP endpoints", show_endpoints_usage }, - { { "mgcp", "debug", NULL }, + { { "mgcp", "set", "debug", NULL }, mgcp_do_debug, "Enable MGCP debugging", debug_usage }, - { { "mgcp", "debug", "off", NULL }, + { { "mgcp", "set", "debug", "off", NULL }, mgcp_no_debug, "Disable MGCP debugging", no_debug_usage }, diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 818673ee5..cb45e7652 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10859,9 +10859,10 @@ static int sip_do_debug_ip(int fd, int argc, char *argv[]) int port = 0; char *p, *arg; - if (argc != 4) + /* sip set debug ip */ + if (argc != 5) return RESULT_SHOWUSAGE; - p = arg = argv[3]; + p = arg = argv[4]; strsep(&p, ":"); if (p) port = atoi(p); @@ -10886,9 +10887,9 @@ static int sip_do_debug_ip(int fd, int argc, char *argv[]) static int sip_do_debug_peer(int fd, int argc, char *argv[]) { struct sip_peer *peer; - if (argc != 4) + if (argc != 5) return RESULT_SHOWUSAGE; - peer = find_peer(argv[3], NULL, 1); + peer = find_peer(argv[4], NULL, 1); if (peer) { if (peer->addr.sin_addr.s_addr) { debugaddr.sin_family = AF_INET; @@ -10897,10 +10898,10 @@ static int sip_do_debug_peer(int fd, int argc, char *argv[]) ast_cli(fd, "SIP Debugging Enabled for IP: %s:%d\n", ast_inet_ntoa(debugaddr.sin_addr), ntohs(debugaddr.sin_port)); ast_set_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONSOLE); } else - ast_cli(fd, "Unable to get IP address of peer '%s'\n", argv[3]); + ast_cli(fd, "Unable to get IP address of peer '%s'\n", argv[4]); unref_peer(peer); } else - ast_cli(fd, "No such peer '%s'\n", argv[3]); + ast_cli(fd, "No such peer '%s'\n", argv[4]); return RESULT_SUCCESS; } @@ -10908,12 +10909,12 @@ static int sip_do_debug_peer(int fd, int argc, char *argv[]) static int sip_do_debug(int fd, int argc, char *argv[]) { int oldsipdebug = sipdebug_console; - if (argc != 2) { - if (argc != 4) + if (argc != 4) { + if (argc != 5) return RESULT_SHOWUSAGE; - else if (strcmp(argv[2], "ip") == 0) + else if (strcmp(argv[3], "ip") == 0) return sip_do_debug_ip(fd, argc, argv); - else if (strcmp(argv[2], "peer") == 0) + else if (strcmp(argv[3], "peer") == 0) return sip_do_debug_peer(fd, argc, argv); else return RESULT_SHOWUSAGE; @@ -10983,7 +10984,7 @@ static int sip_notify(int fd, int argc, char *argv[]) /*! \brief Disable SIP Debugging in CLI */ static int sip_no_debug(int fd, int argc, char *argv[]) { - if (argc != 3) + if (argc != 4) return RESULT_SHOWUSAGE; ast_clear_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONSOLE); ast_cli(fd, "SIP Debugging Disabled\n"); @@ -11284,8 +11285,7 @@ static char history_usage[] = static char sip_reload_usage[] = "Usage: sip reload\n" -" Reloads SIP configuration from sip.conf\n" -" Deprecated: please use 'reload chan_sip.so'\n"; +" Reloads SIP configuration from sip.conf\n"; static char show_subscriptions_usage[] = "Usage: sip show subscriptions\n" @@ -17006,12 +17006,6 @@ static int sip_do_reload(enum channelreloadreason reason) /*! \brief Force reload of module from cli */ static int sip_reload(int fd, int argc, char *argv[]) { - static int deprecated = 0; - if (!deprecated && argc > 0) { - ast_log(LOG_WARNING, "\"sip reload\" is deprecated. Please use 'reload chan_sip.so' instead.\n"); - deprecated = 1; - } - ast_mutex_lock(&sip_reload_lock); if (sip_reloading) ast_verbose("Previous SIP reload not yet done\n"); @@ -17104,19 +17098,19 @@ static struct ast_cli_entry cli_sip[] = { sip_prune_realtime, "Prune cached Realtime user(s)", prune_realtime_usage, complete_sip_prune_realtime_user }, - { { "sip", "debug", NULL }, + { { "sip", "set", "debug", NULL }, sip_do_debug, "Enable SIP debugging", debug_usage }, - { { "sip", "debug", "ip", NULL }, + { { "sip", "set", "debug", "ip", NULL }, sip_do_debug, "Enable SIP debugging on IP", debug_usage }, - { { "sip", "debug", "peer", NULL }, + { { "sip", "set", "debug", "peer", NULL }, sip_do_debug, "Enable SIP debugging on Peername", debug_usage, complete_sip_debug_peer }, - { { "sip", "debug", "off", NULL }, + { { "sip", "set", "debug", "off", NULL }, sip_no_debug, "Disable SIP debugging", no_debug_usage }, diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index b5225c085..951d9b8a3 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -1759,7 +1759,7 @@ static int skinny_do_debug(int fd, int argc, char *argv[]) static int skinny_no_debug(int fd, int argc, char *argv[]) { - if (argc != 3) { + if (argc != 4) { return RESULT_SHOWUSAGE; } skinnydebug = 0; @@ -1956,11 +1956,11 @@ static char show_lines_usage[] = " Lists all lines known to the Skinny subsystem.\n"; static char debug_usage[] = -"Usage: skinny debug\n" +"Usage: skinny set debug\n" " Enables dumping of Skinny packets for debugging purposes\n"; static char no_debug_usage[] = -"Usage: skinny no debug\n" +"Usage: skinny set debug off\n" " Disables dumping of Skinny packets for debugging purposes\n"; static char reset_usage[] = @@ -1976,11 +1976,11 @@ static struct ast_cli_entry cli_skinny[] = { skinny_show_lines, "List defined Skinny lines per device", show_lines_usage }, - { { "skinny", "debug", NULL }, + { { "skinny", "set", "debug", NULL }, skinny_do_debug, "Enable Skinny debugging", debug_usage }, - { { "skinny", "debug", "off", NULL }, + { { "skinny", "set", "debug", "off", NULL }, skinny_no_debug, "Disable Skinny debugging", no_debug_usage }, -- cgit v1.2.3