Skip to content

通話紀錄資料結構 ​

概述 ​

CDR (Call Detail Record) 是通話詳細紀錄的完整資料結構,由 AICC 系統在通話結束後生成,並透過 HTTP 推送到業務系統。每筆 CDR 包含通話的各個層面的信息,包括通話參與者、設備信息、IVR 日誌、語音識別結果等。

完整 CDR 資料結構 ​

JSON 推送範例 ​

json
{
  "call": {
    "id": "call_20260323_001",
    "cdrId": "cdr_20260323_001",
    "callId": "123456789",
    "sessionId": "session_20260323_001",
    "areaCode": "886",
    "callType": 2,
    "inboundCallerId": "0912345678",
    "outboundCallerId": "0212345678",
    "onlineState": 1,
    "state": 3,
    "agentId": "agent_001",
    "agentName": "王小明",
    "agentTeam": "業務部",
    "queueName": "一般查詢",
    "ivr": 1,
    "startTime": "2026-03-23 14:30:00",
    "endTime": "2026-03-23 14:32:30",
    "duration": 150,
    "talkDuration": 120,
    "callCount": 1,
    "taskId": "task_001",
    "taskName": "Q1銀行卡推廣",
    "contactId": "contact_001",
    "customerName": "李美香",
    "customerPhone": "0987654321",
    "customerAddress": "台中市西屯區",
    "customData": {
      "orderAmount": "8000",
      "source": "campaign_001"
    },
    "cdrType": 2,
    "hangupCode": 1,
    "hangupReason": "客戶主動掛機",
    "recordFile": "/record/20260323/call_20260323_001.wav",
    "recordUrl": "https://aicc.example.com/record/20260323/call_20260323_001.wav",
    "transcriptUrl": "https://aicc.example.com/transcript/20260323/call_20260323_001.txt"
  },
  "callDeviceList": [
    {
      "id": "device_1",
      "deviceType": 1,
      "deviceName": "座席001",
      "phoneNumber": "0212345678",
      "joinTime": "2026-03-23 14:30:05",
      "leaveTime": "2026-03-23 14:32:30",
      "duration": 145,
      "muted": 0,
      "state": 3,
      "location": "台北辦公室"
    },
    {
      "id": "device_2",
      "deviceType": 2,
      "deviceName": "客戶電話",
      "phoneNumber": "0987654321",
      "joinTime": "2026-03-23 14:30:10",
      "leaveTime": "2026-03-23 14:32:30",
      "duration": 140,
      "muted": 0,
      "state": 3,
      "location": "台中"
    },
    {
      "id": "device_3",
      "deviceType": 3,
      "deviceName": "PBX分機",
      "phoneNumber": "ext123",
      "joinTime": "2026-03-23 14:30:00",
      "leaveTime": "2026-03-23 14:32:30",
      "duration": 150,
      "muted": 0,
      "state": 3,
      "location": "中心局"
    }
  ],
  "callIvrLogs": [
    {
      "id": "ivr_log_1",
      "ivrId": "ivr_flow_001",
      "ivrName": "語音導航流程_001",
      "enterTime": "2026-03-23 14:30:00",
      "leaveTime": "2026-03-23 14:30:15",
      "duration": 15,
      "flowPath": "歡迎 > 按1查詢 > 轉接座席",
      "lastNode": "轉接座席",
      "hangupCode": 0,
      "hangupReason": "正常轉接"
    }
  ],
  "callDetailList": [
    {
      "id": "detail_1",
      "eventType": 1,
      "eventTime": "2026-03-23 14:30:00",
      "eventName": "通話開始",
      "eventData": {
        "caller": "0987654321",
        "callee": "0212345678",
        "direction": "inbound"
      }
    },
    {
      "id": "detail_2",
      "eventType": 5,
      "eventTime": "2026-03-23 14:30:15",
      "eventName": "IVR 轉接",
      "eventData": {
        "ivrNode": "按1查詢餘額",
        "nextTarget": "agent_001"
      }
    },
    {
      "id": "detail_3",
      "eventType": 2,
      "eventTime": "2026-03-23 14:32:30",
      "eventName": "通話結束",
      "eventData": {
        "hangupCode": 1,
        "hangupReason": "客戶主動掛機"
      }
    }
  ],
  "speechTexts": [
    {
      "id": "speech_1",
      "deviceId": "device_2",
      "speaker": "李美香",
      "startTime": "2026-03-23 14:30:20",
      "endTime": "2026-03-23 14:30:35",
      "duration": 15,
      "text": "您好,我想查詢我的帳戶餘額",
      "confidence": 0.95,
      "language": "zh-TW"
    },
    {
      "id": "speech_2",
      "deviceId": "device_1",
      "speaker": "王小明",
      "startTime": "2026-03-23 14:30:40",
      "endTime": "2026-03-23 14:31:10",
      "duration": 30,
      "text": "好的,請稍候,我為您查詢一下",
      "confidence": 0.98,
      "language": "zh-TW"
    }
  ]
}

Call 物件詳細字段說明 ​

