summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2007-11-06 22:36:55 +0000
committerMark Michelson <mmichelson@digium.com>2007-11-06 22:36:55 +0000
commit0cd3118a621eb1103bc6ab6d831c43ffb8008a64 (patch)
tree0a38a947c93f820dc5d0c20d4e69e8e3e0969839 /apps/app_queue.c
parenta06218ee6de24c3ee0ec51abc6cb5da31e43032b (diff)
Adding the queue strategy wrandom
(closes issue #10942, reported and patched by julianjm, documentation changes by me) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c7
1 files changed, 6 insertions, 1 deletions
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;