Index: configs/voicemail.conf.sample =================================================================== --- configs/voicemail.conf.sample (revision 109712) +++ configs/voicemail.conf.sample (working copy) @@ -214,6 +214,10 @@ ; The default is "no". ;tempgreetwarn=yes ; Remind the user that their temporary greeting is set +;messagewrap=yes ; Enable next/last message to wrap around to + ; first (from last) and last (from first) message + ; The default is "yes". + [zonemessages] eastern=America/New_York|'vm-received' Q 'digits/at' IMp central=America/Chicago|'vm-received' Q 'digits/at' IMp Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 109712) +++ apps/app_voicemail.c (working copy) @@ -201,6 +201,7 @@ #define VM_ALLOCED (1 << 13) #define VM_SEARCH (1 << 14) #define VM_TEMPGREETWARN (1 << 15) /*!< Remind user tempgreeting is set */ +#define VM_MESSAGEWRAP (1 << 17) #define ERROR_LOCK_PATH -100 #define ERROR_MAILBOX_FULL -200 @@ -612,6 +613,8 @@ ast_set2_flag(vmu, ast_true(value), VM_REVIEW); } else if (!strcasecmp(var, "tempgreetwarn")){ ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN); + } else if (!strcasecmp(var, "messagewrap")){ + ast_set2_flag(vmu, ast_true(value), VM_MESSAGEWRAP); } else if (!strcasecmp(var, "operator")){ ast_set2_flag(vmu, ast_true(value), VM_OPERATOR); } else if (!strcasecmp(var, "envelope")){ @@ -5884,7 +5887,7 @@ } } -static int vm_instructions(struct ast_channel *chan, struct vm_state *vms, int skipadvanced) +static int vm_instructions(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int skipadvanced) { int res = 0; /* Play instructions and wait for new command */ @@ -5898,13 +5901,13 @@ if (!res) res = ast_play_and_wait(chan, "vm-opts"); } else { - if (vms->curmsg) + if ((vms->curmsg) || ((ast_test_flag(vmu, VM_MESSAGEWRAP) && (vms->lastmsg>0)))) res = ast_play_and_wait(chan, "vm-prev"); if (!res && !skipadvanced) res = ast_play_and_wait(chan, "vm-advopts"); if (!res) res = ast_play_and_wait(chan, "vm-repeat"); - if (!res && (vms->curmsg != vms->lastmsg)) + if (!res && ((vms->curmsg != vms->lastmsg) || ((ast_test_flag(vmu, VM_MESSAGEWRAP) && (vms->lastmsg>0))))) res = ast_play_and_wait(chan, "vm-next"); if (!res) { if (!vms->deleted[vms->curmsg]) @@ -6817,6 +6820,11 @@ cmd = play_message(chan, vmu, &vms); } else { cmd = ast_play_and_wait(chan, "vm-nomore"); + if ((ast_test_flag(vmu, VM_MESSAGEWRAP)) && (vms.lastmsg > 0)) { + cmd = ast_play_and_wait(chan, "vm-goingtolast"); + vms.curmsg=vms.lastmsg; + cmd = play_message(chan, vmu, &vms); + } } break; case '6': @@ -6825,6 +6833,11 @@ cmd = play_message(chan, vmu, &vms); } else { cmd = ast_play_and_wait(chan, "vm-nomore"); + if ((ast_test_flag(vmu, VM_MESSAGEWRAP)) && (vms.lastmsg > 0)) { + cmd = ast_play_and_wait(chan, "vm-goingtofirst"); + vms.curmsg=0; + cmd = play_message(chan, vmu, &vms); + } } break; case '7': @@ -6852,6 +6865,11 @@ cmd = play_message(chan, vmu, &vms); } else { cmd = ast_play_and_wait(chan, "vm-nomore"); + if ((ast_test_flag(vmu, VM_MESSAGEWRAP)) && (vms.lastmsg > 0)) { + cmd = ast_play_and_wait(chan, "vm-goingtofirst"); + vms.curmsg=0; + cmd = play_message(chan, vmu, &vms); + } } } } else /* Delete not valid if we haven't selected a message */ @@ -6922,6 +6940,11 @@ cmd = play_message(chan, vmu, &vms); } else { cmd = ast_play_and_wait(chan, "vm-nomore"); + if ((ast_test_flag(vmu, VM_MESSAGEWRAP)) && (vms.lastmsg > 0)) { + cmd = ast_play_and_wait(chan, "vm-goingtofirst"); + vms.curmsg=0; + cmd = play_message(chan, vmu, &vms); + } } } break; @@ -6933,7 +6956,7 @@ if (!cmd) cmd = ast_play_and_wait(chan, "vm-opts"); if (!cmd) - cmd = vm_instructions(chan, &vms, 1); + cmd = vm_instructions(chan, vmu, &vms, 1); } else cmd = 0; break; @@ -6943,7 +6966,7 @@ adsi_status(chan, &vms); break; default: /* Nothing */ - cmd = vm_instructions(chan, &vms, 0); + cmd = vm_instructions(chan, vmu, &vms, 0); break; } } @@ -7381,6 +7404,7 @@ const char *astcallop; const char *astreview; const char *asttempgreetwarn; + const char *astmessagewrap; const char *astskipcmd; const char *asthearenv; const char *astsaydurationinfo; @@ -7655,6 +7679,13 @@ } ast_set2_flag((&globalflags), ast_true(asttempgreetwarn), VM_TEMPGREETWARN); + if (!(astmessagewrap = ast_variable_retrieve(cfg, "general", "messagewrap"))){ + if (option_debug) + ast_log(LOG_DEBUG,"VM next message wrap enabled globally\n"); + astmessagewrap = "yes"; + } + ast_set2_flag((&globalflags), ast_true(astmessagewrap), VM_MESSAGEWRAP); + if (!(astcallop = ast_variable_retrieve(cfg, "general", "operator"))){ if (option_debug) ast_log(LOG_DEBUG,"VM Operator break disabled globally\n");