Index: apps/app_voicemail.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v retrieving revision 1.93 diff -u -r1.93 app_voicemail.c --- apps/app_voicemail.c 21 May 2004 00:55:36 -0000 1.93 +++ apps/app_voicemail.c 23 May 2004 01:42:25 -0000 @@ -3424,44 +3424,46 @@ static int vm_box_exists(struct ast_channel *chan, void *data) { struct localuser *u; struct ast_vm_user *user; - char *context, *box; - int branch=0; + char *context; + struct ast_vm_user svm; + char tmp[256], *ext; - if (!data) { + if (data && strlen(data)) { + strncpy(tmp, data, sizeof(tmp) - 1); + } else { ast_log(LOG_ERROR, "MailboxExists requires an argument: (vmbox[@context])\n"); return -1; } LOCAL_USER_ADD(u); - context = ast_strdupa(data); - if (index(context, '@')) { - box = strsep(&context, "@"); - } else { - box = context; - context = "default"; - } + ext = tmp; + while(*ext) { + if (*ext == 's') { + ext++; + } else if (*ext == 'b') { + ext++; + } else if (*ext == 'u') { + ext++; + } else + break; + } - ast_mutex_lock(&vmlock); - user = users; - while (user) { - if ((!strcmp(box,user->mailbox)) && (!strcmp(context,user->context))) { - branch = 1; - break; - } - } - ast_mutex_unlock(&vmlock); + context = strchr(tmp, '@'); + if (context) { + *context = '\0'; + context++; + } - if (branch) { + if ((!find_user(&svm, context, ext))) { if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid)) { chan->priority += 100; } else - ast_log(LOG_WARNING, "VM box %s@%s exists, but extension %s, priority %d doesn't exist\n", box, context, chan->exten, chan->priority + 101); + ast_log(LOG_WARNING, "VM box %s@%s exists, but extension %s, priority %d doesn't exist\n", ext, context, chan->exten, chan->priority + 101); } LOCAL_USER_REMOVE(u); return 0; } - #ifndef USEMYSQLVM /* XXX TL Bug 690 */ static char show_voicemail_users_help[] =