diff --git a/acl.c b/acl.c
index b66eeab0f93167a8a88091e0585d77938508726d..a22f45621acff8e32ac9dbcfc29ec7c258991672 100755
--- a/acl.c
+++ b/acl.c
@@ -38,7 +38,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/acl.h"
 #include "asterisk/logger.h"
diff --git a/alaw.c b/alaw.c
index 6fd99713d2445ff44a78be8cfc39fde919dfc66b..89ecfdca72d998628d153829ba01beeb264863bb 100755
--- a/alaw.c
+++ b/alaw.c
@@ -13,7 +13,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/alaw.h"
 
diff --git a/app.c b/app.c
index 4b99456fbf6c7d04f14b64c31b8a70653ac4acb5..bb21be9e899425f2e87879be5ee9e18c26724457 100755
--- a/app.c
+++ b/app.c
@@ -25,7 +25,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
diff --git a/asterisk.c b/asterisk.c
index 00a1b509a05f2a2196b9c94c175ed6076e320591..19534eaed3312cd71cb87f5c14f328189c1ce001 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -36,7 +36,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/logger.h"
 #include "asterisk/options.h"
diff --git a/autoservice.c b/autoservice.c
index 1a655a790827b9b6433c34074ebe76b51c47c4a8..21bc44db3a1d4d0c18cb58e6a91cc7e504a8b0bd 100755
--- a/autoservice.c
+++ b/autoservice.c
@@ -22,7 +22,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/pbx.h"
 #include "asterisk/frame.h"
diff --git a/callerid.c b/callerid.c
index d51721d4896fb6acc48e8934bd9e771bcc870b3f..79fde4d893c97901bce9f210df059fa1944e3943 100755
--- a/callerid.c
+++ b/callerid.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/ulaw.h"
 #include "asterisk/alaw.h"
diff --git a/cdr.c b/cdr.c
index 919b6e4022f26b036dd18a43eed0a183f956c11a..4b277a412f88d15a1f5a60c1d6787386a0e9b2ab 100755
--- a/cdr.c
+++ b/cdr.c
@@ -22,7 +22,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c
index ec995a675b3ad587476bd2bf5b245b9c780a9f21..bcf20feade4614e0601b879b07fc5892cef222fc 100755
--- a/cdr/cdr_csv.c
+++ b/cdr/cdr_csv.c
@@ -18,7 +18,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/channel.h"
 #include "asterisk/cdr.h"
diff --git a/cdr/cdr_custom.c b/cdr/cdr_custom.c
index e524d71c3e64b05cb0ed49f19bd96e7c206c42bf..d35e3eef2c0a59f105685ede91a994d2f19cfd19 100755
--- a/cdr/cdr_custom.c
+++ b/cdr/cdr_custom.c
@@ -18,7 +18,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/channel.h"
 #include "asterisk/cdr.h"
diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c
index c529d05e104fe50ea7fc6e49c92653e54d093076..3aa9afdc01eb2ab5e42bf90f05acca24882604c2 100755
--- a/cdr/cdr_manager.c
+++ b/cdr/cdr_manager.c
@@ -15,7 +15,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/channel.h"
 #include "asterisk/cdr.h"
diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c
index feed26a1864253126074a0550e74830f96bbeedf..78971d4d094b36c0fdcf874bddd71d798fd74473 100755
--- a/cdr/cdr_odbc.c
+++ b/cdr/cdr_odbc.c
@@ -25,7 +25,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/config.h"
 #include "asterisk/options.h"
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c
index 7039e72cc1c2a6dea05ec82084c47ab7c8c97060..99828ea30b67ee9a636fb0c45ac903ca6ea15773 100755
--- a/cdr/cdr_pgsql.c
+++ b/cdr/cdr_pgsql.c
@@ -26,7 +26,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/config.h"
 #include "asterisk/options.h"
diff --git a/channel.c b/channel.c
index b8e042dd486c6124b05302342537d3bb63fb9e8e..b0a4b2c3c296dcb08a76b6bc0b4786ed420629f0 100755
--- a/channel.c
+++ b/channel.c
@@ -34,7 +34,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/pbx.h"
 #include "asterisk/frame.h"
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 102afb0f998e8acb37c7727acc291c8ddc0a6bc7..10fec951feba694acdc49fc285eaccd99da35cc8 100755
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index 9f83429206d803a8dc6e34eec36ccd4109d1360d..bae02ea7343f4c4abd33c0f352d90c1c203e5b67 100755
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/frame.h"
 #include "asterisk/logger.h"
diff --git a/channels/chan_features.c b/channels/chan_features.c
index 03bdba70601fb870ba6ce92695658ec4ee8c9004..f7505d30bbc1bbd0e804e688934f301b9f2bee07 100755
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index abb9ef2560b3c77b6b73453cc28dbe155dcc3c23..8c1b9c816a0ba44aa25d72b480c9fdc9cab473b5 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -13,7 +13,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/frame.h" 
diff --git a/channels/chan_local.c b/channels/chan_local.c
index e2e54f86cff5526969b849b7437868e8243b81e5..8804b6a53c902a946c43224879873d0a2a3d59be 100755
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 843af438da859d5765bb24e840283b8294d12417..6382b8bb56228f7173e18204f044cdfcf7978d0b 100755
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -72,7 +72,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/channels/chan_modem.c b/channels/chan_modem.c
index c1e61a0bcc6884c64dcbd11b8c496fa89291564b..0b2e10d091a9778e8032dc7e24104d70b17dfb46 100755
--- a/channels/chan_modem.c
+++ b/channels/chan_modem.c
@@ -28,7 +28,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/channels/chan_modem_aopen.c b/channels/chan_modem_aopen.c
index ec6a35fcaf412c388ff18c1d541f82ae42f8ecb0..f18ded9fc4ea3a2fafacc57cebf55af46dae77db 100755
--- a/channels/chan_modem_aopen.c
+++ b/channels/chan_modem_aopen.c
@@ -19,7 +19,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/vmodem.h"
diff --git a/channels/chan_modem_bestdata.c b/channels/chan_modem_bestdata.c
index f1f6a90c9277718bc98a487d82e9f5b0a19c3162..5746b2aa4575465d8edc1508041954c5b9d41cb3 100755
--- a/channels/chan_modem_bestdata.c
+++ b/channels/chan_modem_bestdata.c
@@ -21,7 +21,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/vmodem.h"
diff --git a/channels/chan_modem_i4l.c b/channels/chan_modem_i4l.c
index 92cca420aadfa09c8284b2e93e2d2877871fa61c..7d3761c2c6681164cf7afd722a816714a08f2daa 100755
--- a/channels/chan_modem_i4l.c
+++ b/channels/chan_modem_i4l.c
@@ -21,7 +21,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/vmodem.h"
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 2d13446451d8c95dbfd33ddc95b3e252c4730d6e..ff4e10f2781bcae53a2900ad427ce719e5c056f9 100755
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -34,7 +34,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/frame.h"
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 513be4e3840c38bc55a863eb41d1691e6c39f976..327f25d36566aae8cb7b2eee4a848e02d63cc333 100755
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -32,7 +32,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index f677d839b3be505505155b9dd743a3034e3ad36b..4dfc802f36eeba0f16004c82e82e22d2b0986bf4 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -32,7 +32,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index e5fd4c92da3931e4c5fa0ade913b74c624237be8..588b0b925aee9f0fce82cd46c3f09ff827c7fa7b 100755
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -32,7 +32,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index bd72c71814db402c3616d8d5f819da12f3f39ffe..1fa4d4a8e86a1ba92bd45e86b0af98b328ea027f 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -41,7 +41,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c
index dddf1349bd35e1662fb516324808ae0912eeaf3a..2853c768e877cc8ab42e374c470a92f441fa9982 100755
--- a/channels/iax2-parser.c
+++ b/channels/iax2-parser.c
@@ -18,7 +18,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/frame.h"
 #include "asterisk/utils.h"
diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c
index 143c1b521d28ca69eb85829352a606aa7abe8f7e..03f63c8f0ae8cfde8ca48c0516131457518626d8 100755
--- a/channels/iax2-provision.c
+++ b/channels/iax2-provision.c
@@ -14,7 +14,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/config.h"
 #include "asterisk/logger.h"
diff --git a/chanvars.c b/chanvars.c
index fe4cc15644be38b19f8ce1278eb91ff0663145ee..7cd32cc184a368434735de6129424dc4439eb7db 100755
--- a/chanvars.c
+++ b/chanvars.c
@@ -16,7 +16,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/chanvars.h"
 #include "asterisk/logger.h"
diff --git a/cli.c b/cli.c
index c844da82a7f132bf3cb9bfa461e3673f0a66ba7d..0a05489abcfb2083d2e5be2637577cbb01639d79 100755
--- a/cli.c
+++ b/cli.c
@@ -21,7 +21,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/logger.h"
 #include "asterisk/options.h"
diff --git a/codecs/codec_a_mu.c b/codecs/codec_a_mu.c
index 772d8eb62b0bb90dc04847ebf8d4fc0449ca4256..475446046d9c22d37ed2a352bc469a98884b4e31 100755
--- a/codecs/codec_a_mu.c
+++ b/codecs/codec_a_mu.c
@@ -10,6 +10,17 @@
  * the GNU General Public License
  */
 
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/logger.h"
 #include "asterisk/module.h"
@@ -17,12 +28,6 @@
 #include "asterisk/channel.h"
 #include "asterisk/alaw.h"
 #include "asterisk/ulaw.h"
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 
 #define BUFFER_SIZE   8096	/* size for the translation buffers */
 
diff --git a/codecs/codec_adpcm.c b/codecs/codec_adpcm.c
index 55a0cca75547a11ae83beebcd22aa459695ab2bc..76423066b23bc86205288d761554eaf9a10684d1 100755
--- a/codecs/codec_adpcm.c
+++ b/codecs/codec_adpcm.c
@@ -14,6 +14,17 @@
  * the GNU General Public License
  */
 
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/logger.h"
 #include "asterisk/module.h"
@@ -21,12 +32,6 @@
 #include "asterisk/options.h"
 #include "asterisk/translate.h"
 #include "asterisk/channel.h"
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 
 /* define NOT_BLI to use a faster but not bit-level identical version */
 /* #define NOT_BLI */
diff --git a/codecs/codec_alaw.c b/codecs/codec_alaw.c
index bd1bdea72de022c17071d3733e559d8f8d934f10..31333bd39603344f178c0ff2f348ed89d1ec2f3c 100755
--- a/codecs/codec_alaw.c
+++ b/codecs/codec_alaw.c
@@ -10,6 +10,17 @@
  * the GNU General Public License
  */
 
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/logger.h"
 #include "asterisk/module.h"
@@ -18,12 +29,6 @@
 #include "asterisk/translate.h"
 #include "asterisk/channel.h"
 #include "asterisk/alaw.h"
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 
 #define BUFFER_SIZE   8096	/* size for the translation buffers */
 
diff --git a/codecs/codec_g723_1.c b/codecs/codec_g723_1.c
index 862443900a6523e22bbc7d74e3f92d2fff02c40f..5cabede8a30ecf9d3a621361d4c589bf7faa6600 100755
--- a/codecs/codec_g723_1.c
+++ b/codecs/codec_g723_1.c
@@ -22,11 +22,6 @@
 #define TYPE_MASK	 0x3
 
 #include <sys/types.h>
-#include "asterisk/lock.h"
-#include "asterisk/translate.h"
-#include "asterisk/module.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
 #include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -34,6 +29,16 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/translate.h"
+#include "asterisk/module.h"
+#include "asterisk/logger.h"
+#include "asterisk/channel.h"
+
 #ifdef ANNEX_B
 #include "g723.1b/typedef2.h"
 #include "g723.1b/cst2.h"
diff --git a/codecs/codec_g726.c b/codecs/codec_g726.c
index a0d9d9447ccf33c5b8b61f767befe44a6ae602fc..a058e121921af7599e5a5cd29b4755a93638f930 100755
--- a/codecs/codec_g726.c
+++ b/codecs/codec_g726.c
@@ -13,6 +13,17 @@
  * the GNU General Public License
  */
 
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/logger.h"
 #include "asterisk/module.h"
@@ -20,12 +31,6 @@
 #include "asterisk/options.h"
 #include "asterisk/translate.h"
 #include "asterisk/channel.h"
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 
 #define WANT_ASM
 #include "log2comp.h"
