[Asterisk-cvs] asterisk/apps app_directory.c,1.29,1.30

markster at lists.digium.com markster at lists.digium.com
Tue Dec 21 17:47:36 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv20407/apps

Modified Files:
	app_directory.c 
Log Message:
Allow '*' to exit the directory (bug #3118)


Index: app_directory.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_directory.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- app_directory.c	8 Dec 2004 21:24:00 -0000	1.29
+++ app_directory.c	21 Dec 2004 22:43:25 -0000	1.30
@@ -42,7 +42,8 @@
 "Returns 0 unless the user hangs up. It  also sets up the channel on exit\n"
 "to enter the extension the user selected.  If the user enters '0' and there\n"
 "exists an extension 'o' in the current context, the directory will exit with 0\n"
-"and call control will resume at that extension.\n";
+"and call control will resume at that extension.  Entering '*' will exit similarly,\n"
+"but to the 'a' extension, much like app_voicemail's behavior.\n";
 
 /* For simplicity, I'm keeping the format compatible with the voicemail config,
    but i'm open to suggestions for isolating it */
@@ -243,6 +244,20 @@
 			res = 0;
 		}
 	}	
+	if (digit == '*') {
+		if (ast_exists_extension(chan,chan->context,"a",1,chan->cid.cid_num) || 
+			(!ast_strlen_zero(chan->macrocontext) &&
+		     ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num))) {
+			strncpy(chan->exten, "a", sizeof(chan->exten)-1);
+			chan->priority = 0;
+			return 0;
+		} else {
+
+			ast_log(LOG_WARNING, "Can't find extension 'a' in current context.  "
+				"Not Exiting the Directory!\n");
+			res = 0;
+		}
+	}	
 	memset(ext, 0, sizeof(ext));
 	ext[0] = digit;
 	res = 0;




More information about the svn-commits mailing list