question

Mike Corrente avatar image
Mike Corrente asked Mike Corrente commented

Message Store Report Simultaneous Requests

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.



rest api
1 |1500 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.

Phong Vu avatar image
Phong Vu answered Mike Corrente edited

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.

1 comment
1 |1500 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 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

0 Likes 0 ·
calllogjson.txt (26.9 KiB)
Phong Vu avatar image
Phong Vu answered Mike Corrente commented

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.

8 comments
1 |1500 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.

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


0 Likes 0 ·
callrecjson.txt (1.6 KiB)

That fax was received almost 3 hours ago. I'd hope that would be enough time for any additional legs to be viewed in the log. Still, all the other log entries have the same issue - even faxes from last week. Only one leg.

0 Likes 0 ·

Can you try this endpoint to see if you could read the fax message and attachment

0 Likes 0 ·
Show more comments

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