Index: apps/app_voicemail.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v retrieving revision 1.139 diff -u -r1.139 app_voicemail.c --- apps/app_voicemail.c 2 Sep 2004 04:57:37 -0000 1.139 +++ apps/app_voicemail.c 2 Sep 2004 17:40:44 -0000 @@ -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. */ @@ -3412,7 +3421,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; @@ -4183,6 +4195,10 @@ return NULL; } +static int handle_voicemail_reload(int fd, int argc, char *argv[]) { + return load_config(); +} + static struct ast_cli_entry show_voicemail_users_cli = { { "show", "voicemail", "users", NULL }, handle_show_voicemail_users, "List defined voicemail boxes", @@ -4195,6 +4211,12 @@ #endif +static struct ast_cli_entry voicemail_reload_cli = + { { "voicemail", "reload", NULL }, + handle_voicemail_reload, "Reload Voicemail", + "voicemail reload"}; + + static int load_config(void) { struct ast_vm_user *cur, *l; @@ -4219,7 +4241,7 @@ char *dialoutcxt = NULL; char *callbackcxt = NULL; char *exitcxt = NULL; - + char *extpc; int x; cfg = ast_load(VOICEMAIL_CONFIG); @@ -4261,7 +4283,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"))) { @@ -4568,12 +4595,14 @@ ast_cli_unregister(&show_voicemail_users_cli); ast_cli_unregister(&show_voicemail_zones_cli); #endif + ast_cli_unregister(&voicemail_reload_cli); return res; } int load_module(void) { int res; + memset(ext_pass_cmd, 0, sizeof(ext_pass_cmd) - 1); res = ast_register_application(app, vm_exec, synopsis_vm, descrip_vm); res |= ast_register_application(capp, vm_exec, synopsis_vm, descrip_vm); res |= ast_register_application(app2, vm_execmain, synopsis_vmain, descrip_vmain); @@ -4594,6 +4623,7 @@ ast_cli_register(&show_voicemail_users_cli); ast_cli_register(&show_voicemail_zones_cli); #endif + ast_cli_register(&voicemail_reload_cli); return res; } Index: configs/voicemail.conf.sample =================================================================== RCS file: /usr/cvsroot/asterisk/configs/voicemail.conf.sample,v retrieving revision 1.37 diff -u -r1.37 voicemail.conf.sample --- configs/voicemail.conf.sample 16 Aug 2004 04:05:43 -0000 1.37 +++ configs/voicemail.conf.sample 3 Sep 2004 01:56:40 -0000 @@ -28,6 +28,10 @@ ; 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