From 31d28c2518c63cdf99604516a3c3a22b2936dbb2 Mon Sep 17 00:00:00 2001
From: BJ Weschke <bweschke@btwtech.com>
Date: Sat, 18 Oct 2008 03:35:24 +0000
Subject: [PATCH]  Give app_authenticate the ability to select a prompt other
 than the default.

 (closes issue #13734)
 reported and patched by: jvandal



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@150887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 CHANGES                 |  2 ++
 apps/app_authenticate.c | 11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/CHANGES b/CHANGES
index 9467b1df26..d25134b729 100644
--- a/CHANGES
+++ b/CHANGES
@@ -28,6 +28,8 @@ Applications
 ------------
  * Scheduled meetme conferences may now have their end times extended by
    using MeetMeAdmin.
+ * app_authenticate now gives the ability to select a prompt other than
+   the default.
 
 Miscellaneous
 -------------
diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c
index 8e19195945..1bdc1153ba 100644
--- a/apps/app_authenticate.c
+++ b/apps/app_authenticate.c
@@ -58,7 +58,7 @@ static char *app = "Authenticate";
 static char *synopsis = "Authenticate a user";
 
 static char *descrip =
-"  Authenticate(password[,options[,maxdigits]]): This application asks the caller\n"
+"  Authenticate(password[,options[,maxdigits[,prompt]]]): This application asks the caller\n"
 "to enter a given password in order to continue dialplan execution. If the password\n"
 "begins with the '/' character, it is interpreted as a file which contains a list of\n"
 "valid passwords, listed 1 password per line in the file.\n"
@@ -76,6 +76,8 @@ static char *descrip =
 "         maxdigits have been entered (without requiring the user to\n"
 "         press the '#' key).\n"
 "         Defaults to 0 - no limit - wait for the user press the '#' key.\n"
+"     prompt - Override the agent-pass prompt file.\n"
+ ;
 ;
 
 static int auth_exec(struct ast_channel *chan, void *data)
@@ -88,6 +90,7 @@ static int auth_exec(struct ast_channel *chan, void *data)
 		AST_APP_ARG(password);
 		AST_APP_ARG(options);
 		AST_APP_ARG(maxdigits);
+		AST_APP_ARG(prompt);
 	);
 
 	if (ast_strlen_zero(data)) {
@@ -115,6 +118,12 @@ static int auth_exec(struct ast_channel *chan, void *data)
 		maxdigits = sizeof(passwd) - 2;
 	}
 
+	if (!ast_strlen_zero(arglist.prompt)) {
+		prompt = arglist.prompt;
+	} else {
+		prompt = "agent-pass";
+	}
+   
 	/* Start asking for password */
 	for (retries = 0; retries < 3; retries++) {
 		if ((res = ast_app_getdata(chan, prompt, passwd, maxdigits, 0)) < 0)
-- 
GitLab