Posts Tagged ‘queues’

Asterisk: removing all queue dynamic members

Sunday, March 20th, 2022

Users add themselves as queue members by dialing some short number (AddQueueMember dialplan app is used). The queue may contain several dynamic members.

The task is to remove all queue members by dialing some number, no matter how much members are in this queue. Queue name is ‘superQueue’ (example for AEL, Asterisk 13):

// remove all dynamic queue members
0000 =>
{
    NoOp(superQueue member  list: ${QUEUE_MEMBER_LIST(superQueue)});

    // count members of a queue
    count=${QUEUE_MEMBER(superQueue,count)};

    // and remove all, one by one
    while (${count} >= 1) {
        Set(QMLsuperQueue=${QUEUE_MEMBER_LIST(superQueue)});
        Set(kicked=${CUT(QMLsuperQueue,\,,1)});
        Log(NOTICE, removing dynamic member: ${kicked});
        RemoveQueueMember(superQueue,${kicked});
        count=${count}-1;
    }

    Hangup();
};

Asterisk: Queue statistics

Friday, January 29th, 2016

As it’s said in queues.conf:

  ; If set to yes, the following variables will be set
  ; just prior to the caller being bridged with a queue member
  ; and just prior to the caller leaving the queue
  ; QUEUENAME name of the queue
  ; QUEUEMAX maxmimum number of calls allowed
  ; QUEUESTRATEGY the strategy of the queue;
  ; QUEUECALLS number of calls currently in the queue
  ; QUEUEHOLDTIME current average hold time
  ; QUEUECOMPLETED number of completed calls for the queue
  ; QUEUEABANDONED number of abandoned calls
  ; QUEUESRVLEVEL queue service level
  ; QUEUESRVLEVELPERF current service level performance
  ;
  ;setqueuevar=no

So, add ‘setqueuevar=yes’ to each queue definition in queues.conf and then modify your dialplan after execution of the Queue application:

  Queue(${EXTEN},t,,,25);

  // to enable Queue statistics
  NoOp(${QUEUE_VARIABLES(${EXTEN})});

  NoOp(QUEUESTRATEGY is ${QUEUESTRATEGY});
  NoOp(QUEUECALLS is ${QUEUECALLS});
  NoOp(QUEUEHOLDTIME is ${QUEUEHOLDTIME});
  NoOp(QUEUECOMPLETED is ${QUEUECOMPLETED});
  NoOp(QUEUEABANDONED is ${QUEUEABANDONED});
  NoOp(QUEUESRVLEVEL is ${QUEUESRVLEVEL});
  NoOp(QUEUESRVLEVELPERF is ${QUEUESRVLEVELPERF})

Console output:

  Executing [007@inc:33] NoOp("007@inc-1658;2", "0") in new stack
  Executing [007@inc:34] NoOp("007@inc-1658;2", "QUEUESTRATEGY is ringall") in new stack
  Executing [007@inc:35] NoOp("007@inc-1658;2", "QUEUECALLS is 0") in new stack
  Executing [007@inc:36] NoOp("007@inc-1658;2", "QUEUEHOLDTIME is 6") in new stack
  Executing [007@inc:37] NoOp("007@inc-1658;2", "QUEUECOMPLETED is 12778") in new stack
  Executing [007@inc:38] NoOp("007@inc-1658;2", "QUEUEABANDONED is 34844") in new stack
  Executing [007@inc:39] NoOp("007@inc-1658;2", "QUEUESRVLEVEL is 10") in new stack
  Executing [007@inc:40] NoOp("007@inc-1658;2", "QUEUESRVLEVELPERF is 54.6") in new stack

Cell phone as a queue member

Thursday, December 19th, 2013

From time to time I’m asked by my customers if it is possible to include a cellular phone as a queue member. Yes, it is easy to do. You may include any phone number, not only cell or SIP, which is registered on your Asterisk server. Asterisk must be compiled with the local channel support. Everything is done with its help.

queues.conf:

[queue_cell_and_sip]
strategy = ringall
servicelevel = 10
joinempty = yes
music = default

member => SIP/1301
member => Local/79221234567@your-context

extensions.ael:

...
        1810 =>
        {
                Answer;
                Queue(queue_cell_and_sip);
                Hangup;
        }
...