Skip to content

Lịch sử cuộc gọi (CDR) ​

Truy vấn CDR theo nhiều điều kiện + tải ghi âm qua Signed URL.

GET /api/pbx/cdr — Liệt kê ​

Query parameters ​

FieldTypeRequiredMô tảGiá trị hợp lệ
fromdateoptionalNgày bắt đầu (YYYY-MM-DD)Không truyền → now() - 30 ngày
todateoptionalNgày kết thúc (YYYY-MM-DD)Phải ≥ from. Không truyền → now()
directionstringoptionalHướng cuộc gọiinbound, outbound, internal, local
extensionstringoptionalLọc theo máy nhánh (match extension_number hoặc agent_extension)3-20 ký tự
phonestringoptionalLọc theo số điện thoại (match caller_number hoặc destination_number)max 50 ký tự
pageintegeroptionalSố trang≥ 1
per_pageintegeroptionalSố bản ghi/trang1-200 (default 50)

Giới hạn cửa sổ thời gian

Cửa sổ from..to tối đa 30 ngày (có thể cấu hình riêng cho từng tài khoản qua giới hạn cấu hình theo từng khách hàng). Vượt → HTTP 422.

Response body fields (mỗi item trong data[]) ​

FieldTypeMô tảGiá trị hợp lệ
uuidstringUUID cuộc gọi (Zorio PBX call_uuid)UUID 36 ký tự
directionstringHướng cuộc gọiinbound / outbound / internal / local
source_typestringNguồn cuộc gọiinbound / outbound_manual / outbound_telesales / outbound_callback / outbound_webphone / internal
caller_numberstringSố gọi đi (caller ID)
destination_numberstringSố đích
extension_numberstring|nullMáy nhánh thực hiện hoặc nhận cuộc gọi
agent_extensionstring|nullMáy nhánh của Agent đã trả lời cuộc gọi (cho queue/IVR)
start_timedatetimeLúc cuộc gọi bắt đầuISO 8601
answer_timedatetime|nullLúc nhấc máyISO 8601 (null nếu không nhấc)
end_timedatetimeLúc cúp máyISO 8601
durationintegerTổng thời lượng (giây)≥ 0
billsecintegerThời gian tính tiền (sau khi nhấc, giây)≥ 0
queue_namestring|nullTên queue (nếu cuộc đi qua hàng đợi)
queue_wait_timeinteger|nullThời gian chờ trong queue (giây)
trunk_namestring|nullTên trunk gọi ra (cho outbound)
transfer_countintegerSố lần chuyển máy≥ 0
resultstringKết quả cuộc gọianswered / busy / no_answer / failed / cancelled / rejected / voicemail
hangup_causestringMã hangup từ Zorio PBXvd NORMAL_CLEARING, NO_ANSWER, USER_BUSY, CALL_REJECTED, ...
sip_response_codestring|nullMã phản hồi SIP cuối cùng (cho outbound)vd 200, 486, 487
recording_availableboolCó file ghi âm khôngtrue / false
created_atdatetimeNgày tạo row CDR

Response Body (JSON) — 200 ​

json
{
  "current_page": 1,
  "data": [
    {
      "uuid": "65569ce0-0183-4f61-a3b2-0e433cfa4031",
      "direction": "outbound",
      "source_type": "outbound_telesales",
      "caller_number": "0900000021",
      "destination_number": "0987654321",
      "extension_number": "0900000021",
      "agent_extension": null,
      "start_time": "2026-06-27T08:15:42+00:00",
      "answer_time": "2026-06-27T08:15:42+00:00",
      "end_time": "2026-06-27T08:15:56+00:00",
      "duration": 14,
      "billsec": 14,
      "queue_name": null,
      "queue_wait_time": null,
      "trunk_name": null,
      "transfer_count": 0,
      "result": "answered",
      "hangup_cause": "NORMAL_CLEARING",
      "sip_response_code": null,
      "recording_available": true,
      "created_at": "2026-06-27 08:15:56"
    }
  ],
  "last_page": 5,
  "per_page": 20,
  "total": 87
}

GET /api/pbx/cdr/{uuid} — Chi tiết + signed recording URL ​

Path parameter ​

uuid (string, Zorio PBX call_uuid).

Response = 22 field như list + 1 object recording (nếu có ghi âm).

recording object fields ​

FieldTypeMô tả
durationintegerThời lượng file ghi âm (giây)
file_sizeintegerKích thước file (byte)
recorded_atdatetimeLúc ghi âm bắt đầu (ISO 8601)
urlstringSigned URL dùng để tải file ghi âm .wav — chỉ valid trong expires_in_seconds
expires_in_secondsintegerThời gian hiệu lực của URL (TTL) (default 1800 = 30 phút)

Response Body (JSON) — 200 ​

json
{
  "data": {
    "uuid": "65569ce0-...",
    "direction": "outbound",
    "recording_available": true,
    "recording": {
      "duration": 14,
      "file_size": 56265,
      "recorded_at": "2026-06-27T08:15:57+00:00",
      "url": "https://app.zorio.vn/api/public/recordings/401/audio?expires=1782706011&signature=de93e86...",
      "expires_in_seconds": 1800
    }
  }
}

GET /api/pbx/cdr/{uuid}/recording — 302 redirect tới signed URL ​

Path parameter ​

uuid (CDR Unique-ID).

Response ​

HTTP 302 với header Location: <signed URL>. Client làm theo redirect để tải file hoặc Client tự động theo redirect để tải file .wav. TTL signed URL: 30 phút (HMAC SHA256).

Cấp phép theo điều khoản sử dụng của Zorio.