Hello,
Why don’t you use the ‘PauseQueueMember’ within ‘queue_devstate.agi’?
Now when we use the ‘app-all-queue-pause-toggle’ context we don’t receive the Pause/UnPause records to the Queue Log within the SQL and this is a trouble. But the ‘PauseQueueMember’ cmd writes this events to log and made specially for Pause/UnPause of the queue members.
I changed the function ‘toggle_pause_all’ in following manner and it works fine with queue log:
function toggle_pause_all($pause_user) {
global $agi;
sortqueues();
debug("Looking up queues for agent: $pause_user");
$agent_queues = get_current_queues($pause_user);
debug("got queues from logged in of: " . implode('-',$agent_queues));
$user_interface = "Local/$pause_user@from-queue/n";
$paused_state = 0;
foreach ($agent_queues as $q) {
$state = get_var("QUEUE_MEMBER($q,paused,$user_interface)");
$paused_state |= $state;
}
// If one was paused then treat as all paused and unpause all, otherwise pause all
// in all queues
$new_state = $paused_state ? '0' : '1';
if($new_state==1){
$agi->exec("PauseQueueMember", ",".$user_interface);
}else{
$agi->exec("UnpauseQueueMember", ",".$user_interface);
}
$agi->set_variable("TOGGLEPAUSED", $new_state);
}
Sorry.
<?php
function toggle_pause_all($pause_user) {
global $agi;
sortqueues();
debug("Looking up queues for agent: $pause_user");
$agent_queues = get_current_queues($pause_user);
debug("got queues from logged in of: " . implode('-',$agent_queues));
$user_interface = "Local/$pause_user@from-queue/n";
$paused_state = 0;
foreach ($agent_queues as $q) {
$state = get_var("QUEUE_MEMBER($q,paused,$user_interface)");
$paused_state |= $state;
}
// If one was paused then treat as all paused and unpause all, otherwise pause all
// in all queues
$new_state = $paused_state ? '0' : '1';
if($new_state==1){
$agi->exec("PauseQueueMember", ",".$user_interface);
}else{
$agi->exec("UnpauseQueueMember", ",".$user_interface);
}
$agi->set_variable("TOGGLEPAUSED", $new_state);
}
?>