我不知道我是否做错了什么,或者 Twilio 是否只是在请求记录方面天生很慢。当使用 php 请求会议列表时,响应可能需要 5-7 分钟,这对于任何类型的应用程序似乎都不可行。
这是我正在使用的代码示例:
$conferences = $client->account->conferences->getIterator(0, 50, array(
));
foreach ($conferences as $conference) {
$conferenceRoom = $client->account->conferences->get($conference->sid);
$date1 = new DateTime($conference->date_created);
$date2 = new DateTime($conference->date_updated);
$interval = $date1->diff($date2);
$page = $conferenceRoom->participants->getPage(0, 50);
$participants = $page->participants;
$participantCount = count($participants);
$result['conferences'][$conference->sid]['friendly_name'] = $conference->friendly_name;
$result['conferences'][$conference->sid]['sid'] = $conference->sid;
$result['conferences'][$conference->sid]['participants'] = $participantCount;
$result['conferences'][$conference->sid]['status'] = $conference->status;
$result['conferences'][$conference->sid]['duration'] = $interval->format('%H:%I:%S%');
$result['conferences'][$conference->sid]['date_created'] = strtotime($conference->date_created);
$result['conferences'][$conference->sid]['date'] = $conference->date_created;
}
echo json_encode($result);