I would like to recommend the following patch to app_voicemail.c.
The patch defines a VMBOXEXISTSSTATUS channel variable, which will be
set to SUCCESS or FAILED, depending upon whether the specified mailbox
exists.
This replaces the previous functionality which would cause a jump to
n+101 if the existence check failed. A 'j' (jump) switch is provided
for people who want to keep the previous behaviour.
Also, just as with Dial(), if "priorityjumping" is set to "yes" in the
[general] section of extensions.conf then the previous behaviour will
be enforced globally.
Index: apps/app_voicemail.c
===================================================================
--- apps/app_voicemail.c (revision 2452)
+++ apps/app_voicemail.c (working copy)
@@ -331,8 +331,15 @@
"Check if vmbox exists";
static char *descrip_vm_box_exists =
-" MailboxExists([EMAIL PROTECTED]): Conditionally branches to priority
n+101\n"
-"if the specified voice mailbox exists.\n";
+" MailboxExists([EMAIL PROTECTED]|options]): Check to see if the specified\n"
+"mailbox exists. If no voicemail context is specified, the 'default' context\n"
+"will be used.\n"
+" This application will set the following channel variable upon completion:\n"
+" VMBOXEXISTSSTATUS - This will contain the status of the execution of
the\n"
+" MailboxExists application. Possible values include:\n"
+" SUCCESS | FAILED\n\n"
+" Options:\n"
+" j - Jump to priority n+101 if the mailbox is found.\n";
static char *synopsis_vmauthenticate =
"Authenticate off voicemail passwords";
@@ -5537,7 +5544,13 @@
struct localuser *u;
struct opbx_vm_user svm;
char *context, *box;
+ int priority_jump = 0;
+ OPBX_DECLARE_APP_ARGS(args,
+ OPBX_APP_ARG(mbox);
+ OPBX_APP_ARG(options);
+ );
+
if (opbx_strlen_zero(data)) {
opbx_log(LOG_ERROR, "MailboxExists requires an argument:
([EMAIL PROTECTED])\n");
return -1;
@@ -5552,15 +5565,23 @@
return -1;
}
+ OPBX_STANDARD_APP_ARGS(args, box);
+
+ if (args.options && strchr(args.options, 'j'))
+ priority_jump = 1;
+
if ((context = strchr(box, '@'))) {
*context = '\0';
context++;
}
if (find_user(&svm, context, box)) {
- if (opbx_goto_if_exists(chan, chan->context, chan->exten,
chan->priority + 101))
- opbx_log(LOG_WARNING, "VM box [EMAIL PROTECTED] exists,
but extension %s, priority %d doesn't exist\n", box, context, chan->exten,
chan->priority + 101);
- }
+ pbx_builtin_setvar_helper(chan, "VMBOXEXISTSSTATUS", "SUCCESS");
+ if (priority_jump || option_priority_jumping)
+ if (opbx_goto_if_exists(chan, chan->context,
chan->exten, chan->priority + 101))
+ opbx_log(LOG_WARNING, "VM box [EMAIL PROTECTED]
exists, but extension %s, priority %d doesn't exist\n", box, context,
chan->exten, chan->priority + 101);
+ } else
+ pbx_builtin_setvar_helper(chan, "VMBOXEXISTSSTATUS", "FAILED");
LOCAL_USER_REMOVE(u);
return 0;
}
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ [EMAIL PROTECTED]
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
_______________________________________________
Openpbx-dev mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-dev