app_voicemail: Allow preventing mark messages as urgent.
This adds an option to allow preventing callers from leaving
messages marked as 'urgent'.
Resolves: #619
UserNote: The leaveurgent mailbox option can now be used to
control whether callers may leave messages marked as 'Urgent'.
(cherry picked from commit 3c42b141d7
)
This commit is contained in:
parent
f8da5a2ba3
commit
3469e515de
|
@ -688,6 +688,7 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate);
|
||||||
#define VM_MESSAGEWRAP (1 << 17) /*!< Wrap around from the last message to the first, and vice-versa */
|
#define VM_MESSAGEWRAP (1 << 17) /*!< Wrap around from the last message to the first, and vice-versa */
|
||||||
#define VM_FWDURGAUTO (1 << 18) /*!< Autoset of Urgent flag on forwarded Urgent messages set globally */
|
#define VM_FWDURGAUTO (1 << 18) /*!< Autoset of Urgent flag on forwarded Urgent messages set globally */
|
||||||
#define VM_EMAIL_EXT_RECS (1 << 19) /*!< Send voicemail emails when an external recording is added to a mailbox */
|
#define VM_EMAIL_EXT_RECS (1 << 19) /*!< Send voicemail emails when an external recording is added to a mailbox */
|
||||||
|
#define VM_MARK_URGENT (1 << 20) /*!< After recording, permit the caller to mark the message as urgent */
|
||||||
#define ERROR_LOCK_PATH -100
|
#define ERROR_LOCK_PATH -100
|
||||||
#define ERROR_MAX_MSGS -101
|
#define ERROR_MAX_MSGS -101
|
||||||
#define OPERATOR_EXIT 300
|
#define OPERATOR_EXIT 300
|
||||||
|
@ -1426,6 +1427,8 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
|
||||||
ast_set2_flag(vmu, ast_true(value), VM_SVMAIL);
|
ast_set2_flag(vmu, ast_true(value), VM_SVMAIL);
|
||||||
} else if (!strcasecmp(var, "review")){
|
} else if (!strcasecmp(var, "review")){
|
||||||
ast_set2_flag(vmu, ast_true(value), VM_REVIEW);
|
ast_set2_flag(vmu, ast_true(value), VM_REVIEW);
|
||||||
|
} else if (!strcasecmp(var, "leaveurgent")){
|
||||||
|
ast_set2_flag(vmu, ast_true(value), VM_MARK_URGENT);
|
||||||
} else if (!strcasecmp(var, "tempgreetwarn")){
|
} else if (!strcasecmp(var, "tempgreetwarn")){
|
||||||
ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN);
|
ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN);
|
||||||
} else if (!strcasecmp(var, "messagewrap")){
|
} else if (!strcasecmp(var, "messagewrap")){
|
||||||
|
@ -12952,7 +12955,7 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
|
||||||
/* language parameter seems to only be used for display in manager action */
|
/* language parameter seems to only be used for display in manager action */
|
||||||
static const char options_string[] = "attach=yes|attachfmt=wav49|"
|
static const char options_string[] = "attach=yes|attachfmt=wav49|"
|
||||||
"serveremail=someguy@digium.com|fromstring=Voicemail System|tz=central|delete=yes|saycid=yes|"
|
"serveremail=someguy@digium.com|fromstring=Voicemail System|tz=central|delete=yes|saycid=yes|"
|
||||||
"sendvoicemail=yes|review=yes|tempgreetwarn=yes|messagewrap=yes|operator=yes|"
|
"sendvoicemail=yes|review=yes|tempgreetwarn=yes|messagewrap=yes|operator=yes|leaveurgent=yes|"
|
||||||
"envelope=yes|moveheard=yes|sayduration=yes|saydurationm=5|forcename=yes|"
|
"envelope=yes|moveheard=yes|sayduration=yes|saydurationm=5|forcename=yes|"
|
||||||
"forcegreetings=yes|callback=somecontext|dialout=somecontext2|"
|
"forcegreetings=yes|callback=somecontext|dialout=somecontext2|"
|
||||||
"exitcontext=somecontext3|minsecs=10|maxsecs=100|nextaftercmd=yes|"
|
"exitcontext=somecontext3|minsecs=10|maxsecs=100|nextaftercmd=yes|"
|
||||||
|
@ -13028,6 +13031,10 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
|
||||||
ast_test_status_update(test, "Parse failure for review option\n");
|
ast_test_status_update(test, "Parse failure for review option\n");
|
||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
|
if (!ast_test_flag(vmu, VM_MARK_URGENT)) {
|
||||||
|
ast_test_status_update(test, "Parse failure for leaveurgent option\n");
|
||||||
|
res = 1;
|
||||||
|
}
|
||||||
if (!ast_test_flag(vmu, VM_TEMPGREETWARN)) {
|
if (!ast_test_flag(vmu, VM_TEMPGREETWARN)) {
|
||||||
ast_test_status_update(test, "Parse failure for tempgreetwarm option\n");
|
ast_test_status_update(test, "Parse failure for tempgreetwarm option\n");
|
||||||
res = 1;
|
res = 1;
|
||||||
|
@ -13758,6 +13765,7 @@ static int append_vmu_info_astman(
|
||||||
"DeleteMessage: %s\r\n"
|
"DeleteMessage: %s\r\n"
|
||||||
"VolumeGain: %.2f\r\n"
|
"VolumeGain: %.2f\r\n"
|
||||||
"CanReview: %s\r\n"
|
"CanReview: %s\r\n"
|
||||||
|
"CanMarkUrgent: %s\r\n"
|
||||||
"CallOperator: %s\r\n"
|
"CallOperator: %s\r\n"
|
||||||
"MaxMessageCount: %d\r\n"
|
"MaxMessageCount: %d\r\n"
|
||||||
"MaxMessageLength: %d\r\n"
|
"MaxMessageLength: %d\r\n"
|
||||||
|
@ -13795,6 +13803,7 @@ static int append_vmu_info_astman(
|
||||||
ast_test_flag(vmu, VM_DELETE) ? "Yes" : "No",
|
ast_test_flag(vmu, VM_DELETE) ? "Yes" : "No",
|
||||||
vmu->volgain,
|
vmu->volgain,
|
||||||
ast_test_flag(vmu, VM_REVIEW) ? "Yes" : "No",
|
ast_test_flag(vmu, VM_REVIEW) ? "Yes" : "No",
|
||||||
|
ast_test_flag(vmu, VM_MARK_URGENT) ? "Yes" : "No",
|
||||||
ast_test_flag(vmu, VM_OPERATOR) ? "Yes" : "No",
|
ast_test_flag(vmu, VM_OPERATOR) ? "Yes" : "No",
|
||||||
vmu->maxmsg,
|
vmu->maxmsg,
|
||||||
vmu->maxsecs,
|
vmu->maxsecs,
|
||||||
|
@ -14759,6 +14768,14 @@ static int actual_load_config(int reload, struct ast_config *cfg, struct ast_con
|
||||||
}
|
}
|
||||||
ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW);
|
ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW);
|
||||||
|
|
||||||
|
if (!(val = ast_variable_retrieve(cfg, "general", "leaveurgent"))){
|
||||||
|
val = "yes";
|
||||||
|
} else if (ast_false(val)) {
|
||||||
|
ast_debug(1, "VM leave urgent messages disabled globally\n");
|
||||||
|
val = "no";
|
||||||
|
}
|
||||||
|
ast_set2_flag((&globalflags), ast_true(val), VM_MARK_URGENT);
|
||||||
|
|
||||||
/* Temporary greeting reminder */
|
/* Temporary greeting reminder */
|
||||||
if (!(val = ast_variable_retrieve(cfg, "general", "tempgreetwarn"))) {
|
if (!(val = ast_variable_retrieve(cfg, "general", "tempgreetwarn"))) {
|
||||||
ast_debug(1, "VM Temporary Greeting Reminder Option disabled globally\n");
|
ast_debug(1, "VM Temporary Greeting Reminder Option disabled globally\n");
|
||||||
|
@ -16328,7 +16345,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
if (outsidecaller) { /* only mark vm messages */
|
if (outsidecaller && ast_test_flag(vmu, VM_MARK_URGENT)) { /* only mark vm messages */
|
||||||
/* Mark Urgent */
|
/* Mark Urgent */
|
||||||
if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
|
if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
|
||||||
ast_verb(3, "marking message as Urgent\n");
|
ast_verb(3, "marking message as Urgent\n");
|
||||||
|
@ -16405,7 +16422,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
||||||
return cmd;
|
return cmd;
|
||||||
if (msg_exists) {
|
if (msg_exists) {
|
||||||
cmd = ast_play_and_wait(chan, "vm-review");
|
cmd = ast_play_and_wait(chan, "vm-review");
|
||||||
if (!cmd && outsidecaller) {
|
if (!cmd && outsidecaller && ast_test_flag(vmu, VM_MARK_URGENT)) {
|
||||||
if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
|
if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
|
||||||
cmd = ast_play_and_wait(chan, "vm-review-urgent");
|
cmd = ast_play_and_wait(chan, "vm-review-urgent");
|
||||||
} else if (flag) {
|
} else if (flag) {
|
||||||
|
|
|
@ -293,7 +293,8 @@ sendvoicemail=yes ; Allow the user to compose and send a voicemail while inside
|
||||||
; if not listed, calling the sender back will not be permitted
|
; if not listed, calling the sender back will not be permitted
|
||||||
; exitcontext=fromvm ; Context to go to on user exit such as * or 0
|
; exitcontext=fromvm ; Context to go to on user exit such as * or 0
|
||||||
; The default is the current context.
|
; The default is the current context.
|
||||||
; review=yes ; Allow sender to review/rerecord their message before saving it [OFF by default
|
; review=yes ; Allow sender to review/rerecord their message before saving it [OFF by default]
|
||||||
|
; leaveurgent=yes ; Allow senders to leave messages that are marked as 'Urgent' [ON by default]
|
||||||
; operator=yes ; Allow sender to hit 0 before/after/during leaving a voicemail to
|
; operator=yes ; Allow sender to hit 0 before/after/during leaving a voicemail to
|
||||||
; reach an operator. This option REQUIRES an 'o' extension in the
|
; reach an operator. This option REQUIRES an 'o' extension in the
|
||||||
; same context (or in exitcontext, if set), as that is where the
|
; same context (or in exitcontext, if set), as that is where the
|
||||||
|
|
Loading…
Reference in New Issue