diff --git a/acl.c b/acl.c
index bb735dfbf4bdd308a04c4d5b0d1369d4df7bd5a9..b66eeab0f93167a8a88091e0585d77938508726d 100755
--- a/acl.c
+++ b/acl.c
@@ -36,6 +36,10 @@
 #include <sys/sockio.h>
 #endif
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/acl.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
diff --git a/alaw.c b/alaw.c
index 548230e8b1be7c98a7f39f02707111302117bf19..6fd99713d2445ff44a78be8cfc39fde919dfc66b 100755
--- a/alaw.c
+++ b/alaw.c
@@ -11,6 +11,10 @@
  * the GNU General Public License
  */
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/alaw.h"
 
 #define AMI_MASK 0x55
diff --git a/app.c b/app.c
index a21e3b2b1552fdf627960f7cbf7cb83b143acfe4..4b99456fbf6c7d04f14b64c31b8a70653ac4acb5 100755
--- a/app.c
+++ b/app.c
@@ -23,6 +23,10 @@
 #include <sys/stat.h>
 #include <regex.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/file.h"
@@ -33,7 +37,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/lock.h"
 #include "asterisk/indications.h"
-#include "asterisk.h"
 
 #define MAX_OTHER_FORMATS 10
 
diff --git a/asterisk.c b/asterisk.c
index 1c0ba53d032fb5b47ca173e82fd4d5f874f4494a..91db7d9a5b06144b1bf46a6fce73f00e606ed681 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -28,12 +28,16 @@
 #include <grp.h>
 #include <pwd.h>
 #include <sys/stat.h>
+#include <regex.h>
 
 #if  defined(__FreeBSD__) || defined( __NetBSD__ ) || defined(SOLARIS)
 #include <netdb.h>
 #endif
 
 #include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/logger.h"
 #include "asterisk/options.h"
 #include "asterisk/cli.h"
@@ -60,6 +64,7 @@
 #include "asterisk/config.h"
 #include "asterisk/version.h"
 #include "asterisk/build.h"
+#include "asterisk/linkedlists.h"
 
 #include "defaults.h"
 
@@ -147,6 +152,85 @@ static int shuttingdown = 0;
 static int restartnow = 0;
 static pthread_t consolethread = AST_PTHREADT_NULL;
 
+struct file_version {
+	const char *file;
+	const char *version;
+	AST_LIST_ENTRY(file_version) list;
+};
+
+static AST_LIST_HEAD_STATIC(file_versions, file_version);
+
+void ast_register_file_version(const char *file, const char *version)
+{
+	struct file_version *new;
+
+	new = calloc(1, sizeof(*new));
+	if (!new)
+		return;
+
+	new->file = file;
+	new->version = version;
+	AST_LIST_LOCK(&file_versions);
+	AST_LIST_INSERT_HEAD(&file_versions, new, list);
+	AST_LIST_UNLOCK(&file_versions);
+}
+
+void ast_unregister_file_version(const char *file)
+{
+	struct file_version *find;
+
+	AST_LIST_LOCK(&file_versions);
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&file_versions, find, list) {
+		if (!strcasecmp(find->file, file)) {
+			AST_LIST_REMOVE_CURRENT(&file_versions, list);
+			break;
+		}
+	}
+	AST_LIST_TRAVERSE_SAFE_END;
+	AST_LIST_UNLOCK(&file_versions);
+}
+
+static char show_version_files_help[] = 
+"Usage: show version files [like <pattern>]\n"
+"       Shows the revision numbers of the files used to build this copy of Asterisk.\n"
+"       Optional regular expression pattern is used to filter the file list.\n";
+
+static int handle_show_version_files(int fd, int argc, char *argv[])
+{
+	struct file_version *iterator;
+
+	AST_LIST_LOCK(&file_versions);
+	AST_LIST_TRAVERSE(&file_versions, iterator, list) {
+		ast_cli(fd, "%-25.25s %-20.20s\n", iterator->file, iterator->version);
+	}
+	AST_LIST_UNLOCK(&file_versions);
+	return RESULT_SUCCESS;
+}
+
+static char *complete_show_version_files(char *line, char *word, int pos, int state)
+{
+	struct file_version *find;
+	int which = 0;
+	char *ret = NULL;
+	int matchlen = strlen(word);
+
+	if (pos != 3)
+		return NULL;
+
+	AST_LIST_LOCK(&file_versions);
+	AST_LIST_TRAVERSE(&file_versions, find, list) {
+		if (!strncasecmp(word, find->file, matchlen)) {
+			if (++which > state) {
+				ret = strdup(find->file);
+				break;
+			}
+		}
+	}
+	AST_LIST_UNLOCK(&file_versions);
+
+	return ret;
+}
+
 int ast_register_atexit(void (*func)(void))
 {
 	int res = -1;
@@ -936,6 +1020,8 @@ static struct ast_cli_entry core_cli[] = {
 	  "Restart Asterisk at empty call volume", restart_when_convenient_help },
 	{ { "!", NULL }, handle_bang,
 	  "Execute a shell command", bang_help },
+	{ { "show", "version", "files", NULL }, handle_show_version_files,
+	  "Show versions of files used to build Asterisk", show_version_files_help, complete_show_version_files },
 };
 
 static int ast_el_read_char(EditLine *el, char *cp)
