This function allows resellers and users to retrieve CDRs for a given customer number. The function checks the reseller’s / user’s username and password and whether the customer number is linked to that reseller/user account. On success, the function will return a JSON encoded array.

URL

/cdrs/getcalls/$PROFILE_ID/$START_DATE[/$END_DATE][/$FORMAT]?username=$USERNAME&password=$PASSWORD
  • PROFILE_ID: reseller’s client’s / user’s profile ID (customer number)
  • START_DATE: starting date which you want to retrieve data from (must be smaller than END_DATE)
  • END_DATE: date until when you want to retrieve data (optional, if not set, the current date is selected)
  • FORMAT: can be set to CSV to download the results as a CSV file and JSON
  • USERNAME: reseller’s / user’s username
  • PASSWORD: reseller’s / user’s password

Failures

The function will fail if any of these checks are invalid:

  • The reseller’s / user’s username and password must match
  • the user defined by PROFILE_ID must be linked to the reseller/user account
  • START_DATE must be smaller than END_DATE
  • the interval between START_DATE and END_DATE cannot exceed 3 months

Return value

This function returns a multi-dimensional JSON encoded array

  array(
        [INDEX] => array(
              ['type'] => TYPE,
              ['data'] => DATA
        )
  )

INDEX = numerical index [0, 1, …]

TYPE = any of the following values:

  • CALLIN
  • CALLOUT
  • DEV
  • FAX
  • HARDWARE
  • PAY
  • SERVICE
  • SETUP
  • SMS
  • TRAVEL

DATA = array with these indexes:

  • source = who made the call if type=CALL, else the username
  • destination = which number was dialed if type=CALL, else the product name
  • destination_name = which country was dialed if type=CALL, else a product description
  • call_start = start of the call if type=CALL, else the date of billing
  • call_end = end of the call if type=CALL, else the date of billing
  • quantity = quantity billed
  • price = price in euro cents per quantity
  • invoice = invoice/report number

Example in CSV format:

CALLOUT,+35220333320,35220333000,"Luxembourg","2021-06-29,08:30:15",61,'20,2,7.00,N/A
CALLIN,+35220333000,35220333320,"2021-06-29 10:40:00",0,,0,0.00,N/A

Example in JSON format:

[{"type":"CALLIN","data":{"source":"+35220333000","destination":"35220333320","destination_name":null,"call_start":"2021-06-29
08:13:50","duration":"0","pbxextension":"","quantity":0,"price":"0.00","invoice":"N\/A"}},{"type":"CALLOUT","data":{"source":"+35220333320","destination":"35220333000","destination_name":"Luxembourg","call_start":"2021-06-29
08:24:31","duration":"61","pbxextension":"20","quantity":2,"price":"7.00","invoice":"N\/A"}}]