diff --git a/codecs/codec_gsm.c b/codecs/codec_gsm.c
index 80cb8e9479f8efe394f11bcb93bdcbf15425ac58..12b7306253e7f36fa252306c8484bec4b78c0c0a 100755
--- a/codecs/codec_gsm.c
+++ b/codecs/codec_gsm.c
@@ -14,6 +14,17 @@
  * the GNU General Public License
  */
 
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/translate.h"
 #include "asterisk/config.h"
@@ -21,12 +32,6 @@
 #include "asterisk/module.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <stdio.h>
 
 #include "gsm/inc/gsm.h"
 #include "../formats/msgsm.h"
diff --git a/codecs/codec_ilbc.c b/codecs/codec_ilbc.c
index 503e3c784b2c4a407784763f9ece779b3ce7bbf2..c9f8102d717c55390ed02b7ed8c822af33dd4e37 100755
--- a/codecs/codec_ilbc.c
+++ b/codecs/codec_ilbc.c
@@ -13,11 +13,6 @@
  * the GNU General Public License
  */
 
-#include "asterisk/lock.h"
-#include "asterisk/translate.h"
-#include "asterisk/module.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
 #include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -25,6 +20,16 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/translate.h"
+#include "asterisk/module.h"
+#include "asterisk/logger.h"
+#include "asterisk/channel.h"
+
 #include "ilbc/iLBC_encode.h"
 #include "ilbc/iLBC_decode.h"
 
diff --git a/codecs/codec_lpc10.c b/codecs/codec_lpc10.c
index 9b4cb68bfe22ed8ad9a8a3557151397dcbe1edc5..46093b51fa7e01d956690572b31a686291b1022d 100755
--- a/codecs/codec_lpc10.c
+++ b/codecs/codec_lpc10.c
@@ -16,6 +16,16 @@
  * the GNU General Public License
  */
 
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/translate.h"
@@ -24,12 +34,6 @@
 #include "asterisk/module.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <stdio.h>
 
 #include "lpc10/lpc10.h"
 
diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c
index e7dd94cca49bba9f40a6887019d3c748351ac887..c067283b814658e17398cf13839d9075d183788a 100755
--- a/codecs/codec_speex.c
+++ b/codecs/codec_speex.c
@@ -14,6 +14,14 @@
  * hacked to be configurable by anthm and bkw 9/28/2004
  */
 
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <stdio.h>
+#include <speex.h>
+
 static int quality = 8;
 static int complexity = 2;
 static int enhancement = 0;
