API problem with call data

I’m using IPCortex API version 1.9.1 and I’m having problems with the Call Data functions.

I’m following the instructions found here:
Sending a POST request to https://my.ip.address/rest/call/read gives me a 404 not found error.

What I’m after, essentially, is to be able to get call statistics such as total call time and total number of calls per user in a given period. Call data seems like it’s what I want.

Any help would be appreciated.

Anthony

Hi Anthony,
What PBX firmware version are you using?

Hi Rob,

Version 6.1.6

Hi Anthony,
The call/read REST calls are only available in (alpha) 6.2 PBX images at the moment which is why you are getting a 404 in your 6.1 image. Sorry for the inconvenience.

An alternative way of doing this with any PBX post 4.1 is just to pull the billing data for a date range:

First login:

 https://hostname/login.whtm?sessionUser=admin&sessionPass=password

The cookie that needs to be saved is called “Red60urne”. The response will include a redirect “Location:” header, but this can be ignored. You should use HTTPS if you have a certificate installed.

A query that should get you all OUTBOUND calls for all phones in CSV format:

https://hostname/cdr/bills.whtm?month=09-2016&bill_start=&bill_end=&inbstats=no&outstats=no&format=CSV&allphones=1

NOTE: The above URL provides a redirect “Location:” header. It is necessary to follow this redirect once to get the data. If that is a problem, you can look at the destination, and emulate it directly, but that interface is not guaranteed to remain consistent.

  1. INBOUND CALLS

From version 4.1 of the PABX software you can specify “allext=1” to request a report for all inbound extensions.

https://hostname/cdr/bills.whtm?month=08-2016&bill_start=&bill_end=&inbstats=no&outstats=no&format=CSV&inbcsv=1&allext=1

The date range can be specified using:

month=mm-yyyy&bill_start=&bill_end=

or

month=&bill_start=yyyy-mm-dd hh:mm&bill_end=yyyy-mm-dd hh:mm

But due to memory and complexity constraints, the maximum report period is 45 days.

Also note that with CSV reports, new fields will only ever be added to the end of a line, so it is probably best to assume extra columns can be ignored for future-proofing.

Hi Rob,

Thanks again for your help. This was really helpful.

It’s unfortunate that this information can’t be retrieved through the API. You really shouldn’t have the API calls in the documentation if they aren’t available for the existing versions.

I didn’t get any redirect “Location:” header in the post requests. But I can get the data just fine which is good.

Thanks again!

Hi @rob,

I wanted to ask a quick follow-up question: As per above we are getting a list of calls in CSV format and parsing it.
Is there a way with the new API (version 2) to get the same information through the API (logged in as admin).

Thanks,
Anthony

https://developer.ipcortex.co.uk/6.2/ref/rest/cdr/ should tell you most things you need to know.