Summary:ASTERISK-07091: [patch][post 1.4] app_queue: linear strategy
Reporter:dillec (dillec)Labels:
Date Opened:2006-06-04 12:14:32Date Closed:2007-10-26 10:18:14
Versions:Frequency of
Environment:Attachments:( 0) 7279.patch
( 1) 7279v1.4.patch
( 2) app_queue.c-add_linear_mode-review-2006-06-14.patch
( 3) app_queue.c-add_linear_mode-review-2006-06-25.patch
Description:i've implemented an linear strategy for app_queue which will distribute calls as follows:

start over

so it's like roundrobin method but resetting the position counter everytime a call can get distributed.
Comments:By: wes (whoiswes) 2006-06-05 08:07:14

cool, this would be perfect for our helpdesk, where every call needs to be handled in the exact same order as the last...here's a vote for this to be included in a future release!

By: dillec (dillec) 2006-06-11 13:13:43

I've added that queue members are not refound on reload of queues. So if you reload a queue you are able to specify a new order of static members. Dynamic members will loose their position in queue and will get the last pos.

New file is: app_queue-add_linear_mode.patch [^] (2,067 bytes) 06-11-06 13:12
Build for Asterisk version:

By: Serge Vecher (serge-v) 2006-06-11 13:17:38

ok, in order for this to make it into the 'stable' version, the patch will need to be redone against the very latest trunk.


By: Serge Vecher (serge-v) 2006-06-11 13:19:53

also, please review the CODING-GUIDELINES document and fix the patch accordingly.

By: dillec (dillec) 2006-06-12 03:54:49

i've reviewed the patch by the CODE-GUIDLINES and against the current trunk.

By: Serge Vecher (serge-v) 2006-06-12 09:39:32

ok, this is better, but now quite right still: you are still using spaces for tabulation in several spaces. You need to use tabs. Also, no need to add tabs/spaces for blank lines. Thanks.

By: dillec (dillec) 2006-06-14 01:48:43

thanks for your patiance - this is the first patch for asterisk i've created. Reviewed the code by your hints once again.

By: dillec (dillec) 2006-06-23 01:16:57

like bweschke mentioned, there are some locking issues i've not respected. Further more the rrpos reset whilst user has hangup while connecting to agent, or waiting is missing.

I will provide a patch against latest trunk at the weekend.

By: dillec (dillec) 2006-06-25 13:32:42

I've packaged the reset of RRPOS into a function with locking wrapped around if needed.

By: dillec (dillec) 2006-09-22 00:45:08

1.4 Beta is now online but this patch was not merged. Are there any problems with it ?

By: Serge Vecher (serge-v) 2006-09-22 10:43:48

no problems, really, since this was posted after the cutoff date for new features going into 1.4 beta, it was marked [post 1.4]. Since 1.4 branch is forked now, this is eligible for review and inclusion into trunk now. Hopefully bweschke will find some time to look at this ...

By: jmls (jmls) 2006-11-01 06:09:10.000-0600

bweschke, would you be able to look at this ? Thanks.

By: jmls (jmls) 2006-12-05 04:40:49.000-0600

ping. housekeeping

By: jmls (jmls) 2007-09-02 01:51:44

guys, is this something that's going to be applied to trunk or not ?

By: xarmiex (xarmiex) 2007-09-18 08:07:26

I've added this linear patch to 1.2.24 (and 1.2.17) and it has brought
back bug : 7278 even though that patch was commited a while

So now if agent 2 is unavailable it rings

agent 1
agent 3
agent 3
agent 1 etc.

As described in :

By: Mark Michelson (mmichelson) 2007-10-11 11:28:57

I'm on a bit of a quest to clear up old outstanding queue issues because I don't like the fact that they've been open as long as they have been.

I will be reworking this patch soon, because I think that its implementation is a bit off. Mainly, my problem is that it is trying to use the rrpos variable of a queue in order to determine the linear order of calls. Since each call is going to use the exact same order, I feel it would be better to place a position indicator in the queue_ent structure and use that as a position indicator instead. That way, there would be no worries about (current or future) race conditions with the rrpos of a queue.

I also will be editing the queues.conf.sample to explain this strategy.

By: Mark Michelson (mmichelson) 2007-10-11 15:12:01

I've uploaded a new patch to implement the linear strategy. This was made against trunk. If people could please test it, it would be much appreciated. I've done a small amount of testing myself, and I would like to hear some feedback from others before this gets committed to trunk.

By: Mark Michelson (mmichelson) 2007-10-17 10:40:03

I have uploaded a version of this patch for 1.4 as well. The plan right now is not to include the linear strategy in 1.4, but I understand some people may want it, so here it is.

By: xarmiex (xarmiex) 2007-10-19 15:44:01

putnopvut, We would really like to get this working so we've
tried to apply 7279.patch but even on top of the previous patch
i see code in the patch that i can't find anywhere in our app_queue.c

I'm trying to do this on 1.2.17, can you give me any pointers on how
to apply this patch properly ?

Thanks alot!

By: Mark Michelson (mmichelson) 2007-10-22 09:43:13


The 7279.patch is meant to be applied to trunk, and the 7279v1.4.patch is meant to be applied to 1.4. I'm willing to bet that although neither will apply cleanly to 1.2, the 1.4 version will be less messy to try to clean up. It may be worth noting where the patch fails, because it could be the failure points are trivial to apply manually.

By: Digium Subversion (svnbot) 2007-10-26 10:18:13

Repository: asterisk
Revision: 87154

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

r87154 | mmichelson | 2007-10-26 10:18:12 -0500 (Fri, 26 Oct 2007) | 6 lines

Added queue strategy "linear". This strategy is useful for those who always wish for their
phones to be rung in a specific order.

(closes issue ASTERISK-7091, reported and initially patched by diLLec, patch reworked by me)