diff options
-rwxr-xr-x | apps/app_voicemail.c | 26 | ||||
-rwxr-xr-x | configs/voicemail.conf.sample | 4 |
2 files changed, 26 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 27e16b6ec..f20d6d029 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -86,6 +86,8 @@ static inline void sql_close(void) { } #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 dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, 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 @@ static int reset_user_pw(char *context, char *mailbox, char *newpass) 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 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct 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 @@ static int load_config(void) char *dialoutcxt = NULL; char *callbackcxt = NULL; char *exitcxt = NULL; - + char *extpc; int x; cfg = ast_load(VOICEMAIL_CONFIG); @@ -4259,6 +4271,7 @@ static int load_config(void) zonesl = NULL; users = NULL; usersl = NULL; + memset(ext_pass_cmd, 0, sizeof(ext_pass_cmd) - 1); if (cfg) { /* General settings */ @@ -4279,7 +4292,12 @@ static int load_config(void) 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"))) { diff --git a/configs/voicemail.conf.sample b/configs/voicemail.conf.sample index a763ad2a3..2620a485b 100755 --- a/configs/voicemail.conf.sample +++ b/configs/voicemail.conf.sample @@ -28,6 +28,10 @@ maxlogins=3 ; called when a voicemail is left, delivered, or your voicemailbox ; is checked, uncomment this: ;externnotify=/usr/bin/myapp +; If you need to have an external program, i.e. /usr/bin/myapp +; called when a voicemail password is changed, +; uncomment this: +;externpass=/usr/bin/myapp ; For the directory, you can override the intro file if you want ;directoryintro=dir-intro ; The character set for voicemail messages can be specified here |