[Asterisk-code-review] apps/app_playback.c: Add 'mix' option to app_playback (asterisk[master])

George Joseph asteriskteam at digium.com
Thu Oct 21 10:47:03 CDT 2021


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/16519 )

Change subject: apps/app_playback.c: Add 'mix' option to app_playback
......................................................................

apps/app_playback.c: Add 'mix' option to app_playback

I am adding a mix option that will play by filename and say.conf unlike
say option that will only play with say.conf. It
will look on the format of the name, if it is like say it play with
say.conf if not it will play the file name.

ASTERISK-29662

Change-Id: I815816916a308f0fa8f165140dc15772dcbd547a
---
M apps/app_playback.c
A doc/CHANGES-staging/add_mix_option_to_playback.txt
2 files changed, 23 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Sean Bright: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/apps/app_playback.c b/apps/app_playback.c
index 0c9281a..ab6e60e 100644
--- a/apps/app_playback.c
+++ b/apps/app_playback.c
@@ -62,6 +62,12 @@
 						be answered before the sound is played.</para>
 						<note><para>Not all channel types support playing messages while still on hook.</para></note>
 					</option>
+					<option name="say">
+						<para>Play using the say.conf file.</para>
+					</option>
+					<option name="mix">
+						<para>Play using a mix of filename and the say.conf file.</para>
+					</option>
 				</optionlist>
 			</parameter>
 		</syntax>
@@ -446,6 +452,7 @@
 	char *tmp;
 	int option_skip=0;
 	int option_say=0;
+	int option_mix=0;
 	int option_noanswer = 0;
 
 	AST_DECLARE_APP_ARGS(args,
@@ -466,6 +473,8 @@
 			option_skip = 1;
 		if (strcasestr(args.options, "say"))
 			option_say = 1;
+		if (strcasestr(args.options, "mix"))
+			option_mix = 1;
 		if (strcasestr(args.options, "noanswer"))
 			option_noanswer = 1;
 	}
@@ -486,6 +495,13 @@
 		while (!res && (front = strsep(&back, "&"))) {
 			if (option_say)
 				res = say_full(chan, front, "", ast_channel_language(chan), NULL, -1, -1);
+			else if (option_mix){
+				/* Check if it is in say format but not remote audio file */
+				if (strcasestr(front, ":") && !strcasestr(front, "://"))
+					res = say_full(chan, front, "", ast_channel_language(chan), NULL, -1, -1);
+				else
+					res = ast_streamfile(chan, front, ast_channel_language(chan));
+			}
 			else
 				res = ast_streamfile(chan, front, ast_channel_language(chan));
 			if (!res) {
diff --git a/doc/CHANGES-staging/add_mix_option_to_playback.txt b/doc/CHANGES-staging/add_mix_option_to_playback.txt
new file mode 100644
index 0000000..cfc876c
--- /dev/null
+++ b/doc/CHANGES-staging/add_mix_option_to_playback.txt
@@ -0,0 +1,7 @@
+Subject: app_playback
+Subject: apps
+
+A new option 'mix' is added to the Playback application that 
+will play by filename and say.conf. It will look on the format of the 
+name, if it is like say format it will play with say.conf if not it 
+will play the file name.
\ No newline at end of file

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I815816916a308f0fa8f165140dc15772dcbd547a
Gerrit-Change-Number: 16519
Gerrit-PatchSet: 7
Gerrit-Owner: Shloime Rosenblum <shloimerosenblum at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
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/20211021/04caf2b6/attachment.html>


More information about the asterisk-code-review mailing list