summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-02-15 16:01:09 +0000
committerJoshua Colp <jcolp@digium.com>2015-02-15 16:01:09 +0000
commite6fe69b76c1f01b2c1fe3ce0b534494e60aa819b (patch)
treead72e4b634813b5d1a1cb68cde96121239c513db /res
parent17f9e0caccda7ec534c16f2c3f2c321b7e389ae6 (diff)
res_pjsip: Add "pjsip show version" CLI command.
When debugging things it can be useful to know absolutely what version of pjproject res_pjsip is running against. This change adds a "pjsip show version" CLI command which can be used to query for this. ASTERISK-24685 #close Reported by: Joshua Colp Review: https://reviewboard.asterisk.org/r/4424/ ........ Merged revisions 431824 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip/pjsip_cli.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/res/res_pjsip/pjsip_cli.c b/res/res_pjsip/pjsip_cli.c
index e15e75da4..16df3f59c 100644
--- a/res/res_pjsip/pjsip_cli.c
+++ b/res/res_pjsip/pjsip_cli.c
@@ -328,6 +328,28 @@ int ast_sip_unregister_cli_formatter(struct ast_sip_cli_formatter_entry *formatt
return 0;
}
+static char *handle_pjsip_show_version(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch(cmd) {
+ case CLI_INIT:
+ e->command = "pjsip show version";
+ e->usage =
+ "Usage: pjsip show version\n"
+ " Show the version of pjproject that res_pjsip is running against\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ ast_cli(a->fd, "PJPROJECT version currently running against: %s\n", pj_get_version());
+
+ return CLI_SUCCESS;
+}
+
+static struct ast_cli_entry pjsip_cli[] = {
+ AST_CLI_DEFINE(handle_pjsip_show_version, "Show the version of pjproject in use"),
+};
+
int ast_sip_initialize_cli(void)
{
formatter_registry = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, 17,
@@ -338,10 +360,13 @@ int ast_sip_initialize_cli(void)
return -1;
}
+ ast_cli_register_multiple(pjsip_cli, ARRAY_LEN(pjsip_cli));
+
return 0;
}
void ast_sip_destroy_cli(void)
{
+ ast_cli_unregister_multiple(pjsip_cli, ARRAY_LEN(pjsip_cli));
ao2_ref(formatter_registry, -1);
}