[svn-commits] murf: branch murf/bug8173-1.2 r48061 - in /team/murf/bug8173-1.2: ./ apps/ pb...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Nov 27 11:48:06 MST 2006


Author: murf
Date: Mon Nov 27 12:48:05 2006
New Revision: 48061

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48061
Log:
Merged revisions 48037,48045,48053 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r48037 | file | 2006-11-27 08:30:37 -0700 (Mon, 27 Nov 2006) | 2 lines

Do not reference the freed outgoing structure in the debug message. (issue #8425 reported by arkadia)

........
r48045 | tilghman | 2006-11-27 10:15:54 -0700 (Mon, 27 Nov 2006) | 2 lines

Random MOH wasn't really random (bug 8381)

........
r48053 | file | 2006-11-27 11:03:57 -0700 (Mon, 27 Nov 2006) | 2 lines

Use the proper function to get the new message count instead of always using the filesystem. (issue #8421 reported by slimey)

........

Modified:
    team/murf/bug8173-1.2/   (props changed)
    team/murf/bug8173-1.2/apps/app_voicemail.c
    team/murf/bug8173-1.2/pbx/pbx_spool.c
    team/murf/bug8173-1.2/res/res_musiconhold.c

Propchange: team/murf/bug8173-1.2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Nov 27 12:48:05 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-47998
+/branches/1.2:1-48060

Modified: team/murf/bug8173-1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8173-1.2/apps/app_voicemail.c?view=diff&rev=48061&r1=48060&r2=48061
==============================================================================
--- team/murf/bug8173-1.2/apps/app_voicemail.c (original)
+++ team/murf/bug8173-1.2/apps/app_voicemail.c Mon Nov 27 12:48:05 2006
@@ -5768,22 +5768,13 @@
 			}
 		}
 		while (vmu) {
-			char dirname[256];
-			DIR *vmdir;
-			struct dirent *vment;
-			int vmcount = 0;
-			char count[12];
+			int newmsgs = 0, oldmsgs = 0;
+			char count[12], tmp[256] = "";
 
 			if ((argc == 3) || ((argc == 5) && !strcmp(argv[4],vmu->context))) {
-				make_dir(dirname, 255, vmu->context, vmu->mailbox, "INBOX");
-				if ((vmdir = opendir(dirname))) {
-					/* No matter what the format of VM, there will always be a .txt file for each message. */
-					while ((vment = readdir(vmdir)))
-						if (strlen(vment->d_name) > 7 && !strncmp(vment->d_name + 7,".txt",4))
-							vmcount++;
-					closedir(vmdir);
-				}
-				snprintf(count,sizeof(count),"%d",vmcount);
+				snprintf(tmp, sizeof(tmp), "%s@%s", vmu->mailbox, ast_strlen_zero(vmu->context) ? "default" : vmu->context);
+				messagecount(tmp, &newmsgs, &oldmsgs);
+				snprintf(count,sizeof(count),"%d",newmsgs);
 				ast_cli(fd, output_format, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count);
 			}
 			vmu = vmu->next;

Modified: team/murf/bug8173-1.2/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8173-1.2/pbx/pbx_spool.c?view=diff&rev=48061&r1=48060&r2=48061
==============================================================================
--- team/murf/bug8173-1.2/pbx/pbx_spool.c (original)
+++ team/murf/bug8173-1.2/pbx/pbx_spool.c Mon Nov 27 12:48:05 2006
@@ -315,8 +315,8 @@
 					now += o->retrytime;
 					if (o->callingpid && (o->callingpid == ast_mainpid)) {
 						safe_append(o, time(NULL), "DelayedRetry");
+						ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn);
 						free_outgoing(o);
-						ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn);
 					} else {
 						/* Increment retries */
 						o->retries++;

Modified: team/murf/bug8173-1.2/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8173-1.2/res/res_musiconhold.c?view=diff&rev=48061&r1=48060&r2=48061
==============================================================================
--- team/murf/bug8173-1.2/res/res_musiconhold.c (original)
+++ team/murf/bug8173-1.2/res/res_musiconhold.c Mon Nov 27 12:48:05 2006
@@ -190,7 +190,7 @@
 		if (state->origwfmt && ast_set_write_format(chan, state->origwfmt)) {
 			ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%d'\n", chan->name, state->origwfmt);
 		}
-		state->save_pos = state->pos + 1;
+		state->save_pos = state->pos;
 	}
 }
 
@@ -201,32 +201,29 @@
 	int tries;
 
 	if (state->save_pos) {
-		state->pos = state->save_pos - 1;
+		state->pos = state->save_pos;
 		state->save_pos = 0;
-	} else {
+	}
+
+	state->samples = 0;
+	if (chan->stream) {
+		ast_closestream(chan->stream);
+		chan->stream = NULL;
+		state->pos++;
+		state->pos %= state->class->total_files;
+	}
+
+	if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
 		/* Try 20 times to find something good */
-		for (tries=0;tries < 20;tries++) {
-			state->samples = 0;
-			if (chan->stream) {
-				ast_closestream(chan->stream);
-				chan->stream = NULL;
-				state->pos++;
-			}
-
-			if (ast_test_flag(state->class, MOH_RANDOMIZE))
-				state->pos = rand();
-
-			state->pos %= state->class->total_files;
+		for (tries = 0; tries < 20; tries++) {
+			state->pos = rand() % state->class->total_files;
 
 			/* check to see if this file's format can be opened */
 			if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0)
 				break;
-
-		}
-	}
-
-	state->pos = state->pos % state->class->total_files;
-	
+		}
+	}
+
 	if (!ast_openstream_full(chan, state->class->filearray[state->pos], chan->language, 1)) {
 		ast_log(LOG_WARNING, "Unable to open file '%s': %s\n", state->class->filearray[state->pos], strerror(errno));
 		state->pos++;



More information about the svn-commits mailing list