From 4f3e4e22ef237943c3d68aa6ca4c9aa119323397 Mon Sep 17 00:00:00 2001
From: Brett Bryant <bbryant@digium.com>
Date: Thu, 1 May 2008 23:09:08 +0000
Subject: [PATCH] Add two new console commands "pri show version" and "ss7 show
 version" that will show the version of each library respectively.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115078 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 CHANGES             |  5 +++++
 channels/chan_zap.c | 32 ++++++++++++++++++++++++++++++++
 configure           |  6 +++---
 configure.ac        |  4 ++--
 4 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/CHANGES b/CHANGES
index 5a75d512fb..d039637e88 100644
--- a/CHANGES
+++ b/CHANGES
@@ -82,6 +82,11 @@ CLI Changes
   * New CLI command, "config reload <file.conf>" which reloads any module that
      references that particular configuration file.  Also added "config list"
      which shows which configuration files are in use.
+  * New CLI commands, "pri show version" and "ss7 show version" that will
+     display which version of libpri and libss7 are being used, respectively.
+	 A new API call was added so trunk will now have to be compiled against
+	 a versions of libpri and libss7 that have them or it will not know that
+	 these libraries exist.
 
 DNS manager changes
 -------------------
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 589a8fe216..c201c1a4e1 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -11691,6 +11691,21 @@ static char *handle_pri_show_debug(struct ast_cli_entry *e, int cmd, struct ast_
 	return CLI_SUCCESS;
 }
 
+static char *handle_pri_version(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "pri show version";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	ast_cli(a->fd, "libpri version: %s\n", pri_get_version());
+
+	return CLI_SUCCESS;
+}
+
 static struct ast_cli_entry zap_pri_cli[] = {
 	AST_CLI_DEFINE(handle_pri_debug, "Enables PRI debugging on a span"),
 	AST_CLI_DEFINE(handle_pri_no_debug, "Disables PRI debugging on a span"),
@@ -11700,6 +11715,7 @@ static struct ast_cli_entry zap_pri_cli[] = {
 	AST_CLI_DEFINE(handle_pri_show_debug, "Displays current PRI debug settings"),
 	AST_CLI_DEFINE(handle_pri_set_debug_file, "Sends PRI debug output to the specified file"),
 	AST_CLI_DEFINE(handle_pri_unset_debug_file, "Ends PRI debug output to file"),
+	AST_CLI_DEFINE(handle_pri_version, "Displays libpri version"),
 };
 
 #endif /* HAVE_PRI */
@@ -13103,12 +13119,28 @@ static char *handle_ss7_show_linkset(struct ast_cli_entry *e, int cmd, struct as
 	return CLI_SUCCESS;
 }
 
+static char *handle_ss7_version(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "ss7 show version";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	ast_cli(a->fd, "libss7 version: %s\n", ss7_get_version());
+
+	return CLI_SUCCESS;
+}
+
 static struct ast_cli_entry zap_ss7_cli[] = {
 	AST_CLI_DEFINE(handle_ss7_debug, "Enables SS7 debugging on a linkset"), 
 	AST_CLI_DEFINE(handle_ss7_no_debug, "Disables SS7 debugging on a linkset"), 
 	AST_CLI_DEFINE(handle_ss7_block_cic, "Disables SS7 debugging on a linkset"),
 	AST_CLI_DEFINE(handle_ss7_unblock_cic, "Disables SS7 debugging on a linkset"),
 	AST_CLI_DEFINE(handle_ss7_show_linkset, "Shows the status of a linkset"),
+	AST_CLI_DEFINE(handle_ss7_version, "Displays libss7 version"),
 };
 #endif /* HAVE_SS7 */
 
diff --git a/configure b/configure
index 46ad2fdb9c..b49d8cff33 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 114696 .
+# From configure.ac Revision: 114713 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for asterisk 1.6.
 #
@@ -38314,7 +38314,7 @@ if test "x${PBX_PRI}" != "x1" -a "${USE_PRI}" != "no"; then
       	 pbxlibdir="-L${PRI_DIR}"
       fi
    fi
-   pbxfuncname="pri_new_bri"
+   pbxfuncname="pri_get_version"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
       AST_PRI_FOUND=yes
    else
@@ -38576,7 +38576,7 @@ if test "x${PBX_SS7}" != "x1" -a "${USE_SS7}" != "no"; then
       	 pbxlibdir="-L${SS7_DIR}"
       fi
    fi
-   pbxfuncname="isup_set_generic_name"
+   pbxfuncname="ss7_get_version"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
       AST_SS7_FOUND=yes
    else
diff --git a/configure.ac b/configure.ac
index a878707a46..e49d3531d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1265,9 +1265,9 @@ AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
 
 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 
-AST_EXT_LIB_CHECK([PRI], [pri], [pri_new_bri], [libpri.h])
+AST_EXT_LIB_CHECK([PRI], [pri], [pri_get_version], [libpri.h])
 
-AST_EXT_LIB_CHECK([SS7], [ss7], [isup_set_generic_name], [libss7.h])
+AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_get_version], [libss7.h])
 
 if test "${USE_PWLIB}" != "no"; then
 	if test -n "${PWLIB_DIR}"; then
-- 
GitLab