Solved

Message Store Report Simultaneous Requests

  • 18 August 2021
  • 4 replies
  • 545 views

My app subscribes to message notifications and automatically imports faxes to our CRM. These are mission-critical to us, so to make sure we don't miss anything I also periodically request a message store report (say once every ten minutes, looking back 12 minutes). These are going to be very small reports.

I'm getting an unexpected response (429) Too Many Requests:

{

"errors" : [ {

"errorCode" : "PIC-020",

"message" : "Data export is limited to [numberOfRequests] simultaneously executing requests.",

"numberOfRequests" : "2"

} ]

}

Seems pretty self-explanatory - I already have two reports executing. The thing is, I don't think I do. These reports return pretty quickly because of the narrow time range, so the code is run synchronously. The only thing I can think of is that a report was requested and the code terminated unexpectedly and an orphaned report or two is out there still executing and blocking additional reports.

I'm trying to figure out how to handle this. Is there a way to get a list of message store report tasks? I know how to put task info if I have the taskId, but obviously I don't have the taskId for a task I don't know about.

Is there a better way to be doing this? I've worked with enough webhooks to know they're not foolproof, and missing some of these faxes would be VERY expensive for us.



icon

Best answer by Phong1426275020 19 August 2021, 15:50

View original

4 replies

Userlevel 1

The max number of simultaneous tasks per account is 2 and you have existed it. And if I remember correctly, the message store export is limited to max 20 tasks per day. Anyway, the message store export APIs are more for archiving for compliant purpose and you should not use it in this scenario.

You can use the Company Call Log and set the query params to read Fax only (type=Fax) and set the period of time using dateFrom and dateTo accordingly.

Thanks for the response.

I'm playing around with the Company Call Log endpoint, but I'm not getting enough info to pull the fax. I've uploaded the JSON response of a call report from our sandbox account. I can see all the faxes, but I'm getting Message objects for only some of them. Looks like I'm getting a Message object for all the outgoing faxes, but only on one of the five incoming faxes. I thought it was because many of them were marked as "Partial Receive", but that's not it. The only Message object I got on a received fax was for a "Partial Receive" - the two "Received" have no Message object.

Is there a way to get the contents of a fax without a Message? I know it's in there because I can call Get Message List and see it.

CallLogJson.txt

Userlevel 1

Reading the account level and detailed view, you should get the legs info and there will be 2 legs. The fax message details should be in the second leg. Here is my example record

{
    "uri": "https://platform.ringcentral.com/restapi/v1.0/account/xxxxx/call-log/NwY6raZCz1whzxx?view=Detailed",
    "id": "NwY6raZCz1whzxx",
    "sessionId": "665203367016",
    "startTime": "2021-08-19T16:27:34.135Z",
    "duration": 42,
    "type": "Fax",
    "internalType": "LocalNumber",
    "direction": "Inbound",
    "action": "Incoming Fax",
    "result": "Received",
    "to": {
      "phoneNumber": "+1626380xxxx"
    },
    "from": {
      "name": "RINGCENTRAL",
      "phoneNumber": "+1650513xxxx",
      "location": "San Mateo, CA"
    },
    "telephonySessionId": "s-0de91b408246444599d4d3103ffc9fd2",
    "transport": "PSTN",
    "lastModifiedTime": "2021-08-19T16:28:30.368Z",
    "billing": {
      "costIncluded": 0,
      "costPurchased": 0
    },
    "legs": [
      {
        "startTime": "2021-08-19T16:27:34.135Z",
        "duration": 42,
        "type": "Fax",
        "internalType": "LocalNumber",
        "direction": "Inbound",
        "action": "Incoming Fax",
        "result": "Received",
        "to": {
          "phoneNumber": "+1626380xxxx"
        },
        "from": {
          "name": "RINGCENTRAL",
          "phoneNumber": "+1650513xxxx",
          "location": "San Mateo, CA"
        },
        "telephonySessionId": "s-0de91b408246444599d4d3103ffc9fd2",
        "transport": "PSTN",
        "billing": {
          "costIncluded": 0,
          "costPurchased": 0
        },
        "legType": "CallBack",
        "master": true
      },
      {
        "startTime": "2021-08-19T16:27:34.162Z",
        "duration": 42,
        "type": "Fax",
        "internalType": "LocalNumber",
        "direction": "Inbound",
        "action": "Incoming Fax",
        "result": "Received",
        "to": {
          "name": "Paco",
          "phoneNumber": "+1626380xxxx",
          "extensionId": "62288329016"
        },
        "from": {
          "name": "RINGCENTRAL",
          "phoneNumber": "+1650513xxxx",
          "location": "San Mateo, CA"
        },
        "message": {
          "uri": "https://platform.ringcentral.com/restapi/v1.0/account/xxxxxxxx/extension/xxxxxxxx/message-store/1547175155016",
          "id": "1547175155016",
          "type": "Fax"
        },
        "extension": {
          "uri": "https://platform.ringcentral.com/restapi/v1.0/account/xxxxxxxx/extension/xxxxxxxx",
          "id": 62288329016
        },
        "telephonySessionId": "s-0de91b408246444599d4d3103ffc9fd2",
        "transport": "PSTN",
        "legType": "CallBack"
      }
    ]
  }

If you don't see the same, can you share the entire record data (REMOVE SENSITIVE INFO SUCH AS real phone number, account Id. OR, give it some time and read again.

I think that's what I'm doing. I do notice that the only Inbound fax that has a Message object has two legs and the rest have one.

Here's what I used to get the test fax I sent myself earlier:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/call-log/Aij5Pe5YqyWgzUA?view=Detailed

Attached the JSON. It shows it as a Received fax, but only one leg with no Message object:

CallRecJson.txt


Reply