diff --git a/astmm.c b/astmm.c
index be165ebf7adf47c29a2295a8cefd6531aa461492..fe8f7fdbc3a1abe3f4d431ca309b6061ced57234 100755
--- a/astmm.c
+++ b/astmm.c
@@ -20,6 +20,10 @@
 #include <string.h>
 #include <time.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/cli.h"
 #include "asterisk/logger.h"
 #include "asterisk/options.h"
diff --git a/autoservice.c b/autoservice.c
index 25c9ae8871707d4b4074cd38e73ba5ba41b8ec9e..1a655a790827b9b6433c34074ebe76b51c47c4a8 100755
--- a/autoservice.c
+++ b/autoservice.c
@@ -20,6 +20,10 @@
 #include <unistd.h>
 #include <math.h>			/* For PI */
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/pbx.h"
 #include "asterisk/frame.h"
 #include "asterisk/sched.h"
diff --git a/callerid.c b/callerid.c
index 430f3cedcca97499d2f04962144ab81268435c7a..d51721d4896fb6acc48e8934bd9e771bcc870b3f 100755
--- a/callerid.c
+++ b/callerid.c
@@ -22,6 +22,10 @@
 #include <math.h>
 #include <ctype.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/ulaw.h"
 #include "asterisk/alaw.h"
 #include "asterisk/frame.h"
diff --git a/cdr.c b/cdr.c
index 6ceb4aad17ff1442e8291407aaf3e07a16d08b89..919b6e4022f26b036dd18a43eed0a183f956c11a 100755
--- a/cdr.c
+++ b/cdr.c
@@ -20,6 +20,10 @@
 #include <stdio.h>
 #include <signal.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
 #include "asterisk/cdr.h"
diff --git a/channel.c b/channel.c
index 9797f0ab15774b2d884c3511016c18fb952f61ce..b8e042dd486c6124b05302342537d3bb63fb9e8e 100755
--- a/channel.c
+++ b/channel.c
@@ -32,6 +32,10 @@
 #endif
 #endif
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/pbx.h"
 #include "asterisk/frame.h"
 #include "asterisk/sched.h"
@@ -53,7 +57,6 @@
 #include "asterisk/lock.h"
 #include "asterisk/app.h"
 #include "asterisk/transcap.h"
-#include "asterisk.h"
 
 /* uncomment if you have problems with 'monitoring' synchronized files */
 #if 0
diff --git a/chanvars.c b/chanvars.c
index 3d768b213f9ab4fe940e4e3fe413eabb10362b98..fe4cc15644be38b19f8ce1278eb91ff0663145ee 100755
--- a/chanvars.c
+++ b/chanvars.c
@@ -14,6 +14,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/chanvars.h"
 #include "asterisk/logger.h"
 
