News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Is there a way to look at this call log record and determine that the call is not completed yet?
Tags: rest api
Aug 8, 2019 at 7:26am   •   1 replies  •  0 likes
matt-spinks

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.

1 Answer
answered on Aug 8, 2019 at 8:23am  

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



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us