Index: build_tools/make_defaults_h
===================================================================
--- build_tools/make_defaults_h	(revision 19972)
+++ build_tools/make_defaults_h	(working copy)
@@ -11,6 +11,7 @@
 #define AST_MODULE_DIR "${INSTALL_PATH}${MODULES_DIR}"
 #define AST_SPOOL_DIR  "${INSTALL_PATH}${ASTSPOOLDIR}"
 #define AST_VAR_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}"
+#define AST_DATA_DIR   "${INSTALL_PATH}${ASTDATADIR}"
 #define AST_LOG_DIR    "${INSTALL_PATH}${ASTLOGDIR}"
 #define AST_AGI_DIR    "${INSTALL_PATH}${AGI_DIR}"
 #define AST_KEY_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}/keys"
@@ -19,7 +20,7 @@
 
 #define AST_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
 
-#define AST_SOUNDS     "${INSTALL_PATH}${ASTVARLIBDIR}/sounds"
-#define AST_IMAGES     "${INSTALL_PATH}${ASTVARLIBDIR}/images"
+#define AST_SOUNDS     "${INSTALL_PATH}${ASTDATADIR}/sounds"
+#define AST_IMAGES     "${INSTALL_PATH}${ASTDATADIR}/images"
 
 END
Index: http.c
===================================================================
--- http.c	(revision 19972)
+++ http.c	(working copy)
@@ -125,12 +125,12 @@
 	mtype=ftype2mtype(ftype, wkspace, sizeof(wkspace));
 	
 	/* Cap maximum length */
-	len = strlen(uri) + strlen(ast_config_AST_VAR_DIR) + strlen("/static-http/") + 5;
+	len = strlen(uri) + strlen(ast_config_AST_DATA_DIR) + strlen("/static-http/") + 5;
 	if (len > 1024)
 		goto out403;
 		
 	path = alloca(len);
-	sprintf(path, "%s/static-http/%s", ast_config_AST_VAR_DIR, uri);
+	sprintf(path, "%s/static-http/%s", ast_config_AST_DATA_DIR, uri);
 	if (stat(path, &st))
 		goto out404;
 	if (S_ISDIR(st.st_mode))
Index: app.c
===================================================================
--- app.c	(revision 19972)
+++ app.c	(working copy)
@@ -414,7 +414,7 @@
 		if (filename[0] == '/') 
 			ast_copy_string(tmpf, filename, sizeof(tmpf));
 		else
-			snprintf(tmpf, sizeof(tmpf), "%s/%s/%s", (char *)ast_config_AST_VAR_DIR, "sounds", filename);
+			snprintf(tmpf, sizeof(tmpf), "%s/%s/%s", (char *)ast_config_AST_DATA_DIR, "sounds", filename);
 		fd = open(tmpf, O_RDONLY);
 		if (fd < 0){
 			ast_log(LOG_WARNING, "Unable to open file '%s': %s\n", tmpf, strerror(errno));
Index: image.c
===================================================================
--- image.c	(revision 19972)
+++ image.c	(working copy)
@@ -103,9 +103,9 @@
 			snprintf(buf, len, "%s.%s", filename, ext);
 	} else {
 		if (!ast_strlen_zero(preflang))
-			snprintf(buf, len, "%s/%s/%s-%s.%s", ast_config_AST_VAR_DIR, "images", filename, preflang, ext);
+			snprintf(buf, len, "%s/%s/%s-%s.%s", ast_config_AST_DATA_DIR, "images", filename, preflang, ext);
 		else
-			snprintf(buf, len, "%s/%s/%s.%s", ast_config_AST_VAR_DIR, "images", filename, ext);
+			snprintf(buf, len, "%s/%s/%s.%s", ast_config_AST_DATA_DIR, "images", filename, ext);
 	}
 }
 
Index: Makefile
===================================================================
--- Makefile	(revision 19972)
+++ Makefile	(working copy)
@@ -163,12 +163,13 @@
   ASTMANDIR=$(INSTALL_PREFIX)/usr/share/man
 endif
 endif
