I am currently using the call log to pull all calls using the extension id:
for (var extensionId in extensions) { var request = (HttpWebRequest)WebRequest.Create("/restapi/v1.0/account/~/extension/" + extensionId + "/call-log"); request.Method = "GET"; request.Headers.Add("Authorization", "Bearer " + AccessToken); request.Accept = "application/json"; WebResponse response = request.GetResponse(); Stream dataStream = response.GetResponseStream(); //DO STUFF WITH CALLS HERE... dataStream.Close(); response.Close(); }
However, my client has around 150 extensions (call center). And the above code makes 150 separate api calls, and takes around 45 minutes to run. I want to speed this up by making only one api call. Something like this:
var request = (HttpWebRequest)WebRequest.Create("/restapi/v1.0/account/~/call-log"); request.Method = "GET"; request.Headers.Add("Authorization", "Bearer " + AccessToken); request.Accept = "application/json"; WebResponse response = request.GetResponse(); Stream dataStream = response.GetResponseStream(); for (var extensionId in extensions) { //GET CALLS FOR EXTENSION... //DO STUFF WITH CALLS HERE... } dataStream.Close(); response.Close();
Obviously I am leaving out some code for parsing the call log into an object. But this is the general idea. My question has to do with the call log structure itself. Is there a way that I can:
- Use the call log api to get all calls for an account (without using the extension filter)
- Then take all those calls and divide them up by extension
Is that built into the call log structure? Or can I use a combination of direction and from/to?
I do see that there is an extension object returned from the cal log api. But when analyzing the results, I see that sometimes the extension object is present in the main call log entry, and sometimes it is present inside one of the legs. I just want to make sure that if this is the method to get the extension, that it is reliable, and will get me the same results as making the separate api calls (one for each extension). I also need to take into consideration the case when the call has been forwarded to an external number.
One more thing - I found this question, which seems similar to mine. And I don't see that it was ever definitively answered: https://devcommunity.ringcentral.com/ringcentraldev/topics/extension-id-in-call-log