[Asterisk-code-review] app_voicemail.c: Ability to silence instructions if greeting is present. (asterisk[master])

Friendly Automation asteriskteam at digium.com
Wed Sep 8 19:18:12 CDT 2021


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/16444 )

Change subject: app_voicemail.c: Ability to silence instructions if greeting is present.
......................................................................

app_voicemail.c: Ability to silence instructions if greeting is present.

There is an option to silence voicemail instructions but it does not
take into consideration if a recorded greeting exists or not. Add a
new 'S' option that does that.

ASTERISK-29632 #close

Change-Id: I03f2f043a9beb9d99deab302247e2a8686066fb4
---
M apps/app_voicemail.c
A doc/CHANGES-staging/app_voicemail.txt
2 files changed, 23 insertions(+), 3 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit



diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index db531e9..cb70ed6 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -149,6 +149,11 @@
 						<para>Skip the playback of instructions for leaving a message to the
 						calling party.</para>
 					</option>
+					<option name="S">
+						<para>Skip the playback of instructions for leaving a message to the
+						calling party, but only if a greeting has been recorded by the
+						mailbox user.</para>
+					</option>
 					<option name="t">
 						<argument name="x" required="false" />
 						<para>Play a custom beep tone to the caller instead of the default one.
@@ -588,7 +593,8 @@
 	OPT_MESSAGE_Urgent =   (1 << 8),
 	OPT_MESSAGE_PRIORITY = (1 << 9),
 	OPT_EARLYM_GREETING =  (1 << 10),
-	OPT_BEEP =             (1 << 11)
+	OPT_BEEP =             (1 << 11),
+	OPT_SILENT_IF_GREET =  (1 << 12),
 };
 
 enum vm_option_args {
@@ -608,6 +614,7 @@
 
 AST_APP_OPTIONS(vm_app_options, {
 	AST_APP_OPTION('s', OPT_SILENT),
+	AST_APP_OPTION('S', OPT_SILENT_IF_GREET),
 	AST_APP_OPTION('b', OPT_BUSY_GREETING),
 	AST_APP_OPTION('u', OPT_UNAVAIL_GREETING),
 	AST_APP_OPTION_ARG('g', OPT_RECORDGAIN, OPT_ARG_RECORDGAIN),
@@ -6781,8 +6788,14 @@
 #endif
 			RETRIEVE(prefile, -1, ext, context);
 		if (ast_fileexists(prefile, NULL, NULL) > 0) {
-			if (ast_streamfile(chan, prefile, ast_channel_language(chan)) > -1)
+			if (ast_streamfile(chan, prefile, ast_channel_language(chan)) > -1) {
+				/* We know we have a greeting at this point, so squelch the instructions
+				 * if that is what is being asked of us */
+				if (ast_test_flag(options, OPT_SILENT_IF_GREET)) {
+					ast_set_flag(options, OPT_SILENT);
+				}
 				res = ast_waitstream(chan, ecodes);
+			}
 #ifdef ODBC_STORAGE
 			if (success == -1) {
 				/* We couldn't retrieve the file from the database, but we found it on the file system. Let's put it in the database. */
@@ -12295,7 +12308,7 @@
 		if (args.argc == 2) {
 			if (ast_app_parse_options(vm_app_options, &flags, opts, args.argv1))
 				return -1;
-			ast_copy_flags(&leave_options, &flags, OPT_SILENT | OPT_BUSY_GREETING | OPT_UNAVAIL_GREETING | OPT_MESSAGE_Urgent | OPT_MESSAGE_PRIORITY | OPT_DTMFEXIT);
+			ast_copy_flags(&leave_options, &flags, OPT_SILENT | OPT_SILENT_IF_GREET | OPT_BUSY_GREETING | OPT_UNAVAIL_GREETING | OPT_MESSAGE_Urgent | OPT_MESSAGE_PRIORITY | OPT_DTMFEXIT);
 			if (ast_test_flag(&flags, OPT_RECORDGAIN)) {
 				int gain;
 
diff --git a/doc/CHANGES-staging/app_voicemail.txt b/doc/CHANGES-staging/app_voicemail.txt
new file mode 100644
index 0000000..c52d1f0
--- /dev/null
+++ b/doc/CHANGES-staging/app_voicemail.txt
@@ -0,0 +1,7 @@
+Subject: app_voicemail
+
+Add a new 'S' option to VoiceMail which prevents the instructions
+(vm-intro) from being played if a busy/unavailable/temporary greeting
+from the voicemail user is played. This is similar to the existing 's'
+option except that instructions will still be played if no user
+greeting is available.

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16444
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I03f2f043a9beb9d99deab302247e2a8686066fb4
Gerrit-Change-Number: 16444
Gerrit-PatchSet: 3
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Sean Bright <sean at seanbright.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210908/149b5da6/attachment-0001.html>


More information about the asterisk-code-review mailing list