基本信息 ​

字段名型別說明
idstring通話記錄 ID,全系統唯一
cdrIdstringCDR ID,用於識別此條 CDR 記錄
callIdstringSIP 通話 ID
sessionIdstring會話 ID,用於追蹤相關聯的通話
areaCodestring區域代碼 (如 886 表示台灣)

通話類型及方向 ​

字段名型別說明
callTypeinteger通話類型 (詳見 callType 枚舉)
inboundCallerIdstring來電號碼 (主叫方)
outboundCallerIdstring去電號碼 (被叫方)
onlineStateinteger在線狀態 (1: 在線, 0: 離線)

通話狀態 ​

字段名型別說明
stateinteger通話狀態碼 (0: 初始, 1: 呼出, 2: 連接中, 3: 已連接, 4: 保持, 5: 轉接, 6: 諮詢, 7: 會議)
durationinteger通話總時長 (秒)
talkDurationinteger實際通話時長 (秒)
callCountinteger通話次數

座席信息 ​

字段名型別說明
agentIdstring座席 ID
agentNamestring座席姓名
agentTeamstring座席所屬團隊
queueNamestring所屬隊列名稱

IVR 信息 ​

字段名型別說明
ivrinteger是否經過 IVR (1: 是, 0: 否)

時間戳 ​

字段名型別說明
startTimestring通話開始時間 (ISO 8601 格式)
endTimestring通話結束時間 (ISO 8601 格式)

任務及聯絡人 ​

字段名型別說明
taskIdstring所屬任務 ID (外撥時)
taskNamestring所屬任務名稱
contactIdstring聯絡人 ID
customerNamestring客戶姓名
customerPhonestring客戶電話
customerAddressstring客戶地址

自定義數據 ​

字段名型別說明
customDataobject自定義欄位數據,鍵值對形式

掛機信息 ​

字段名型別說明
cdrTypeintegerCDR 類型 (詳見 cdrType 枚舉)
hangupCodeinteger掛機代碼 (0-15)
hangupReasonstring掛機原因文字說明

錄音及轉錄 ​

字段名型別說明
recordFilestring本地錄音檔案路徑
recordUrlstring錄音下載 URL
transcriptUrlstring轉錄文本 URL

callDeviceList 設備列表 ​

字段說明 ​

字段名型別說明
idstring設備 ID
deviceTypeinteger設備類型 (1: 座席, 2: 客戶, 3: 外線)
deviceNamestring設備名稱
phoneNumberstring設備電話號碼
joinTimestring加入時間
leaveTimestring離開時間
durationinteger參與時長 (秒)
mutedinteger是否靜音 (1: 是, 0: 否)
stateinteger設備狀態
locationstring設備位置

callIvrLogs IVR 日誌 ​

字段說明 ​

字段名型別說明
idstringIVR 日誌 ID
ivrIdstringIVR 流程 ID
ivrNamestringIVR 流程名稱
enterTimestring進入時間
leaveTimestring離開時間
durationinteger停留時長 (秒)
flowPathstring流程路徑 (用 > 分隔)
lastNodestring最後節點名稱
hangupCodeinteger掛機代碼
hangupReasonstring掛機原因

callDetailList 事件詳情列表 ​

字段說明 ​

字段名型別說明
idstring事件 ID
eventTypeinteger事件類型 (1: 通話開始, 2: 通話結束, 3: 保持, 4: 恢復, 5: IVR 轉接, 6: 轉接, 7: 諮詢, 8: 會議)
eventTimestring事件發生時間
eventNamestring事件名稱
eventDataobject事件相關數據 (內容根據 eventType 而異)

speechTexts 語音文本 ​

字段說明 ​

字段名型別說明
idstring語音文本 ID
deviceIdstring所屬設備 ID
speakerstring說話者名稱
startTimestring開始時間
endTimestring結束時間
durationinteger時長 (秒)
textstring轉錄文本
confidencenumber識別置信度 (0-1)
languagestring語言代碼 (zh-TW: 繁體中文, zh-CN: 簡體中文, en: 英文)

數據類型及長度限制 ​

字段類型長度限制備註
id, callId, sessionIdstring最大 100 字元系統生成
inboundCallerId, outboundCallerIdstring最多 20 位數字電話號碼
agentName, customerNamestring最大 50 字元中文時建議不超過 25 字
customDataobject最大 10000 字符JSON 格式
recordUrl, transcriptUrlstring最大 500 字元完整 URL
text (speechTexts)string最大 5000 字符語音識別結果

注意事項 ​

  1. 時間戳格式:均採用 ISO 8601 格式的 UTC+8 時間
  2. 數據完整性:某些字段可能為空,取決於通話類型和配置
  3. 嵌套數組:callDeviceList、callDetailList、speechTexts 都是數組,數量不固定
  4. 自定義數據:customData 的鍵值必須與欄位定義相符
  5. 大數據處理:對於長通話,speechTexts 陣列可能很大,請注意記憶體使用

Copyright © 2026 承暉版權所有|Design by InfoTrends