[Asterisk-cvs] asterisk/apps app_voicemail.c,1.211,1.212
kpfleming at lists.digium.com
kpfleming at lists.digium.com
Sun May 15 01:17:37 CDT 2005
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv1702/apps
Modified Files:
app_voicemail.c
Log Message:
add silent option to VMAuthenticate application (bug #4157)
Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- app_voicemail.c 10 May 2005 19:05:50 -0000 1.211
+++ app_voicemail.c 15 May 2005 05:23:05 -0000 1.212
@@ -264,12 +264,13 @@
"Authenticate off voicemail passwords";
static char *descrip_vmauthenticate =
-" VMAuthenticate([mailbox][@context]): Behaves identically to the Authenticate\n"
-"application, with the exception that the passwords are taken from\n"
-"voicemail.conf.\n"
+" VMAuthenticate([mailbox][@context][|options]): Behaves identically to\n"
+"the Authenticate application, with the exception that the passwords are\n"
+"taken from voicemail.conf.\n"
" If the mailbox is specified, only that mailbox's password will be considered\n"
"valid. If the mailbox is not specified, the channel variable AUTH_MAILBOX will\n"
-"be set with the authenticated mailbox.\n";
+"be set with the authenticated mailbox.\n"
+"If the options contain 's' then no initial prompts will be played.\n";
/* Leave a message */
static char *app = "VoiceMail";
@@ -4375,7 +4376,9 @@
}
}
-static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_size, struct ast_vm_user *res_vmu, const char *context, const char *prefix, int skipuser, int maxlogins)
+static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_size,
+ struct ast_vm_user *res_vmu, const char *context, const char *prefix,
+ int skipuser, int maxlogins, int silent)
{
int useadsi, valid=0, logretries=0;
char password[AST_MAX_EXTENSION]="", *passptr;
@@ -4385,7 +4388,7 @@
adsi_begin(chan, &useadsi);
if (!skipuser && useadsi)
adsi_login(chan);
- if (!skipuser && ast_streamfile(chan, "vm-login", chan->language)) {
+ if (!silent && !skipuser && ast_streamfile(chan, "vm-login", chan->language)) {
ast_log(LOG_WARNING, "Couldn't stream login file\n");
return -1;
}
@@ -4553,7 +4556,7 @@
}
if (!valid) {
- res = vm_authenticate(chan, vms.username, sizeof(vms.username), &vmus, context, prefixstr, skipuser, maxlogins);
+ res = vm_authenticate(chan, vms.username, sizeof(vms.username), &vmus, context, prefixstr, skipuser, maxlogins, 0);
}
if (!res) {
@@ -4993,10 +4996,14 @@
return 0;
}
-static int vmauthenticate(struct ast_channel *chan, void *data) {
+static int vmauthenticate(struct ast_channel *chan, void *data)
+{
struct localuser *u;
char *s = data, *user=NULL, *context=NULL, mailbox[AST_MAX_EXTENSION];
struct ast_vm_user vmus;
+ char *options = NULL;
+ int silent = 0;
+ int res = -1;
if (s) {
s = ast_strdupa(s);
@@ -5004,20 +5011,30 @@
ast_log(LOG_ERROR, "Out of memory\n");
return -1;
}
- user = strsep(&s, "@");
- context = strsep(&s, "");
+ user = strsep(&s, "|");
+ options = strsep(&s, "|");
+ if (user) {
+ s = user;
+ user = strsep(&s, "@");
+ context = strsep(&s, "");
+ }
+ }
+
+ if (options) {
+ silent = (strchr(options, 's')) != NULL;
}
+
LOCAL_USER_ADD(u);
- if (!vm_authenticate(chan, mailbox, sizeof(mailbox), &vmus, context, NULL, 0, 3)) {
+ if (!vm_authenticate(chan, mailbox, sizeof(mailbox), &vmus, context, NULL, 0, 3, silent)) {
pbx_builtin_setvar_helper(chan, "AUTH_MAILBOX", mailbox);
pbx_builtin_setvar_helper(chan, "AUTH_CONTEXT", vmus.context);
LOCAL_USER_REMOVE(u);
- return 0;
- } else {
- LOCAL_USER_REMOVE(u);
- return -1;
+ res = 0;
}
+
+ LOCAL_USER_REMOVE(u);
+ return res;
}
static char show_voicemail_users_help[] =
More information about the svn-commits
mailing list