summaryrefslogtreecommitdiff
path: root/res/res_pjsip.c
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2015-04-09 22:03:17 +0000
committerKevin Harwell <kharwell@digium.com>2015-04-09 22:03:17 +0000
commit5737650a672ff2b1e2fdd8b76de345d12ede81c8 (patch)
tree71ae2931eb23ddad585b3300a6e38140a15f3c20 /res/res_pjsip.c
parent1695a5b85ffe22ae26c06b46543782a29b31df67 (diff)
res_pjsip: add CLI command to show global and system configuration
Added a new CLI command for res_pjsip that shows both global and system configuration settings: pjsip show settings ASTERISK-24918 #close Reported by: Scott Griepentrog Review: https://reviewboard.asterisk.org/r/4597/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434527 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip.c')
-rw-r--r--res/res_pjsip.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 6fc14774f..448d57ddb 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -37,6 +37,7 @@
#include "asterisk/sorcery.h"
#include "asterisk/file.h"
#include "asterisk/cli.h"
+#include "asterisk/res_pjsip_cli.h"
/*** MODULEINFO
<depend>pjproject</depend>
@@ -2141,7 +2142,39 @@ static char *cli_show_endpoint_identifiers(struct ast_cli_entry *e, int cmd, str
#undef ENDPOINT_IDENTIFIER_FORMAT
}
+static char *cli_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ struct ast_sip_cli_context context;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "pjsip show settings";
+ e->usage = "Usage: pjsip show settings\n"
+ " Show global and system configuration options\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ context.output_buffer = ast_str_create(256);
+ if (!context.output_buffer) {
+ ast_cli(a->fd, "Could not allocate output buffer.\n");
+ return CLI_FAILURE;
+ }
+
+ if (sip_cli_print_global(&context) || sip_cli_print_system(&context)) {
+ ast_free(context.output_buffer);
+ ast_cli(a->fd, "Error retrieving settings.\n");
+ return CLI_FAILURE;
+ }
+
+ ast_cli(a->fd, "%s", ast_str_buffer(context.output_buffer));
+ ast_free(context.output_buffer);
+ return CLI_SUCCESS;
+}
+
static struct ast_cli_entry cli_commands[] = {
+ AST_CLI_DEFINE(cli_show_settings, "Show global and system configuration options"),
AST_CLI_DEFINE(cli_show_endpoint_identifiers, "List registered endpoint identifiers")
};