[asterisk-users] Determining if a queue member is paused in Dialplan logic. [1.8]

Kevin Larsen kevin.larsen at pioneerballoon.com
Wed Mar 25 14:13:43 CDT 2015


asterisk-users-bounces at lists.digium.com wrote on 03/25/2015 01:38:26 PM:
> 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?

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150325/e92fc3d7/attachment.html>


More information about the asterisk-users mailing list