API Docs for: 2.6
Show:

plugin_rest_historycall Class

Module: plugins_rest
Parent Module: com_history_rest

REST plugin that provides history functions through the following REST API:

GET requests

  1. historycall/down_callrec/:id
  2. historycall/listen_callrec/:id
  3. historycall/day/:endpoint/:day
  4. historycall/day/:endpoint/:day/:filter
  5. historycall/interval/:endpoint/:from/:to
  6. historycall/interval/:endpoint/:from/:to/:filter

historycall/down_callrec/:id

The user can downlaod the record audio file of a call. The id is the call indentifier in the database (uniqueid field of the asteriskcdrdb.cdr database table). The user with admin_recording authorization can download all audio files, while the user with the recording permission can download only the audio file of his own calls.


historycall/listen_callrec/:id

The user can listen the record audio file of a call. The id is the call indentifier in the database (uniqueid field of the asteriskcdrdb.cdr database table). The user with admin_recording authorization can listen all audio files, while the user with the recording permission can listen only the audio file of his own calls.


historycall/day/:endpoint/:day

Returns the history call of the day "day" and endpoint "endpoint". E.g. the endpoint can be the extension number. Date must be expressed in YYYYMMDD format. If an error occurs an HTTP 500 response is returned.

Example JSON response:

[
    {
       date: "02/01/2014"
       time: "08:32:57"
       channel: "SIP/2001-00000000"
       dstchannel: "SIP/303-0000000b"
       uniqueid: "1388647977.5182"
       duration: 29
       billsec: 21
       disposition: "ANSWERED"
       dcontext: "ext-local"
       recordingfile: ""
       src: "0721123432"
       dst: "vms201"
       clid: ""CHIU: USER" <1233312>"
    }
]

historycall/day/:endpoint/:day/:filter

Returns the history call of the day "day" and endpoint "endpoint" filtering by "filter". E.g. the endpoint can be the extension number. Date must be expressed in YYYYMMDD format. If an error occurs an HTTP 500 response is returned.

Example JSON response:

[
    {
       date: "02/01/2014"
       time: "08:32:57"
       channel: "SIP/2001-00000000"
       dstchannel: "SIP/303-0000000b"
       uniqueid: "1388647977.5182"
       duration: 29
       billsec: 21
       disposition: "ANSWERED"
       dcontext: "ext-local"
       recordingfile: ""
       src: "0721123432"
       dst: "vms201"
       clid: ""CHIU: USER" <1233312>"
    }
]

historycall/interval/:endpoint/:from/:to

Returns the history call between "from" date to "to" date for the endpoint "endpoint". E.g. the endpoint can be the extension number. Dates must be expressed in YYYYMMDD format. If an error occurs an HTTP 500 response is returned.

Example JSON response:

[
    {
       date: "02/01/2014"
       time: "08:32:57"
       channel: "SIP/2001-00000000"
       dstchannel: "SIP/303-0000000b"
       uniqueid: "1388647977.5182"
       duration: 29
       billsec: 21
       disposition: "ANSWERED"
       dcontext: "ext-local"
       recordingfile: ""
       src: "0721123432"
       dst: "vms201"
       clid: ""CHIU: USER" <1233312>"
    }
]

historycall/interval/:endpoint/:from/:to/:filter

Returns the history call between "from" date to "to" date for the endpoint "endpoint" filtering by "filter". E.g. the endpoint can be the extension number. Date must be expressed in YYYYMMDD format. If an error occurs an HTTP 500 response is returned.

Example JSON response:

[
    {
       date: "02/01/2014"
       time: "08:32:57"
       channel: "SIP/2001-00000000"
       dstchannel: "SIP/303-0000000b"
       uniqueid: "1388647977.5182"
       duration: 29
       billsec: 21
       disposition: "ANSWERED"
       dcontext: "ext-local"
       recordingfile: ""
       src: "0721123432"
       dst: "vms201"
       clid: ""CHIU: USER" <1233312>"
    }
]

POST requests

  1. historycall/delete_callrec

historycall/delete_callrec

Delete the specified call recording. The request must contains the following parameters:

  • id: the identifier of the call in the database

Example JSON request parameters:

{ "id": "74" }

Methods

day

(
  • req
  • res
  • next
)

