[Asterisk-code-review] app_queue: option to start the periodic announcements at a different... (asterisk[master])

Jaco Kroon asteriskteam at digium.com
Tue Feb 21 06:28:10 CST 2023


Jaco Kroon has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19899 )


Change subject: app_queue:  option to start the periodic announcements at a different time interval than the frequency.
......................................................................

app_queue:  option to start the periodic announcements at a different
time interval than the frequency.

Change-Id: Ia79984b6377ef78f167ad9ea2ac084bec29955d0
Signed-off-by: Jaco Kroon <jaco at uls.co.za>
---
M apps/app_queue.c
M configs/samples/queues.conf.sample
2 files changed, 24 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/99/19899/1

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 084f25b..5ead140 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1839,6 +1839,7 @@
 	int announcepositionlimit;          /*!< How many positions we announce? */
 	int announcefrequency;              /*!< How often to announce their position */
 	int minannouncefrequency;           /*!< The minimum number of seconds between position announcements (def. 15) */
+	int periodicannouncestartdelay;     /*!< How long into the queue should the periodic accouncement start */
 	int periodicannouncefrequency;      /*!< How often to play periodic announcement */
 	int numperiodicannounce;            /*!< The number of periodic announcements configured */
 	int randomperiodicannounce;         /*!< Are periodic announcments randomly chosen */
@@ -3423,6 +3424,8 @@
 			ast_str_set(&q->sound_periodicannounce[0], 0, "%s", val);
 			q->numperiodicannounce = 1;
 		}
+	} else if (!strcasecmp(param, "periodic-announce-startdelay")) {
+		q->periodicannouncestartdelay = atoi(val);
 	} else if (!strcasecmp(param, "periodic-announce-frequency")) {
 		q->periodicannouncefrequency = atoi(val);
 	} else if (!strcasecmp(param, "relative-periodic-announce")) {
@@ -8522,6 +8525,10 @@
 	qe.last_pos_said = 0;
 	qe.last_pos = 0;
 	qe.last_periodic_announce_time = time(NULL);
+	if (qe.parent->periodicannouncestartdelay >= 0) {
+		qe.last_periodic_announce_time += qe.parent->periodicannouncestartdelay;
+		qe.last_periodic_announce_time -= qe.parent->periodicannouncefrequency;
+	}
 	qe.last_periodic_announce_sound = 0;
 	qe.valid_digits = 0;
 	if (join_queue(args.queuename, &qe, &reason, position)) {
diff --git a/configs/samples/queues.conf.sample b/configs/samples/queues.conf.sample
index 0987236..07b78b3 100644
--- a/configs/samples/queues.conf.sample
+++ b/configs/samples/queues.conf.sample
@@ -278,6 +278,12 @@
 ;
 ;periodic-announce-frequency=60
 ;
+; If enabled, how far into the call should the periodic announcements start.
+; Normally this happens at periodic-announce-frequency into the call, which
+; may not always be desired.
+;
+;periodic-announce-startdelay=10
+;
 ; Should the periodic announcements be played in a random order? Default is no.
 ;
 ;random-periodic-announce=no

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ia79984b6377ef78f167ad9ea2ac084bec29955d0
Gerrit-Change-Number: 19899
Gerrit-PatchSet: 1
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230221/74f7bbed/attachment-0001.html>


More information about the asterisk-code-review mailing list