[Asterisk-code-review] app followme: Add a prompt to be read when a call is connected (asterisk[13])

Graham Mainwaring asteriskteam at digium.com
Wed Dec 27 17:48:18 CST 2017


Graham Mainwaring has uploaded this change for review. ( https://gerrit.asterisk.org/7741


Change subject: app_followme:  Add a prompt to be read when a call is connected
......................................................................

app_followme:  Add a prompt to be read when a call is connected

This patch adds the ability to configure a prompt which will be read
to the "winner" who pressed 1 (or the configured value) and received
the call.

ASTERISK-24372 #close

Change-Id: I6ec1c6c883347f7d1e1f597189544993c8d65272
---
M CHANGES
M apps/app_followme.c
M configs/samples/followme.conf.sample
3 files changed, 32 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/41/7741/1

diff --git a/CHANGES b/CHANGES
index 9cb80f1..3c0e6a0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3272,6 +3272,9 @@
  * The winning FollowMe outgoing call is now put on hold if the caller put it on
    hold.
 
+ * Added a new prompt, connecting-prompt, which will be played
+   (if configured) to the "winner" callee before connecting the call.
+
 
 MixMonitor
 ------------------
diff --git a/apps/app_followme.c b/apps/app_followme.c
index 16fc044..22d06c2 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -176,6 +176,7 @@
 	char plsholdprompt[PATH_MAX];	/*!< Sound prompt name and path */
 	char statusprompt[PATH_MAX];	/*!< Sound prompt name and path */
 	char sorryprompt[PATH_MAX];	/*!< Sound prompt name and path */
+	char connprompt[PATH_MAX];	/*!< Sound prompt name and path */
 
 	AST_LIST_HEAD_NOLOCK(numbers, number) numbers;	   /*!< Head of the list of follow-me numbers */
 	AST_LIST_HEAD_NOLOCK(blnumbers, number) blnumbers; /*!< Head of the list of black-listed numbers */
@@ -210,6 +211,7 @@
 	char plsholdprompt[PATH_MAX];	/*!< Sound prompt name and path */
 	char statusprompt[PATH_MAX];	/*!< Sound prompt name and path */
 	char sorryprompt[PATH_MAX];	/*!< Sound prompt name and path */
+	char connprompt[PATH_MAX];	/*!< Sound prompt name and path */
 	struct ast_flags followmeflags;
 };
 
@@ -274,6 +276,7 @@
 static char plsholdprompt[PATH_MAX] = "followme/pls-hold-while-try";
 static char statusprompt[PATH_MAX] = "followme/status";
 static char sorryprompt[PATH_MAX] = "followme/sorry";
+static char connprompt[PATH_MAX] = "";
 
 
 static AST_RWLIST_HEAD_STATIC(followmes, call_followme);
@@ -329,6 +332,7 @@
 	ast_copy_string(f->plsholdprompt, plsholdprompt, sizeof(f->plsholdprompt));
 	ast_copy_string(f->statusprompt, statusprompt, sizeof(f->statusprompt));
 	ast_copy_string(f->sorryprompt, sorryprompt, sizeof(f->sorryprompt));
+	ast_copy_string(f->connprompt, connprompt, sizeof(f->connprompt));
 	if (activate) {
 		f->active = 1;
 	}
@@ -360,6 +364,8 @@
 		ast_copy_string(f->statusprompt, val, sizeof(f->statusprompt));
 	else if (!strcasecmp(param, "followme-sorry-prompt") || !strcasecmp(param, "sorry_prompt"))
 		ast_copy_string(f->sorryprompt, val, sizeof(f->sorryprompt));
+	else if (!strcasecmp(param, "followme-connecting-prompt") || !strcasecmp(param, "connecting_prompt"))
+		ast_copy_string(f->connprompt, val, sizeof(f->connprompt));
 	else if (failunknown) {
 		if (linenum >= 0)
 			ast_log(LOG_WARNING, "Unknown keyword in profile '%s': %s at line %d of followme.conf\n", f->name, param, linenum);
@@ -475,6 +481,12 @@
 	} else if ((tmpstr = ast_variable_retrieve(cfg, "general", "sorry_prompt")) && !ast_strlen_zero(tmpstr)) {
 		ast_copy_string(sorryprompt, tmpstr, sizeof(sorryprompt));
 	}
+        if ((tmpstr = ast_variable_retrieve(cfg, "general", "connecting-prompt")) && !ast_strlen_zero(tmpstr)) {
+                ast_copy_string(connprompt, tmpstr, sizeof(connprompt));
+        } else if ((tmpstr = ast_variable_retrieve(cfg, "general", "connecting_prompt")) && !ast_strlen_zero(tmpstr)) {
+                ast_copy_string(connprompt, tmpstr, sizeof(connprompt));
+        }
+
 
 	/* Chug through config file */
 	while ((cat = ast_category_browse(cfg, cat))) {
@@ -1377,6 +1389,7 @@
 	ast_copy_string(targs->plsholdprompt, f->plsholdprompt, sizeof(targs->plsholdprompt));
 	ast_copy_string(targs->statusprompt, f->statusprompt, sizeof(targs->statusprompt));
 	ast_copy_string(targs->sorryprompt, f->sorryprompt, sizeof(targs->sorryprompt));
+	ast_copy_string(targs->connprompt, f->connprompt, sizeof(targs->connprompt));
 	/* Copy the numbers we're going to use into another list in case the master list should get modified
 	   (and locked) while we're trying to do a follow-me */
 	AST_LIST_HEAD_INIT_NOLOCK(&targs->cnumbers);
@@ -1464,6 +1477,11 @@
 		res = 0;
 	} else {
 		caller = chan;
+
+                /* Play "connecting" message to the winner, if configured. */
+		if (!ast_strlen_zero(targs->connprompt)) {
+			ast_stream_and_wait(outbound, targs->connprompt, "");
+		}
 		/* Bridge the two channels. */
 
 		memset(&config, 0, sizeof(config));
diff --git a/configs/samples/followme.conf.sample b/configs/samples/followme.conf.sample
index be301f1..eb12cbd 100644
--- a/configs/samples/followme.conf.sample
+++ b/configs/samples/followme.conf.sample
@@ -34,7 +34,11 @@
 sorry_prompt=>followme/sorry
 ; The global default for 'I'm sorry, but we were unable to locate your party' message.
 ;
-;
+connecting_prompt=>
+; The global default sound file name for 'Please say hello to the caller' message.
+; Setting to an empty string skips playing the prompt.  The default is no prompt
+; file name.
+
 [default]
 musicclass=>default
 ; The moh class that should be used for the caller while they are waiting to be connected.
@@ -87,3 +91,9 @@
 sorry_prompt=>followme/sorry
 ; The 'I'm sorry, but we were unable to locate your party' message prompt. Default
 ; is the global default.
+;
+connecting_prompt=>
+; The sound file name for 'Please say hello to the caller' message. Default is the
+; global default.
+;
+

-- 
To view, visit https://gerrit.asterisk.org/7741
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ec1c6c883347f7d1e1f597189544993c8d65272
Gerrit-Change-Number: 7741
Gerrit-PatchSet: 1
Gerrit-Owner: Graham Mainwaring <graham at mhn.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171227/011b83f8/attachment-0001.html>


More information about the asterisk-code-review mailing list