[Asterisk-code-review] app queue: Add 'moved up' option to 'announce-position' setting (asterisk[15])

Sean Bright asteriskteam at digium.com
Wed Jul 26 08:44:20 CDT 2017


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/6095


Change subject: app_queue: Add 'moved_up' option to 'announce-position' setting
......................................................................

app_queue: Add 'moved_up' option to 'announce-position' setting

Change-Id: I173a124121422209485b043e2bf784f54242fce6
---
M CHANGES
M apps/app_queue.c
M configs/samples/queues.conf.sample
3 files changed, 26 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/95/6095/1

diff --git a/CHANGES b/CHANGES
index 5daa816..7df23fd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -17,6 +17,11 @@
  * PAUSEALL/UNPAUSEALL now sets the pause reason in the queue_log if it has
    been defined.
 
+ * A new option, "moved_up," has been added to the "announce-position"
+   configuration setting. Using this option will cause the Queue application
+   to announce the caller's position, but only if it has improved since we
+   last announced it.
+
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 14.6.0 to Asterisk 14.7.0 ------------
 ------------------------------------------------------------------------------
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 762119e..1e77ac8 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1628,6 +1628,7 @@
 #define ANNOUNCEPOSITION_NO 2 /*!< We don't announce position */
 #define ANNOUNCEPOSITION_MORE_THAN 3 /*!< We say "Currently there are more than <limit>" */
 #define ANNOUNCEPOSITION_LIMIT 4 /*!< We not announce position more than <limit> */
+#define ANNOUNCEPOSITION_MOVED_UP 5 /*!< Announce position if our position has improved */
 
 struct call_queue {
 	AST_DECLARE_STRING_FIELDS(
@@ -3166,6 +3167,8 @@
 			q->announceposition = ANNOUNCEPOSITION_LIMIT;
 		} else if (!strcasecmp(val, "more")) {
 			q->announceposition = ANNOUNCEPOSITION_MORE_THAN;
+		} else if (!strcasecmp(val, "moved_up")) {
+			q->announceposition = ANNOUNCEPOSITION_MOVED_UP;
 		} else if (ast_true(val)) {
 			q->announceposition = ANNOUNCEPOSITION_YES;
 		} else {
@@ -3911,6 +3914,11 @@
 		return 0;
 	}
 
+	/* If our position has changed for the better, say position */
+	if (qe->parent->announceposition == ANNOUNCEPOSITION_MOVED_UP && qe->last_pos_said <= qe->pos) {
+		return 0;
+	}
+
 	if (ringing) {
 		ast_indicate(qe->chan,-1);
 	} else {
@@ -3919,6 +3927,7 @@
 
 	if (qe->parent->announceposition == ANNOUNCEPOSITION_YES ||
 		qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN ||
+		qe->parent->announceposition == ANNOUNCEPOSITION_MOVED_UP ||
 		(qe->parent->announceposition == ANNOUNCEPOSITION_LIMIT &&
 		qe->pos <= qe->parent->announcepositionlimit)) {
 			announceposition = 1;
diff --git a/configs/samples/queues.conf.sample b/configs/samples/queues.conf.sample
index b34a8d8..a7d6dea 100644
--- a/configs/samples/queues.conf.sample
+++ b/configs/samples/queues.conf.sample
@@ -314,14 +314,18 @@
 ;announce-holdtime = yes|no|once
 ;
 ; Queue position announce?
-; Valid values are "yes," "no," "limit," or "more." If set to "no," then the caller's position will
-; never be announced. If "yes," then the caller's position in the queue will be announced
-; to the caller. If set to "more," then if the number of callers is more than the number
-; specified by the announce-position-limit option, then the caller will hear that there
-; are more than that many callers waiting (i.e. if a caller number 6 is in a queue with the
-; announce-position-limit set to 5, then that caller will hear that there are more than 5
-; callers waiting). If set to "limit," then only callers within the limit specified by announce-position-limit
-; will have their position announced.
+; Valid values are "yes," "no," "limit," "more," or "moved_up." If set to "no,"
+; then the caller's position will never be announced. If "yes," then the caller's
+; position in the queue will be announced to the caller. If set to "more," then
+; if the number of callers is more than the number specified by the
+; announce-position-limit option, then the caller will hear that there are more
+; than that many callers waiting (i.e. if a caller number 6 is in a queue with
+; the announce-position-limit set to 5, then that caller will hear that there are
+; more than 5 callers waiting). If set to "limit," then only callers within the
+; limit specified by announce-position-limit will have their position announced.
+; If set to "moved_up," the caller's position will be announced, but only if it
+; has improved (they've gotten closer to the head of the queue) since the last
+; time that we announced it.
 ;
 ;announce-position = yes
 ;

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I173a124121422209485b043e2bf784f54242fce6
Gerrit-Change-Number: 6095
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170726/6401a1e0/attachment.html>


More information about the asterisk-code-review mailing list