From da010f160037f541bac040467efb93fbf05e6d61 Mon Sep 17 00:00:00 2001
From: Mark Spencer <markster@digium.com>
Date: Thu, 29 Apr 2004 13:50:29 +0000
Subject: [PATCH] Add ability to customize directory introduction (bug #1488)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2819 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_directory.c          | 7 +++++--
 configs/voicemail.conf.sample | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/apps/app_directory.c b/apps/app_directory.c
index 34f76f2f86..bd51bb2c7e 100755
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -238,7 +238,7 @@ static int directory_exec(struct ast_channel *chan, void *data)
 	int res = 0;
 	struct localuser *u;
 	struct ast_config *cfg;
-	char *context, *dialcontext;
+	char *context, *dialcontext, *dirintro;
 	if (!data) {
 		ast_log(LOG_WARNING, "directory requires an argument (context)\n");
 		return -1;
@@ -250,6 +250,9 @@ static int directory_exec(struct ast_channel *chan, void *data)
 	}
 	LOCAL_USER_ADD(u);
 top:
+	dirintro = ast_variable_retrieve(cfg, "general", "directoryintro");
+	if (!dirintro || !strlen(dirintro))
+		dirintro = "dir-intro";
 	context = ast_strdupa(data);
 	dialcontext = strchr(context, '|');
 	if (dialcontext) {
@@ -260,7 +263,7 @@ top:
 	if (chan->_state != AST_STATE_UP) 
 		res = ast_answer(chan);
 	if (!res)
-		res = ast_streamfile(chan, "dir-intro", chan->language);
+		res = ast_streamfile(chan, dirintro, chan->language);
 	if (!res)
 		res = ast_waitstream(chan, AST_DIGIT_ANY);
 	ast_stopstream(chan);
diff --git a/configs/voicemail.conf.sample b/configs/voicemail.conf.sample
index 37648accb5..f850c105ae 100755
--- a/configs/voicemail.conf.sample
+++ b/configs/voicemail.conf.sample
@@ -28,7 +28,8 @@ maxlogins=3
 ; called when a voicemail is left, delivered, or your voicemailbox 
 ; changes, uncomment this:
 ;externnotify=/usr/bin/myapp
-
+; For the directory, you can override the intro file if you want
+;directoryintro=dir-intro
 
 ; Skip the "[PBX]:" string from the message title
 ;pbxskip=yes
-- 
GitLab