doucheng9304 2017-10-24 12:31
浏览 30
已采纳

在twilio中获得进程中的队列

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

  • 写回答

1条回答 默认 最新

  • douzuqin3467 2017-10-26 06:43
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求苍穹外卖环境配置
  • ¥15 代码在keil5里变成了这样怎么办啊,文件图像也变了,
  • ¥20 Ue4.26打包win64bit报错,如何解决?(语言-c++)
  • ¥15 clousx6整点报时指令怎么写
  • ¥30 远程帮我安装软件及库文件
  • ¥15 关于#自动化#的问题:如何通过电脑控制多相机同步拍照或摄影(相机或者摄影模组数量大于60),并将所有采集的照片或视频以一定编码规则存放至规定电脑文件夹内
  • ¥20 深信服vpn-2050这台设备如何配置才能成功联网?
  • ¥15 Arduino的wifi连接,如何关闭低功耗模式?
  • ¥15 Android studio 无法定位adb是什么问题?
  • ¥15 C#连接不上服务器,