[asterisk-commits] app queue: Add announce-position-only-up option (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 1 08:39:49 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5880 )

Change subject: app_queue: Add announce-position-only-up option
......................................................................

app_queue: Add announce-position-only-up option

Setting this option will cause the Queue application to only announce
the caller's position if it has improved since the last time that we
announced it.

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

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



diff --git a/CHANGES b/CHANGES
index 5daa816..462018b 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, "announce-position-only-up," has been added that, when set to
+   yes, causes position announcements to only be played when the caller's
+   queue position has improved since the last time that we annouced their
+   position. This default is no.
+
 ------------------------------------------------------------------------------
 --- 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..f297dad 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1683,6 +1683,7 @@
 	unsigned int timeoutrestart:1;
 	unsigned int announceholdtime:2;
 	unsigned int announceposition:3;
+	unsigned int announceposition_only_up:1; /*!< Only announce position if it has improved */
 	int strategy:4;
 	unsigned int realtime:1;
 	unsigned int found:1;
@@ -2722,6 +2723,7 @@
 	q->announcefrequency = 0;
 	q->minannouncefrequency = DEFAULT_MIN_ANNOUNCE_FREQUENCY;
 	q->announceholdtime = 1;
+	q->announceposition_only_up = 0;
 	q->announcepositionlimit = 10; /* Default 10 positions */
 	q->announceposition = ANNOUNCEPOSITION_YES; /* Default yes */
 	q->roundingseconds = 0; /* Default - don't announce seconds */
@@ -3171,6 +3173,8 @@
 		} else {
 			q->announceposition = ANNOUNCEPOSITION_NO;
 		}
+	} else if (!strcasecmp(param, "announce-position-only-up")) {
+		q->announceposition_only_up = ast_true(val);
 	} else if (!strcasecmp(param, "announce-position-limit")) {
 		q->announcepositionlimit = atoi(val);
 	} else if (!strcasecmp(param, "periodic-announce")) {
@@ -3911,6 +3915,11 @@
 		return 0;
 	}
 
+	/* Only announce if the caller's queue position has improved since last time */
+	if (qe->parent->announceposition_only_up && qe->last_pos_said <= qe->pos) {
+		return 0;
+	}
+
 	if (ringing) {
 		ast_indicate(qe->chan,-1);
 	} else {
diff --git a/configs/samples/queues.conf.sample b/configs/samples/queues.conf.sample
index b34a8d8..3e7cbd8 100644
--- a/configs/samples/queues.conf.sample
+++ b/configs/samples/queues.conf.sample
@@ -345,6 +345,11 @@
 ;
 ; announce-round-seconds = 10
 ;
+; Only announce the caller's position if it has improved since the last announcement.
+; The default value is no.
+;
+; announce-position-only-up = yes
+;
 ; Use these sound files in making position/holdtime announcements.  The
 ; defaults are as listed below -- change only if you need to.
 ;

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I173a124121422209485b043e2bf784f54242fce6
Gerrit-Change-Number: 5880
Gerrit-PatchSet: 5
Gerrit-Owner: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170801/84b1d52b/attachment-0001.html>


More information about the asterisk-commits mailing list