diff --git a/cli.c b/cli.c
index 4f1ce103a61f5ab2a723c137c0f55d3f5dd04ea8..c844da82a7f132bf3cb9bfa461e3673f0a66ba7d 100755
--- a/cli.c
+++ b/cli.c
@@ -19,6 +19,10 @@
 #include <string.h>
 #include <ctype.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/logger.h"
 #include "asterisk/options.h"
 #include "asterisk/cli.h"
@@ -31,7 +35,6 @@
 /* For rl_filename_completion */
 #include "editline/readline/readline.h"
 /* For module directory */
-#include "asterisk.h"
 #include "asterisk/version.h"
 #include "asterisk/build.h"
 
@@ -227,17 +230,17 @@ static int handle_unload(int fd, int argc, char *argv[])
 	return RESULT_SUCCESS;
 }
 
-#define MODLIST_FORMAT  "%-30s %-40.40s %-20.20s %-10d\n"
-#define MODLIST_FORMAT2 "%-30s %-40.40s %-20.20s %-10s\n"
+#define MODLIST_FORMAT  "%-30s %-40.40s %-10d\n"
+#define MODLIST_FORMAT2 "%-30s %-40.40s %-10s\n"
 
 AST_MUTEX_DEFINE_STATIC(climodentrylock);
 static int climodentryfd = -1;
 
-static int modlist_modentry(const char *module, const char *description, int usecnt, const char *version, const char *like)
+static int modlist_modentry(const char *module, const char *description, int usecnt, const char *like)
 {
 	/* Comparing the like with the module */
 	if (strstr(module, like) != NULL) {
-		ast_cli(climodentryfd, MODLIST_FORMAT, module, description, version, usecnt);
+		ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt);
 		return 1;
 	} 
 	return 0;
@@ -384,7 +387,7 @@ static int handle_modlist(int fd, int argc, char *argv[])
 		
 	ast_mutex_lock(&climodentrylock);
 	climodentryfd = fd;
-	ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Version", "Use Count");
+	ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Use Count");
 	ast_cli(fd,"%d modules loaded\n", ast_update_module_list(modlist_modentry, like));
 	climodentryfd = -1;
 	ast_mutex_unlock(&climodentrylock);
@@ -822,6 +825,22 @@ static struct ast_cli_entry *find_cli(char *cmds[], int exact)
 	int y;
 	int match;
 	struct ast_cli_entry *e=NULL;
+
+	for (e=helpers;e;e=e->next) {
+		match = 1;
+		for (y=0;match && cmds[y]; y++) {
+			if (!e->cmda[y] && !exact)
+				break;
+			if (!e->cmda[y] || strcasecmp(e->cmda[y], cmds[y]))
+				match = 0;
+		}
+		if ((exact > -1) && e->cmda[y])
+			match = 0;
+		if (match)
+			break;
+	}
+	if (e)
+		return e;
 	for (x=0;builtins[x].cmda[0];x++) {
 		/* start optimistic */
 		match = 1;
@@ -843,20 +862,7 @@ static struct ast_cli_entry *find_cli(char *cmds[], int exact)
 		if (match)
 			return &builtins[x];
 	}
-	for (e=helpers;e;e=e->next) {
-		match = 1;
-		for (y=0;match && cmds[y]; y++) {
-			if (!e->cmda[y] && !exact)
-				break;
-			if (!e->cmda[y] || strcasecmp(e->cmda[y], cmds[y]))
-				match = 0;
-		}
-		if ((exact > -1) && e->cmda[y])
-			match = 0;
-		if (match)
-			break;
-	}
-	return e;
+	return NULL;
 }
 
 static void join(char *dest, size_t destsize, char *w[])
diff --git a/config.c b/config.c
index 916dc0c8351bb394bc06f5433586e6f15333d717..f99577f9c6b25313d23ed6cc6ba8db9e043d998c 100755
--- a/config.c
+++ b/config.c
@@ -25,6 +25,10 @@
 # include <glob.h>
 #endif
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/config.h"
 #include "asterisk/cli.h"
 #include "asterisk/lock.h"
