如何找到 RingCentral 呼叫的 callerStatus 和 calleeStatus?

How to find the callerStatus and calleeStatus for RingCentral calls?

如何获取过去通话的通话状态?

我想获得我在 RingOut Status API 响应中看到的 callerStatuscalleeStatus 状态,但我不确定 [=14= 使用什么] 在 URL 路径中:

https://developer.ringcentral.com/api-reference#RingOut-getRingOutCallStatus

请求

获取/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 状态呼叫时,我希望获得呼叫列表,但我却收到以下错误:

Resource for parameter [ringOutId] is not found

ringOutId 有什么用?我怎样才能得到 callerStatuscalleeStatus 来电?

RingOut 活动呼叫状态

RingOut 状态 API 仅在通过 RingOut 进行 phone 呼叫时使用。 ringOutId 在 Make RingOut API 的响应中被 return 编辑。它也只有 return 在通话过程中和短时间后的状态,之后,它会 return 一个 404。

API 参考:https://developer.ringcentral.com/api-reference#RingOut-makeRingOutCall

RingOut 历史通话状态

要获取历史通话的通话状态,请使用通话记录 API。默认情况下,该服务将 return 状态为 result 中的整体调用 属性。要获取通话中各个参与方的状态(称为支线),请使用详细通话记录 API。以下网址可用:

公司通话记录(所有用户)

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'

Note: It's possible for a CDR to only have one leg. This can happen if the result is Busy. In RingOut, if one party is busy, it can be an optimization to not call the other party. Many times, our customers will use RingOut to call their employee first, and if the employee picks up, then call the customer. If the employee isn't there, there's no reason to call the customer and have them listen to a busy tone.

这里是响应调用日志记录示例:

{
  "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
    }
  ]
},

Note: In the detailed call log example, the to and from for the RingOutClientToCaller leg coincide with the to and from for the overall call, while they are reversed for the RingOutClientToSubscriber leg to the callee. This is because the callee will be connect with the caller, whose number is in the to property from their perspective.

你可以打电话 https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/active-calls 此端点获取所有活动呼叫详细信息 请参见 https://developers.ringcentral.com/guide/voice/finding-active-calls