matt-spinks2179 avatar image
matt-spinks2179 asked

How to detect and remove duplicate recordings within the same call record

When inspecting some call records, I've noticed that there are sometimes duplicate recordings. Here is an example (I've removed some extra data to make is easier to read):

{   "id": "DkFXDQocJi8hjUA",   "uri": "",   "sessionId": "172335211023",   "type": "Voice",   "direction": "Inbound",   "action": "Phone Call",   "result": "Accepted",   "startTime": "2019-04-27T13:18:10.463Z",   "duration": 28,   "lastModifiedTime": "2019-04-27T13:18:46.132Z",   "transport": "PSTN",   "from": {    "phoneNumber": null,    "extensionNumber": "143",    "location": null,    "name": "Ana Jorge",    "device": null   },   "to": {    "phoneNumber": null,    "extensionNumber": "104",    "location": null,    "name": null,    "device": null   },   "recording": {    "id": "985541334023",    "uri": "",    "type": "Automatic",    "contentUri": ""   },   "message": null,   "billing": {    "costIncluded": "0.000",    "costPurchased": "0.000"   },   "legs": [{    "id": null,    "uri": null,    "sessionId": null,    "type": "Voice",    "direction": "Outbound",    "action": "VoIP Call",    "result": "Call connected",    "startTime": "2019-04-27T13:18:10.462Z",    "duration": 28,    "lastModifiedTime": null,    "transport": "VoIP",    "legType": "SipToPstnMetered",    "extension": {     "id": "62481118023",     "uri": ""    },    "from": {     "phoneNumber": null,     "extensionNumber": "143",     "location": null,     "name": "Ana Jorge",     "device": {      "id": "800571597022",      "uri": ""     }    },    "to": {     "phoneNumber": null,     "extensionNumber": "104",     "location": null,     "name": "Jason Miller",     "device": null    },    "recording": {     "id": "985541333023",     "uri": "",     "type": "Automatic",     "contentUri": ""    },    "message": null,    "billing": null   }, {    "id": null,    "uri": null,    "sessionId": null,    "type": "Voice",    "direction": "Outbound",    "action": "VoIP Call",    "result": "Call connected",    "startTime": "2019-04-27T13:18:18.204Z",    "duration": 19,    "lastModifiedTime": null,    "transport": "VoIP",    "legType": "PstnToSip",    "extension": {     "id": "314180022",     "uri": ""    },    "from": {     "phoneNumber": null,     "extensionNumber": "143",     "location": null,     "name": "Jason Miller",     "device": {      "id": "800865565023",      "uri": ""     }    },    "to": {     "phoneNumber": "+15619827939",     "extensionNumber": "104",     "location": "Boca Raton, FL",     "name": null,     "device": null    },    "recording": {     "id": "985541334023",     "uri": "",     "type": "Automatic",     "contentUri": ""    },    "message": null,    "billing": null   }]  }

As you can see, there are 3 recordings listed:

985541334023 (from the main call record)

985541333023 (from the first leg)

985541334023 (from the last leg)

Two of those ids are identical (the main call record and the last leg), so I know that those two are duplicates automatically. However, the recording from the first leg has a different recording id. And upon checking, these two recordings are the same (at least from listening to them). Why does this happen? And, more importantly, is there a way to detect these duplicates from the api? Or am I going to have to do a byte comparison on my end to determine if they are duplicates or not?

1 |3000

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

0 Answers

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys