aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--apps/app_queue.c7
-rw-r--r--configs/queues.conf.sample7
3 files changed, 14 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 98770b31f..d8fb29156 100644
--- a/CHANGES
+++ b/CHANGES
@@ -166,6 +166,7 @@ Queue changes
queue log.
* Added ability for non-realtime queues to have realtime members
* Added the "linear" strategy to queues.
+ * Added the "wrandom" strategy to queues.
MeetMe Changes
--------------
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 2082e4ed4..ca5a461e4 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -101,7 +101,8 @@ enum {
QUEUE_STRATEGY_FEWESTCALLS,
QUEUE_STRATEGY_RANDOM,
QUEUE_STRATEGY_RRMEMORY,
- QUEUE_STRATEGY_LINEAR
+ QUEUE_STRATEGY_LINEAR,
+ QUEUE_STRATEGY_WRANDOM
};
static struct strategy {
@@ -114,6 +115,7 @@ static struct strategy {
{ QUEUE_STRATEGY_RANDOM, "random" },
{ QUEUE_STRATEGY_RRMEMORY, "rrmemory" },
{ QUEUE_STRATEGY_LINEAR, "linear" },
+ { QUEUE_STRATEGY_WRANDOM, "wrandom"},
};
#define DEFAULT_RETRY 5
@@ -2597,6 +2599,9 @@ static int calc_metric(struct call_queue *q, struct member *mem, int pos, struct
tmp->metric = ast_random() % 1000;
tmp->metric += mem->penalty * 1000000;
break;
+ case QUEUE_STRATEGY_WRANDOM:
+ tmp->metric = ast_random() % ((1 + mem->penalty) * 1000);
+ break;
case QUEUE_STRATEGY_FEWESTCALLS:
tmp->metric = mem->calls;
tmp->metric += mem->penalty * 1000000;
diff --git a/configs/queues.conf.sample b/configs/queues.conf.sample
index a7dd92a73..531a2d665 100644
--- a/configs/queues.conf.sample
+++ b/configs/queues.conf.sample
@@ -96,6 +96,13 @@ shared_lastcall=no
; linear - rings interfaces in the order specified in this configuration file.
; If you use dynamic members, the members will be rung in the order in
; which they were added
+; wrandom - rings random interface, but uses the member's penalty as a weight
+; when calculating their metric. So a member with penalty 0 will have
+; a metric somewhere between 0 and 1000, and a member with penalty 1 will
+; have a metric between 0 and 2000, and a member with penalty 2 will have
+; a metric between 0 and 3000. Please note, if using this strategy, the member
+; penalty is not the same as when using other queue strategies. It is ONLY used
+; as a weight for calculating metric.
;
;strategy = ringall
;