Search the history call for the specified day, endpoint and optional filter by the following REST api:

day/:endpoint/:day
day/:endpoint/:day/:filter

Parameters:

  • req Object

    The client request.

  • res Object

    The client response.

  • next Function

    Function to run the next handler in the chain.

    It uses interval function.

delete_callrec

(
  • req
  • res
  • next
)

Delete the record audio file of a call with the following REST API:

delete_callrec

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

deleteCallRecording

(
  • id
  • username
  • data
  • res
)
private

Delete call recording using history component.

Parameters:

  • id String

    The identifier of the call

  • username String

    The name of the user

  • data Object
    • year String

      The creation year of the file

    • month String

      The creation month of the file

    • day String

      The creation day of the file

    • filename String

      The name of the file

  • res Object

    The client response

down_callrec

(
  • req
  • res
  • next
)

Download the record audio file of a call with the following REST API:

down_callrec

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

downCallRecording

(
  • id
  • username
  • data
  • res
)
private

Download call recording using the history component. This returns the content of the audio file using base64 enconding. So the data is sent to the client.

Parameters:

  • id String

    The identifier of the call

  • username String

    The name of the user

  • data Object
    • year String

      The creation year of the file

    • month String

      The creation month of the file

    • day String

      The creation day of the file

    • filename String

      The name of the file

  • res Object

    The client response

interval

(
  • req
  • res
  • next
)

Search the history call for the specified interval, endpoint and optional filter by the following REST api:

interval/:endpoint/:from/:to
interval/:endpoint/:from/:to/:filter

Parameters:

  • req Object

    The client request.

  • res Object

    The client response.

  • next Function

    Function to run the next handler in the chain.

listen_callrec

(
  • req
  • res
  • next
)

Listen the record audio file of a call with the following REST API:

listen_callrec

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

listenCallRecording

(
  • id
  • username
  • data
  • res
)
private

Listen call recording using history component. This returns the content of the audio file using base64 enconding. So the data is sent to the client.

Parameters:

  • id String

    The identifier of the call

  • username String

    The name of the user

  • data Object
    • year String

      The creation year of the file

    • month String

      The creation month of the file

    • day String

      The creation day of the file

    • filename String

      The name of the file

  • res Object

    The client response

setCompAstProxy

(
  • comp
)

Sets the asterisk proxy architect component.

Parameters:

  • comp Object

    The asterisk proxy architect component.

setCompAuthorization

(
  • ca
)

Set authorization architect component used by history functions.

Parameters:

  • ca Object

    The authorization architect component.

setCompHistory

(
  • ch
)

Set history architect component used by history functions.

Parameters:

  • ch Object

    The history architect component.

setCompStatic

(
  • comp
)

Set static http architecht component used by history functions.

Parameters:

  • comp Object

    The http static architect component.

setCompUser

(
  • comp
)

Sets the user architect component.

Parameters:

  • comp Object

    The user architect component.

setCompUtil

(
  • comp
)

Sets the utility architect component.

Parameters:

  • comp Object

    The utility architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

Properties

compAstProxy

Object private

The asterisk proxy architect component.

compAuthorization

Object private

The architect component to be used for authorization.

compHistory

Object private

The history architect component used for history functions.

compStaticHttp

Object private

The http static module.

compUser

Object private

The user architect component.

compUtil

Object private

The utility architect component.

get

Array

REST API to be requested using HTTP GET request.

Sub-properties:

  • down_callrec/:id String

    To download the record audio file of a call

  • listen_callrec/:id String

    To listen the record audio file of a call

  • day/:endpoint/:day String

    To get the history call of the day and endpoint. The date must be expressed in YYYYMMDD format

  • day/:endpoint/:day/:filter String

    To get the history call of the day and endpoint filtering by filter. The date must be expressed in YYYYMMDD format

  • interval/:endpoint/:from/:to String

    To get the history call between "from" date to "to" date. The date must be expressed in YYYYMMDD format

  • interval/:endpoint/:from/:to/:filter String

    To get the history call between "from" date to "to" date filtering by filter. The date must be expressed in YYYYMMDD format

IDLOG

String private final

The module identifier used by the logger.

Default: [plugins_rest/historycall]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

post

Array

REST API to be requested using HTTP POST request.

Sub-properties:

  • delete_callrec String

    To delete a call recording