[svn-commits] file: trunk r431825 - in /trunk: ./ res/res_pjsip/pjsip_cli.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Feb 15 10:01:11 CST 2015


Author: file
Date: Sun Feb 15 10:01:09 2015
New Revision: 431825

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=431825
Log:
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

Modified:
    trunk/   (props changed)
    trunk/res/res_pjsip/pjsip_cli.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/res/res_pjsip/pjsip_cli.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip/pjsip_cli.c?view=diff&rev=431825&r1=431824&r2=431825
==============================================================================
--- trunk/res/res_pjsip/pjsip_cli.c (original)
+++ trunk/res/res_pjsip/pjsip_cli.c Sun Feb 15 10:01:09 2015
@@ -328,6 +328,28 @@
 	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 @@
 		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);
 }




More information about the svn-commits mailing list