question

matt-spinks avatar image
matt-spinks asked ·

Is there a way to look at this call log record and determine that the call is not completed yet?

I have a routine that extracts data from the call log and injects it into an analytics engine. I came across a record yesterday that confuses me, because it showed up in the call log before the call was completed, and all the data was NOT there. This is a snapshot of the record we saw in the call log (before the call was completed):

{
    "id": "EZFVGyf7hMo-jUA",
    "uri": "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/call-log/EZFVGyf7hMo-jUA?view=Detailed",
    "sessionId": "212380520035",
    "type": "Voice",
    "direction": "Outbound",
    "action": "FindMe",
    "result": "Busy",
    "startTime": "2019-08-06T14:50:24.633Z",
    "duration": 0,
    "lastModifiedTime": "2019-08-06T14:51:40.840Z",
    "transport": "PSTN",
    "from": {
        "phoneNumber": "+17168511819",
        "extensionNumber": null,
        "location": null,
        "name": "Joe Healy",
        "device": {
            "id": "800382230035",
            "uri": "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/device/800382230035"
        }
    },
    "to": {
        "phoneNumber": "+16147605116",
        "extensionNumber": null,
        "location": "Dublin, OH",
        "name": "Joe Healy",
        "device": null
    },
    "recording": null,
    "message": null,
    "billing": {
        "costIncluded": "0.000",
        "costPurchased": "0.000"
    },
    "legs": [{
        "id": null,
        "uri": null,
        "sessionId": null,
        "type": "Voice",
        "direction": "Outbound",
        "action": "FindMe",
        "result": "Busy",
        "startTime": "2019-08-06T14:50:24.633Z",
        "duration": 0,
        "lastModifiedTime": null,
        "transport": "PSTN",
        "legType": "FindMe",
        "extension": {
            "id": "2147029020",
            "uri": "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/extension/2147029020"
        },
        "from": {
            "phoneNumber": "+17168511819",
            "extensionNumber": null,
            "location": null,
            "name": "Joe Healy",
            "device": {
                "id": "800382230035",
                "uri": "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/device/800382230035"
            }
        },
        "to": {
            "phoneNumber": "+16147605116",
            "extensionNumber": null,
            "location": "Dublin, OH",
            "name": "Joe Healy",
            "device": null
        },
        "recording": null,
        "message": null,
        "billing": null
    }]
}

This was brought to my attention because the duration here shows 0. The client was complaining that he wasn't getting credit for the correct amount of time on the call. He insisted he was on the call for at least 3 minutes. So I did some digging. When I fetched that same record from the call log api again (later), I got an entirely different result, shown here:

