mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
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
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user