diff options
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_iax2.c | 138 | ||||
-rw-r--r-- | channels/chan_mgcp.c | 45 | ||||
-rw-r--r-- | channels/chan_sip.c | 58 | ||||
-rw-r--r-- | channels/chan_skinny.c | 54 | ||||
-rw-r--r-- | channels/chan_usbradio.c | 36 |
5 files changed, 224 insertions, 107 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index c393711b9..990ab41fd 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5262,117 +5262,158 @@ static char *handle_cli_iax2_show_netstats(struct ast_cli_entry *e, int cmd, str return CLI_SUCCESS; } -static char *handle_cli_iax2_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *handle_cli_iax2_set_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "iax2 set debug"; + e->command = "iax2 set debug [off]"; e->usage = - "Usage: iax2 set debug\n" - " Enables dumping of IAX packets for debugging purposes.\n"; + "Usage: iax2 set debug [off]\n" + " Enables/Disables dumping of IAX packets for debugging purposes.\n"; return NULL; case CLI_GENERATE: return NULL; } - if (a->argc < 2 || a->argc > 3) + if (a->argc < 3 || a->argc > 4) return CLI_SHOWUSAGE; - iaxdebug = 1; - ast_cli(a->fd, "IAX2 Debugging Enabled\n"); + if (a->argc == 3) { + iaxdebug = 1; + ast_cli(a->fd, "IAX2 Debugging Enabled\n"); + } else { + iaxdebug = 0; + ast_cli(a->fd, "IAX2 Debugging Disabled\n"); + } return CLI_SUCCESS; } -static char *handle_cli_iax2_set_debug_off(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *handle_cli_iax2_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "iax2 set debug off"; + e->command = "iax2 set debug {on|off}"; e->usage = - "Usage: iax2 set debug off\n" - " Disables dumping of IAX packets for debugging purposes.\n"; + "Usage: iax2 set debug {on|off}\n" + " Enables/Disables dumping of IAX packets for debugging purposes.\n"; return NULL; case CLI_GENERATE: return NULL; } - if (a->argc < 3 || a->argc > 4) + + if (a->argc != e->args) return CLI_SHOWUSAGE; - iaxdebug = 0; - ast_cli(a->fd, "IAX2 Debugging Disabled\n"); + + if (!strncasecmp(a->argv[e->args -1], "on", 2)) { + iaxdebug = 1; + ast_cli(a->fd, "IAX2 Debugging Enabled\n"); + } else { + iaxdebug = 0; + ast_cli(a->fd, "IAX2 Debugging Disabled\n"); + } return CLI_SUCCESS; } -static char *handle_cli_iax2_set_debug_trunk(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) + +static char *handle_cli_iax2_set_debug_trunk_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "iax2 set debug trunk"; + e->command = "iax2 set debug trunk [off]"; e->usage = - "Usage: iax2 set debug trunk\n" - " Requests current status of IAX trunking\n"; + "Usage: iax2 set debug trunk [off]\n" + " Enables/Disables debugging of IAX trunking\n"; return NULL; case CLI_GENERATE: return NULL; } - if (a->argc < 3 || a->argc > 4) + + if (a->argc < 4 || a->argc > 5) return CLI_SHOWUSAGE; - iaxtrunkdebug = 1; - ast_cli(a->fd, "IAX2 Trunk Debugging Requested\n"); + + if (a->argc == 4) { + iaxtrunkdebug = 1; + ast_cli(a->fd, "IAX2 Trunk Debugging Enabled\n"); + } else { + iaxtrunkdebug = 0; + ast_cli(a->fd, "IAX2 Trunk Debugging Disabled\n"); + } return CLI_SUCCESS; } -static char *handle_cli_iax2_set_debug_trunk_off(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *handle_cli_iax2_set_debug_trunk(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "iax2 set debug trunk off"; + e->command = "iax2 set debug trunk {on|off}"; e->usage = - "Usage: iax2 set debug trunk off\n" - " Disables debugging of IAX trunking\n"; + "Usage: iax2 set debug trunk {on|off}\n" + " Enables/Disables debugging of IAX trunking\n"; return NULL; case CLI_GENERATE: return NULL; } - if (a->argc < 4 || a->argc > 5) + + if (a->argc != e->args) return CLI_SHOWUSAGE; - iaxtrunkdebug = 0; - ast_cli(a->fd, "IAX2 Trunk Debugging Disabled\n"); + + if (!strncasecmp(a->argv[e->args - 1], "on", 2)) { + iaxtrunkdebug = 1; + ast_cli(a->fd, "IAX2 Trunk Debugging Enabled\n"); + } else { + iaxtrunkdebug = 0; + ast_cli(a->fd, "IAX2 Trunk Debugging Disabled\n"); + } return CLI_SUCCESS; } -static char *handle_cli_iax2_set_debug_jb(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *handle_cli_iax2_set_debug_jb_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "iax2 set debug jb"; + e->command = "iax2 set debug jb [off]"; e->usage = - "Usage: iax2 set debug jb\n" - " Enables jitterbuffer debugging information\n"; + "Usage: iax2 set debug jb [off]\n" + " Enables/Disables jitterbuffer debugging information\n"; return NULL; case CLI_GENERATE: return NULL; } - if (a->argc < 3 || a->argc > 4) + + if (a->argc < 4 || a->argc > 5) return CLI_SHOWUSAGE; - jb_setoutput(jb_error_output, jb_warning_output, jb_debug_output); - ast_cli(a->fd, "IAX2 Jitterbuffer Debugging Enabled\n"); + + if (a->argc == 4) { + jb_setoutput(jb_error_output, jb_warning_output, jb_debug_output); + ast_cli(a->fd, "IAX2 Jitterbuffer Debugging Enabled\n"); + } else { + jb_setoutput(jb_error_output, jb_warning_output, NULL); + ast_cli(a->fd, "IAX2 Jitterbuffer Debugging Disabled\n"); + } return CLI_SUCCESS; } -static char *handle_cli_iax2_set_debug_jb_off(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *handle_cli_iax2_set_debug_jb(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "iax2 set debug jb off"; + e->command = "iax2 set debug jb {on|off}"; e->usage = - "Usage: iax2 set debug jb off\n" - " Disables jitterbuffer debugging information\n"; + "Usage: iax2 set debug jb {on|off}\n" + " Enables/Disables jitterbuffer debugging information\n"; return NULL; case CLI_GENERATE: return NULL; } - if (a->argc < 4 || a->argc > 5) + + if (a->argc != e->args) return CLI_SHOWUSAGE; - jb_setoutput(jb_error_output, jb_warning_output, NULL); - ast_cli(a->fd, "IAX2 Jitterbuffer Debugging Disabled\n"); + + if (!strncasecmp(a->argv[e->args -1], "on", 2)) { + jb_setoutput(jb_error_output, jb_warning_output, jb_debug_output); + ast_cli(a->fd, "IAX2 Jitterbuffer Debugging Enabled\n"); + } else { + jb_setoutput(jb_error_output, jb_warning_output, NULL); + ast_cli(a->fd, "IAX2 Jitterbuffer Debugging Disabled\n"); + } return CLI_SUCCESS; } @@ -11474,17 +11515,18 @@ static struct ast_switch iax2_switch = #endif */ +static struct ast_cli_entry cli_iax2_set_debug_deprecated = AST_CLI_DEFINE(handle_cli_iax2_set_debug_deprecated, "Enable/Disable IAX debugging"); +static struct ast_cli_entry cli_iax2_set_debug_trunk_deprecated = AST_CLI_DEFINE(handle_cli_iax2_set_debug_trunk_deprecated, "Enable/Disable IAX debugging"); +static struct ast_cli_entry cli_iax2_set_debug_jb_deprecated = AST_CLI_DEFINE(handle_cli_iax2_set_debug_jb_deprecated, "Enable/Disable IAX debugging"); + static struct ast_cli_entry cli_iax2[] = { AST_CLI_DEFINE(handle_cli_iax2_provision, "Provision an IAX device"), AST_CLI_DEFINE(handle_cli_iax2_prune_realtime, "Prune a cached realtime lookup"), AST_CLI_DEFINE(handle_cli_iax2_reload, "Reload IAX configuration"), AST_CLI_DEFINE(handle_cli_iax2_set_mtu, "Set the IAX systemwide trunking MTU"), - AST_CLI_DEFINE(handle_cli_iax2_set_debug, "Enable IAX debugging"), - AST_CLI_DEFINE(handle_cli_iax2_set_debug_trunk, "Enable IAX trunk debugging"), - AST_CLI_DEFINE(handle_cli_iax2_set_debug_jb, "Enable IAX jitterbuffer debugging"), - AST_CLI_DEFINE(handle_cli_iax2_set_debug_off, "Disable IAX debugging"), - AST_CLI_DEFINE(handle_cli_iax2_set_debug_trunk_off, "Disable IAX trunk debugging"), - AST_CLI_DEFINE(handle_cli_iax2_set_debug_jb_off, "Disable IAX jitterbuffer debugging"), + AST_CLI_DEFINE(handle_cli_iax2_set_debug, "Enable/Disable IAX debugging", .deprecate_cmd = &cli_iax2_set_debug_deprecated), + AST_CLI_DEFINE(handle_cli_iax2_set_debug_trunk, "Enable/Disable IAX trunk debugging", .deprecate_cmd = &cli_iax2_set_debug_trunk_deprecated), + AST_CLI_DEFINE(handle_cli_iax2_set_debug_jb, "Enable/Disable IAX jitterbuffer debugging", .deprecate_cmd = &cli_iax2_set_debug_jb_deprecated), AST_CLI_DEFINE(handle_cli_iax2_show_cache, "Display IAX cached dialplan"), AST_CLI_DEFINE(handle_cli_iax2_show_channels, "List active IAX channels"), AST_CLI_DEFINE(handle_cli_iax2_show_firmware, "List available IAX firmware"), diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index de7c624be..f4ce2ce6a 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1139,51 +1139,64 @@ static char *handle_mgcp_audit_endpoint(struct ast_cli_entry *e, int cmd, struct return CLI_SUCCESS; } -static char *handle_mgcp_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +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"; + e->command = "mgcp set debug [off]"; e->usage = - "Usage: mgcp set debug\n" - " Enables dumping of MGCP packets for debugging purposes\n"; + "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) + if (a->argc < 3 || a->argc > 4) return CLI_SHOWUSAGE; - mgcpdebug = 1; - ast_cli(a->fd, "MGCP Debugging Enabled\n"); + 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_off(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *handle_mgcp_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "mgcp set debug off"; + e->command = "mgcp set debug {on|off}"; e->usage = - "Usage: mgcp set debug off\n" - " Disables dumping of MGCP packets for debugging purposes\n"; + "Usage: mgcp set debug {on|off}\n" + " Enables/Disables dumping of MGCP packets for debugging purposes\n"; return NULL; case CLI_GENERATE: return NULL; } - if (a->argc != 4) + if (a->argc != e->args) return CLI_SHOWUSAGE; - mgcpdebug = 0; - ast_cli(a->fd, "MGCP Debugging Disabled\n"); + + if (!strncasecmp(a->argv[e->args - 1], "on", 2)) { + 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"); + } else { + return CLI_SHOWUSAGE; + } 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 MGCP debugging"), - AST_CLI_DEFINE(handle_mgcp_set_debug_off, "Disable MGCP debugging"), + AST_CLI_DEFINE(handle_mgcp_set_debug, "Enable/Disable MGCP debugging", .deprecate_cmd = &cli_mgcp_set_debug_deprecated), AST_CLI_DEFINE(mgcp_reload, "Reload MGCP configuration"), }; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 6408f52aa..40320b1bd 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1853,8 +1853,8 @@ static char *sip_do_debug_ip(int fd, char *arg); 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_notify(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); -static char *sip_do_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); -static char *sip_no_history(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); static int sip_do_reload(enum channelreloadreason reason); @@ -13243,7 +13243,7 @@ static char *sip_show_history(struct ast_cli_entry *e, int cmd, struct ast_cli_a if (a->argc != 4) return CLI_SHOWUSAGE; if (!recordhistory) - ast_cli(a->fd, "\n***Note: History recording is currently DISABLED. Use 'sip history' to ENABLE.\n"); + ast_cli(a->fd, "\n***Note: History recording is currently DISABLED. Use 'sip set history on' to ENABLE.\n"); len = strlen(a->argv[3]); dialoglist_lock(); for (cur = dialoglist; cur; cur = cur->next) { @@ -13652,49 +13652,63 @@ static char *sip_notify(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a return CLI_SUCCESS; } -/*! \brief Enable SIP History logging (CLI) */ -static char *sip_do_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +/*! \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"; + e->command = "sip history [off]"; e->usage = - "Usage: sip history\n" - " Enables recording of SIP dialog history for debugging purposes.\n" + "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) { + if (a->argc < 2 || a->argc > 3) { return CLI_SHOWUSAGE; } - recordhistory = TRUE; - ast_cli(a->fd, "SIP History Recording Enabled (use 'sip show history')\n"); + 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; } -/*! \brief Disable SIP History logging (CLI) */ -static char *sip_no_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +/*! \brief Enable/Disable SIP History logging (CLI) */ +static char *sip_set_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - switch (cmd) { case CLI_INIT: - e->command = "sip history off"; + e->command = "sip set history {on|off}"; e->usage = - "Usage: sip history off\n" - " Disables recording of SIP dialog history for debugging purposes\n"; + "Usage: sip history {on|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 != 3) { + if (a->argc != e->args) + return CLI_SHOWUSAGE; + + if (!strncasecmp(a->argv[e->args - 1], "on", 2)) { + recordhistory = TRUE; + ast_cli(a->fd, "SIP History Recording Enabled (use 'sip show history')\n"); + } else if (!strncasecmp(a->argv[e->args - 1], "off", 3)) { + recordhistory = FALSE; + ast_cli(a->fd, "SIP History Recording Disabled\n"); + } else { return CLI_SHOWUSAGE; } - recordhistory = FALSE; - ast_cli(a->fd, "SIP History Recording Disabled\n"); return CLI_SUCCESS; } @@ -21102,6 +21116,7 @@ static int reload(void) 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/subscriptions"), @@ -21120,8 +21135,7 @@ static struct ast_cli_entry cli_sip[] = { AST_CLI_DEFINE(sip_show_user, "Show details on specific SIP user"), 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_do_history, "Enable SIP history"), - AST_CLI_DEFINE(sip_no_history, "Disable SIP history"), + AST_CLI_DEFINE(sip_set_history, "Enable/Disable SIP history", .deprecate_cmd = &cli_sip_do_history_deprecated), AST_CLI_DEFINE(sip_reload, "Reload SIP configuration"), AST_CLI_DEFINE(sip_show_tcp, "List TCP Connections") }; diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 719258178..b9fe618d2 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -2371,46 +2371,62 @@ static struct ast_rtp_protocol skinny_rtp = { .set_rtp_peer = skinny_set_rtp_peer, }; -static char *handle_skinny_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +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"; + e->command = "skinny set debug [off]"; e->usage = - "Usage: skinny set debug\n" - " Enables dumping of Skinny packets for debugging purposes\n"; + "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) + if (a->argc < 3 || a->argc > 4) return CLI_SHOWUSAGE; - skinnydebug = 1; - ast_cli(a->fd, "Skinny Debugging Enabled\n"); - return CLI_SUCCESS; + 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_off(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *handle_skinny_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "skinny set debug off"; + e->command = "skinny set debug {on|off}"; e->usage = - "Usage: skinny set debug off\n" - " Disables dumping of Skinny packets for debugging purposes\n"; + "Usage: skinny set debug {on|off}\n" + " Enables/Disables dumping of Skinny packets for debugging purposes\n"; return NULL; case CLI_GENERATE: return NULL; } - - if (a->argc != 4) + + if (a->argc != e->args) return CLI_SHOWUSAGE; - skinnydebug = 0; - ast_cli(a->fd, "Skinny Debugging Disabled\n"); - return CLI_SUCCESS; + if (!strncasecmp(a->argv[e->args - 1], "on", 2)) { + skinnydebug = 1; + ast_cli(a->fd, "Skinny Debugging Enabled\n"); + return CLI_SUCCESS; + } else if (!strncasecmp(a->argv[e->args - 1], "off", 3)) { + skinnydebug = 0; + ast_cli(a->fd, "Skinny Debugging Disabled\n"); + return CLI_SUCCESS; + } else { + return CLI_SHOWUSAGE; + } } static char *complete_skinny_devices(const char *word, int state) @@ -2841,14 +2857,14 @@ static char *handle_skinny_show_settings(struct ast_cli_entry *e, int cmd, struc 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 Skinny debugging"), - AST_CLI_DEFINE(handle_skinny_set_debug_off, "Disable Skinny debugging"), + AST_CLI_DEFINE(handle_skinny_set_debug, "Enable/Disable Skinny debugging", .deprecate_cmd = &cli_skinny_set_debug_deprecated), AST_CLI_DEFINE(handle_skinny_reset, "Reset Skinny device(s)"), }; diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c index 6b2154c82..06f97939d 100644 --- a/channels/chan_usbradio.c +++ b/channels/chan_usbradio.c @@ -1622,7 +1622,7 @@ static int set_txctcss_level(struct chan_usbradio_pvt *o) /* CLI debugging on and off */ -static char *handle_cli_radio_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *handle_cli_radio_set_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { struct chan_usbradio_pvt *o = NULL; @@ -1652,11 +1652,43 @@ static char *handle_cli_radio_set_debug(struct ast_cli_entry *e, int cmd, struct return CLI_SUCCESS; } +static char *handle_cli_radio_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +{ + struct chan_usbradio_pvt *o = NULL; + + switch (cmd) { + case CLI_INIT: + e->command = "radio set debug {on|off}"; + e->usage = + "Usage: radio set debug {on|off}\n" + " Enable/Disable radio debugging.\n"; + case CLI_GENERATE: + return NULL; + } + + if (a->argc != e->args) + return CLI_SHOWUSAGE; + + o = find_desc(usbradio_active); + + if (!strncasecmp(a->argv[e->args - 1], "on", 2)) + o->debuglevel = 1; + else if (!strncasecmp(a->argv[e->args - 1], "off", 3)) + o->debuglevel = 0; + else + return CLI_SHOWUSAGE; + + ast_cli(a->fd, "USB Radio debugging %s.\n", o->debuglevel ? "enabled" : "disabled"); + + return CLI_SUCCESS; +} + +static struct ast_cli_entry cli_radio_set_debug_deprecated = AST_CLI_DEFINE(handle_cli_radio_set_debug_deprecated, "Enable/Disable Radio Debugging"); static struct ast_cli_entry cli_usbradio[] = { AST_CLI_DEFINE(handle_cli_radio_key, "Simulate Rx Signal Present"), AST_CLI_DEFINE(handle_cli_radio_unkey, "Simulate Rx Signal Lusb"), AST_CLI_DEFINE(handle_cli_radio_tune, "Radio Tune"), - AST_CLI_DEFINE(handle_cli_radio_set_debug, "Enable/Disable Radio Debugging"), + AST_CLI_DEFINE(handle_cli_radio_set_debug, "Enable/Disable Radio Debugging", .deprecate_cmd = &cli_radio_set_debug_deprecated), }; /* |