PBX API : GET /CallHistory/

To get a call history, make an HTTP GET request with basic authorization, resource URI:

http(s)://{PBX}/api/v1/CallHistory/

GET Parameters

Required Parameters

NameDescription

Optional Parameters:

NameDefaultPossible valuesDescription

fields

All

id
start
answer
end
billsec
disposition
faxdata
from_name
from_number
to_name
to_number
lastapp
userfield
lastdata
cost
channel
dstchannel
type

A list of fields that should be returned

Maybe using with comma "," for listing all required fields

start0

{from 0 to n}

Offset rows returned

count

100{from 1 to n}How many rows to return

sort

start

id
start
answer
end
billsec
disposition
faxdata
from_name
from_number
to_name
to_number
lastapp
userfield
lastdata
cost
channel
dstchannel
type

Sort field
dir

DESC

ASC
DESC

Type of sorting

search

empty{search word}

Search words
If searchFields is not specify , searching by following fields:
from_number
to_number
from_name
to_name

searchFields

from_number
to_number
from_name
to_name

id
start
answer
end
billsec
disposition
faxdata
from_name
from_number
to_name
to_number
lastapp
userfield
lastdata
cost
channel
dstchannel

type

Field to be searched, there may be several.

Maybe using with comma "," for listing all required fields

 

filter[$key]empty

filter[id]
filter[start]
filter[answer]
filter[end]
filter[billsec]
filter[disposition]
filter[faxdata]
filter[from_name]
filter[from_number]
filter[to_name]
filter[to_number]
filter[lastapp]
filter[userfield]
filter[lastdata]
filter[cost]
filter[channel]
filter[dstchannel]
filter[type]

Filtering by any field also can use range [from][to] for filtering

'type' values:
call
fax

'disposition' values:
ANSWERED
FAILED
NO ANSWER
BUSY

Response example:

GET http://{PBX}/api/v1/CallHistory/?start=1&count=2&sort=start&dir=DESC
{
  "type": "result",
  "result": {
    "total": "2289",
    "records": [
      {
        "id": "8289",
        "start": "2015-03-11 13:32:36",
        "answer": "2015-03-11 13:32:40",
        "end": "2015-03-11 13:32:42",
        "from_number": "320",
        "to_number": "320",
        "from_name": "u_320",
        "to_name": "u_320",
        "billsec": "2",
        "disposition": "ANSWERED",
        "lastapp": "Queue",
        "userfield": "",
        "faxdata": "",
        "lastdata": "tags:yellow,green, blues",
        "cost": "",
        "channel": "SIP/320-000000aa",
        "dstchannel": "SIP/320-000000ab",
        "type": "call"
      },
      {
        "id": "8288",
        "start": "2015-03-11 13:32:36",
        "answer": "2015-03-11 13:32:36",
        "end": "2015-03-11 13:32:40",
        "from_number": "320",
        "to_number": "",
        "from_name": "u_320",
        "to_name": "",
        "billsec": "0",
        "disposition": "NO ANSWER",
        "lastapp": "Wait",
        "userfield": "",
        "faxdata": "",
        "lastdata": "15",
        "cost": "",
        "channel": "SIP/320-000000aa",
        "dstchannel": "SIP/320-000000ab",
        "type": "call"
      }
    ]
  }
}

 

Example:

CLI CURL
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?fields=type"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?fields=type,id,from_name"
count
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?count=5"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?count=1000"
sort
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?sort=id"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?sort=id&dir=ASC"
dir
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?sort=id&dir=ASC"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?sort=id&dir=DESC"
search
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?search=320"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?search=320&searchFields=from_number"
searchFields
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?search=320&searchFields=from_number"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?search=320&searchFields=from_number,from_name,faxdata,id"
Filter
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?filter[cost]=600&sort=id&count=3&dir=DESC"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?filter[id]=8257&sort=id&count=3&dir=DESC"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?filter[from_number]=320&sort=id&count=3&dir=DESC"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?filter[to_name]=u_320&sort=id&count=3&dir=DESC"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?filter[billsec]=22"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?filter[disposition]=ANSWERED"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?filter[disposition]=ANSWERED&filter[lastapp]=Dial"
curl -X GET --globoff -u user:pass --url "http://{PBX}/api/v1/CallHistory/?filter[type]=fax"
filter by range 'from' 'to'
curl -X GET --globoff -u user:pass -G --data-urlencode 'filter[start][from]=2014-12-08 17:47:36' --data-urlencode 'filter[start][to]=2014-13-08 17:47:36'