aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/app_voicemail.c13
-rw-r--r--configs/voicemail.conf.sample5
2 files changed, 15 insertions, 3 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 54285c298..934deb9c1 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -223,6 +223,7 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate);
#define VM_ALLOCED (1 << 13)
#define VM_SEARCH (1 << 14)
#define VM_TEMPGREETWARN (1 << 15) /*!< Remind user tempgreeting is set */
+#define VM_MOVEHEARD (1 << 16) /*!< Move a "heard" message to Old after listening to it */
#define ERROR_LOCK_PATH -100
@@ -716,6 +717,8 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
ast_set2_flag(vmu, ast_true(value), VM_OPERATOR);
} else if (!strcasecmp(var, "envelope")){
ast_set2_flag(vmu, ast_true(value), VM_ENVELOPE);
+ } else if (!strcasecmp(var, "moveheard")){
+ ast_set2_flag(vmu, ast_true(value), VM_MOVEHEARD);
} else if (!strcasecmp(var, "sayduration")){
ast_set2_flag(vmu, ast_true(value), VM_SAYDURATION);
} else if (!strcasecmp(var, "saydurationm")){
@@ -5183,7 +5186,7 @@ static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
return ERROR_LOCK_PATH;
for (x = 0; x < vmu->maxmsg; x++) {
- if (!vms->deleted[x] && (strcasecmp(vms->curbox, "INBOX") || !vms->heard[x])) {
+ if (!vms->deleted[x] && (strcasecmp(vms->curbox, "INBOX") || !vms->heard[x] || (vms->heard[x] && !ast_test_flag(vmu, VM_MOVEHEARD)))) {
/* Save this message. It's not in INBOX or hasn't been heard */
make_file(vms->fn, sizeof(vms->fn), vms->curdir, x);
if (!EXISTS(vms->curdir, x, vms->fn, NULL))
@@ -5193,7 +5196,7 @@ static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
if (strcmp(vms->fn, vms->fn2)) {
RENAME(vms->curdir, x, vmu->mailbox,vmu->context, vms->curdir, vms->curmsg, vms->fn, vms->fn2);
}
- } else if (!strcasecmp(vms->curbox, "INBOX") && vms->heard[x] && !vms->deleted[x]) {
+ } else if (!strcasecmp(vms->curbox, "INBOX") && vms->heard[x] && ast_test_flag(vmu, VM_MOVEHEARD) && !vms->deleted[x]) {
/* Move to old folder before deleting */
res = save_to_folder(vmu, vms, x, 1);
if (res == ERROR_LOCK_PATH) {
@@ -8296,6 +8299,12 @@ static int load_config(int reload)
}
ast_set2_flag((&globalflags), ast_true(val), VM_ENVELOPE);
+ if (!(val = ast_variable_retrieve(cfg, "general", "moveheard"))) {
+ ast_debug(1,"Move Heard enabled globally\n");
+ val = "yes";
+ }
+ ast_set2_flag((&globalflags), ast_true(val), VM_MOVEHEARD);
+
if (!(val = ast_variable_retrieve(cfg, "general", "sayduration"))) {
ast_debug(1,"Duration info before msg enabled globally\n");
val = "yes";
diff --git a/configs/voicemail.conf.sample b/configs/voicemail.conf.sample
index 945783ea6..c4dac60fd 100644
--- a/configs/voicemail.conf.sample
+++ b/configs/voicemail.conf.sample
@@ -51,6 +51,9 @@ silencethreshold=128
; Max number of failed login attempts
maxlogins=3
;
+; Move heard messages to the 'Old' folder automagically. Defaults to on.
+;moveheard=yes
+;
; User context is where entries from users.conf are registered. The
; default value is 'default'
;
@@ -279,7 +282,7 @@ european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM
;4200 => 9855,Mark Spencer,markster@linux-support.net,mypager@digium.com,attach=no|serveremail=myaddy@digium.com|tz=central|maxmsg=10
;4300 => 3456,Ben Rigas,ben@american-computer.net
;4310 => -5432,Sales,sales@marko.net
-;4069 => 6522,Matt Brooks,matt@marko.net,,|tz=central|attach=yes|saycid=yes|dialout=fromvm|callback=fromvm|review=yes|operator=yes|envelope=yes|sayduration=yes|saydurationm=1
+;4069 => 6522,Matt Brooks,matt@marko.net,,|tz=central|attach=yes|saycid=yes|dialout=fromvm|callback=fromvm|review=yes|operator=yes|envelope=yes|moveheard=yes|sayduration=yes|saydurationm=1
;4073 => 1099,Bianca Paige,bianca@biancapaige.com,,delete=1
;4110 => 3443,Rob Flynn,rflynn@blueridge.net
;4235 => 1234,Jim Holmes,jim@astricon.ips,,Tz=european