[PATCH] Was Re: [Asterisk-Users] Message Waiting and VoiceMail 2

Brancaleoni Matteo mbrancaleoni at espia.it
Sun May 25 07:28:34 MST 2003


Ok found it. The problem was in app.c , that works ok if
context=default, but fails if voicemail context != default

(in that case app_has_voicemail searches into
/var/spool/asterisk/voicemail/<context>/mailbox at context/INBOX
instead of
/var/spool/asterisk/voicemail/<context>/mailbox/INBOX
as is expected to do)

That fixes the message checking issue.

What remains out is vm mysql support, that don't set a context at all...

Il dom, 2003-05-25 alle 15:40, Brancaleoni Matteo ha scritto:
> Hi again.
> Just for debug, I noticed that this issue happens when:
> 
> * vm compiled with mysql support > app.c don't get the context -> 
>   so we fall into default (eg the dir checked is 
>   voicemail/default/<vm num>
> 
> * any mailbox defined outside the default context into voicemail.conf
>   So if I specify mailbox=1234 at office , it don't get checked.
>   If the mailbox is into default, all is ok.
> 
> So we don't have true mailbox checking virtualhosting ;-)
> 
> however , I'm trying to understand why the 2nd point don't work...
> 
> Matteo.
> 
> Il dom, 2003-05-25 alle 14:59, Brancaleoni Matteo ha scritto:
> > Hi.
> > I noticed that if new messages are recorded
> > with voicemail2 , they're not detected by
> > the message waiting indicator, so
> > the mailbox=XXXX param has no effect, and
> > no message waiting is sent to the phone
> > (sip & adsi, or stutter dialtone)
> > 
> > Any hint?
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
-------------- next part --------------
--- asterisk/app.c	2003-05-25 16:17:00.000000000 +0200
+++ myasterisk/app.c	2003-05-25 16:15:47.000000000 +0200
@@ -149,6 +149,7 @@
 	char tmp[256]="";
 	char *mb, *cur;
 	char *context;
+	char *mailboxnr;
 	int ret;
 	/* If no mailbox, return immediately */
 	if (!strlen(mailbox))
@@ -167,12 +168,14 @@
 	}
 	strncpy(tmp, mailbox, sizeof(tmp) - 1);
 	context = strchr(tmp, '@');
+	strncpy(tmp, mailbox, sizeof(tmp) - 1);
+	mailboxnr = strtok(tmp, "@");
 	if (context) {
 		*context = '\0';
 		context++;
 	} else
 		context = "default";
-	snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, context, mailbox);
+	snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, context, mailboxnr);
 	dir = opendir(fn);
 	if (!dir)
 		return 0;
@@ -194,6 +197,7 @@
 	char tmp[256]="";
 	char *mb, *cur;
 	char *context;
+	char *mailboxnr;
 	int ret;
 	if (newmsgs)
 		*newmsgs = 0;
@@ -223,13 +227,15 @@
 	}
 	strncpy(tmp, mailbox, sizeof(tmp) - 1);
 	context = strchr(tmp, '@');
+	strncpy(tmp, mailbox, sizeof(tmp) - 1);
+	mailboxnr = strtok(tmp, "@");
 	if (context) {
 		*context = '\0';
 		context++;
 	} else
 		context = "default";
 	if (newmsgs) {
-		snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, context, mailbox);
+		snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, context, mailboxnr);
 		dir = opendir(fn);
 		if (dir) {
 			while ((de = readdir(dir))) {
@@ -242,7 +248,7 @@
 		}
 	}
 	if (oldmsgs) {
-		snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/Old", (char *)ast_config_AST_SPOOL_DIR, context, mailbox);
+		snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/Old", (char *)ast_config_AST_SPOOL_DIR, context, mailboxnr);
 		dir = opendir(fn);
 		if (dir) {
 			while ((de = readdir(dir))) {


More information about the asterisk-users mailing list