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

Shloime Rosenblum asteriskteam at digium.com
Mon Sep 20 11:43:15 CDT 2021


Shloime Rosenblum has uploaded this change for review. ( 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
1 file changed, 16 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/19/16519/1

diff --git a/apps/app_playback.c b/apps/app_playback.c
index 0c9281a..045934d 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,7 +495,13 @@
 		while (!res && (front = strsep(&back, "&"))) {
 			if (option_say)
 				res = say_full(chan, front, "", ast_channel_language(chan), NULL, -1, -1);
-			else
+			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) {
 				res = ast_waitstream(chan, "");

-- 
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: 1
Gerrit-Owner: Shloime Rosenblum <shloimerosenblum at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210920/1016f829/attachment.html>


More information about the asterisk-code-review mailing list