]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_queue: periodic announcement configurable start time.
authorJaco Kroon <jaco@uls.co.za>
Tue, 21 Feb 2023 12:24:36 +0000 (14:24 +0200)
committerJoshua Colp <jcolp@sangoma.com>
Thu, 16 Mar 2023 15:43:38 +0000 (10:43 -0500)
This newly introduced periodic-announce-startdelay makes it possible to
configure the initial start delay of the first periodic announcement
after which periodic-announce-frequency takes over.

ASTERISK-30437 #close
Change-Id: Ia79984b6377ef78f167ad9ea2ac084bec29955d0
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
apps/app_queue.c
configs/samples/queues.conf.sample
doc/CHANGES-staging/app_queue.txt [new file with mode: 0644]

index 084f25b456f7051715b25a64596ffaf303c5a09e..df7322605cd1d33a76964bee9e29b1138d4e52be 100644 (file)
@@ -1839,6 +1839,7 @@ struct call_queue {
        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 */
@@ -2967,6 +2968,7 @@ static void init_queue(struct call_queue *q)
        q->weight = 0;
        q->timeoutrestart = 0;
        q->periodicannouncefrequency = 0;
+       q->periodicannouncestartdelay = -1;
        q->randomperiodicannounce = 0;
        q->numperiodicannounce = 0;
        q->relativeperiodicannounce = 0;
@@ -3423,6 +3425,8 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
                        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 +8526,10 @@ static int queue_exec(struct ast_channel *chan, const char *data)
        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)) {
index 0987236cd695d815b3227e1cc879a7877549e9aa..7b5fe0b32001313d1d2c66b09dddc1835e76a94e 100644 (file)
@@ -278,6 +278,13 @@ monitor-type = MixMonitor
 ;
 ;periodic-announce-frequency=60
 ;
+; If given indicates the number of seconds after entering the queue the first
+; periodic announcement should be played.  The default (and historic) behavior
+; is to play the first periodic announcement at periodic-announce-frequency
+; seconds after entering the queue.
+;
+;periodic-announce-startdelay=10
+;
 ; Should the periodic announcements be played in a random order? Default is no.
 ;
 ;random-periodic-announce=no
diff --git a/doc/CHANGES-staging/app_queue.txt b/doc/CHANGES-staging/app_queue.txt
new file mode 100644 (file)
index 0000000..f71bcb0
--- /dev/null
@@ -0,0 +1,9 @@
+Subject: app_queue
+
+Introduce a new queue configuration option called
+'periodic-announce-startdelay' which will vary the normal (historic) behavior
+of starting the periodic announcement cycle at periodic-announce-frequency
+seconds after entering the queue to start the periodic announcement cycle at
+period-announce-startdelay seconds after joining the queue.
+
+The default behavior if this config option is not set remains unchanged.