+ASTDATADIR?=$(ASTVARLIBDIR)
 
 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
 # when starting Asterisk
 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
 MODULES_DIR=$(ASTLIBDIR)/modules
-AGI_DIR=$(ASTVARLIBDIR)/agi-bin
+AGI_DIR=$(ASTDATADIR)/agi-bin
 
 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
 HTTP_DOCSDIR=/var/www/html
@@ -562,42 +563,42 @@
 	# Should static HTTP be installed during make samples or even with its own target ala
 	# webvoicemail?  There are portions here that *could* be customized but might also be
 	# improved a lot.  I'll put it here for now.
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/static-http
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
 	for x in static-http/*; do \
-		install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/static-http ; \
+		install -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/priv-callerintros
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/digits
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/priv-callerintros
 	for x in sounds/digits/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/digits ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/dictate
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/dictate
 	for x in sounds/dictate/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/dictate ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/dictate ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/letters
 	for x in sounds/letters/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/letters ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/phonetic
 	for x in sounds/phonetic/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/phonetic ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
@@ -605,16 +606,16 @@
 	done
 	for x in sounds/demo-* sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-* sounds/queue-* sounds/spy-* sounds/priv-* sounds/screen-* sounds/hello-*; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/mohmp3
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/images
 	for x in images/*.jpg; do \
-		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
 	done
 	mkdir -p $(DESTDIR)$(AGI_DIR)
 
@@ -674,7 +675,7 @@
 	if [ -n "$(OLDHEADERS)" ]; then \
 		rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
 	fi
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys
@@ -775,6 +776,7 @@
 		echo "astetcdir => $(ASTETCDIR)" ; \
 		echo "astmoddir => $(MODULES_DIR)" ; \
 		echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
+		echo "astdatadir => $(ASTDATADIR)" ; \
 		echo "astagidir => $(AGI_DIR)" ; \
 		echo "astspooldir => $(ASTSPOOLDIR)" ; \
 		echo "astrundir => $(ASTVARRUNDIR)" ; \
@@ -792,28 +794,28 @@
 	else \
 		echo "Skipping asterisk.conf creation"; \
 	fi
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds ; \
 	for x in sounds/demo-*; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/mohmp3 ; \
 	for x in sounds/*.mp3; do \
-		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/mohmp3 ; \
 	done
-	rm -f $(DESTDIR)$(ASTVARLIBDIR)/mohmp3/sample-hold.mp3
+	rm -f $(DESTDIR)$(ASTDATADIR)/mohmp3/sample-hold.mp3
 	mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
 	:> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
 	for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
-		cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
+		cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
 	done
 	:> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
 	for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
-		cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
+		cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
 	done
 
 webvmail:
@@ -935,7 +937,7 @@
 	rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
 	rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
 	rm -rf $(DESTDIR)$(ASTHEADERDIR)
-	rm -rf $(DESTDIR)$(ASTVARLIBDIR)/sounds
+	rm -rf $(DESTDIR)$(ASTDATADIR)/sounds
 	rm -rf $(DESTDIR)$(ASTVARLIBDIR)/firmware
 	rm -rf $(DESTDIR)$(ASTMANDIR)/man8
 	for x in $(SUBDIRS); do $(MAKE) -C $$x uninstall || exit 1 ; done
@@ -957,6 +959,7 @@
 uninstall-all: _uninstall
 	rm -rf $(DESTDIR)$(ASTLIBDIR)
 	rm -rf $(DESTDIR)$(ASTVARLIBDIR)
+	rm -rf $(DESTDIR)$(ASTDATADIR)
 	rm -rf $(DESTDIR)$(ASTSPOOLDIR)
 	rm -rf $(DESTDIR)$(ASTETCDIR)
 	rm -rf $(DESTDIR)$(ASTLOGDIR)
Index: include/asterisk.h
===================================================================
--- include/asterisk.h	(revision 19972)
+++ include/asterisk.h	(working copy)
@@ -34,6 +34,7 @@
 extern char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_VAR_DIR[AST_CONFIG_MAX_PATH];
+extern char ast_config_AST_DATA_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_LOG_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_AGI_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_DB[AST_CONFIG_MAX_PATH];
Index: asterisk.c
===================================================================
--- asterisk.c	(revision 19972)
+++ asterisk.c	(working copy)
@@ -206,6 +206,7 @@
 char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_VAR_DIR[AST_CONFIG_MAX_PATH];
+char ast_config_AST_DATA_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_LOG_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_AGI_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_DB[AST_CONFIG_MAX_PATH];
@@ -2083,6 +2084,7 @@
 	ast_copy_string(ast_config_AST_MODULE_DIR, AST_MODULE_DIR, sizeof(ast_config_AST_MODULE_DIR));
  	snprintf(ast_config_AST_MONITOR_DIR, sizeof(ast_config_AST_MONITOR_DIR) - 1, "%s/monitor", ast_config_AST_SPOOL_DIR);
 	ast_copy_string(ast_config_AST_VAR_DIR, AST_VAR_DIR, sizeof(ast_config_AST_VAR_DIR));
+	ast_copy_string(ast_config_AST_DATA_DIR, AST_DATA_DIR, sizeof(ast_config_AST_DATA_DIR));
 	ast_copy_string(ast_config_AST_LOG_DIR, AST_LOG_DIR, sizeof(ast_config_AST_LOG_DIR));
 	ast_copy_string(ast_config_AST_AGI_DIR, AST_AGI_DIR, sizeof(ast_config_AST_AGI_DIR));
 	ast_copy_string(ast_config_AST_DB, AST_DB, sizeof(ast_config_AST_DB));
@@ -2119,6 +2121,8 @@
 			ast_copy_string(ast_config_AST_VAR_DIR, v->value, sizeof(ast_config_AST_VAR_DIR));
 			snprintf(ast_config_AST_DB, sizeof(ast_config_AST_DB), "%s/astdb", v->value);
 			snprintf(ast_config_AST_KEY_DIR, sizeof(ast_config_AST_KEY_DIR), "%s/keys", v->value);
+		} else if (!strcasecmp(v->name, "astdatadir")) {
+			ast_copy_string(ast_config_AST_DATA_DIR, v->value, sizeof(ast_config_AST_DATA_DIR));
 		} else if (!strcasecmp(v->name, "astlogdir")) {
 			ast_copy_string(ast_config_AST_LOG_DIR, v->value, sizeof(ast_config_AST_LOG_DIR));
 		} else if (!strcasecmp(v->name, "astagidir")) {
Index: res/res_agi.c
===================================================================
--- res/res_agi.c	(revision 19972)
+++ res/res_agi.c	(working copy)
@@ -281,6 +281,7 @@
 		setenv("AST_SPOOL_DIR", ast_config_AST_SPOOL_DIR, 1);
 		setenv("AST_MONITOR_DIR", ast_config_AST_MONITOR_DIR, 1);
 		setenv("AST_VAR_DIR", ast_config_AST_VAR_DIR, 1);
+		setenv("AST_DATA_DIR", ast_config_AST_DATA_DIR, 1);
 		setenv("AST_LOG_DIR", ast_config_AST_LOG_DIR, 1);
 		setenv("AST_AGI_DIR", ast_config_AST_AGI_DIR, 1);
 		setenv("AST_KEY_DIR", ast_config_AST_KEY_DIR, 1);
Index: file.c
===================================================================
--- file.c	(revision 19972)
+++ file.c	(working copy)
@@ -264,7 +264,7 @@
 		asprintf(&fn, "%s.%s", filename, ext);
 	else
 		asprintf(&fn, "%s/sounds/%s.%s",
-			ast_config_AST_VAR_DIR, filename, ext);
+			ast_config_AST_DATA_DIR, filename, ext);
 	return fn;
 }
 