@@ -28,6 +36,10 @@ static int dtx = 0;
 #define TYPE_LOW	 0x1
 #define TYPE_MASK	 0x3
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION("$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/translate.h"
 #include "asterisk/module.h"
@@ -35,14 +47,6 @@ static int dtx = 0;
 #include "asterisk/options.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <speex.h>
 
 /* Sample frame data */
 #include "slin_speex_ex.h"
diff --git a/codecs/codec_ulaw.c b/codecs/codec_ulaw.c
index 0dffe95c488ad41e9d091cff8265377940cb036f..8ab3a2cad56f6c2b49b0fbbe4d24439ce6300f2a 100755
--- a/codecs/codec_ulaw.c
+++ b/codecs/codec_ulaw.c
@@ -10,6 +10,17 @@
  * the GNU General Public License
  */
 
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/logger.h"
 #include "asterisk/module.h"
@@ -18,12 +29,6 @@
 #include "asterisk/translate.h"
 #include "asterisk/channel.h"
 #include "asterisk/ulaw.h"
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 
 #define BUFFER_SIZE   8096	/* size for the translation buffers */
 
diff --git a/config.c b/config.c
index f99577f9c6b25313d23ed6cc6ba8db9e043d998c..ee4f18e98d7769e0612ca8d798e0968fbf150061 100755
--- a/config.c
+++ b/config.c
@@ -27,7 +27,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/config.h"
 #include "asterisk/cli.h"
diff --git a/config_old.c b/config_old.c
index 770d8e50d697896092c87ebf868de2036b7628fb..d4f366794f31f36dc25eae0d8f267704b4edbf6f 100755
--- a/config_old.c
+++ b/config_old.c
@@ -19,7 +19,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/config.h"
 #include "asterisk/logger.h"
diff --git a/db.c b/db.c
index 7baabdb39675458b798f831519ec1d0418d28858..3a3c96c2e268bc57673f8988069f753e48b58acc 100755
--- a/db.c
+++ b/db.c
@@ -26,7 +26,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/channel.h"
 #include "asterisk/file.h"
diff --git a/dns.c b/dns.c
index 5f44bbb8730edd9a3cb9bcbbc74c8b0a10433083..7ea60d5f8db080697f523e27470af62d5f86adf8 100755
--- a/dns.c
+++ b/dns.c
@@ -18,7 +18,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
diff --git a/dnsmgr.c b/dnsmgr.c
index 2b05ad5f78a9e86e968b6ac600049dc206f1c665..984077ff33b39c976daeca8d123f6434769880fc 100755
--- a/dnsmgr.c
+++ b/dnsmgr.c
@@ -25,7 +25,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/dnsmgr.h"
 #include "asterisk/linkedlists.h"
diff --git a/dsp.c b/dsp.c
index fb945a6bfb62ef707b9c74bbb0e1135cb0a5c6ed..ad90ff65034c418fa2c19818d979f954a84e18e1 100755
--- a/dsp.c
+++ b/dsp.c
@@ -38,7 +38,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/frame.h"
 #include "asterisk/channel.h"
diff --git a/enum.c b/enum.c
index 44a8dfaab8652045e92d9e5a87290e3affeb7a41..d79d24a148dbbdea4c8567fe22373291422e141f 100755
--- a/enum.c
+++ b/enum.c
@@ -28,7 +28,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/logger.h"
 #include "asterisk/options.h"
diff --git a/file.c b/file.c
index 4eaff4626d64726485d72c9c5b2e1e9c6d1b80fb..b4006a8812e483da7331210537175e3647a0c175 100755
--- a/file.c
+++ b/file.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/frame.h"
 #include "asterisk/file.h"
diff --git a/formats/format_au.c b/formats/format_au.c
index 4ad1958fc8075a7b212b121903d6c130cd5b45d7..4ce708d01083169445be354ea2789fdf15259564 100755
--- a/formats/format_au.c
+++ b/formats/format_au.c
@@ -21,6 +21,11 @@
 #else
 #include <machine/endian.h>
 #endif
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
 #include "asterisk/file.h"
diff --git a/formats/format_g723.c b/formats/format_g723.c
index 25e1899fe8442cd08fd31b9b3116eceafac20d37..9a84301846b3bcb02e34dbdf917349583f8fcd88 100755
--- a/formats/format_g723.c
+++ b/formats/format_g723.c
@@ -11,12 +11,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -24,6 +18,18 @@
 #include <errno.h>
 #include <string.h>
 #include <sys/time.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+
 #include "../channels/adtranvofr.h"
 
 
diff --git a/formats/format_g726.c b/formats/format_g726.c
index 67ecaae9e25561d2c0c2ca6e83efcb92e782ed5d..8e3c8b3c36c1a5d81f5fc42bc3f7afe4c2e3652f 100755
--- a/formats/format_g726.c
+++ b/formats/format_g726.c
@@ -9,14 +9,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/options.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -26,6 +18,19 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/options.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 #define	RATE_40		0
 #define	RATE_32		1
 #define	RATE_24		2
diff --git a/formats/format_g729.c b/formats/format_g729.c
index 597fb78e613bb934fbbf44b937ef2207e0dd5fae..bb25f190f25588184e4579cd098ed1aa0586cc6e 100755
--- a/formats/format_g729.c
+++ b/formats/format_g729.c
@@ -11,13 +11,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -27,6 +20,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 /* Some Ideas for this code came from makeg729e.c by Jeffrey Chilton */
 
 /* Portions of the conversion code are by guido@sienanet.it */
diff --git a/formats/format_gsm.c b/formats/format_gsm.c
index 7011e5da6e369e99408ec934ffa317080e1ff30a..381733adac93c93c0daa61a0fa25fd9faae5b5bf 100755
--- a/formats/format_gsm.c
+++ b/formats/format_gsm.c
@@ -11,13 +11,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -26,6 +19,19 @@
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 #include "msgsm.h"
 
 /* Some Ideas for this code came from makegsme.c by Jeffrey Chilton */
diff --git a/formats/format_h263.c b/formats/format_h263.c
index c5bfd243eb50b06b9fb8119ebe9a97609b156e91..518ccf6ab20b59b0cb5ea3dd70d6e8010a23d1e9 100755
--- a/formats/format_h263.c
+++ b/formats/format_h263.c
@@ -11,13 +11,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -27,6 +20,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 /* Some Ideas for this code came from makeh263e.c by Jeffrey Chilton */
 
 /* Portions of the conversion code are by guido@sienanet.it */
diff --git a/formats/format_ilbc.c b/formats/format_ilbc.c
index 19ea3de21f5f26ec2f2796d7e8882c361270fdea..47a437c97bdab008289844c247d539eba7d0ab95 100755
--- a/formats/format_ilbc.c
+++ b/formats/format_ilbc.c
@@ -13,13 +13,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -29,6 +22,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 /* Some Ideas for this code came from makeg729e.c by Jeffrey Chilton */
 
 /* Portions of the conversion code are by guido@sienanet.it */
diff --git a/formats/format_jpeg.c b/formats/format_jpeg.c
index 0e81d890fec592199f603d47263cf6186a7e062e..875e327451c7c2fc23a7eaf96a3e84f74d0102dc 100755
--- a/formats/format_jpeg.c
+++ b/formats/format_jpeg.c
@@ -12,14 +12,6 @@
  */
  
 #include <sys/types.h>
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/image.h"
-#include "asterisk/lock.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -29,6 +21,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/image.h"
+#include "asterisk/lock.h"
+#include "asterisk/endian.h"
 
 static char *desc = "JPEG (Joint Picture Experts Group) Image Format";
 
diff --git a/formats/format_pcm.c b/formats/format_pcm.c
index 6a0552fe59fc46b0f938224bb22c728c3347c314..d3b8a04fbb43ddc1fe7b446b5f78bcd51761d507 100755
--- a/formats/format_pcm.c
+++ b/formats/format_pcm.c
@@ -11,13 +11,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -27,6 +20,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 #define BUF_SIZE 160		/* 160 samples */
 
 struct ast_filestream {
diff --git a/formats/format_pcm_alaw.c b/formats/format_pcm_alaw.c
index 9b1e5efaed356442bb49e84a94e0894344546106..f53deb487114186585c209007870c2458ca6b939 100755
--- a/formats/format_pcm_alaw.c
+++ b/formats/format_pcm_alaw.c
@@ -11,13 +11,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -29,6 +22,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 #define BUF_SIZE 160		/* 160 samples */
 
 /* #define REALTIME_WRITE */
diff --git a/formats/format_sln.c b/formats/format_sln.c
index 0ae19af67b177f5ef45cdddd2b84fab88fc0cddf..911163de941e7efa29e48e297638e5c01e48e2d3 100755
--- a/formats/format_sln.c
+++ b/formats/format_sln.c
@@ -9,13 +9,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -25,6 +18,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 #define BUF_SIZE 320		/* 320 samples */
 
 struct ast_filestream {
diff --git a/formats/format_vox.c b/formats/format_vox.c
index 8753c3bdd9965cff95dd55ded474eaa3bab8d6b7..659281ea1cbc6ddc3f6c18af23a6aa776a4e07eb 100755
--- a/formats/format_vox.c
+++ b/formats/format_vox.c
@@ -11,13 +11,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -27,6 +20,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 #define BUF_SIZE 80		/* 160 samples */
 
 struct ast_filestream {
diff --git a/formats/format_wav.c b/formats/format_wav.c
index 2282aac122acbc8fd141f2c3a5973a9e56989332..3e8117c3fb16ea00787e8504408671e10f9dc469 100755
--- a/formats/format_wav.c
+++ b/formats/format_wav.c
@@ -11,13 +11,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -27,6 +20,18 @@
 #include <errno.h>
 #include <string.h>
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 /* Some Ideas for this code came from makewave.c by Jeffrey Chilton */
 
 /* Portions of the conversion code are by guido@sienanet.it */
diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c
index 7d8717faaff32fdf2b0719cc1ead48b3b71733f8..441cb5d60395ca7fbb922d04fc3dd78768a7e01e 100755
--- a/formats/format_wav_gsm.c
+++ b/formats/format_wav_gsm.c
@@ -11,13 +11,6 @@
  * the GNU General Public License
  */
  
-#include "asterisk/lock.h"
-#include "asterisk/channel.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/sched.h"
-#include "asterisk/module.h"
-#include "asterisk/endian.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -26,6 +19,19 @@
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/sched.h"
+#include "asterisk/module.h"
+#include "asterisk/endian.h"
+
 #include "msgsm.h"
 
 /* Some Ideas for this code came from makewave.c by Jeffrey Chilton */
diff --git a/frame.c b/frame.c
index 502b3f1f5fa3e435e2ed127516a9523e87cf20b5..457ca1a04799fcc501a5ed99cc9ca5acd036e29c 100755
--- a/frame.c
+++ b/frame.c
@@ -19,7 +19,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/frame.h"
diff --git a/fskmodem.c b/fskmodem.c
index 20716717f57cadfc3b6544e7f57dfd478d9894e1..98d815fbe0b5a887588fe9d71ad20c876bb39ec4 100755
--- a/fskmodem.c
+++ b/fskmodem.c
@@ -18,7 +18,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/fskmodem.h"
 
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c
index fb70269a2b19f81b14e469d6991659af03656044..b3bd8d3e32eaeb3300aa6d36f78b0b9b8e5bce74 100755
--- a/funcs/func_callerid.c
+++ b/funcs/func_callerid.c
@@ -13,6 +13,10 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION("$Revision$") */
+
 #ifndef BUILTIN_FUNC
 #include "asterisk/module.h"
 #endif /* BUILTIN_FUNC */
diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c
index 82a8686ba093a042d406d1ad807ef4e1d6de8593..0e9a13eaae62741d136b217d38b0fe47e01a1661 100755
--- a/funcs/func_cdr.c
+++ b/funcs/func_cdr.c
@@ -14,6 +14,10 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
diff --git a/funcs/func_db.c b/funcs/func_db.c
index bc3202da76d9da4c4fa93f7cac4496f0d9794ab6..d9b60d6537d17c6d3248e7f0cf0864ef5a361394 100755
--- a/funcs/func_db.c
+++ b/funcs/func_db.c
@@ -18,6 +18,10 @@
 #include <sys/types.h>
 #include <regex.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
diff --git a/funcs/func_env.c b/funcs/func_env.c
index 4d734137f12ca45b28dbfccd12ac64a57bfca86d..827dfec97fa4c61aeea84d542219d9587eca8a37 100755
--- a/funcs/func_env.c
+++ b/funcs/func_env.c
@@ -13,6 +13,10 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
diff --git a/funcs/func_groupcount.c b/funcs/func_groupcount.c
index d76c95724832a57bdb711c11735f42ca82a5500a..292364a46b1869ff1ca4a4f7d326c83f7495f261 100755
--- a/funcs/func_groupcount.c
+++ b/funcs/func_groupcount.c
@@ -13,6 +13,10 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
diff --git a/funcs/func_language.c b/funcs/func_language.c
index 2584e62619b70dac6a811af4592564d8c1792a20..cce6a8370f762a6f2c93fd065b44a9a3e3a74d44 100755
--- a/funcs/func_language.c
+++ b/funcs/func_language.c
@@ -13,6 +13,10 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
diff --git a/funcs/func_logic.c b/funcs/func_logic.c
index 12402637b0284329864f83204a51355ffd0536ce..e85934d74e4a426386e6d20f5c3c35bbe2815ae7 100755
--- a/funcs/func_logic.c
+++ b/funcs/func_logic.c
@@ -14,6 +14,10 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
diff --git a/funcs/func_md5.c b/funcs/func_md5.c
index dedb4ba6d16b78bee1a2505aec227debb289239b..254c31a68046118cde0dd045a534eeee4849e762 100755
--- a/funcs/func_md5.c
+++ b/funcs/func_md5.c
@@ -15,6 +15,10 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
diff --git a/funcs/func_strings.c b/funcs/func_strings.c
index 0385fc5ddb7667a6036e50d3c0b2b9783ae9d2bf..de7015190832d95d5c396d6e1fae09762b4b5c28 100755
--- a/funcs/func_strings.c
+++ b/funcs/func_strings.c
@@ -16,6 +16,10 @@
 #include <sys/types.h>
 #include <regex.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
diff --git a/funcs/func_timeout.c b/funcs/func_timeout.c
index 950e134c06fa99e7257ec76df811951ba1b50b4d..76c11e36001d1e98471e5f504074ec1406338dfd 100755
--- a/funcs/func_timeout.c
+++ b/funcs/func_timeout.c
@@ -13,6 +13,10 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include "asterisk.h"
+
+/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
diff --git a/funcs/pbx_functions.c b/funcs/pbx_functions.c
index c998b61ed8224ac72a0521dc09005cc7e5ea2a8e..4b97991049ec5da8ca4d3ab2731f27e08c689bc0 100755
--- a/funcs/pbx_functions.c
+++ b/funcs/pbx_functions.c
@@ -16,7 +16,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/module.h"
 #include "asterisk/pbx.h"
diff --git a/image.c b/image.c
index 067376326b2f30f5a65298bca47d9f3ad8720a2e..5c6b71eb4070e9ad7434ddb2b18822b4f9be5322 100755
--- a/image.c
+++ b/image.c
@@ -22,7 +22,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/sched.h"
 #include "asterisk/options.h"
diff --git a/include/asterisk.h b/include/asterisk.h
index 0e9d2e3654ca14c06a52debd1035f48d994708eb..5c82fbd4ff2c8f5b65f7ce657f7c82f42cb51f5c 100755
--- a/include/asterisk.h
+++ b/include/asterisk.h
@@ -58,14 +58,14 @@ 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) \
+#define ASTERISK_FILE_VERSION(file, version) \
 	static void __attribute__((constructor)) __register_file_version(void) \
 	{ \
-		ast_register_file_version(__FILE__, x); \
+		ast_register_file_version(file, version); \
 	} \
 	static void __attribute__((destructor)) __unregister_file_version(void) \
 	{ \
-		ast_unregister_file_version(__FILE__); \
+		ast_unregister_file_version(file); \
 	}
 #else /* ! __GNUC__ */
 #define ASTERISK_FILE_VERSION(x) static const char __file_version[] = x;
diff --git a/indications.c b/indications.c
index 59641e0aba477d68fbe1266da1d9fb7acedb0122..cc1c7e3b0adc28e1e7367f81d4e4874062bf8faf 100755
--- a/indications.c
+++ b/indications.c
@@ -23,7 +23,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/indications.h"
 #include "asterisk/frame.h"
diff --git a/io.c b/io.c
index 09d99d5f37eeb69d4d5782be17cd71cf33b0757d..bfb86224f9fe5420efe5cd67882043239b9b7f2b 100755
--- a/io.c
+++ b/io.c
@@ -20,7 +20,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/io.h"
 #include "asterisk/logger.h"
diff --git a/jitterbuf.c b/jitterbuf.c
index 3b69e5151a831a687c58605462aa4fde02cc9a22..431fff8a12c86d793167cbc25c45cc3131e24c69 100755
--- a/jitterbuf.c
+++ b/jitterbuf.c
@@ -19,7 +19,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "jitterbuf.h"
 
diff --git a/loader.c b/loader.c
index bc7e2bdfc41c2b5ce7cb0e9b974fd5b76e532354..012491cc111ce21a6abf66f9f7d8ac91e9ab1242 100755
--- a/loader.c
+++ b/loader.c
@@ -19,7 +19,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/module.h"
 #include "asterisk/options.h"
diff --git a/logger.c b/logger.c
index 6e938ac044605dc71250605ba14b7167136d78ed..c498d0db22df1566838b4200c59ecb5b525724fc 100755
--- a/logger.c
+++ b/logger.c
@@ -27,7 +27,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/options.h"
diff --git a/manager.c b/manager.c
index df6b93ff0466a6d82c1b05ebf74c60c3277515e0..c006586950a6ab82af1483322c29faae1b4ebe7a 100755
--- a/manager.c
+++ b/manager.c
@@ -29,7 +29,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/channel.h"
 #include "asterisk/file.h"
diff --git a/md5.c b/md5.c
index ea162c35ab36021035cfd7ca058f1be08ff68425..225b5ff2af4f6d16b6296970371489bbd31600cc 100755
--- a/md5.c
+++ b/md5.c
@@ -21,7 +21,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/endian.h"
 #include "asterisk/md5.h"
diff --git a/pbx.c b/pbx.c
index 717ba9d68b580d5d13a5c4df120d3e6649b1e812..b4df9be529cc33f49f0361e774f9f05886e8d505 100755
--- a/pbx.c
+++ b/pbx.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/cli.h"
diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c
index 41d97d2addca77d2f7ccf5466f4ebd6ad78a287f..b29224d3c61198a5e0080fb503d7a3a183e94acb 100755
--- a/pbx/dundi-parser.c
+++ b/pbx/dundi-parser.c
@@ -13,12 +13,17 @@
 #include <sys/socket.h>
 #include <string.h>
 #include <netinet/in.h>
-#include "asterisk/frame.h"
-#include "asterisk/utils.h"
 #include <arpa/inet.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/frame.h"
+#include "asterisk/utils.h"
 #include "asterisk/dundi.h"
 #include "dundi-parser.h"
 #include "asterisk/dundi.h"
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 1e5bd49bd62828f721206b906fc2e0c5aa9d64bf..69b66d5c2cf3ee6cccb56f86877526c26f816bf8 100755
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -12,6 +12,16 @@
  */
 
 #include <sys/types.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/pbx.h"
 #include "asterisk/config.h"
 #include "asterisk/options.h"
@@ -19,13 +29,6 @@
 #include "asterisk/logger.h"
 #include "asterisk/cli.h"
 #include "asterisk/callerid.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-/* For where to put dynamic tables */
-#include "asterisk.h"
 
 #ifdef __AST_DEBUG_MALLOC
 static void FREE(void *ptr)
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index c5deb503c56f65f24449cd78bc2598e50b391eda..36149f39cac7b05fc6c48b9aeeda77a8e34c11b3 100755
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -9,6 +9,31 @@
  * of the GNU General Public License.
  */
 
+#include <stdlib.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <string.h>
+#include <errno.h>
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(SOLARIS) || defined(__Darwin__)
+#include <sys/types.h>
+#include <netinet/in_systm.h>
+#endif
+#include <netinet/ip.h>
+#include <sys/ioctl.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__Darwin__)
+#include <net/if_dl.h>
+#include <ifaddrs.h>
+#endif
+#include <zlib.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
@@ -31,26 +56,6 @@
 #include "asterisk/aes.h"
 
 #include "dundi-parser.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <string.h>
-#include <errno.h>
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(SOLARIS) || defined(__Darwin__)
-#include <sys/types.h>
-#include <netinet/in_systm.h>
-#endif
-#include <netinet/ip.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__Darwin__)
-#include <net/if_dl.h>
-#include <ifaddrs.h>
-#endif
-#include <zlib.h>
 
 #define MAX_RESULTS	64
 
diff --git a/pbx/pbx_gtkconsole.c b/pbx/pbx_gtkconsole.c
index 9394b641cb6fe8b63e84f87a48a1b239064d401e..62443d29ea886ae522574221c6739845ecbca0cc 100755
--- a/pbx/pbx_gtkconsole.c
+++ b/pbx/pbx_gtkconsole.c
@@ -20,13 +20,6 @@
  */
 
 #include <sys/types.h>
-#include "asterisk/pbx.h"
-#include "asterisk/config.h"
-#include "asterisk/module.h"
-#include "asterisk/logger.h"
-#include "asterisk/options.h"
-#include "asterisk/cli.h"
-#include "asterisk/utils.h"
 #include <stdlib.h>
 #include <fcntl.h>
 #include <unistd.h>
@@ -38,9 +31,18 @@
 
 #include <gtk/gtk.h>
 #include <glib.h>
-/* For where to put dynamic tables */
+
 #include "asterisk.h"
-#include "astconf.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/pbx.h"
+#include "asterisk/config.h"
+#include "asterisk/module.h"
+#include "asterisk/logger.h"
+#include "asterisk/options.h"
+#include "asterisk/cli.h"
+#include "asterisk/utils.h"
 
 AST_MUTEX_DEFINE_STATIC(verb_lock);
 
diff --git a/pbx/pbx_loopback.c b/pbx/pbx_loopback.c
index 065cac855f50f38f546b52cddf5c55f028de1428..70159c79b6bdd36cd9539609f08e1659b2f9554e 100755
--- a/pbx/pbx_loopback.c
+++ b/pbx/pbx_loopback.c
@@ -9,6 +9,15 @@
  * of the GNU General Public License.
  */
 
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
@@ -29,11 +38,6 @@
 #include "asterisk/crypto.h"
 #include "asterisk/astdb.h"
 
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
 static char *tdesc = "Loopback Switch";
 
 /* Loopback switch substitutes ${EXTEN}, ${CONTEXT}, and ${PRIORITY} into
diff --git a/pbx/pbx_realtime.c b/pbx/pbx_realtime.c
index 8574a6675bbdc7718228d4f1a59b58416b5e6680..c2536b16a7eed3380f78cd33ac35d88568b761d2 100755
--- a/pbx/pbx_realtime.c
+++ b/pbx/pbx_realtime.c
@@ -9,6 +9,15 @@
  * of the GNU General Public License.
  */
 
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
@@ -31,11 +40,6 @@
 #include "asterisk/crypto.h"
 #include "asterisk/astdb.h"
 
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
 #define MODE_MATCH 		0
 #define MODE_MATCHMORE 	1
 #define MODE_CANMATCH 	2
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index c30888dc472a2c35dc37ead69f7ed07dfc5998a0..1087cb4b04ad0445bef8c4abedf8e32cf1a237db 100755
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -11,15 +11,6 @@
  * the GNU General Public License
  */
 
-#include "asterisk/lock.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/callerid.h"
-#include "asterisk/pbx.h"
-#include "asterisk/module.h"
-#include "asterisk/options.h"
-#include "asterisk/utils.h"
 #include <sys/stat.h>
 #include <errno.h>
 #include <time.h>
@@ -31,8 +22,21 @@
 #include <string.h>
 #include <stdio.h>
 #include <unistd.h>
+
 #include "asterisk.h"
 
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/channel.h"
+#include "asterisk/callerid.h"
+#include "asterisk/pbx.h"
+#include "asterisk/module.h"
+#include "asterisk/options.h"
+#include "asterisk/utils.h"
+
 /*
  * pbx_spool is similar in spirit to qcall, but with substantially enhanced functionality...
  * The spool file contains a header 
diff --git a/plc.c b/plc.c
index 261fca8ec30dc25acee1d9391508f1f161d001b5..b4f3a6abd674537f7e34e8925ae69d4851bbe145 100755
--- a/plc.c
+++ b/plc.c
@@ -37,7 +37,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/plc.h"
 
diff --git a/privacy.c b/privacy.c
index 2f9feab6e761d367caf91a53cba5561bf0b993fb..c02f093e0ff4ddc73ad8c4486cef825245a0615d 100755
--- a/privacy.c
+++ b/privacy.c
@@ -22,7 +22,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/channel.h"
 #include "asterisk/file.h"
diff --git a/res/res_adsi.c b/res/res_adsi.c
index 82c05073a21851ac2cb4672b7ccb3cffcec46635..fb11c368ed028b6ee2d1360837476a8c9125622d 100755
--- a/res/res_adsi.c
+++ b/res/res_adsi.c
@@ -21,6 +21,11 @@
 #include <unistd.h>
 #include <math.h>
 #include <errno.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/ulaw.h"
 #include "asterisk/alaw.h"
 #include "asterisk/callerid.h"
diff --git a/res/res_agi.c b/res/res_agi.c
index 726c549515c7b30572dda4327423202b80b0f214..275ccf6d55b8172aca44c669e218845b53cd09e0 100755
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -17,13 +17,6 @@
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/module.h"
-#include "asterisk/astdb.h"
-#include "asterisk/callerid.h"
 #include <math.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -34,6 +27,18 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <errno.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/channel.h"
+#include "asterisk/pbx.h"
+#include "asterisk/module.h"
+#include "asterisk/astdb.h"
+#include "asterisk/callerid.h"
 #include "asterisk/cli.h"
 #include "asterisk/logger.h"
 #include "asterisk/options.h"
@@ -46,7 +51,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/lock.h"
 #include "asterisk/agi.h"
-#include "asterisk.h"
 #ifdef SOLARIS
 #include "asterisk/astmm.h"
 #endif
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c
index 484741ec7e1aa51d340525b1aff240e31b45fcf6..cba29fac6aabcec5b3434dfeeecf24b85765fb8e 100755
--- a/res/res_config_odbc.c
+++ b/res/res_config_odbc.c
@@ -9,6 +9,14 @@
  * Copyright (C) 2004 - 2005 Anthony Minessale II <anthmct@yahoo.com>
  */
 
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
@@ -17,9 +25,6 @@
 #include "asterisk/module.h"
 #include "asterisk/lock.h"
 #include "asterisk/options.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
 #include "asterisk/res_odbc.h"
 #include "asterisk/utils.h"
 
diff --git a/res/res_crypto.c b/res/res_crypto.c
index 0ca1b9e11060504b121805f6a74216a758f2ed58..43936a2974712ab210e1e1df7b089cd029d008dc 100755
--- a/res/res_crypto.c
+++ b/res/res_crypto.c
@@ -12,6 +12,19 @@
  */
 
 #include <sys/types.h>
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/file.h"
 #include "asterisk/channel.h"
 #include "asterisk/logger.h"
@@ -24,15 +37,6 @@
 #include "asterisk/io.h"
 #include "asterisk/lock.h"
 #include "asterisk/utils.h"
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-#include <stdio.h>
-#include <dirent.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include "asterisk.h"
 
 /*
  * Asterisk uses RSA keys with SHA-1 message digests for its
diff --git a/res/res_features.c b/res/res_features.c
index 15546c04065c4a0145d03e16775718a925d56e0b..2765cc159113a35b5b2b39029c5663312a1dbf15 100755
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -11,6 +11,21 @@
  * the GNU General Public License
  */
 
+#include <pthread.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/time.h>
+#include <sys/signal.h>
+#include <netinet/in.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
@@ -28,16 +43,6 @@
 #include "asterisk/manager.h"
 #include "asterisk/utils.h"
 #include "asterisk/adsi.h"
-#include <pthread.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/time.h>
-#include <sys/signal.h>
-#include <netinet/in.h>
 
 #ifdef __AST_DEBUG_MALLOC
 static void FREE(void *ptr)
diff --git a/res/res_indications.c b/res/res_indications.c
index 0b6d74f2ac0f48e6a03c56389b7644a887d4c562..18f4072d8921e338becca753d759ef8d073c0c54 100755
--- a/res/res_indications.c
+++ b/res/res_indications.c
@@ -21,6 +21,11 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
 #include "asterisk/cli.h"
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 1053e9aea550c165e955fcd5e9861ac20a792a0c..80051d5820e17db033e97b6ab6b3e89f79549743 100755
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -1,3 +1,15 @@
+/* res_monitor.c 
+ *
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Copyright (C) 2005, Digium
+ *
+ * Mark Spencer, <markster@digium.com>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+ 
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -6,6 +18,10 @@
 #include <sys/stat.h>
 #include <libgen.h>		/* dirname() */
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
 #include "asterisk/logger.h"
@@ -18,7 +34,6 @@
 #include "asterisk/app.h"
 #include "asterisk/utils.h"
 #include "asterisk/config.h"
-#include "asterisk.h"
 
 AST_MUTEX_DEFINE_STATIC(monitorlock);
 
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 33609c442321e83d9d5441210d0c55ec2aea900b..8aeb8826c99079d89edc129612dac8f768709c62 100755
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -11,20 +11,7 @@
  * the GNU General Public License
  */
 
-#include "asterisk/lock.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/options.h"
-#include "asterisk/module.h"
-#include "asterisk/translate.h"
-#include "asterisk/say.h"
-#include "asterisk/musiconhold.h"
-#include "asterisk/config.h"
-#include "asterisk/utils.h"
 #include <stdlib.h>
-#include "asterisk/cli.h"
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
@@ -45,6 +32,25 @@
 #endif
 #include <unistd.h>
 #include <sys/ioctl.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/lock.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/channel.h"
+#include "asterisk/pbx.h"
+#include "asterisk/options.h"
+#include "asterisk/module.h"
+#include "asterisk/translate.h"
+#include "asterisk/say.h"
+#include "asterisk/musiconhold.h"
+#include "asterisk/config.h"
+#include "asterisk/utils.h"
+#include "asterisk/cli.h"
+
 #define MAX_MOHFILES 512
 #define MAX_MOHFILE_LEN 128
 
diff --git a/res/res_odbc.c b/res/res_odbc.c
index c4955980d5bea8b06a3480b8558d839d9e57c22c..14286b6f094c0c8f618ba0b4883ec28aeec1c11d 100755
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -9,6 +9,14 @@
  * Copyright (C) 2004 - 2005 Anthony Minessale II <anthmct@yahoo.com>
  */
 
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
@@ -18,9 +26,6 @@
 #include "asterisk/module.h"
 #include "asterisk/cli.h"
 #include "asterisk/lock.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
 #include "asterisk/res_odbc.h"
 #define MAX_ODBC_HANDLES 25
 
diff --git a/res/res_osp.c b/res/res_osp.c
index e86a2e8810a0ff037ce1bc356ff8a7b871c449a4..ed52d83079b0f0b0b9edd1a54d505ac19881cb0a 100755
--- a/res/res_osp.c
+++ b/res/res_osp.c
@@ -13,6 +13,21 @@
 
 #include <sys/types.h>
 #include <osp.h>
+#include <openssl/err.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <openssl/bio.h>
+#include <openssl/pem.h>
+#include <openssl/evp.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/file.h"
 #include "asterisk/channel.h"
 #include "asterisk/logger.h"
@@ -30,19 +45,6 @@
 #include "asterisk/lock.h"
 #include "asterisk/causes.h"
 #include "asterisk/callerid.h"
-#include <openssl/err.h>
-#include <stdio.h>
-#include <dirent.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include "asterisk.h"
-#include "astconf.h"
-#include <openssl/bio.h>
-#include <openssl/pem.h>
-#include <openssl/evp.h>
-
 
 #define MAX_CERTS 10
 #define MAX_SERVICEPOINTS 10
diff --git a/rtp.c b/rtp.c
index 016cb89f106f981ffae7ddc12a6d68d12beef90f..a9ecd34a7b63aa0914bc3d9504c602e88796a39c 100755
--- a/rtp.c
+++ b/rtp.c
@@ -28,7 +28,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/rtp.h"
 #include "asterisk/frame.h"
diff --git a/say.c b/say.c
index 908c44018f157b9795c4fb59866390487099d349..9e69f79f7c5d623b0274c2a8e724f71c3abbba4f 100755
--- a/say.c
+++ b/say.c
@@ -29,7 +29,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/file.h"
 #include "asterisk/channel.h"
diff --git a/sched.c b/sched.c
index 98529ea9264fd3bd7da8dd4b73400ead93d65af7..9b4dc4d2a66c09524f75e16272c9829025b066e2 100755
--- a/sched.c
+++ b/sched.c
@@ -25,7 +25,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/sched.h"
 #include "asterisk/logger.h"
diff --git a/srv.c b/srv.c
index b74d7615889f135df17ab528a99bfdb4b3e42914..572f1c2638bab6db8fdd8193beba650cbe26a77a 100755
--- a/srv.c
+++ b/srv.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/channel.h"
 #include "asterisk/logger.h"
diff --git a/tdd.c b/tdd.c
index 9d36e353402f4de8f145471f1a098b495e762948..cf94a7b512c60e54f900f89d54f1e60e30ab893f 100755
--- a/tdd.c
+++ b/tdd.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/ulaw.h"
 #include "asterisk/tdd.h"
diff --git a/term.c b/term.c
index f210e2a9956d050d6788415bd8384e44d8c923e2..27cdf1e8b37b5d1726a7bfa0687b9090f482272e 100755
--- a/term.c
+++ b/term.c
@@ -24,7 +24,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/term.h"
 #include "asterisk/options.h"
diff --git a/translate.c b/translate.c
index 4c79fbcb59e5b68401ee0e8a6aeac78e66940e0e..3ef5c9dc94efc055783901bc3dd71ea99f7e642a 100755
--- a/translate.c
+++ b/translate.c
@@ -21,7 +21,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
diff --git a/ulaw.c b/ulaw.c
index 3a867e11e3ae51472f50b9c90447ead252b6b102..b97315c2f94455d1ca3205231a533e4c4ce7af5f 100755
--- a/ulaw.c
+++ b/ulaw.c
@@ -13,7 +13,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/ulaw.h"
 
diff --git a/utils.c b/utils.c
index 6841cb7fe9ff0efdb412d822960ae3e87aac6a95..c7d5e56cd2f0a5a6a34944f8df43c88e79aabc5c 100755
--- a/utils.c
+++ b/utils.c
@@ -26,7 +26,7 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION("$Revision$")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/utils.h"