[Asterisk-cvs] asterisk/apps app_voicemail.c,1.141,1.142
markster at lists.digium.com
markster at lists.digium.com
Thu Sep 2 23:50:39 CDT 2004
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv16516/apps
Modified Files:
app_voicemail.c
Log Message:
Allow external program to be used to change password (bug #2357)
Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- app_voicemail.c 3 Sep 2004 03:26:29 -0000 1.141
+++ app_voicemail.c 3 Sep 2004 03:53:47 -0000 1.142
@@ -86,6 +86,8 @@
#define MAX_DATETIME_FORMAT 512
#define MAX_NUM_CID_CONTEXTS 10
+static int load_config(void);
+
/* Syntaxes supported, not really language codes.
en - English
de - German
@@ -178,7 +180,7 @@
static int play_record_review(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int outsidecaller, struct ast_vm_user *vmu, int *duration);
static int vm_delete(char *file);
-
+static char ext_pass_cmd[128];
static char *tdesc = "Comedian Mail (Voicemail System)";
@@ -572,6 +574,13 @@
return res;
}
+static void vm_change_password_shell(struct ast_vm_user *vmu, char *newpassword)
+{
+ char buf[255];
+ snprintf(buf,255,"%s %s %s %s",ext_pass_cmd,vmu->context,vmu->mailbox,newpassword);
+ ast_safe_system(buf);
+}
+
static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
{
/* There's probably a better way of doing this. */
@@ -3418,7 +3427,10 @@
cmd = play_and_wait(chan, "vm-mismatch");
break;
}
- vm_change_password(vmu,newpassword);
+ if(ast_strlen_zero(ext_pass_cmd))
+ vm_change_password(vmu,newpassword);
+ else
+ vm_change_password_shell(vmu,newpassword);
ast_log(LOG_DEBUG,"User %s set password to %s of length %i\n",vms->username,newpassword,(int)strlen(newpassword));
cmd = play_and_wait(chan,"vm-passchanged");
break;
@@ -4237,7 +4249,7 @@
char *dialoutcxt = NULL;
char *callbackcxt = NULL;
char *exitcxt = NULL;
-
+ char *extpc;
int x;
cfg = ast_load(VOICEMAIL_CONFIG);
@@ -4259,6 +4271,7 @@
zonesl = NULL;
users = NULL;
usersl = NULL;
+ memset(ext_pass_cmd, 0, sizeof(ext_pass_cmd) - 1);
if (cfg) {
/* General settings */
@@ -4279,7 +4292,12 @@
if (maxsilence > 0)
maxsilence *= 1000;
}
-
+
+ /* External password changing command */
+ if ((extpc = ast_variable_retrieve(cfg, "general", "externpass"))) {
+ strncpy(ext_pass_cmd,extpc,sizeof(ext_pass_cmd) - 1);
+ }
+
/* External voicemail notify application */
if ((notifystr = ast_variable_retrieve(cfg, "general", "externnotify"))) {
More information about the svn-commits
mailing list