]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_queue.c: Add new global 'log_unpause_on_reason_change'
authorIgor Goncharovsky <igorg@iqtek.ru>
Tue, 2 Sep 2025 06:50:19 +0000 (12:50 +0600)
committerIgor Goncharovsky <igorg@iqtek.ru>
Mon, 8 Sep 2025 14:28:45 +0000 (14:28 +0000)
In many asterisk-based systems, the pause reason is used to separate
pauses by type,and logically, changing the reason defines two intervals
that should be accounted for separately. The introduction of a new
option allows me to separate the intervals of operator inactivity in
the log by the event of unpausing.

UserNote: Add new global option 'log_unpause_on_reason_change' that
is default disabled. When enabled cause addition of UNPAUSE event on
every re-PAUSE with reason changed.

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

index 39a2a1750545f65f0ef4edfe8c689851ad70bac6..a9d8d2495af1060eba50f7f121ab075a88ca5a46 100644 (file)
@@ -1801,6 +1801,9 @@ static int force_longest_waiting_caller;
 /*! \brief queues.conf [general] option */
 static int log_caller_id_name; 
 
+/*! \brief queues.conf [general] option */
+static int log_unpause_on_reason_change;
+
 /*! \brief name of the ringinuse field in the realtime database */
 static char *realtime_ringinuse_field;
 
@@ -8068,6 +8071,11 @@ static void set_queue_member_pause(struct call_queue *q, struct member *mem, con
        if (mem->paused == paused) {
                ast_debug(1, "%spausing already-%spaused queue member %s:%s\n",
                        (paused ? "" : "un"), (paused ? "" : "un"), q->name, mem->interface);
+               if (log_unpause_on_reason_change && paused) {
+                       if (!ast_strings_equal(mem->reason_paused, reason)) {
+                               ast_queue_log(q->name, "NONE", mem->membername, "UNPAUSE", "%s", "Auto-Unpause");
+                       }
+               }
        }
 
        if (mem->realtime && !ast_strlen_zero(mem->rt_uniqueid)) {
@@ -9900,6 +9908,7 @@ static void queue_reset_global_params(void)
        negative_penalty_invalid = 0;
        log_membername_as_agent = 0;
        force_longest_waiting_caller = 0;
+       log_unpause_on_reason_change = 0;
 }
 
 /*! Set the global queue parameters as defined in the "general" section of queues.conf */
@@ -9928,6 +9937,9 @@ static void queue_set_global_params(struct ast_config *cfg)
        if ((general_val = ast_variable_retrieve(cfg, "general", "force_longest_waiting_caller"))) {
                force_longest_waiting_caller = ast_true(general_val);
        }
+       if ((general_val = ast_variable_retrieve(cfg, "general", "log_unpause_on_reason_change"))) {
+               log_unpause_on_reason_change = ast_true(general_val);
+       }
        /* Apply log-caller-id-name in the same place as other global settings */
        if ((general_val = ast_variable_retrieve(cfg, "general", "log-caller-id-name"))) {
                log_caller_id_name = ast_true(general_val);
index 63e1e21dbe5e22c808272da1a6dd0c5f9bb02397..f340e0089be12bd80bf46f3dfc9d56e0a2e9c6ac 100644 (file)
@@ -82,6 +82,11 @@ monitor-type = MixMonitor
 ;
 ;force_longest_waiting_caller = no
 ;
+; Add unpause event to queue log in case of pause send twice with different reason code.
+;
+;log_unpause_on_reason_change = no
+;
+;
 ;[markq]
 ;
 ; A sample call queue