<p>Jaco Kroon has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/20080">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_queue: periodic-announce-startdelay option.<br><br>This newly introduced periodic-announce-startdelay makes it possible to<br>configure the initial start delay of the first periodic announcement<br>after which periodic-announce-frequency takes over.<br><br>The original patch introduced a null dereference due to incorrect<br>ordering.  This one fixes that (as shown by testing on<br>https://gerrit.asterisk.org/c/asterisk/+/20039)<br><br>ASTERISK-30492 #close<br>ASTERISK-30437 #close<br>Signed-off-by: Jaco Kroon <jaco@uls.co.za><br><br>Change-Id: If2be8d04976a3b7204e777c5d80a78c2c11ecd24<br>---<br>M apps/app_queue.c<br>M configs/samples/queues.conf.sample<br>A doc/CHANGES-staging/app_queue.txt<br>3 files changed, 46 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/80/20080/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_queue.c b/apps/app_queue.c</span><br><span>index 9eebb2f..1ab5bd1 100644</span><br><span>--- a/apps/app_queue.c</span><br><span>+++ b/apps/app_queue.c</span><br><span>@@ -1836,6 +1836,7 @@</span><br><span>    int announcepositionlimit;          /*!< How many positions we announce? */</span><br><span>       int announcefrequency;              /*!< How often to announce their position */</span><br><span>  int minannouncefrequency;           /*!< The minimum number of seconds between position announcements (def. 15) */</span><br><span style="color: hsl(120, 100%, 40%);">+ int periodicannouncestartdelay;     /*!< How long into the queue should the periodic accouncement start */</span><br><span>        int periodicannouncefrequency;      /*!< How often to play periodic announcement */</span><br><span>       int numperiodicannounce;            /*!< The number of periodic announcements configured */</span><br><span>       int randomperiodicannounce;         /*!< Are periodic announcments randomly chosen */</span><br><span>@@ -2964,6 +2965,7 @@</span><br><span>     q->weight = 0;</span><br><span>    q->timeoutrestart = 0;</span><br><span>    q->periodicannouncefrequency = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+  q->periodicannouncestartdelay = -1;</span><br><span>       q->randomperiodicannounce = 0;</span><br><span>    q->numperiodicannounce = 0;</span><br><span>       q->relativeperiodicannounce = 0;</span><br><span>@@ -3420,6 +3422,8 @@</span><br><span>                  ast_str_set(&q->sound_periodicannounce[0], 0, "%s", val);</span><br><span>                   q->numperiodicannounce = 1;</span><br><span>               }</span><br><span style="color: hsl(120, 100%, 40%);">+     } else if (!strcasecmp(param, "periodic-announce-startdelay")) {</span><br><span style="color: hsl(120, 100%, 40%);">+            q->periodicannouncestartdelay = atoi(val);</span><br><span>        } else if (!strcasecmp(param, "periodic-announce-frequency")) {</span><br><span>            q->periodicannouncefrequency = atoi(val);</span><br><span>         } else if (!strcasecmp(param, "relative-periodic-announce")) {</span><br><span>@@ -8528,6 +8532,11 @@</span><br><span>    }</span><br><span>    ast_assert(qe.parent != NULL);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+    if (qe.parent->periodicannouncestartdelay >= 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+               qe.last_periodic_announce_time += qe.parent->periodicannouncestartdelay;</span><br><span style="color: hsl(120, 100%, 40%);">+           qe.last_periodic_announce_time -= qe.parent->periodicannouncefrequency;</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  ast_queue_log(args.queuename, ast_channel_uniqueid(chan), "NONE", "ENTERQUEUE", "%s|%s|%d",</span><br><span>            S_OR(args.url, ""),</span><br><span>                S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),</span><br><span>diff --git a/configs/samples/queues.conf.sample b/configs/samples/queues.conf.sample</span><br><span>index 0987236..7b5fe0b 100644</span><br><span>--- a/configs/samples/queues.conf.sample</span><br><span>+++ b/configs/samples/queues.conf.sample</span><br><span>@@ -278,6 +278,13 @@</span><br><span> ;</span><br><span> ;periodic-announce-frequency=60</span><br><span> ;</span><br><span style="color: hsl(120, 100%, 40%);">+; If given indicates the number of seconds after entering the queue the first</span><br><span style="color: hsl(120, 100%, 40%);">+; periodic announcement should be played.  The default (and historic) behavior</span><br><span style="color: hsl(120, 100%, 40%);">+; is to play the first periodic announcement at periodic-announce-frequency</span><br><span style="color: hsl(120, 100%, 40%);">+; seconds after entering the queue.</span><br><span style="color: hsl(120, 100%, 40%);">+;</span><br><span style="color: hsl(120, 100%, 40%);">+;periodic-announce-startdelay=10</span><br><span style="color: hsl(120, 100%, 40%);">+;</span><br><span> ; Should the periodic announcements be played in a random order? Default is no.</span><br><span> ;</span><br><span> ;random-periodic-announce=no</span><br><span>diff --git a/doc/CHANGES-staging/app_queue.txt b/doc/CHANGES-staging/app_queue.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..f71bcb0</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/app_queue.txt</span><br><span>@@ -0,0 +1,9 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_queue</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Introduce a new queue configuration option called</span><br><span style="color: hsl(120, 100%, 40%);">+'periodic-announce-startdelay' which will vary the normal (historic) behavior</span><br><span style="color: hsl(120, 100%, 40%);">+of starting the periodic announcement cycle at periodic-announce-frequency</span><br><span style="color: hsl(120, 100%, 40%);">+seconds after entering the queue to start the periodic announcement cycle at</span><br><span style="color: hsl(120, 100%, 40%);">+period-announce-startdelay seconds after joining the queue.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The default behavior if this config option is not set remains unchanged.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/20080">change 20080</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/20080"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If2be8d04976a3b7204e777c5d80a78c2c11ecd24 </div>
<div style="display:none"> Gerrit-Change-Number: 20080 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Jaco Kroon <jaco@uls.co.za> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>