本文整理汇总了PHP中Call::get_status方法的典型用法代码示例。如果您正苦于以下问题:PHP Call::get_status方法的具体用法?PHP Call::get_status怎么用?PHP Call::get_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Call
的用法示例。
在下文中一共展示了Call::get_status方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_calls
function get_calls($offset = 0, $page_size = 20)
{
$output = array();
$page_cache_key = $this->cache_key . "_{$offset}_{$page_size}";
$total_cache_key = $this->cache_key . '_total';
if (function_exists('apc_fetch')) {
$success = FALSE;
$total = apc_fetch($total_cache_key, $success);
if ($total and $success) {
$this->total = $total;
}
$data = apc_fetch($page_cache_key, $success);
if ($data and $success) {
$output = @unserialize($data);
if (is_array($output)) {
return $output;
}
}
}
$page = floor(($offset + 1) / $page_size);
$params = array('num' => $page_size, 'page' => $page);
$response = $this->twilio->request("Accounts/{$this->twilio_sid}/Calls", 'GET', $params);
if ($response->IsError) {
throw new VBX_CallException($response->ErrorMessage, $response->HttpStatus);
} else {
$this->total = (string) $response->ResponseXml->Calls['total'];
$records = $response->ResponseXml->Calls->Call;
foreach ($records as $record) {
$item = new stdClass();
$item->id = (string) $record->Sid;
$item->caller = format_phone($record->Caller);
$item->called = format_phone($record->Called);
$item->status = Call::get_status((string) $record->Status);
$item->start = isset($record->StartTime) ? strtotime($record->StartTime) : null;
$item->end = isset($record->EndTime) ? strtotime($record->EndTime) : null;
$item->seconds = isset($record->Duration) ? (string) $record->Duration : 0;
$output[] = $item;
}
}
if (function_exists('apc_store')) {
apc_store($page_cache_key, serialize($output), self::CACHE_TIME_SEC);
apc_store($total_cache_key, $this->total, self::CACHE_TIME_SEC);
}
return $output;
}