Pause queue members patch on recent FreePBX versions (>=2.11)

Recent FreePBX versions, for some odd reason, use only device states to 'pause' members, losing the builtin functionality in Asterisk queues to log pauses and reasons so they can be reported.



If you use FreePBX and builtin feature codes to pause/unpause members, but they do not show on Asternic reports or realtime view, then this might help you.



Here is a patch contributed by a fellow user that solves the problem by adding the missing commands to the .agi responsible of pausing/unpausing members:



The file to modify is /var/lib/asterisk/agi-bin/queue_devstate.agi

And also posibli this one: /var/www/html/admin/modules/queues/agi-bin/queue_devstate.agi

You will find this code:



$new_state = $paused_state ? '0' : '1';
foreach ($agent_queues as $q) {
$agi->set_variable("QUEUE_MEMBER($q,paused,$user_interface)", $new_state);
debug("QUEUE_MEMBER($q,paused,$user_interface)=$new_state");
}
$agi->set_variable("TOGGLEPAUSED", $new_state);

After that you must add the following:



if($new_state)
$agi->exec('PauseQueueMember',",$user_interface");
else
$agi->exec('UnPauseQueueMember',",$user_interface");
So, the final code should look like this:



$new_state = $paused_state ? '0' : '1';
foreach ($agent_queues as $q) {
$agi->set_variable("QUEUE_MEMBER($q,paused,$user_interface)", $new_state);
debug("QUEUE_MEMBER($q,paused,$user_interface)=$new_state");
}
$agi->set_variable("TOGGLEPAUSED", $new_state);
if($new_state)
$agi->exec('PauseQueueMember',",$user_interface");
else
$agi->exec('UnPauseQueueMember',",$user_interface");




Did you find this article useful?