Sandbox Unable to get old calls...

  • 1
  • Problem
  • Updated 3 years ago
  • (Edited)
For the past few weeks I've been able to get calls using the api call "Get Call Log Records by Filter". Yet this morning I couldn't get any calls. I logged into my sandbox panel and could still see them, but couldn't pull them via the api. I doubled checked dates (i'm pulling from Jan 1st, this year), and other settings, but still nothing. I tried the api explorer and still nothing.  
On a hunch, I called my line one more time. Then that one call showed up via my api guzzle call, and with the API explorer. I'm pretty sure i've got my code setup correctly, but I wonder why I can't get the older calls that I can see in my sandbox account panel. 

So 

  1. Does the sandbox API exclude older calls (I can't get ones older than 19 days), 
  2. If so, why?
  3. And will this behavior still happen when I move to production?

Cheers!

Stephen
Photo of Stephen Godfrey

Stephen Godfrey

  • 120 Points 100 badge 2x thumb
  • Moderately intrigued, and partially hungry.

Posted 3 years ago

  • 1
Photo of Stephen Godfrey

Stephen Godfrey

  • 120 Points 100 badge 2x thumb
Well that was fun. It looks like someone fixed it, or something happened that it started working again. This whole morning I've been pulling results, testing, and truncating my call log table. Then all of a sudden I had all my calls show up. 

Any back story to what happened?
Photo of VB

VB, Official Rep

  • 1,410 Points 1k badge 2x thumb
Hi Stephen,
Is your organization "Eangee"? If not can you provide me your organization name? 
Photo of Stephen Godfrey

Stephen Godfrey

  • 120 Points 100 badge 2x thumb
Definitely not. The company I am working for is called turnkey storage, and the sandbox phone number for the app is +15856234243.

What is interesting is that the api would only return the 2 new test calls I placed today, but not the old ones. Then around noon, it would return all of them. I didn't change the code, so it is likely that something happened on ring central side. 

Best of luck figuring this out. 
Photo of VB

VB, Official Rep

  • 1,410 Points 1k badge 2x thumb
Hi Stephen,

After checking your error logs, There are few issues I would like to point out.
1. I see that your datefrom and dateto  filter for call-log API is not set properly.
2. dateto filter is future date
3. Your RPM( Request per Minute) for call-log calls is more that the RPM set for your usage plan- you are making more than 10 calls per minute and hence you get a 429 -  Too many Requests error (Please visit this link for more info:https://devcommunity.ringcentral.com/ringcentraldev/topics/429-too-many-requests-error )

If you are trying to access most recent calls - please use /Active-calls api instead of /call-log api . For more info visit this link: http://ringcentral.github.io/cti-tutorial/#view-active-calls

Let me know if you have any more questions.
Photo of Stephen Godfrey

Stephen Godfrey

  • 120 Points 100 badge 2x thumb
Thanks for getting back to me. 

1. You say that the date filters are not set properly, but what do you mean by that? The api docs suggest that the dates are in ISO 8601 format (eg: 2012-09-17T12:51:00.000Z), and that is what I am entering in. 
2. Basically I want to make sure that I grab every call that has been logged (as active calls don't show up anyway when using the filtered call log), so I set the date ahead. It's like building a sql query that says give me all the data from this date to a future date, just as a precautionary measure. Is this okay?
3. If you look in the logs, all those 'too many requests' happened while I was just testing. I know how to handle that kind of response, and I will admit that sometimes i'll test the system a little heavy, and that I should wait, but heavy testing is not the issue. The issue is that this morning I made an api call, and the system returned false information, and kept returning false information until noon. I'm not angry, I just need to know if I can depend on the api to get correct data when I ask. So, what do you suggest we do?

And you are right, that 'get active calls' feature would be awesome, but that only exists in the JavaScript sdk, and I am using the standard API using guzzle calls. Anything like the active calls in the api? In the future, i'll plan to just pull the calls for a given day and set this up to run consistently via cron, so I likely won't set a future date. 

Most of all thanks for looking into this, and I look forward to your reply. 
Photo of VB

VB, Official Rep

  • 1,410 Points 1k badge 2x thumb
1. You say that the date filters are not set properly, but what do you mean by that? The api docs suggest that the dates are in ISO 8601 format (eg: 2012-09-17T12:51:00.000Z), and that is what I am entering in. 

Your dateTo parameter is set to future date. It shouldnt cause any issue but try to avoid the future date. The format looks fine for me. The dateFrom and dateTo should be set in such a way that there should be constant time interval between each call and change the dateTo and dateFrom keeping the same interval and append to the previous call-log data.

For Eg:  if the datefrom and dateTo has 15 min interval - you retrive the call-log data for 15min and set the dateFrom = dateTo and dateTo = dateTo+15min. and apeend every data that you get to the previous data. Handle the failure case as well. 

2. Basically I want to make sure that I grab every call that has been logged (as active calls don't show up anyway when using the filtered call log), so I set the date ahead. It's like building a sql query that says give me all the data from this date to a future date, just as a precautionary measure. Is this okay?


Active - Call API /v1.0/account/{accountId}/active-calls  will help you retrive latest calls and the call in progress for the account . This can be used to get all the latest calls along with active calls- caals in progress - along with filters. I think this api is more suitable for your app. 


3. If you look in the logs, all those 'too many requests' happened while I was just testing. I know how to handle that kind of response, and I will admit that sometimes i'll test the system a little heavy, and that I should wait, but heavy testing is not the issue. The issue is that this morning I made an api call, and the system returned false information, and kept returning false information until noon. I'm not angry, I just need to know if I can depend on the api to get correct data when I ask. So, what do you suggest we do?

When ever you throttle the system, you add up a penalty for the throttle and you need to wait for sometime before making the next api call ( when 429 error occurs penalty of nearly 1 min is applied where you need to add a delay before next call) Thats the reason you got an error message. Yes testing is necesary but please make sure you add the delay when you are throttled. One of our graudation criteria to move you app to production involves throttle free app. 

And you are right, that 'get active calls' feature would be awesome, but that only exists in the JavaScript sdk, and I am using the standard API using guzzle calls. Anything like the active calls in the api? In the future, i'll plan to just pull the calls for a given day and set this up to run consistently via cron, so I likely won't set a future date. 

I have mentioned above the api for active call - /v1.0/account/{accountId}/active-calls  it is not SDK specific. Please read our API doc for further details.