Lấy lịch sử cuộc gọi

  • Sau khi thực hiện cuộc gọi, sử dụng api sau để lấy danh sách lịch sử cuộc gọi

ListCallLogs

post
Body
Responses
200

A successful response

application/json
post
/v1/shop.Sencloud/ListCallLogs
POST /v1/shop.Sencloud/ListCallLogs HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 403

{
  "filter": {
    "call_number": "text",
    "call_state": "unknown",
    "date_from": "2025-12-06T03:38:08.453Z",
    "date_to": "2025-12-06T03:38:08.453Z",
    "department_id": "text",
    "direction": "unknown",
    "duration": {
      "comparison": "unknow",
      "value": 1
    },
    "extension_ids": [
      "text"
    ],
    "external_id": "text",
    "external_session_id": "text",
    "hotline_ids": [
      "text"
    ],
    "user_id": "text"
  },
  "paging": {
    "after": "text",
    "before": "text",
    "limit": 1,
    "sort": "text"
  }
}
200

A successful response

{
  "call_logs": [
    {
      "call_state": "unknown",
      "call_status": "Z",
      "call_targets": [
        {
          "add_time": "2025-12-06T03:38:08.453Z",
          "answered_time": "2025-12-06T03:38:08.453Z",
          "end_reason": "text",
          "ended_time": "2025-12-06T03:38:08.453Z",
          "fail_code": 1,
          "ring_duration": 1,
          "ring_time": "2025-12-06T03:38:08.453Z",
          "status": "text",
          "target_number": "text",
          "trunk_name": "text"
        }
      ],
      "callee": "text",
      "caller": "text",
      "contact_id": "text",
      "created_at": "2025-12-06T03:38:08.453Z",
      "direction": "unknown",
      "duration": 1,
      "ended_at": "2025-12-06T03:38:08.453Z",
      "extension_id": "text",
      "external_id": "text",
      "external_session_id": "text",
      "id": "text",
      "note": "text",
      "recording_urls": [
        "text"
      ],
      "started_at": "2025-12-06T03:38:08.453Z",
      "updated_at": "2025-12-06T03:38:08.453Z",
      "user_id": "text"
    }
  ],
  "paging": {
    "after": "text",
    "before": "text",
    "limit": 1,
    "next": "text",
    "prev": "text",
    "sort": "text"
  }
}

Request

curl --request POST \
  --url $BASE_URL/v1/shop.Sencloud/ListCallLogs \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer $API_KEY' \
  --data '{
    "extension_ids": ["101"]
}'

Request Sample

{
  "filter": {
    "call_number": "string",
    "call_state": "unknown",
    "date_from": "string",
    "date_to": "string",
    "direction": "unknown",
    "extension_ids": [
      "string"
    ],
    "hotline_ids": [
      "string"
    ],
    "external_id": "string",
    "external_session_id": "string"
  },
  "paging": {
    "after": "string",
    "before": "string",
    "limit": 0,
    "sort": "string"
  }
}
Tên trường
Kiểu dữ liệu
Mô tả

extension_ids

string[]

Danh sách máy nhánh

call_number

string

Số gọi

hotline_ids

string[]

Danh sách hotline

call_state

enum

Trạng thái cuộc gọi (unknown answered not_answered)

date_from

string

Ngày bắt đầu (VD: "2021-03-10T17:07:19+07:00")

date_to

string

Ngày kết thúc (VD: "2021-03-10T17:07:19+07:00")

external_id

string

Lấy được khi thực hiện cuộc gọi ở web/mobile

external_session_id

string

Lấy được khi thực hiện cuộc gọi ở web/mobile

Response Sample

{
  "call_logs": [
    {
      "call_state": "unknown",
      "call_status": "Z",
      "call_targets": [
        {
          "add_time": "2019-08-24T14:15:22Z",
          "answered_time": "2019-08-24T14:15:22Z",
          "end_reason": "string",
          "ended_time": "2019-08-24T14:15:22Z",
          "fail_code": 0,
          "ring_duration": 0,
          "ring_time": "2019-08-24T14:15:22Z",
          "status": "string",
          "target_number": "string",
          "trunk_name": "string"
        }
      ],
      "callee": "string",
      "caller": "string",
      "contact_id": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "direction": "unknown",
      "duration": 0,
      "ended_at": "2019-08-24T14:15:22Z",
      "extension_id": "string",
      "external_session_id": "string",
      "id": "string",
      "note": "string",
      "recording_urls": [
        "string"
      ],
      "started_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "user_id": "string"
    }
  ],
  "paging": {
    "after": "string",
    "before": "string",
    "limit": 0,
    "next": "string",
    "prev": "string",
    "sort": "string"
  }
}
  • Giải thích một số fields ở kết quả trả về

Tên trường
Kiểu dữ liệu
Mô tả

extension_id

string

Id của máy nhánh

callee

string

Số điện thoại người nhận

caller

string

Số điện thoại người gọi

direction

enum

Hướng cuộc gọi (unknown in out ext ext_in ext_out)

call_targets

array

Danh sách các máy nhánh liên quan

recording_urls

array

File ghi âm

Lưu ý:

  • Response trả về theo kiểu phân trang. Thông thường: 100 phần tử (call logs) / trang sắp xếp theo thứ tự mới nhất, truyền limit nếu muốn thay đổi.

  • Response trả về sẽ kèm theo paging

  • Truyền next vào query string after ở request trên sẽ lấy được trang tiếp theo, ngược lại truyền prev vào query string after ở request trên sẽ lấy được trang trước (nếu có).

Last updated