diff options
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/pbx_ael.c | 41 | ||||
-rw-r--r-- | pbx/pbx_dundi.c | 139 |
2 files changed, 120 insertions, 60 deletions
diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c index cffa65f40..fa4b7d516 100644 --- a/pbx/pbx_ael.c +++ b/pbx/pbx_ael.c @@ -146,7 +146,7 @@ static int pbx_load_module(void) } /* CLI interface */ -static char *handle_cli_ael_debug_multiple(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *handle_cli_ael_debug_multiple_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: @@ -180,6 +180,40 @@ static char *handle_cli_ael_debug_multiple(struct ast_cli_entry *e, int cmd, str return CLI_SUCCESS; } +static char *handle_cli_ael_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +{ + switch (cmd) { + case CLI_INIT: + e->command = "ael set debug {read|tokens|macros|contexts|off}"; + e->usage = + "Usage: ael debug {read|tokens|macros|contexts|off}\n" + " Enable AEL read, token, macro, or context debugging,\n" + " or disable all AEL debugging messages. Note: this\n" + " currently does nothing.\n"; + return NULL; + case CLI_GENERATE: + return NULL; + } + + if (a->argc != e->args) + return CLI_SHOWUSAGE; + + if (!strcasecmp(a->argv[3], "read")) + aeldebug |= DEBUG_READ; + else if (!strcasecmp(a->argv[3], "tokens")) + aeldebug |= DEBUG_TOKENS; + else if (!strcasecmp(a->argv[3], "macros")) + aeldebug |= DEBUG_MACROS; + else if (!strcasecmp(a->argv[3], "contexts")) + aeldebug |= DEBUG_CONTEXTS; + else if (!strcasecmp(a->argv[3], "off")) + aeldebug = 0; + else + return CLI_SHOWUSAGE; + + return CLI_SUCCESS; +} + static char *handle_cli_ael_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -199,9 +233,10 @@ static char *handle_cli_ael_reload(struct ast_cli_entry *e, int cmd, struct ast_ return (pbx_load_module() ? CLI_FAILURE : CLI_SUCCESS); } +static struct ast_cli_entry cli_ael_debug_multiple_deprecated = AST_CLI_DEFINE(handle_cli_ael_debug_multiple_deprecated, "Enable AEL debugging flags"); static struct ast_cli_entry cli_ael[] = { - AST_CLI_DEFINE(handle_cli_ael_reload, "Reload AEL configuration"), - AST_CLI_DEFINE(handle_cli_ael_debug_multiple, "Enable AEL debugging flags") + AST_CLI_DEFINE(handle_cli_ael_reload, "Reload AEL configuration"), + AST_CLI_DEFINE(handle_cli_ael_set_debug, "Enable AEL debugging flags", .deprecate_cmd = &cli_ael_debug_multiple_deprecated) }; static int unload_module(void) diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 9d30fe24f..b5bd58de3 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -2179,42 +2179,106 @@ static int start_network_thread(void) return 0; } -static char *dundi_do_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *dundi_do_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "dundi debug"; + e->command = "dundi [no] debug"; e->usage = - "Usage: dundi debug\n" - " Enables dumping of DUNDi packets for debugging purposes\n"; + "Usage: dundi [no] debug\n" + " Enables/Disables dumping of DUNDi packets for debugging purposes\n"; return NULL; case CLI_GENERATE: return NULL; } - if (a->argc != 2) + if (a->argc < 2 || a->argc > 3) return CLI_SHOWUSAGE; - dundidebug = 1; - ast_cli(a->fd, "DUNDi Debugging Enabled\n"); + if (a->argc == 2) { + dundidebug = 1; + ast_cli(a->fd, "DUNDi Debugging Enabled\n"); + } else { + dundidebug = 0; + ast_cli(a->fd, "DUNDi Debugging Disabled\n"); + } + return CLI_SUCCESS; +} + +static char *dundi_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +{ + switch (cmd) { + case CLI_INIT: + e->command = "dundi set debug {on|off}"; + e->usage = + "Usage: dundi set debug {on|off}\n" + " Enables/Disables dumping of DUNDi packets for debugging purposes\n"; + return NULL; + case CLI_GENERATE: + return NULL; + } + + if (a->argc != e->args) + return CLI_SHOWUSAGE; + + if (!strncasecmp(a->argv[e->args -1], "on", 2)) { + dundidebug = 1; + ast_cli(a->fd, "DUNDi Debugging Enabled\n"); + } else { + dundidebug = 0; + ast_cli(a->fd, "DUNDi Debugging Disabled\n"); + } return CLI_SUCCESS; } -static char *dundi_do_store_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +static char *dundi_do_store_history_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "dundi store history"; + e->command = "dundi [no] store history"; e->usage = - "Usage: dundi store history\n" - " Enables storing of DUNDi requests and times for debugging\n" + "Usage: dundi [no] store history\n" + " Enables/Disables storing of DUNDi requests and times for debugging\n" "purposes\n"; return NULL; case CLI_GENERATE: return NULL; } - if (a->argc != 3) + if (a->argc < 3 || a->argc > 4) return CLI_SHOWUSAGE; - global_storehistory = 1; - ast_cli(a->fd, "DUNDi History Storage Enabled\n"); + + if (a->argc == 3) { + global_storehistory = 1; + ast_cli(a->fd, "DUNDi History Storage Enabled\n"); + } else { + global_storehistory = 0; + ast_cli(a->fd, "DUNDi History Storage Disabled\n"); + } + return CLI_SUCCESS; +} + +static char *dundi_store_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +{ + switch (cmd) { + case CLI_INIT: + e->command = "dundi store history {on|off}"; + e->usage = + "Usage: dundi store history {on|off}\n" + " Enables/Disables storing of DUNDi requests and times for debugging\n" + "purposes\n"; + return NULL; + case CLI_GENERATE: + return NULL; + } + + if (a->argc != e->args) + return CLI_SHOWUSAGE; + + if (!strncasecmp(a->argv[e->args -1], "on", 2)) { + global_storehistory = 1; + ast_cli(a->fd, "DUNDi History Storage Enabled\n"); + } else { + global_storehistory = 0; + ast_cli(a->fd, "DUNDi History Storage Disabled\n"); + } return CLI_SUCCESS; } @@ -2263,45 +2327,6 @@ static char *dundi_flush(struct ast_cli_entry *e, int cmd, struct ast_cli_args * return CLI_SUCCESS; } -static char *dundi_no_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - switch (cmd) { - case CLI_INIT: - e->command = "dundi no debug"; - e->usage = - "Usage: dundi no debug\n" - " Disables dumping of DUNDi packets for debugging purposes\n"; - return NULL; - case CLI_GENERATE: - return NULL; - } - if (a->argc != 3) - return CLI_SHOWUSAGE; - dundidebug = 0; - ast_cli(a->fd, "DUNDi Debugging Disabled\n"); - return CLI_SUCCESS; -} - -static char *dundi_no_store_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) -{ - switch (cmd) { - case CLI_INIT: - e->command = "dundi no store history"; - e->usage = - "Usage: dundi no store history\n" - " Disables storing of DUNDi requests and times for debugging\n" - "purposes\n"; - return NULL; - case CLI_GENERATE: - return NULL; - } - if (a->argc != 4) - return CLI_SHOWUSAGE; - global_storehistory = 0; - ast_cli(a->fd, "DUNDi History Storage Disabled\n"); - return CLI_SUCCESS; -} - static char *model2str(int model) { switch(model) { @@ -2817,11 +2842,11 @@ static char *dundi_show_precache(struct ast_cli_entry *e, int cmd, struct ast_cl #undef FORMAT2 } +static struct ast_cli_entry cli_dundi_do_debug_deprecated = AST_CLI_DEFINE(dundi_do_debug_deprecated, "Enable/Disable DUNDi debugging"); +static struct ast_cli_entry cli_dundi_do_store_history_deprecated = AST_CLI_DEFINE(dundi_do_store_history_deprecated, "Enable/Disable DUNDi historic records"); static struct ast_cli_entry cli_dundi[] = { - AST_CLI_DEFINE(dundi_do_debug, "Enable DUNDi debugging"), - AST_CLI_DEFINE(dundi_no_debug, "Disable DUNDi debugging"), - AST_CLI_DEFINE(dundi_do_store_history, "Enable DUNDi historic records"), - AST_CLI_DEFINE(dundi_no_store_history, "Disable DUNDi historic records"), + AST_CLI_DEFINE(dundi_set_debug, "Enable/Disable DUNDi debugging", .deprecate_cmd = &cli_dundi_do_debug_deprecated), + AST_CLI_DEFINE(dundi_store_history, "Enable/Disable DUNDi historic records", .deprecate_cmd = &cli_dundi_do_store_history_deprecated), AST_CLI_DEFINE(dundi_flush, "Flush DUNDi cache"), AST_CLI_DEFINE(dundi_show_peers, "Show defined DUNDi peers"), AST_CLI_DEFINE(dundi_show_trans, "Show active DUNDi transactions"), |