? app_directory2.c
? mysql-vm-routines.h
? ttt
Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- Makefile	26 Oct 2003 18:50:49 -0000	1.24
+++ Makefile	30 Oct 2003 22:05:43 -0000
@@ -11,7 +11,7 @@
 # the GNU General Public License
 #
 
-USE_MYSQL_VM_INTERFACE=0
+USE_MYSQL_VM_INTERFACE=1
 USE_POSTGRES_VM_INTERFACE=0
 
 #APPS=app_dial.so app_playback.so app_directory.so app_intercom.so app_mp3.so 
@@ -24,7 +24,7 @@
      app_authenticate.so app_softhangup.so app_lookupblacklist.so \
      app_waitforring.so app_privacy.so app_db.so app_chanisavail.so \
      app_enumlookup.so app_voicemail2.so app_transfer.so app_setcidnum.so app_cdr.so \
-     app_hasnewvoicemail.so app_sayunixtime.so app_cut.so
+     app_hasnewvoicemail.so app_sayunixtime.so app_cut.so app_directory2.so
 
 ifneq (${OSARCH},Darwin)
 APPS+=app_intercom.so
@@ -42,6 +42,10 @@
 CFLAGS+=-DUSEPOSTGRESVM
 endif
 
+ifeq ($(USE_MYSQL_VM_INTERFACE),1)
+CFLAGS+=-DUSEMYSQLVM
+endif
+
 all: $(APPS)
 
 clean:
@@ -72,6 +76,9 @@
 	$(CC) $(SOLINK) -o $@ $(MLFLAGS) $< 
 endif
 endif
+
+app_directory2.so: app_directory2.o
+	$(CC) $(SOLINK) -o $@ $(MLFLAGS) $< -lmysqlclient
 
 app_sql_postgres.o: app_sql_postgres.c
 	$(CC) -pipe -I/usr/local/pgsql/include $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
Index: app_directory.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_directory.c,v
retrieving revision 1.5
diff -u -r1.5 app_directory.c
--- app_directory.c	29 Sep 2003 20:10:49 -0000	1.5
+++ app_directory.c	30 Oct 2003 22:05:44 -0000
@@ -127,7 +127,7 @@
 	struct ast_variable *v;
 	int res;
 	int found=0;
-	char *start, *pos, *conv,*stringp=NULL;
+	char *start, *pos, *conv,*stringp, *manager, *secretary, *managerStart=NULL;
 	char fn[256];
 	char fn2[256];
 	if (!context || !strlen(context)) {
@@ -171,11 +171,15 @@
 				v = v->next;
 			}
 			if (v) {
+				managerStart = strdup(v->name);
+				manager = strsep(&managerStart, "/");
+				secretary = strsep(&managerStart, " ");
+				if(!secretary) { secretary=manager; }
 				/* We have a match -- play a greeting if they have it */
 				/* Check for the VoiceMail2 greeting first */
-				snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet", (char *)ast_config_AST_SPOOL_DIR, context, v->name);
+				snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet", (char *)ast_config_AST_SPOOL_DIR, context, manager);
 				/* Otherwise, check for an old-style Voicemail greeting */
-				snprintf(fn2, sizeof(fn2), "%s/vm/%s/greet", (char *)ast_config_AST_SPOOL_DIR, v->name);
+				snprintf(fn2, sizeof(fn2), "%s/vm/%s/greet", (char *)ast_config_AST_SPOOL_DIR, manager);
 				if (ast_fileexists(fn, NULL, chan->language) > 0) {
 					res = ast_streamfile(chan, fn, chan->language);
 					if (!res)
@@ -187,7 +191,7 @@
 						res = ast_waitstream(chan, AST_DIGIT_ANY);
 					ast_stopstream(chan);
 				} else {
-					res = ast_say_digit_str(chan, v->name, AST_DIGIT_ANY, chan->language);
+					res = ast_say_digit_str(chan, secretary, AST_DIGIT_ANY, chan->language);
 				}
 ahem:
 				if (!res)
@@ -199,7 +203,7 @@
 				ast_stopstream(chan);
 				if (res > -1) {
 					if (res == '1') {
-						strncpy(chan->exten, v->name, sizeof(chan->exten)-1);
+						strncpy(chan->exten, secretary, sizeof(chan->exten)-1);
 						chan->priority = 0;
 						strncpy(chan->context, context, sizeof(chan->context)-1);
 						res = 0;
Index: app_voicemail2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail2.c,v
retrieving revision 1.58
diff -u -r1.58 app_voicemail2.c
--- app_voicemail2.c	22 Oct 2003 03:12:17 -0000	1.58
+++ app_voicemail2.c	30 Oct 2003 22:05:48 -0000
@@ -2221,9 +2221,14 @@
 		if (!res) {
 			vms->repeats++;
 			if (vms->repeats > 2) {
+				/* The "out" block of vm_execmain tells them goodbye
+				   we will just set res and go about our business...
+				   
 				res = play_and_wait(chan, "vm-goodbye");
 				if (!res)
-					res = 't';
+				
+				*/
+				res = 't';
 			}
 		}
 	}
@@ -2429,10 +2434,15 @@
 		logretries++;
 	}
 	if (!valid && (logretries >= maxlogins)) {
+		/* The "out" block of vm_execmain tells them goodbye
+		and stops the stream.  we will just set res...
+                                                                   
 		ast_stopstream(chan);
 		res = play_and_wait(chan, "vm-goodbye");
 		if (res > 0)
-			res = 0;
+		
+		*/
+		res = 0;
 	}
 
 	if (valid) {
