[Home]

Summary:ASTERISK-18662: Member penalty ignored because wrong queue membercount
Reporter:Richard van Vliet (rjvvliet)Labels:
Date Opened:2011-10-04 06:47:48Date Closed:2011-11-01 12:54:18
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_queue
Versions:1.8.4 1.8.6.0 Frequency of
Occurrence
Constant
Related
Issues:
is duplicated byASTERISK-18588 Static queue agent penalty not respected (rrmemory)
Environment:Centos,FreePBX 2.8/2.9, PIAFAttachments:
Description:While building a queue i found that the Member Penalty value is being ignored, when searching it seemed that the value of {{q->membercount}} is in correctly updated and is constantly 0 (zero). which resulted in the check for {{usepenalty}} in calc_metric to always be 0.

When then {{q->membercount}} is found as 0 then the flowing will be reported in the debug 4 output.

{noformat}
app_queue.c: Disregarding penalty, 0 members and 0 in penaltymemberslimit.
{noformat}

And it subsecently calculates a 0 penalty for all members.

Also the values of dialplan function QUEUE_MEMBER(650,count) is incorrectly reported because it returns the value of {{q->membercount}} when using the dialplan below, the diaplan function QUEUE_MEMBER_COUNT(650) seems to works as expected.

{noformat}
[from-internal-custom]
exten => 1234,1,noop(queue_members(logged) : ${QUEUE_MEMBER(650,logged)})
exten => 1234,n,noop(queue_members(free) : ${QUEUE_MEMBER(650,free)})
exten => 1234,n,noop(queue_members(count) : ${QUEUE_MEMBER(650,count)})
exten => 1234,n,noop(queue_members_count : ${QUEUE_MEMBER_COUNT(650)})
exten => 1234,n,noop(queue_members_list : ${QUEUE_MEMBER_LIST(650)})
exten => 1234,n,hangup()

-- Executing [1234@from-internal:1] NoOp("SIP/304-0000003e", "queue_members(logged) : 4") in new stack
-- Executing [1234@from-internal:2] NoOp("SIP/304-0000003e", "queue_members(free) : 4") in new stack
-- Executing [1234@from-internal:3] NoOp("SIP/304-0000003e", "queue_members(count) : 0") in new stack
-- Executing [1234@from-internal:4] NoOp("SIP/304-0000003e", "queue_members_count : 4") in new stack
-- Executing [1234@from-internal:5] NoOp("SIP/304-0000003e", "queue_members_list : Local/304@from-queue/n,Local/303@from-queue/n,Local/302@from-queue/n,Local/301@from-queue/n") in new stack
{noformat}

Adding the parameter below the member penalties are working as expected.

{noformat}
penaltymemberslimit=-1
{noformat}

Tested with Asterisk 1.8.4.4 and 1.8.6.0



Comments:By: Richard van Vliet (rjvvliet) 2011-10-04 12:39:05.254-0500

Extra info :

I have just tested this with Asterisk 1.6.2.20 and i seem to have the same problem with the value of {{q->membercount}} the dialplan function QUEUE_MEMBER(650,count) and the diaplan function QUEUE_MEMBER_COUNT(650).

{noformat}
-- Executing [1234@from-internal:1] NoOp("SIP/301-0000003e", "queue_member(count) : 0") in new stack
-- Executing [1234@from-internal:2] NoOp("SIP/301-0000003e", "queue_member_count : 1") in new stack
{noformat}


By: Richard van Vliet (rjvvliet) 2011-10-09 08:03:34.681-0500

I hope this still helps, I did another debug session en found that this is only happening on {{static}} members, using {{dynamic}} members the {{q->membercount}} and QUEUE_MEMBER(count) is correct.

Using the same dialplan as above now with dynamic members.

{noformat}
-- Executing [1234@from-internal:1] NoOp("SIP/305-00000006", "queue_members(logged) : 4") in new stack
-- Executing [1234@from-internal:2] NoOp("SIP/305-00000006", "queue_members(free) : 4") in new stack
-- Executing [1234@from-internal:3] NoOp("SIP/305-00000006", "queue_members(count) : 4") in new stack
-- Executing [1234@from-internal:4] NoOp("SIP/305-00000006", "queue_members_count : 4") in new stack
-- Executing [1234@from-internal:5] NoOp("SIP/305-00000006", "queue_members_list : Local/304@from-queue/n,Local/303@from-queue/n,Local/302@from-queue/n,Local/301@from-queue/n") in new stack
{noformat}

{noformat}
pbx*CLI> queue show 650
650 has 0 calls (max 3) in 'rrmemory' strategy (0s holdtime, 0s talktime), W:0, C:0, A:2, SL:0.0% within 60s
  Members:
     EXTEN4 (Local/304@from-queue/n) with penalty 3 (dynamic) (Not in use) has taken no calls yet
     EXTEN3 (Local/303@from-queue/n) with penalty 2 (dynamic) (Not in use) has taken no calls yet
     EXTEN2 (Local/302@from-queue/n) with penalty 1 (dynamic) (Not in use) has taken no calls yet
     EXTEN1 (Local/301@from-queue/n) (dynamic) (Not in use) has taken no calls yet
  No Callers
{noformat}

_i wish my C skills where much beter_ ;-)

By: Leif Madsen (lmadsen) 2011-11-01 08:29:21.655-0500

I'm not sure if this helps or not, but generally the best practice when using Local channels in a Queue() is to always relate it to a SIP channel to get the device state from. Otherwise the Queue() application can generally only make a best effort as to the state of the Local channel. There may be some code in there that could certainly be made better to track the state of a Local channel more consistently, but the general rule has always been to define a state interface:

Per queues.conf.sample:


; Each member of this call queue is listed on a separate line in
; the form technology/dialstring.  "member" means a normal member of a
; queue.  An optional penalty may be specified after a comma, such that
; entries with higher penalties are considered last.  An optional member
; name may also be specified after a second comma, which is used in log
; messages as a "friendly name".  Multiple interfaces may share a single
; member name. An optional state interface may be specified after a third
; comma. This interface will be the one for which app_queue receives device
; state notifications, even though the first interface specified is the one
; that is actually called.
;
; A hint can also be used in place of the state interface using the format
; hint:<extension>@<context>. If no context is specified then 'default' will
; be used.
;
; It is important to ensure that channel drivers used for members are loaded
; before app_queue.so itself or they may be marked invalid until reload. This
; can be accomplished by explicitly listing them in modules.conf before
; app_queue.so.  Additionally, if you use Local channels as queue members, you
; must also preload pbx_config.so and chan_local.so (or pbx_ael.so, pbx_lua.so,
; or pbx_realtime.so, depending on how your dialplan is configured).
;
;member => DAHDI/1
;member => DAHDI/2,10
;member => DAHDI/3,10,Bob Johnson
;member => Agent/1001
;member => Agent/1002
;member => Local/1000@default,0,John Smith,SIP/1000


By: Terry Wilson (twilson) 2011-11-01 12:54:18.160-0500

This was fixed in internal issue AST-676 with commits made on October 25th.