Summary:ASTERISK-10242: advanced QUEUE_MEMBER_COUNT function
Reporter:Wolfgang Pichler (wuwu)Labels:
Date Opened:2007-09-05 06:36:41Date Closed:2007-10-29 15:15:22
Versions:Frequency of
Environment:Attachments:( 0) 10652.patch
( 1) queue_member_count.patch
Description:with r76801 (issue ASTERISK-9813) the application queue was patched to now include a variable membercount to keep track of the number of queue members.

As Michelson noted in the changelog - as a side effect the QUEUE_MEMBER_COUNT function did also changed to return the number of members regardless of their state.

I think that may people still want to use the old method, to get the real member count (members which are logged on). (we are one of those peoples....)

In my opinion there are 3 values which are from interest
   - the complete member count (as it gets now returned by QUEUE_MEMBER_COUNT)
   - the logged in member count (as QUEUE_MEMBER_COUNT did it before the change)
   - the free member count (how many logged in members do not have a call)
There are two possible ways to implement this
   - Create an own function for each value of interest (QUEUE_MEMBER_COUNT, QUEUE_AVAILABLE_MEMBERS, QUEUE_FREE_MEMBERS)
   - Add a parameter to the QUEUE_MEMBER_COUNT function to control which value it should return (no parameter = current behaviour, parameter l = old behaviour, parameter f = only free members)
Comments:By: Mark Michelson (mmichelson) 2007-09-05 09:19:05

It was a mistake for me to change the QUEUE_MEMBER_COUNT function in 1.4 to do something that it didn't do originally. I'm going to revert it back to its original behavior. The commit should show up in the bugnotes here.

Regarding your patch, there's discussion going on in the mailing list right now and so I'm going to continue the discussion there for now.

By: Digium Subversion (svnbot) 2007-09-05 09:44:57

Repository: asterisk
Revision: 81520

r81520 | mmichelson | 2007-09-05 09:44:57 -0500 (Wed, 05 Sep 2007) | 6 lines

Reverting behavior of QUEUE_MEMBER_COUNT to only count members who are logged in
and available.

(related to issue ASTERISK-10242, reported by wuwu)


By: Digium Subversion (svnbot) 2007-09-05 09:46:28

Repository: asterisk
Revision: 81522

r81522 | mmichelson | 2007-09-05 09:46:28 -0500 (Wed, 05 Sep 2007) | 14 lines

Merged revisions 81520 via svnmerge from

r81520 | mmichelson | 2007-09-05 10:03:22 -0500 (Wed, 05 Sep 2007) | 6 lines

Reverting behavior of QUEUE_MEMBER_COUNT to only count members who are logged in
and available.

(related to issue ASTERISK-10242, reported by wuwu)



By: Mark Michelson (mmichelson) 2007-09-05 10:05:38

The commits above were done hastily, so check out revision 81525 of 1.4 or 81535 of trunk so that * will actually compile.

By: Wolfgang Pichler (wuwu) 2007-09-06 07:05:34

the discussion on the mailing list (see the thread at http://lists.digium.com/pipermail/asterisk-dev/2007-September/029322.html ) did brought up, that the most people would prefer to have one new function called QUEUE_MEMBER which takes as arguments COUNT, AVAILABLE, FREE.

I will integrate this, will post the new patch soon.

Will this function take it into the official 1.4 ?

By: Mark Michelson (mmichelson) 2007-09-06 10:09:07

1.4 is feature frozen, so the enhanced member counting will only be in trunk.

By: Wolfgang Pichler (wuwu) 2007-09-11 06:52:08

i've noticed that there is a small bug in the code - the calculation for the option "f" must be

+               } else if (args.option && (strchr(args.option, 'f'))) {
+                       for (m = q->members; m; m = m->next) {
+                               /* Count the agents who are logged in and do not have a call at time */
+                               if ((m->status == AST_DEVICE_NOT_INUSE) && (!m->paused)) {
+                                       count++;
+                               }
+                       }

By: Tilghman Lesher (tilghman) 2007-09-11 10:09:31

wuwu:  please check out the latest 1.4 SVN.  That patch is no longer valid.

By: Mark Michelson (mmichelson) 2007-10-16 15:23:29

I've uploaded the file "10652.patch" as a replacement for the earlier version. This patch is functionally the same as the first, but with three changes:

1. This one is adapted to use the astobj2 stuff which has been added to app_queue since the original patch was written.

2. This uses a QUEUE_MEMBER function which takes arguments "logged", "free", or "count" which correspond with the "l", "f", and "c" options from the original patch.

3. The fix that wuwu pointed out in his bug note has been merged.

I've done some local testing, and it appears this works properly. It's not a complicated patch, but I'm going to leave this up for a couple more days to get feedback in case people have issues with it. I'll commit it at the end of the week if there are no issues.

By: Mark Michelson (mmichelson) 2007-10-29 15:15:21

After testing, I have committed the QUEUE_MEMBER function to trunk. Thanks to wuwu for the patch! It was committed in revision 87395.