如何获取过去通话的通话状态?
我想获取在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
的电话?
答案 0 :(得分:0)
仅当通过RingOut拨打电话时,才使用RingOut Status API。 ringOutId
在Make RingOut API的响应中返回。它还仅在通话进行中和一小段时间后返回状态,此后,它将返回404。
API参考:https://developer.ringcentral.com/api-reference#RingOut-makeRingOutCall
要获取历史通话的通话状态,请使用“通话记录” 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
属性的响应,该属性是呼叫日志记录的阵列,也称为Call Detail Records (CDR)。记录示例如下所示。 legs
数组中的每个调用都有一个result
属性。使用result
代替状态,因为呼叫记录仅列出已完成的呼叫。每条腿都有一个legType
属性,可用于识别呼叫者和被呼叫者。
例如,legType
可以设置为:
RingOutClientToCaller
RingOutClientToSubscriber
RingOutClientToSubscriber
可以用于calleeStatus
。这给了我们:
callerStatus
= leg.result
其中leg.legType == 'RingOutClientToCaller'
calleeStatus
= leg.result
其中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
和{{ 1}}代表整个通话,而相反的from
则指向被叫方。这是因为被叫方将与呼叫者保持联系,从他们的角度来看,该呼叫者的号码在RingOutClientToSubscriber
属性中。
答案 1 :(得分:0)