@@ -33,7 +37,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/channel.h"
 #include "asterisk/app.h"
-#include "asterisk.h"
 
 #define MAX_NESTED_COMMENTS 128
 #define COMMENT_START ";--"
diff --git a/config_old.c b/config_old.c
index 1c8a91290778c1229a4842e2cf153c1d5bcc843c..770d8e50d697896092c87ebf868de2036b7628fb 100755
--- a/config_old.c
+++ b/config_old.c
@@ -17,6 +17,10 @@
 #include <string.h>
 #include <errno.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/config.h"
 #include "asterisk/logger.h"
 
diff --git a/db.c b/db.c
index 29603d1db95984209a34d3263ee73e312c58af0c..7baabdb39675458b798f831519ec1d0418d28858 100755
--- a/db.c
+++ b/db.c
@@ -24,6 +24,10 @@
 #include <unistd.h>
 #include <dirent.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/channel.h"
 #include "asterisk/file.h"
 #include "asterisk/app.h"
@@ -36,7 +40,6 @@
 #include "asterisk/lock.h"
 #include "asterisk/manager.h"
 #include "db1-ast/include/db.h"
-#include "asterisk.h"
 
 static DB *astdb;
 AST_MUTEX_DEFINE_STATIC(dblock);
diff --git a/dns.c b/dns.c
index 7fe8a2513c79eeb562b87c309142e3d5dc57ed9a..5f44bbb8730edd9a3cb9bcbbc74c8b0a10433083 100755
--- a/dns.c
+++ b/dns.c
@@ -16,6 +16,10 @@
 #include <resolv.h>
 #include <unistd.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
 #include "asterisk/dns.h"
diff --git a/dnsmgr.c b/dnsmgr.c
index c954b41883de7856abc5f27f0c53b99a0bf15767..2b05ad5f78a9e86e968b6ac600049dc206f1c665 100755
--- a/dnsmgr.c
+++ b/dnsmgr.c
@@ -23,6 +23,10 @@
 #include <regex.h>
 #include <signal.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/dnsmgr.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/utils.h"
@@ -31,7 +35,6 @@
 #include "asterisk/sched.h"
 #include "asterisk/options.h"
 #include "asterisk/cli.h"
-#include "asterisk.h"
 
 static struct sched_context *sched;
 static int refresh_sched = -1;
diff --git a/dsp.c b/dsp.c
index 7712b077be7d40ed331d37ea551bb16acd04858b..fb945a6bfb62ef707b9c74bbb0e1135cb0a5c6ed 100755
--- a/dsp.c
+++ b/dsp.c
@@ -36,6 +36,10 @@
 #include <errno.h>
 #include <stdio.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/frame.h"
 #include "asterisk/channel.h"
 #include "asterisk/logger.h"
diff --git a/enum.c b/enum.c
index a17281c16e4aba244bbc36239c2a7be54e592658..44a8dfaab8652045e92d9e5a87290e3affeb7a41 100755
--- a/enum.c
+++ b/enum.c
@@ -26,6 +26,10 @@
 #include <unistd.h>
 #include <errno.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/logger.h"
 #include "asterisk/options.h"
 #include "asterisk/enum.h"
diff --git a/file.c b/file.c
index 52e81716d2d63f1bd49f01b5374595134d627c31..4eaff4626d64726485d72c9c5b2e1e9c6d1b80fb 100755
--- a/file.c
+++ b/file.c
@@ -22,6 +22,10 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/frame.h"
 #include "asterisk/file.h"
 #include "asterisk/cli.h"
@@ -33,7 +37,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/lock.h"
 #include "asterisk/app.h"
