Determining If A Queue Member Is Paused In Dialplan Logic. [1.8]

Home » Asterisk Users » Determining If A Queue Member Is Paused In Dialplan Logic. [1.8]
Asterisk Users 3 Comments

Howdy,

I’m looking at enabling autopause on one of my queues where my queue members are bad about leaving their desks without pausing.

The problem I see is that when the queue pauses an Member it doesn’t jump into the dialplan to do so which means my handy device state and asterisk database driven Light for the Member showing their paused status won’t update.

My idea for solving this problem is to check the status of my Member in the queue before I send the calls into it and toggle on the Members Paused light at that point in time if they are paused.

Sadly I don’t see a way to determine if my Staff are paused or not from the dialplan, There doesn’t appear to be a function to retrieve the status of the members in the queue.

Does the list have any suggestions?

3 thoughts on - Determining If A Queue Member Is Paused In Dialplan Logic. [1.8]

  • asterisk-users-bounces@lists.digium.com wrote on 03/25/2015 01:38:26 PM:

    First, let me say I feel dirty for even posting this. It is probably far from ideal, but it does get the job done. I had the same issue. Also, I am using Asterisk 11. I just looked and it doesn’t appear that the QUEUE_MEMBER function supports the paused option in 1.8. To be honest, I
    am not sure if there is a good replacement for what I have done below in the 1.8 series.

    [sub_autopause_status]
    exten => s,1,NoOp(Checking for autopaused members for ${arg1} queue)
    same => n,Set(MEMBERS=${QUEUE_MEMBER_LIST(${arg1})})
    same => n,Set(i=1)
    same => n,Set(max=${FIELDQTY(MEMBERS,,)})

    same => n,While($[${i} < = ${max}]) same => n,Set(MEMBER=${CUT(MEMBERS,\,,${i})})
    same => n,Set(STATUS=${QUEUE_MEMBER(${arg1},paused,${MEMBER})})
    same => n,Set(MEMBER_EXT=${CUT(MEMBER,\/,2)})
    same => n,ExecIf($[“${STATUS}” = “0”]?System(echo “IN” >
    /var/spool/asterisk/status/agent-${MEMBER_EXT}-status.txt))
    same => n,ExecIf($[“${STATUS}” = “1”]?System(echo “PAU” >
    /var/spool/asterisk/status/agent-${MEMBER_EXT}-status.txt))
    same => n,NoOp(${MEMBER}: ${STATUS})
    same => n,Set(i=$[${i} + 1])
    same => n,EndWhile()

    same => n,Return()

    So, as an explanation, I have multiple queues and agents who autopause. I
    show their status on their phones, hence the System(echo…) commands to the /var/spool/asterisk/status directory. Those files are used to generate a simple web page that is shown on their phones that lets them see their status. You should be able to adapt that to what you do.

    Basically, you pass the queue name into the subroutine as arg1. The subroutine gets a list of every person logged into that queue and then loops through checking the status of each person using the QUEUE_MEMBER
    function.

    It isn’t elegant and if you have a lot of queues/queue members to check, it will constitute a lot of looping, but it does work. Like you, I would like to have a way to check the pause status of a member easier. If the queue application could call a subroutine with it autopaused someone, that would actually make an elegant solution, but for now, this was the way I
    could see to do it.

    You could maybe call a script that would parse the queue_log file looking for an agents status and pass that back into the dialplan.

  • Thank you Kevin, I’ve looked at your solution and while I agree it’s not ideal it does appear to be something that might work for me.

    I’ll see if I can maybe backport the QUEUE_MEMBER stuff to 1.8 from 11.

    I’m also exploring an idea with a co-worker of using an AMI listener that will fire off actions in response to the member being paused and doing things that way.

    I looked at parsing the log but sadly the log uses the Member Name in the log instead of the actual device so I don’t have a way of knowing what handset they are logged into the queue from.

  • I use a Perl script that monitors AMI events. It also checks the state of all queues and members and generates some basic HTML pages for monitoring the queues. It’s not perfect, nor would I call it pretty, but it gets the job done.

    If you are interested, I can send it to you.

    Dale