Summary:ASTERISK-10494: [PATCH] Add a new queue strategy: weighted random (wrandom)
Reporter:Julian J. M. (julianjm)Labels:
Date Opened:2007-10-10 17:43:49Date Closed:2007-11-06 16:35:01.000-0600
Versions:Frequency of
Environment:Attachments:( 0) app_queue_wrandom_strategy_trunk_v1.diff
( 1) app_queue_wrandom_strategy_trunk_v2.diff
( 2) app_queue_wrandom_strategy_v2.diff
Description:Random strategy, but using penaly as a weight. Basically, the higher the penalty, the less probability to receive calls from the queue.


When calculating the metric for each round, we use this formula:
metric=ast_random() % ((penalty+1)*1000)

penalty 0 => metric between 0 and 999
penalty 1 => metric between 0 and 1999
penalty 2 => metric between 0 and 2999

The member with lower metric gets the next call.
Comments:By: IƱaki Baz Castillo (ibc) 2007-10-11 08:39:39

I think this strategy=wrandom can be really useful.

By: Mark Michelson (mmichelson) 2007-10-11 16:09:21

This makes for an interesting interpretation of a queue member's penalty! The only complaint I have about this is that since this is a new feature, this will go into Asterisk trunk, not 1.4. If you don't mind making a patch against trunk, that would be excellent.

I'm going to go ahead and mark this as ready for testing. If I don't hear complaints about the patch I'll commit in a week or two, along with a revised queues.conf.sample which will have an explanation of the wrandom strategy.

Thanks very much for the contribution!

By: Julian J. M. (julianjm) 2007-10-11 16:58:20

There it goes. It's been made against revision 85485.

Julian J. M.

By: Mark Michelson (mmichelson) 2007-10-11 18:00:44

Awesome! Thank you very much!

By: Eliel Sardanons (eliel) 2007-10-11 18:35:09

Review the ast_log(). It is not necesary to print the function name (calc_metric).

By: Julian J. M. (julianjm) 2007-10-12 04:23:51

Uploaded trunk_v2 patch, which removes ast_log call.


By: Digium Subversion (svnbot) 2007-11-06 16:35:01.000-0600

Repository: asterisk
Revision: 89070

U   trunk/CHANGES
U   trunk/apps/app_queue.c
U   trunk/configs/queues.conf.sample

r89070 | mmichelson | 2007-11-06 16:35:00 -0600 (Tue, 06 Nov 2007) | 5 lines

Adding the queue strategy wrandom

(closes issue ASTERISK-10494, reported and patched by julianjm, documentation changes by me)