Is there any way to get Queues which have current_size
greater than 0.
I want to get Queues which have current_size
greater than 0, I have hundreds of Queues in the system so i want to get only specific queues.
This is what i have done. I am getting the queues having current_size
0.
function get_inprocess_queue_calls(){
if(!$this->input->is_ajax_request()){
exit('Direct access of script is not allowed');
}
require_once 'twilio/Twilio.php';
$twilio_result=$this->broswer_call_model->twilio_credentials();
$client = new Services_Twilio($twilio_result->twilio_accountId, $twilio_result->twilio_authtoken);
$queues = $client->account->queues->getIterator(0, 50,array("Status" => "in-progress"));
$i=0;
$data='';
foreach ($queues as $queue) {
if($queue->current_size>0){
$f_name = $queue->friendly_name;
if($f_name!=''){
$nameArr = array();
$nameArr = @explode('_', $f_name);
$leadId = $nameArr[3];
$from_number = $nameArr[0];
if(strpos($from_number, '+')!== false){
$lead_name = '';
if($leadId!=0){
$lead_record = $this->broswer_call_model->get_lead_details($leadId,$this->teamId,$this->leadTable);
if($lead_record!=0){
$lead_name = $lead_record->first_name.' '.$lead_record->last_name;
}
}
$fun_param1 = "'".$queue->friendly_name."'";
$fun_param2 = "'".$queue->sid."'";
$data.='<tr>
<td style="text-align: center;">'.$lead_name.'</td>
<td style="text-align: center;">'.$from_number.'</td>
<td style="text-align: center;">'.$queue->average_wait_time.'</td>
<td onclick="ConnectLead('.$fun_param1.','.$fun_param2.')" style="cursor:pointer; color:#0066FF; text-align: center;">Connect</td>
</tr>';
}
}
$i++;
}
}
echo json_encode(array('show_status'=>$i,'data'=>$data));
}
What I want to do is like
$queues = $client->account->queues->getIterator(0, 50,array("Status" => "in-progress"));
Or like
$queues = $client->account->queues->getIterator(0, 50,array("Current Size" => "> 0"));
Any Help would be much appreciated
Thanks
Twilio developer evangelist here.
The documentation for the Queues resource only lists FriendlyName
and MaxSize
as the parameters you can use to filter the results. This doesn't include a status parameter or current length parameter, so there is no direct call you can make to the API for this.
It looks like what you've got is probably your best bet now.