-#include "asterisk.h"
 
 struct ast_format {
 	/* Name of format */
diff --git a/frame.c b/frame.c
index 23a6e59506be8ec53f0143ea5f2e5bce17fb8b5b..502b3f1f5fa3e435e2ed127516a9523e87cf20b5 100755
--- a/frame.c
+++ b/frame.c
@@ -17,6 +17,10 @@
 #include <errno.h>
 #include <stdio.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/frame.h"
 #include "asterisk/logger.h"
@@ -25,7 +29,6 @@
 #include "asterisk/cli.h"
 #include "asterisk/term.h"
 #include "asterisk/utils.h"
-#include "asterisk.h"
 
 #ifdef TRACE_FRAMES
 static int headers = 0;
diff --git a/fskmodem.c b/fskmodem.c
index df30581ae2cce27b806c97ffa321682b86857aa6..20716717f57cadfc3b6544e7f57dfd478d9894e1 100755
--- a/fskmodem.c
+++ b/fskmodem.c
@@ -16,6 +16,10 @@
 
 #include <stdio.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/fskmodem.h"
 
 #define NBW	2
diff --git a/funcs/pbx_functions.c b/funcs/pbx_functions.c
index 5171c6271bfbe6a08553fc5d411486e286415532..c998b61ed8224ac72a0521dc09005cc7e5ea2a8e 100755
--- a/funcs/pbx_functions.c
+++ b/funcs/pbx_functions.c
@@ -14,6 +14,10 @@
 #include <sys/types.h>
 #include <stdlib.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/module.h"
 #include "asterisk/pbx.h"
 #include "pbx_functions.h"
@@ -56,8 +60,3 @@ char *key()
 {
 	return ASTERISK_GPL_KEY;
 }
-
-const char *version()
-{
-	return "$Revision$";
-}
diff --git a/image.c b/image.c
index 804c2d87c2ac699a0dcc874a7239347975307ea7..067376326b2f30f5a65298bca47d9f3ad8720a2e 100755
--- a/image.c
+++ b/image.c
@@ -20,6 +20,10 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/sched.h"
 #include "asterisk/options.h"
 #include "asterisk/channel.h"
@@ -29,7 +33,6 @@
 #include "asterisk/translate.h"
 #include "asterisk/cli.h"
 #include "asterisk/lock.h"
-#include "asterisk.h"
 
 static struct ast_imager *list;
 AST_MUTEX_DEFINE_STATIC(listlock);
diff --git a/include/asterisk.h b/include/asterisk.h
index b4b26a7757b673d1cb5b76d3129432d4fb8ddc91..0e9d2e3654ca14c06a52debd1035f48d994708eb 100755
--- a/include/asterisk.h
+++ b/include/asterisk.h
@@ -3,9 +3,9 @@
  *
  * General Definitions for Asterisk top level program
  * 
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2005, Mark Spencer
  *
- * Mark Spencer <markster@linux-support.net>
+ * Mark Spencer <markster@digium.com>
  *
  * This program is free software, distributed under the terms of
  * the GNU General Public License
@@ -54,4 +54,21 @@ extern void ast_channels_init(void);
 extern int dnsmgr_init(void);
 extern void dnsmgr_reload(void);
 
-#endif
+void ast_register_file_version(const char *file, const char *version);
+void ast_unregister_file_version(const char *file);
+
+#ifdef __GNUC__
+#define ASTERISK_FILE_VERSION(x) \
+	static void __attribute__((constructor)) __register_file_version(void) \
+	{ \
+		ast_register_file_version(__FILE__, x); \
+	} \
+	static void __attribute__((destructor)) __unregister_file_version(void) \
+	{ \
+		ast_unregister_file_version(__FILE__); \
+	}
+#else /* ! __GNUC__ */
+#define ASTERISK_FILE_VERSION(x) static const char __file_version[] = x;
+#endif /* __GNUC__ */
+
+#endif /* _ASTERISK_H */
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h
index d90365920693432227cc35762b910aa56fd7f324..9f5f216fd2bb5f97e7598cd9b7594253a91e6cd0 100755
--- a/include/asterisk/linkedlists.h
+++ b/include/asterisk/linkedlists.h
@@ -66,14 +66,14 @@ struct name {								\
 
   Example usage:
   \code
-  static AST_LIST_HEAD_STATIC(entry_list, entry) entries;
+  static AST_LIST_HEAD_STATIC(entry_list, entry);
   \endcode
 
-  This would define \c struct \c entry_list, and declare an instance of it named
-  \a entries, all intended to hold a list of type \c struct \c entry.
+  This would define \c struct \c entry_list, intended to hold a list of
+  type \c struct \c entry.
 */
 #define AST_LIST_HEAD_STATIC(name, type)				\
-struct name {							\
+struct name {								\
 	struct type *first;						\
 	ast_mutex_t lock;						\
 } name = {								\
diff --git a/include/asterisk/module.h b/include/asterisk/module.h
index c674d16ae6c298309fcf8bb5789feb2376d72389..4889550a1126ab1e16c735812480705a0a928e6b 100755
--- a/include/asterisk/module.h
+++ b/include/asterisk/module.h
@@ -66,8 +66,6 @@ char *key(void);		/*! Return the below mentioned key, unmodified */
  */
 int reload(void);		/*! reload configs */
 
-const char *version(void);
-
 #define ASTERISK_GPL_KEY \
 	"This paragraph is Copyright (C) 2000, Linux Support Services, Inc.  \
 In order for your module to load, it must return this key via a function \
@@ -116,7 +114,7 @@ void ast_update_use_count(void);
  * For each of the modules loaded, modentry will be executed with the resource, description,
  * version, and usecount values of each particular module.
  */
-int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *version, const char *like),
+int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like),
 			   const char *like);
 
 /*! Ask this procedure to be run with modules have been updated */
diff --git a/indications.c b/indications.c
index 4867fd4bdfa02cb75c926c3440527f3402586f3d..59641e0aba477d68fbe1266da1d9fb7acedb0122 100755
--- a/indications.c
+++ b/indications.c
@@ -21,6 +21,10 @@
 #include <string.h>
 #include <math.h>			/* For PI */
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/indications.h"
 #include "asterisk/frame.h"
 #include "asterisk/options.h"
diff --git a/io.c b/io.c
index f04277c39bf6cf1e8b31488c899452891ba1888b..09d99d5f37eeb69d4d5782be17cd71cf33b0757d 100755
--- a/io.c
+++ b/io.c
@@ -18,6 +18,10 @@
 #include <string.h> /* for memset */
 #include <sys/ioctl.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/io.h"
 #include "asterisk/logger.h"
 
diff --git a/jitterbuf.c b/jitterbuf.c
index 2ffa143f72dff59977300432e8897de7db6d74af..3b69e5151a831a687c58605462aa4fde02cc9a22 100755
--- a/jitterbuf.c
+++ b/jitterbuf.c
@@ -17,6 +17,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "jitterbuf.h"
 
 /* define these here, just for ancient compiler systems */
diff --git a/loader.c b/loader.c
index b404fa0fa4bb92ac0fe9fa8d250dea97b6599cea..bc7e2bdfc41c2b5ce7cb0e9b974fd5b76e532354 100755
--- a/loader.c
+++ b/loader.c
@@ -17,6 +17,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/module.h"
 #include "asterisk/options.h"
 #include "asterisk/config.h"
@@ -34,7 +38,6 @@
 #include <dlfcn.h>
 #endif
 #include "asterisk/md5.h"
-#include "asterisk.h"
 
 #ifndef RTLD_NOW
 #define RTLD_NOW 0
@@ -51,7 +54,6 @@ struct module {
 	char *(*description)(void);
 	char *(*key)(void);
 	int (*reload)(void);
-	const char *(*version)(void);
 	void *lib;
 	char resource[256];
 	struct module *next;
@@ -253,11 +255,6 @@ int ast_module_reload(const char *name)
 	return reloaded;
 }
 
-static const char *unknown_version(void)
-{
-	return "--unknown--";
-}
-
 static int __load_resource(const char *resource_name, const struct ast_config *cfg)
 {
 	static char fn[256];
@@ -358,12 +355,6 @@ static int __load_resource(const char *resource_name, const struct ast_config *c
 	if (m->reload == NULL)
 		m->reload = dlsym(m->lib, "_reload");
 
-	m->version = dlsym(m->lib, "version");
-	if (m->version == NULL)
-		m->version = dlsym(m->lib, "_version");
-	if (m->version == NULL)
-		m->version = unknown_version;
-
 	if (!m->key || !(key = m->key())) {
 		ast_log(LOG_WARNING, "Key routine returned NULL in module %s\n", fn);
 		key = NULL;
@@ -563,7 +554,7 @@ void ast_update_use_count(void)
 	
 }
 
-int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *version, const char *like),
+int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like),
 			   const char *like)
 {
 	struct module *m;
@@ -574,10 +565,7 @@ int ast_update_module_list(int (*modentry)(const char *module, const char *descr
 		unlock = 0;
 	m = module_list;
 	while (m) {
-		char ver_string[80];
-
-		ast_copy_string(ver_string, m->version(), sizeof(ver_string));
-		total_mod_loaded += modentry(m->resource, m->description(), m->usecount(), ast_strip(ast_strip_quoted(ver_string, "$", "$")), like);
+		total_mod_loaded += modentry(m->resource, m->description(), m->usecount(), like);
 		m = m->next;
 	}
 	if (unlock)
diff --git a/logger.c b/logger.c
index 9e31cd5856c7bfdd67030fa992cac753ec3bf8ec..6e938ac044605dc71250605ba14b7167136d78ed 100755
--- a/logger.c
+++ b/logger.c
@@ -25,6 +25,10 @@
 		        from <syslog.h> which is included by logger.h */
 #include <syslog.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/options.h"
 #include "asterisk/channel.h"
@@ -33,7 +37,6 @@
 #include "asterisk/cli.h"
 #include "asterisk/utils.h"
 #include "asterisk/manager.h"
-#include "asterisk.h"
 
 static int syslog_level_map[] = {
 	LOG_DEBUG,
diff --git a/manager.c b/manager.c
index 5a6af77cff00b8a205ec3ffec2a30b06a9cbe8c0..df6b93ff0466a6d82c1b05ebf74c60c3277515e0 100755
--- a/manager.c
+++ b/manager.c
@@ -27,6 +27,10 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/channel.h"
 #include "asterisk/file.h"
 #include "asterisk/manager.h"
diff --git a/md5.c b/md5.c
index b0b5d39d18c78b056f52f5750094d190baed7973..ea162c35ab36021035cfd7ca058f1be08ff68425 100755
--- a/md5.c
+++ b/md5.c
@@ -19,6 +19,10 @@
  */
 #include <string.h>		/* for memcpy() */
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/endian.h"
 #include "asterisk/md5.h"
 
diff --git a/pbx.c b/pbx.c
index 1307f6768a3313600ba39489ead6c2733a1884f1..717ba9d68b580d5d13a5c4df120d3e6649b1e812 100755
--- a/pbx.c
+++ b/pbx.c
@@ -22,6 +22,10 @@
 #include <time.h>
 #include <sys/time.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/cli.h"
 #include "asterisk/pbx.h"
@@ -41,7 +45,6 @@
 #include "asterisk/causes.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/app.h"
-#include "asterisk.h"
 
 /*
  * I M P O R T A N T :
diff --git a/plc.c b/plc.c
index 08f67c21bc5d9cc9a298053b7c881d12dd74cd67..261fca8ec30dc25acee1d9391508f1f161d001b5 100755
--- a/plc.c
+++ b/plc.c
@@ -35,6 +35,10 @@
 #include <math.h>
 #include <limits.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/plc.h"
 
 #if !defined(FALSE)
diff --git a/privacy.c b/privacy.c
index 0fbcc73d49bb3c9b1f8d3cab563b7c176636d946..2f9feab6e761d367caf91a53cba5561bf0b993fb 100755
--- a/privacy.c
+++ b/privacy.c
@@ -20,6 +20,10 @@
 #include <unistd.h>
 #include <dirent.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/channel.h"
 #include "asterisk/file.h"
 #include "asterisk/app.h"
@@ -31,7 +35,6 @@
 #include "asterisk/privacy.h"
 #include "asterisk/utils.h"
 #include "asterisk/lock.h"
-#include "asterisk.h"
 
 int ast_privacy_check(char *dest, char *cid)
 {
diff --git a/rtp.c b/rtp.c
index 12cb4961140f12274eb326a45a38cbaaf9d263ae..016cb89f106f981ffae7ddc12a6d68d12beef90f 100755
--- a/rtp.c
+++ b/rtp.c
@@ -26,6 +26,10 @@
 #include <arpa/inet.h>
 #include <fcntl.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/rtp.h"
 #include "asterisk/frame.h"
 #include "asterisk/logger.h"
diff --git a/say.c b/say.c
index 65f8fe7c60449d3aecb3406a4c80058b9e324e14..908c44018f157b9795c4fb59866390487099d349 100755
--- a/say.c
+++ b/say.c
@@ -21,11 +21,16 @@
 #include <time.h>
 #include <ctype.h>
 #include <math.h>
+#include <stdio.h>
 
 #ifdef SOLARIS
 #include <iso/limits_iso.h>
 #endif
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/file.h"
 #include "asterisk/channel.h"
 #include "asterisk/logger.h"
@@ -33,8 +38,6 @@
 #include "asterisk/lock.h"
 #include "asterisk/localtime.h"
 #include "asterisk/utils.h"
-#include "asterisk.h"
-#include <stdio.h>
 
 /* Forward declaration */
 static int wait_file(struct ast_channel *chan, const char *ints, const char *file, const char *lang);
diff --git a/sched.c b/sched.c
index 723c44a32b72ce0b1e9624cddbcfdea53270e6da..98529ea9264fd3bd7da8dd4b73400ead93d65af7 100755
--- a/sched.c
+++ b/sched.c
@@ -23,6 +23,10 @@
 #include <unistd.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/sched.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
diff --git a/srv.c b/srv.c
index b7b097d9e156696032b253d144e99609f836feaa..b74d7615889f135df17ab528a99bfdb4b3e42914 100755
--- a/srv.c
+++ b/srv.c
@@ -22,6 +22,10 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/channel.h"
 #include "asterisk/logger.h"
 #include "asterisk/srv.h"
diff --git a/tdd.c b/tdd.c
index fb2da9e3202480a9840cf9306dc7ae41580720de..9d36e353402f4de8f145471f1a098b495e762948 100755
--- a/tdd.c
+++ b/tdd.c
@@ -22,6 +22,10 @@
 #include <math.h>
 #include <ctype.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/ulaw.h"
 #include "asterisk/tdd.h"
 #include "asterisk/logger.h"
diff --git a/term.c b/term.c
index 5bdfe28392c2fe42f0fbce83a5df8e5f6332068b..f210e2a9956d050d6788415bd8384e44d8c923e2 100755
--- a/term.c
+++ b/term.c
@@ -22,6 +22,10 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/term.h"
 #include "asterisk/options.h"
 #include "asterisk/lock.h"
diff --git a/translate.c b/translate.c
index 890e04222089f259487118a53a882d2016e176ba..4c79fbcb59e5b68401ee0e8a6aeac78e66940e0e 100755
--- a/translate.c
+++ b/translate.c
@@ -19,6 +19,10 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
 #include "asterisk/logger.h"
diff --git a/ulaw.c b/ulaw.c
index 37ab25488951033b3c32b85757ae0d5127c85474..3a867e11e3ae51472f50b9c90447ead252b6b102 100755
--- a/ulaw.c
+++ b/ulaw.c
@@ -11,6 +11,10 @@
  * the GNU General Public License
  */
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/ulaw.h"
 
 #define ZEROTRAP    /* turn on the trap as per the MIL-STD */
diff --git a/utils.c b/utils.c
index e2ce549eb11d9714169c4b6948fa2574d2ed5b58..6841cb7fe9ff0efdb412d822960ae3e87aac6a95 100755
--- a/utils.c
+++ b/utils.c
@@ -24,6 +24,10 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/utils.h"
 #include "asterisk/io.h"