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(); };