响铃活动呼叫状态
RingOut 状态 API 仅在通过 RingOut 拨打电话时使用。在 Make RingOut API的ringOutId
响应中返回 。它也只在调用过程中返回状态,稍后会返回一个 404。
API 参考:https ://developer.ringcentral.com/api-reference#RingOut-makeRingOutCall
RingOut 历史通话状态
要获取历史通话的通话状态,请使用通话记录 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
在哪里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
and与整体通话的 and 一致,而对于被调用者的分支则相反。这是因为被呼叫者将与呼叫者连接,从他们的角度来看,呼叫者的号码在属性中。from
RingOutClientToCaller
to
from
RingOutClientToSubscriber
to