本文整理匯總了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;
}