From 95871451f638203e8d76049221cbad0cbc930dbf Mon Sep 17 00:00:00 2001 From: Matthew Jordan Date: Mon, 11 Aug 2014 00:07:22 +0000 Subject: app_queue: Add RealTime support for queue rules This patch gives the optional ability to keep queue rules in RealTime. It is important to note that with this patch: (a) Queue rules in RealTime are only examined on module load/reload (b) Queue rules are loaded both from the queuerules.conf file as well as the RealTime backend To inform app_queue to examine RealTime for queue rules, a new setting has been added to queuerules.conf's general section "realtime_rules". RealTime queue rules will only be used when this setting is set to "yes". The schema for the database table supports a rule_name, time, min_penalty, and max_penalty columns. min_penalty and max_penalty can be relative, if a '-' or '+' literal is provided. Otherwise, the penalties are treated as constants. For example: rule_name, time, min_penalty, max_penalty 'default', '10', '20', '30' 'test2', '20', '30', '55' 'test2', '25', '-11', '+1111' 'test2', '400', '112', '333' 'test3', '0', '4564', '46546' 'test_rule', '40', '15', '50' which would result in : Rule: default - After 10 seconds, adjust QUEUE_MAX_PENALTY to 30 and adjust QUEUE_MIN_PENALTY to 20 Rule: test2 - After 20 seconds, adjust QUEUE_MAX_PENALTY to 55 and adjust QUEUE_MIN_PENALTY to 30 - After 25 seconds, adjust QUEUE_MAX_PENALTY by 1111 and adjust QUEUE_MIN_PENALTY by -11 - After 400 seconds, adjust QUEUE_MAX_PENALTY to 333 and adjust QUEUE_MIN_PENALTY to 112 Rule: test3 - After 0 seconds, adjust QUEUE_MAX_PENALTY to 46546 and adjust QUEUE_MIN_PENALTY to 4564 Rule: test_rule - After 40 seconds, adjust QUEUE_MAX_PENALTY to 50 and adjust QUEUE_MIN_PENALTY to 15 If you use RealTime, the queue rules will be always reloaded on a module reload, even if the underlying file did not change. With the option disabled, the rules will only be reloaded if the file was modified. Review: https://reviewboard.asterisk.org/r/3607/ ASTERISK-23823 #close Reported by: Michael K patches: app_queue.c_realtime_trunk.patch uploaded by Michael K (License 6621) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@420624 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- configs/samples/extconfig.conf.sample | 3 ++- configs/samples/queuerules.conf.sample | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'configs') diff --git a/configs/samples/extconfig.conf.sample b/configs/samples/extconfig.conf.sample index 52a49cfbe..8fb6cac8c 100644 --- a/configs/samples/extconfig.conf.sample +++ b/configs/samples/extconfig.conf.sample @@ -15,7 +15,7 @@ ; database driver, database and table (or uses the ; name of the file as the table if not specified) ; -;uncomment to load queues.conf via the odbc engine. +; Uncomment to load queues.conf via the odbc engine. ; ;queues.conf => odbc,asterisk,ast_config ;extensions.conf => sqlite,asterisk,ast_config @@ -89,6 +89,7 @@ ;meetme => mysql,general ;queues => odbc,asterisk ;queue_members => odbc,asterisk +;queue_rules => odbc,asterisk ;acls => odbc,asterisk ;musiconhold => mysql,general ;queue_log => mysql,general diff --git a/configs/samples/queuerules.conf.sample b/configs/samples/queuerules.conf.sample index fb2a1ba87..417f52de1 100644 --- a/configs/samples/queuerules.conf.sample +++ b/configs/samples/queuerules.conf.sample @@ -1,3 +1,14 @@ + +[general] + +; Look for queue rules in the queue_rules database table through RealTime. Note +; that this option is not strictly "RealTime", in the sense that the queue +; rules are only loaded and parsed during module load/reload. Queue rules +; must have a unique rule name and support relative min/max penalties. +; +; realtime_rules = yes +; + ; It is possible to change the value of the QUEUE_MAX_PENALTY and QUEUE_MIN_PENALTY ; channel variables in mid-call by defining rules in the queue for when to do so. This can allow for ; a call to be opened to more members or potentially a different set of members. -- cgit v1.2.3