[asterisk-commits] qwell: branch 1.2 r40446 - /branches/1.2/apps/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Aug 18 18:03:23 MST 2006


Author: qwell
Date: Fri Aug 18 20:03:22 2006
New Revision: 40446

URL: http://svn.digium.com/view/asterisk?rev=40446&view=rev
Log:
Fix a bug with app_voicemail when trying to use app_directory to leave messages
to another user (options 3, 5, 2).

If the context/extension didn't exist in the dialplan (and why should it have to?),
it would fail, saying that it's an "invalid extension".

Fix was different in svn trunk.

Modified:
    branches/1.2/apps/app_directory.c
    branches/1.2/apps/app_voicemail.c

Modified: branches/1.2/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_directory.c?rev=40446&r1=40445&r2=40446&view=diff
==============================================================================
--- branches/1.2/apps/app_directory.c (original)
+++ branches/1.2/apps/app_directory.c Fri Aug 18 20:03:22 2006
@@ -256,7 +256,7 @@
  *           '1' for selected entry from directory
  *           '*' for skipped entry from directory
  */
-static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dialcontext, char *ext, char *name) {
+static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dialcontext, char *ext, char *name, int fromappvm) {
 	int res = 0;
 	int loop = 3;
 	char fn[256];
@@ -314,12 +314,17 @@
 				case '1':
 					/* Name selected */
 					loop = 0;
-					if (ast_goto_if_exists(chan, dialcontext, ext, 1)) {
-						ast_log(LOG_WARNING,
-							"Can't find extension '%s' in context '%s'.  "
-							"Did you pass the wrong context to Directory?\n",
-							ext, dialcontext);
-						res = -1;
+					if (fromappvm) {
+						/* We still want to set the exten */
+						ast_copy_string(chan->exten, ext, sizeof(chan->exten));
+					} else {
+						if (ast_goto_if_exists(chan, dialcontext, ext, 1)) {
+							ast_log(LOG_WARNING,
+								"Can't find extension '%s' in context '%s'.  "
+								"Did you pass the wrong context to Directory?\n",
+								ext, dialcontext);
+							res = -1;
+						}
 					}
 					break;
 	
@@ -403,7 +408,7 @@
 	return cfg;
 }
 
-static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *context, char *dialcontext, char digit, int last)
+static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *context, char *dialcontext, char digit, int last, int fromappvm)
 {
 	/* Read in the first three digits..  "digit" is the first digit, already read */
 	char ext[NUMDIGITS + 1];
@@ -482,7 +487,7 @@
 
 			if (v) {
 				/* We have a match -- play a greeting if they have it */
-				res = play_mailbox_owner(chan, context, dialcontext, v->name, name);
+				res = play_mailbox_owner(chan, context, dialcontext, v->name, name, fromappvm);
 				switch (res) {
 					case -1:
 						/* user pressed '1' but extension does not exist, or
@@ -529,6 +534,7 @@
 	struct localuser *u;
 	struct ast_config *cfg;
 	int last = 1;
+	int fromappvm = 0;
 	char *context, *dialcontext, *dirintro, *options;
 
 	if (ast_strlen_zero(data)) {
@@ -549,6 +555,8 @@
 			options++; 
 			if (strchr(options, 'f'))
 				last = 0;
+			if (strchr(options, 'v'))
+				fromappvm = 1;
 		}
 	} else	
 		dialcontext = context;
@@ -581,7 +589,7 @@
 		if (!res)
 			res = ast_waitfordigit(chan, 5000);
 		if (res > 0) {
-			res = do_directory(chan, cfg, context, dialcontext, res, last);
+			res = do_directory(chan, cfg, context, dialcontext, res, last, fromappvm);
 			if (res > 0) {
 				res = ast_waitstream(chan, AST_DIGIT_ANY);
 				ast_stopstream(chan);

Modified: branches/1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_voicemail.c?rev=40446&r1=40445&r2=40446&view=diff
==============================================================================
--- branches/1.2/apps/app_voicemail.c (original)
+++ branches/1.2/apps/app_voicemail.c Fri Aug 18 20:03:22 2006
@@ -3445,13 +3445,15 @@
 			
 			app = pbx_findapp("Directory");
 			if (app) {
-				/* make mackup copies */
+				/* make backup copies */
+				char vmcontext[256];
 				memcpy(old_context, chan->context, sizeof(chan->context));
 				memcpy(old_exten, chan->exten, sizeof(chan->exten));
 				old_priority = chan->priority;
 				
 				/* call the the Directory, changes the channel */
-				res = pbx_exec(chan, app, context ? context : "default", 1);
+				sprintf(vmcontext, "%s||v", context ? context : "default");
+				res = pbx_exec(chan, app, vmcontext, 1);
 				
 				ast_copy_string(username, chan->exten, sizeof(username));
 				



More information about the asterisk-commits mailing list