mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 08:13:22 +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:
1
CHANGES
1
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
|
||||
--------------
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
;
|
||||
|
Reference in New Issue
Block a user