[Asterisk-code-review] app_queue: (Breaking change) shared_lastcall and autofill default to no (asterisk[master])

Joshua Colp asteriskteam at digium.com
Thu Jul 9 05:20:38 CDT 2020


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14596 )

Change subject: app_queue: (Breaking change) shared_lastcall and autofill default to no
......................................................................

app_queue: (Breaking change) shared_lastcall and autofill default to no

If your queues.conf had _no_ [general] section, they would default to
'yes'. Now, they always default to 'no'.

(Actually, commit ed615afb7e0d630a58feba569c657eadc6ddc0a9 already
partially fixed it for shared_lastcall.)

ASTERISK-28951

Change-Id: Ic39d8a0202906bc454194368bbfbae62990fe5f6
---
M apps/app_queue.c
M configs/samples/queues.conf.sample
A doc/UPGRADE-staging/app_queue_consistent_general.txt
3 files changed, 41 insertions(+), 23 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, approved; Approved for Submit
  Kevin Harwell: Looks good to me, but someone else must approve



diff --git a/apps/app_queue.c b/apps/app_queue.c
index ff001ee..19622fd 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1463,34 +1463,34 @@
 static const char * const pm_family = "Queue/PersistentMembers";
 
 /*! \brief queues.conf [general] option */
-static int queue_persistent_members = 0;
+static int queue_persistent_members;
 
-/*! \brief queues.conf per-queue weight option */
-static int use_weight = 0;
+/*! \brief Records that one or more queues use weight */
+static int use_weight;
 
 /*! \brief queues.conf [general] option */
-static int autofill_default = 1;
+static int autofill_default;
 
 /*! \brief queues.conf [general] option */
-static int montype_default = 0;
+static int montype_default;
 
 /*! \brief queues.conf [general] option */
-static int shared_lastcall = 0;
+static int shared_lastcall;
 
 /*! \brief queuesrules.conf [general] option */
-static int realtime_rules = 0;
+static int realtime_rules;
 
 /*! \brief Subscription to device state change messages */
 static struct stasis_subscription *device_state_sub;
 
 /*! \brief queues.conf [general] option */
-static int update_cdr = 0;
+static int update_cdr;
 
 /*! \brief queues.conf [general] option */
-static int negative_penalty_invalid = 0;
+static int negative_penalty_invalid;
 
 /*! \brief queues.conf [general] option */
-static int log_membername_as_agent = 0;
+static int log_membername_as_agent;
 
 /*! \brief name of the ringinuse field in the realtime database */
 static char *realtime_ringinuse_field;
@@ -9110,14 +9110,19 @@
 	.write = queue_function_memberpenalty_write,
 };
 
+/*! Reset the global queue rules parameters even if there is no "general" section of queuerules.conf */
+static void queue_rules_reset_global_params(void)
+{
+	realtime_rules = 0;
+}
+
 /*! Set the global queue rules parameters as defined in the "general" section of queuerules.conf */
 static void queue_rules_set_global_params(struct ast_config *cfg)
 {
-        const char *general_val = NULL;
-        realtime_rules = 0;
-        if ((general_val = ast_variable_retrieve(cfg, "general", "realtime_rules"))) {
-                realtime_rules = ast_true(general_val);
-        }
+	const char *general_val = NULL;
+	if ((general_val = ast_variable_retrieve(cfg, "general", "realtime_rules"))) {
+		realtime_rules = ast_true(general_val);
+	}
 }
 
 /*! \brief Reload the rules defined in queuerules.conf
@@ -9152,6 +9157,7 @@
 			ast_free(pr_iter);
 		ast_free(rl_iter);
 	}
+	queue_rules_reset_global_params();
 	while ((rulecat = ast_category_browse(cfg, rulecat))) {
 		if (!strcasecmp(rulecat, "general")) {
 			queue_rules_set_global_params(cfg);
@@ -9183,36 +9189,41 @@
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
+/*! Always set the global queue defaults, even if there is no "general" section in queues.conf */
+static void queue_reset_global_params(void)
+{
+	queue_persistent_members = 0;
+	autofill_default = 0;
+	montype_default = 0;
+	update_cdr = 0;
+	shared_lastcall = 0;
+	negative_penalty_invalid = 0;
+	log_membername_as_agent = 0;
+}
+
 /*! Set the global queue parameters as defined in the "general" section of queues.conf */
 static void queue_set_global_params(struct ast_config *cfg)
 {
 	const char *general_val = NULL;
-	queue_persistent_members = 0;
 	if ((general_val = ast_variable_retrieve(cfg, "general", "persistentmembers"))) {
 		queue_persistent_members = ast_true(general_val);
 	}
-	autofill_default = 0;
 	if ((general_val = ast_variable_retrieve(cfg, "general", "autofill"))) {
 		autofill_default = ast_true(general_val);
 	}
-	montype_default = 0;
 	if ((general_val = ast_variable_retrieve(cfg, "general", "monitor-type"))) {
 		if (!strcasecmp(general_val, "mixmonitor"))
 			montype_default = 1;
 	}
-	update_cdr = 0;
 	if ((general_val = ast_variable_retrieve(cfg, "general", "updatecdr"))) {
 		update_cdr = ast_true(general_val);
 	}
-	shared_lastcall = 0;
 	if ((general_val = ast_variable_retrieve(cfg, "general", "shared_lastcall"))) {
 		shared_lastcall = ast_true(general_val);
 	}
-	negative_penalty_invalid = 0;
 	if ((general_val = ast_variable_retrieve(cfg, "general", "negative_penalty_invalid"))) {
 		negative_penalty_invalid = ast_true(general_val);
 	}
-	log_membername_as_agent = 0;
 	if ((general_val = ast_variable_retrieve(cfg, "general", "log_membername_as_agent"))) {
 		log_membername_as_agent = ast_true(general_val);
 	}
@@ -9547,6 +9558,7 @@
 
 	/* Chug through config file. */
 	cat = NULL;
+	queue_reset_global_params();
 	while ((cat = ast_category_browse(cfg, cat)) ) {
 		if (!strcasecmp(cat, "general") && queue_reload) {
 			queue_set_global_params(cfg);
diff --git a/configs/samples/queues.conf.sample b/configs/samples/queues.conf.sample
index 073ec49..eae5e0e 100644
--- a/configs/samples/queues.conf.sample
+++ b/configs/samples/queues.conf.sample
@@ -23,7 +23,7 @@
 ;    no more available members or no more waiting callers. This is
 ;    probably more along the lines of how a queue should work and
 ;    in most cases, you will want to enable this behavior. If you
-;    do not specify or comment out this option, it will default to yes.
+;    do not specify or comment out this option, it will default to no.
 ;
 ;autofill = no
 ;
diff --git a/doc/UPGRADE-staging/app_queue_consistent_general.txt b/doc/UPGRADE-staging/app_queue_consistent_general.txt
new file mode 100644
index 0000000..0a98bf9
--- /dev/null
+++ b/doc/UPGRADE-staging/app_queue_consistent_general.txt
@@ -0,0 +1,6 @@
+Subject: app_queue
+Master-Only: true
+
+If they are not specified in [general], "shared_lastcall" and "autofill"
+now always default to OFF.  Before this version, they would be off ('no') if
+queues.conf did not have a [general] section, but on ('yes') if it did.

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ic39d8a0202906bc454194368bbfbae62990fe5f6
Gerrit-Change-Number: 14596
Gerrit-PatchSet: 5
Gerrit-Owner: Walter Doekes <walter+asterisk at wjd.nu>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200709/c3b32dd0/attachment-0001.html>


More information about the asterisk-code-review mailing list