{
  "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/call-log?view=Detailed&sessionId=212380520035&page=1&perPage=500",
  "records" : [ {
    "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/call-log/EZFVGyf7hMo-jUA?view=Detailed",
    "id" : "EZFVGyf7hMo-jUA",
    "sessionId" : "212380520035",
    "startTime" : "2019-08-06T14:50:20.595Z",
    "duration" : 227,
    "type" : "Voice",
    "direction" : "Inbound",
    "action" : "Phone Call",
    "result" : "Accepted",
    "to" : {
      "phoneNumber" : "+16147605116"
    },
    "from" : {
      "phoneNumber" : "+17168511819",
      "location" : "Buffalo, NY"
    },
    "reason" : "Accepted",
    "reasonDescription" : "The call connected to and was accepted by this number.",
    "transport" : "PSTN",
    "lastModifiedTime" : "2019-08-06T14:54:30.636Z",
    "billing" : {
      "costIncluded" : 0.000,
      "costPurchased" : 0.000
    },
    "legs" : [ {
      "startTime" : "2019-08-06T14:50:20.595Z",
      "duration" : 227,
      "type" : "Voice",
      "direction" : "Inbound",
      "action" : "Phone Call",
      "result" : "Accepted",
      "to" : {
        "phoneNumber" : "+16147605116"
      },
      "from" : {
        "phoneNumber" : "+17168511819",
        "location" : "Buffalo, NY"
      },
      "reason" : "Accepted",
      "reasonDescription" : "The call connected to and was accepted by this number.",
      "transport" : "PSTN",
      "billing" : {
        "costIncluded" : 0.000,
        "costPurchased" : 0.000
      },
      "legType" : "Accept",
      "master" : true
    }, {
      "startTime" : "2019-08-06T14:50:20.612Z",
      "duration" : 227,
      "type" : "Voice",
      "direction" : "Inbound",
      "action" : "Phone Call",
      "result" : "Accepted",
      "to" : {
        "phoneNumber" : "+16147605116",
        "extensionId" : "2147029020",
        "name" : "Joe Healy"
      },
      "from" : {
        "phoneNumber" : "+17168511819",
        "location" : "Buffalo, NY"
      },
      "extension" : {
        "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/extension/2147029020",
        "id" : 2147029020
      },
      "reason" : "Accepted",
      "reasonDescription" : "The call connected to and was accepted by this number.",
      "transport" : "PSTN",
      "legType" : "Accept"
    }, {
      "startTime" : "2019-08-06T14:50:24.620Z",
      "duration" : 223,
      "type" : "Voice",
      "direction" : "Outbound",
      "action" : "VoIP Call",
      "result" : "Call connected",
      "to" : {
        "phoneNumber" : "+16147605000",
        "extensionNumber" : "5116",
        "location" : "Dublin, OH"
      },
      "from" : {
        "phoneNumber" : "+17168511819",
        "extensionId" : "2147029020",
        "name" : "Joe Healy",
        "device" : {
          "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/device/800400659035",
          "id" : "800400659035"
        }
      },
      "extension" : {
        "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/extension/2147029020",
        "id" : 2147029020
      },
      "reason" : "Accepted",
      "reasonDescription" : "The call connected to and was accepted by this number.",
      "transport" : "VoIP",
      "legType" : "PstnToSip"
    }, {
      "startTime" : "2019-08-06T14:50:24.633Z",
      "duration" : 0,
      "type" : "Voice",
      "direction" : "Outbound",
      "action" : "FindMe",
      "result" : "Busy",
      "to" : {
        "phoneNumber" : "+16147605116",
        "name" : "Joe Healy",
        "location" : "Dublin, OH"
      },
      "from" : {
        "phoneNumber" : "+17168511819",
        "extensionId" : "2147029020",
        "name" : "Joe Healy",
        "device" : {
          "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/device/800382230035",
          "id" : "800382230035"
        }
      },
      "extension" : {
        "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/extension/2147029020",
        "id" : 2147029020
      },
      "reason" : "Line Busy",
      "reasonDescription" : "The phone number you dialed was busy.",
      "transport" : "PSTN",
      "legType" : "FindMe"
    } ]
  } ],
  "paging" : {
    "page" : 1,
    "perPage" : 500,
    "pageStart" : 0,
    "pageEnd" : 0
  },
  "navigation" : {
    "firstPage" : {
      "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/call-log?view=Detailed&sessionId=212380520035&page=1&perPage=500"
    },
    "lastPage" : {
      "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/1951617020/call-log?view=Detailed&sessionId=212380520035&page=1&perPage=500"
    }
  }
}

This appears to be a timing issue, but I am not sure. I believe when our system first pulled the record, the call may have still been going on. And when the call actually completed, the record was updated. And that would make sense, because the new record shows a lastModifiedTime around 4 minutes after the startTime (and the duration of the call is around 3.5 minutes). Is there some way I can look at the record the first time we pulled it (the first snapshot, showing a duration of 0, above), and determine that I need to look at it again later, because the call may still be going on, or may be getting transferred? I noticed that it has an action of "FindMe" and a result of "Busy". Is that any kind of indication?

Also, according to this: https://forums.developers.ringcentral.com/questions/1301/when-in-the-call-is-a-record-logged.html, a call will not appear in the call log until "several minutes" after the call completes. Is that not a true statement? Or could this be a bug?

Just to give some additional info: This instance is the exception to the rule. Most calls we grab from the call log are fully complete and have all the data. In this case, this was a call that was transferred to a soft phone, and answered using the RC app. And from what we can tell, all other calls that are not answered by the app (but answered by a desk phone) show up correctly. So I think the transfer (and usage of the app) has something to do with it.

apicall log
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

· Write an Answer
Phong Vu avatar image
Phong Vu answered ·

Hi Matt,

I answered part of your question in the other thread. Yes, it is the timing issue, but it is the nature of our call log system to sync call data from multiple data sites.

A call log item with sessionId is created almost instantly but the call data is not completed. The system will update the call log after a call is completed and there is a time gap depending on the complexity of the call (call transfer).

It's worth to know also if you use the active call API to get call data from an active call, you will see the time (start, end etc.) slightly different from the final info you get from the same call from the call log API.

1 comment Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks for the info Phong. So it sounds like there are two possible solutions:

1. Delay our api fetch (maybe an hour delay or so)

2. Do a lookup of calls within the Get Company Active Calls api to determine if a call is still in progress (if it is, just skip it for now)

Does that sound about right?

I'm leaning toward using the "Get Company Active Calls" route (to stay as close to NRT as possible). I haven't used the "Get Company Active Calls" api before. It looks straightforward. Am I correct in my understanding of the following?...

1. If the call id shows up in this api, then the call is still ongoing

2. And if not, then the call has completed

3. At that moment, am I guaranteed that the call log record from the call log api is fully complete and has all data?

0 Likes 0 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.