Skip to content

Recording ​

Nhóm endpoint phát/tải ghi âm từng cuộc gọi, tạo tác vụ xuất hàng loạt (ZIP), theo dõi và quản lý tác vụ và tạm dừng/tiếp tục ghi âm thời gian thực để tuân thủ PCI.

Tạm dừng / tiếp tục ghi âm (PCI compliance) ​

http
POST /api/telesales/calls/{uuid}/recording/pause
POST /api/telesales/calls/{uuid}/recording/resume

Path parameter ​

FieldTypeMô tả
uuidstringUUID cuộc gọi đang diễn ra

Response fields ​

FieldTypeMô tảGiá trị hợp lệ
uuidstringUUID cuộc gọi
recordingstringTrạng thái ghi âm sau khi gọi endpointpaused / recording

Response 200: { "data": { "uuid": "...", "recording": "paused" } }

Use case

Agent có thể tạm dừng ghi âm khi khách hàng đang đọc thông tin nhạy cảm (số thẻ tín dụng, CVV, ...) để đảm bảo tuân thủ PCI-DSS, sau đó tiếp tục ghi khi đoạn nhạy cảm đã kết thúc.

Tổng quan endpoint ​

EndpointMục đích
GET /api/telesales/recordings/{uuid}Phát trực tiếp file ghi âm (trả audio/wav, hỗ trợ Range request)
GET /api/telesales/recordings/{uuid}/downloadTải file .wav kèm filename
POST /api/telesales/recordings/export-bulkTạo tác vụ xuất ZIP (xử lý bất đồng bộ)
GET /api/telesales/recordings/export-bulk/{jobId}Kiểm tra trạng thái tác vụ
GET /api/telesales/recordings/export-bulk/{jobId}/downloadTải ZIP khi job hoàn tất
DELETE /api/telesales/recordings/export-bulk/{jobId}Huỷ job / dọn ZIP sớm

GET /api/telesales/recordings/{uuid} — stream ​

Path parameter ​

FieldTypeMô tả
uuidstringUUID cuộc gọi

Response headers ​

HeaderMô tảGiá trị
Content-TypeLoại MIMEaudio/wav
Accept-RangesHỗ trợ HTTP Range Requestbytes
Content-LengthKích thước file (byte)
Cache-ControlCache policyprivate, max-age=3600

Response 200:

  • Content-Type: audio/wav
  • Accept-Ranges: bytes (cho HTML5 audio scrubbing)
  • Content-Length: <bytes>
  • Cache-Control: private, max-age=3600

Response 206 Partial Content (HTTP Range request) — trình phát âm thanh dùng để tua đến vị trí mong muốn.

Response 404 — không có ghi âm:

json
{ "message": "Recording not found.", "error_code": "RECORDING_NOT_FOUND" }

Response 410 Gone — ghi âm đã hết hạn theo retention rule do admin cấu hình:

json
{ "message": "Recording has exceeded the retention window.", "expired_at": "2026-03-01T00:00:00Z" }

GET /api/telesales/recordings/{uuid}/download ​

Path parameter ​

FieldTypeMô tả
uuidstringUUID cuộc gọi

Response headers ​

HeaderMô tảGiá trị
Content-TypeLoại MIMEaudio/wav
Content-DispositionFilename gợi ý cho trình duyệtattachment; filename="call-{uuid}-{date}.wav"

Response 200:

  • Content-Type: audio/wav
  • Content-Disposition: attachment; filename="call-093e1024-2026-06-06.wav"

Lỗi 404/410 giống endpoint stream.

POST /api/telesales/recordings/export-bulk — tạo job ZIP ​

Request body fields ​

FieldTypeRequiredMô tảGiá trị hợp lệ
campaign_idintegeroptionalLọc theo chiến dịch
date_fromdatetime✅Mốc bắt đầu (ISO 8601 UTC)
date_todatetime✅Mốc kết thúc (ISO 8601 UTC)Khoảng date_from..date_to ≤ 31 ngày
agent_ids[]array<integer>optionalLọc theo agent
disposition_codes[]array<string>optionalChỉ export cuộc có disposition nàymã disposition của tài khoản

Body:

json
{
  "campaign_id": 36,
  "date_from": "2026-06-01T00:00:00Z",
  "date_to":   "2026-06-05T23:59:59Z",
  "agent_ids": [25, 26],
  "disposition_codes": ["SALE-OK", "CALLBACK_REQ"]
}

Response fields ​

