]> 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)
committerAsterisk Development Team <asteriskteam@digium.com>
Fri, 12 Jan 2024 18:29:18 +0000 (18:29 +0000)
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.

UserNote: 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.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
(cherry picked from commit a4cb63e231222b9214ee5e0ab986391576f151e4)

apps/app_queue.c
configs/samples/queues.conf.sample

index 0f3fa4bdf376e4db40df71f3abf3e86cd7dff2f1..0ce7d1653b1b66e2099e2fb3d4a0ff82b34baf6e 100644 (file)
@@ -1862,6 +1862,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 */
@@ -2995,6 +2996,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;
@@ -3453,6 +3455,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")) {
@@ -8743,6 +8747,11 @@ static int queue_exec(struct ast_channel *chan, const char *data)
        }
        ast_assert(qe.parent != NULL);
 
+       if (qe.parent->periodicannouncestartdelay >= 0) {
+               qe.last_periodic_announce_time += qe.parent->periodicannouncestartdelay;
+               qe.last_periodic_announce_time -= qe.parent->periodicannouncefrequency;
+       }
+
        ast_queue_log(args.queuename, ast_channel_uniqueid(chan), "NONE", "ENTERQUEUE", "%s|%s|%d",
                S_OR(args.url, ""),
                S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),
index 436cdf13ac4d553001a99ae0bfd6f3c182525d16..003e3636a0acc4620930d2b05fa6dfd5bc1c0f9a 100644 (file)
@@ -299,6 +299,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