[英]How to find the callerStatus and calleeStatus for RingCentral calls?
如何獲取過去通話的通話狀態?
我想獲取在 RingOut Status API 響應中看到的callerStatus
和calleeStatus
狀態,但我不確定在 URL 路徑中用於ringOutId
的內容:
https://developer.ringcentral.com/api-reference#RingOut-getRingOutCallStatus
要求
GET /restapi/v1.0/account/400162076008/extension/400162076009/ring-out/Y3MxNzE4NDkyODg0NDM5MDJAMTAuNjIuMjkuMzM
回復
HTTP 200 OK
{
"uri" : "https://platform.ringcentral.com/restapi/v1.0/account/400162076008/extension/400162076009/ring-out/2",
"id" : "Y3MxNzE4NDkyODg0NDM5MDJAMTAuNjIuMjkuMzM",
"status" : {
"callStatus" : "Success",
"callerStatus" : "Success",
"calleeStatus" : "Success"
}
}
在沒有ringOutId
情況下進行 RingOut Status 呼叫時,我希望獲得呼叫列表,但我收到以下錯誤:
Resource for parameter [ringOutId] is not found
我用什么ringOutId
? 如何獲取呼叫的callerStatus
和calleeStatus
?
RingOut 狀態 API 僅在通過 RingOut 撥打電話時使用。 ringOutId
在 Make RingOut API 的響應中返回。 它也只在調用過程中和短時間內返回狀態,之后,它將返回 404。
API 參考: https : //developer.ringcentral.com/api-reference#RingOut-makeRingOutCall
要獲取歷史呼叫的呼叫狀態,請使用 Call Log API。 默認情況下,服務將在result
屬性中返回整體調用的狀態。 要獲取通話中各個方的狀態(稱為支路),請使用詳細通話記錄 API。 以下 URL 可用:
公司通話記錄(所有用戶)
GET /restapi/v1.0/account/~/call-log?view=Detailed
https://developer.ringcentral.com/api-reference#Call-Log-loadCompanyCallLog
用戶分機通話記錄
GET /restapi/v1.0/account/~/extension/~/call-log?view=Detailed
https://developer.ringcentral.com/api-reference#Call-Log-loadUserCallLog
使用詳細視圖,您將收到帶有legs
屬性的響應,這是一組呼叫日志記錄,也稱為呼叫詳細記錄 (CDR) 。 下面顯示了一個示例記錄。 legs
數組中的每個調用都有一個result
屬性。 result
而不是狀態,因為呼叫日志僅列出已完成的呼叫。 每條腿都有一個legType
屬性,可用於識別調用者和被調用者。
例如, legType
可以設置為:
RingOutClientToCaller
RingOutClientToSubscriber
RingOutClientToSubscriber
可用於calleeStatus
。 這給了我們:
callerStatus
= leg.result
where leg.legType == 'RingOutClientToCaller'
calleeStatus
= leg.result
where leg.legType == 'RingOutClientToSubscriber'
注意: CDR 可能只有一條腿。 如果
result
是Busy
就會發生這種情況。 在 RingOut 中,如果一方忙,不呼叫另一方可能是一種優化。 很多時候,我們的客戶會先使用 RingOut 給他們的員工打電話,如果員工接聽,再給客戶打電話。 如果員工不在,就沒有理由打電話給客戶並讓他們聽忙音。
這是一個響應呼叫日志記錄示例:
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/727097016/extension/727097016/call-log/L6HbCN6tB1nyDUA?view=Detailed",
"id": "L6HbCN6tB1nyDUA",
"sessionId": "575838550017",
"startTime": "2018-11-22T08:42:05.500Z",
"duration": 19,
"type": "Voice",
"direction": "Outbound",
"action": "RingOut PC",
"result": "Call connected",
"to": {
"phoneNumber": "+12125550111",
"name": "Daenerys Targaryen",
},
"from": {
"phoneNumber": "+16505550101",
"name": "John Snow"
},
"extension": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/727097016/extension/727097016",
"id": 727097016
},
"transport": "PSTN",
"lastModifiedTime": "2018-11-22T08:42:30.007Z",
"billing": {
"costIncluded": 0.0,
"costPurchased": 0.0
},
"legs": [
{
"startTime": "2018-11-22T08:42:05.257Z",
"duration": 20,
"type": "Voice",
"direction": "Outbound",
"action": "RingOut PC",
"result": "Call connected",
"to": {
"phoneNumber": "+16505550101",
"name": "John Snow"
},
"from": {
"phoneNumber": "+12125550111",
"name": "Daenerys Targaryen",
},
"extension": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/727097016/extension/727097016",
"id": 727097016
},
"transport": "PSTN",
"billing": {
"costIncluded": 0.0,
"costPurchased": 0.0
},
"legType": "RingOutClientToSubscriber"
},
{
"startTime": "2018-11-22T08:42:05.500Z",
"duration": 19,
"type": "Voice",
"direction": "Outbound",
"action": "RingOut PC",
"result": "Call connected",
"to": {
"phoneNumber": "+12125550111",
"name": "Daenerys Targaryen",
},
"from": {
"phoneNumber": "+16505550101",
"name": "John Snow"
},
"extension": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/727097016/extension/727097016",
"id": 727097016
},
"transport": "PSTN",
"legType": "RingOutClientToCaller",
"master": true
}
]
},
注:在詳細呼叫記錄例如,
to
和from
該RingOutClientToCaller
與腿相吻合to
和from
對整體呼叫,而他們被顛倒了RingOutClientToSubscriber
腿到被叫方。 這是因為被調用者將與調用者連接,從他們的角度來看,調用者的號碼在to
屬性中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.