FieldTypeMô tảGiá trị hợp lệ
job_idstringID job exportexp_<hex>
statusstringTrạng thái khởi tạoqueued
estimated_filesintegerƯớc tính số file ghi âm sẽ đóng gói≥ 1
estimated_size_mbintegerƯớc tính dung lượng ZIP (MB)≥ 0
created_atdatetimeLúc tạo job (ISO 8601 UTC)
expires_atdatetimeLúc ZIP bị xoá tự động (default +30 ngày)ISO 8601 UTC

Response 201:

json
{
  "data": {
    "job_id": "exp_abc123",
    "status": "queued",
    "estimated_files": 215,
    "estimated_size_mb": 480,
    "created_at": "2026-06-06T07:00:00Z",
    "expires_at": "2026-07-06T07:00:00Z"
  }
}

Response 422 — các trường hợp validate sai:

json
// Khoảng thời gian vượt 31 ngày
{
  "message": "The given data was invalid.",
  "errors": { "date_to": ["The date_from..date_to range may not exceed 31 days."] }
}

// Không có bản ghi nào phù hợp với bộ lọc → không tạo job
{
  "message": "No recordings match the filter.",
  "errors": { "filter": ["Estimated 0 files. Adjust date range or filters."] }
}

Response 403 — người gọi API không có quyền supervisor / admin:

json
{ "message": "You are not allowed to bulk-export recordings. Supervisor or admin role is required." }

GET /api/telesales/recordings/export-bulk/{jobId} — kiểm tra trạng thái ​

Path parameter ​

FieldTypeMô tả
jobIdstringID job trả về từ POST tạo job

Response fields ​

FieldTypeMô tảGiá trị hợp lệ
job_idstringID job export
statusstringTrạng thái jobqueued / running / ready / failed / expired / cancelled
progress_pctintegerPhần trăm hoàn thành0-100
filesintegerSố file đã đóng gói (chỉ khi ready)≥ 0
files_processedintegerSố file đã xử lý (chỉ khi running)≥ 0
size_mbintegerDung lượng ZIP thực tế (MB)
download_urlstringURL tải ZIP (khi status=ready)
created_atdatetimeLúc tạo job (ISO 8601 UTC)
completed_atdatetime|nullLúc đóng gói xong
expires_atdatetimeLúc ZIP bị xoá tự động
error_codestringMã lỗi khi status=failedvd STORAGE_ERROR
error_messagestringMô tả lỗi khi status=failed
failed_atdatetimeLúc job thất bại

Response 200:

json
{
  "data": {
    "job_id":        "exp_abc123",
    "status":        "ready",
    "progress_pct":  100,
    "files":         215,
    "size_mb":       478,
    "download_url":  "/api/telesales/recordings/export-bulk/exp_abc123/download",
    "created_at":    "2026-06-06T07:00:00Z",
    "completed_at":  "2026-06-06T07:08:42Z",
    "expires_at":    "2026-07-06T07:00:00Z"
  }
}

Enum status: queued | running | ready | failed | expired | cancelled.

Trạng thái running trả thêm progress_pct (0..99) + files_processed.

Trạng thái failed trả thêm:

json
{
  "data": {
    "job_id": "exp_abc123",
    "status": "failed",
    "error_code": "STORAGE_ERROR",
    "error_message": "Storage unavailable during ZIP packaging.",
    "failed_at": "2026-06-06T07:05:00Z"
  }
}

Response 404 — job không tồn tại hoặc không thuộc tài khoản.

GET /api/telesales/recordings/export-bulk/{jobId}/download ​

Path parameter ​

FieldTypeMô tả
jobIdstringID job (status phải = ready)

Response headers ​

HeaderMô tảGiá trị
Content-TypeLoại MIMEapplication/zip
Content-DispositionFilename ZIPattachment; filename="recordings-{jobId}.zip"

Response 200:

  • Content-Type: application/zip
  • Content-Disposition: attachment; filename="recordings-exp_abc123.zip"

ZIP chứa các file .wav cùng một manifest.csv (danh sách các file trong gói ZIP) (danh sách các file trong gói ZIP) (call UUID, extension agent, tên agent, disposition code, start_time, duration, số điện thoại lead).

Response 410 Gone — ZIP đã hết hạn (30 ngày):

json
{ "message": "Export ZIP has expired. Please create a new job." }

Response 409 Conflict — job chưa sẵn sàng:

json
{ "message": "Job exp_abc123 is currently in state 'running' (38%). Wait until ready before downloading." }

DELETE /api/telesales/recordings/export-bulk/{jobId} — huỷ / dọn ​

Path parameter ​

FieldTypeMô tả
jobIdstringID job cần huỷ hoặc dọn
Nếu tác vụ đang chờ hoặc đang xử lý sẽ bị hủy. Nếu đã hoàn thành, tệp ZIP sẽ được xóa để giải phóng dung lượng lưu trữ.

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