API Docs for:
Show:

plugin_rest_histcallswitch Class

Module: plugins_rest
Parent Module: com_history_rest

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

GET requests

  1. histcallswitch/interval/:from/:to[?type=type&limit=n&offset=n&sort=field]
  2. histcallswitch/interval/:from/:to/:filter[?type=type&limit=n&offset=n&sort=field]

histcallswitch/interval/:from/:to[?type=type&limit=n&offset=n&sort=field]

Returns the switchboard history call between "from" date to "to" date of all endpoints.

  • from: the start date in YYYYMMDD format
  • to: the end date in YYYYMMDD format
  • [type]: ("in" | "out" | "internal") the type of the calls. If it is through a trunk

If an error occurs an HTTP 500 response is returned. It supports pagination with limit and offset parameters and sorting.

Example JSON response:

[
    {
       "time": 1491480471,
       "channel": "PJSIP/204-00000006",
       "dstchannel": "PJSIP/91223-00000007",
       "uniqueid": "1491473271.12",
       "userfield": "",
       "duration": 2,
       "billsec": 1,
       "disposition": "ANSWERED",
       "dcontext": "ext-local",
       "recordingfile": "",
       "cnum": "204",
       "cnam": "andrea marchio",
       "ccompany": "",
       "src": "204",
       "dst": "91223",
       "dst_cnam": "",
       "dst_ccompany": "",
       "clid": "\"andrea marchio\" <204>",
       "type": "out" // can be ("in" | "out" | "internal") if it is through a trunk or not
    },
    ...
]

histcallswitch/interval/:from/:to/:filter[?type=type&limit=n&offset=n&sort=field]

Returns the switchboard history call between "from" date to "to" date of all endpoints filtering by "filter".

  • from: the start date in YYYYMMDD format
  • to: the end date in YYYYMMDD format
  • filter: filter results on "cnum", "clid" and "dst" fields of the database
  • [type]: ("in" | "out" | "internal") the type of the calls. If it is through a trunk

If an error occurs an HTTP 500 response is returned. It supports pagination with limit and offset parameters and sorting.

Example JSON response:

[
    {
       "time": 1491480471,
       "channel": "PJSIP/204-00000006",
       "dstchannel": "PJSIP/91223-00000007",
       "uniqueid": "1491473271.12",
       "userfield": "",
       "duration": 2,
       "billsec": 1,
       "disposition": "ANSWERED",
       "dcontext": "ext-local",
       "recordingfile": "",
       "src": "204",
       "cnum": "204",
       "cnam": "andrea marchio",
       "ccompany": "",
       "dst": "91223",
       "dst_cnam": "",
       "dst_ccompany": "",
       "clid": "\"andrea marchio\" <204>",
       "type": "out" // can be ("in" | "out" | "internal") if it is through a trunk or not
    },
    ...
]

Methods

interval

(
  • req
  • res
  • next
)

Search the history call of all endpoints for the specified interval and optional filter by the following REST api:

interval/:from/:to[?type=type&limit=n&offset=n&sort=field]
interval/:from/:to/:filter[?type=type&limit=n&offset=n&sort=field]

Parameters:

  • req Object

    The client request.

  • res Object

    The client response.

  • next Function

    Function to run the next handler in the chain.

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.

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.

setPrivacy

(
  • str
)

Sets the string to be used to hide last digits of phone numbers in privacy mode.

Parameters:

  • str Object

    The string used to hide last digits of phone numbers.

Properties

compAuthorization

Object private

The architect component to be used for authorization.

compHistory

Object private

The history architect component used for history functions.

compUtil

Object private

The utility architect component.

get

Array

REST API to be requested using HTTP GET request.

Sub-properties:

  • interval/:from/:to[?type=type&limit=n&offset=n&sort=field] String

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

  • interval/:from/:to/:filter[?type=type&limit=n&offset=n&sort=field] 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/histcallswitch]

logger

Object private

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

Default: console

privacyStrReplace

String private

The string used to hide phone numbers in privacy mode.

Default: "xxx"