Skip to main content

I have a routine that extracts data from the call log and injects it into an analytics engine. I cam across a record yesterday that confuses me, because not all the data appears to be there. This is the record:

{
    "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": d{
        "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. I didn't find anything else in the call logs (via api) when I did a search on date range and/or extension. However, I know that sometimes transferring a call in various ways can affect the session that the call is in. When I fetched data from the call log api using the session id (shown above in the data), I get 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" : a {
    "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" : u {
      "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"
    }
  }
}

As you can see, there is much more information in here, including the correct duration (over 3 minutes). So my question is: Do I need to look up the records by SessionID every time, to ensure that I am getting all the data necessary? For my purposes, I don't care about "linking" these calls together. I just need to extract the extension, the date, and the duration of the call. So if the transfers (shown in the second, longer record) show up as separate calls in the call log (when searching by date only), that's fine. However, that additional information does not show up in the call log when I do a search by date (and not session). It appears to me that the only way I can get this additional information (and in this case, the correct call duration) is to do an additional fetch to the call log api using the sessionId that I get from the first call. Is this expected behavior? Or am I missing something? If I have to do that, then I am going to be making thousands of more calls to the api to ensure I am extracting all the necessary data, and I'm probably going to start getting throttled. Plus, that just seems unnecessary to satisfy a small number of fringe cases like this.

Just to give some additional info: This instance is the exception to the rule. Most calls have the correct duration in the call log without using the sessionId. Also, 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) give us the information we need without any additional api call. So I think the transfer (and usage of the app) has something to do with it.

Hi Matt,

My first guess was also about the timing and that was why I was asking how you called the API. Normally it takes about 20-30 secs for the system to update the call log. The delay could be longer if a call has multiple legs and call recording enabled. No, the action FindMe is not an indication of the readyness of the call data.

For archiving, I recommend you to sync or read the call log periodically with at longer delay (let's say a few hrs or a day) to make sure the system has sync completely all call data for that period . If you need the data instantly for real time or near real time analytics, you can use the active call API to get the call log data.


Reply