API Docs for:
Show:

customer_card Class

Module: customer_card

Provides the customer card functionalities.

Methods

config

(
  • path
)

Configures the module by using the specified JSON configuration file.

Parameters:

  • path String

    The path of the JSON configuration file

configPrivacy

(
  • path
)

Customize the privacy used to hide phone numbers by a configuration file. The file must use the JSON syntax.

Parameters:

  • path String

    The path of the configuration file

filterPrivacyCcCalls

(
  • username
  • num
  • calls
)
Array

Filter customer card "calls" obscuring phone numbers that do not involve the user.

Parameters:

  • username String

    The identifier of the user

  • num String

    The number used to search the customer cards

  • calls Array

    The list of the calls

Returns:

Array:

The received call list with hides numbers.

getAllCustomerCards

(
  • username
  • num
  • format
  • cb
)

Gets all authorized customer cards of the user and returns them in the specified format.

Parameters:

  • username String

    The identifier of the user

  • num String

    The number used to search the customer cards

  • format String

    The format of the customer card data to be returned. It is contained in the data key of the returned object

  • cb Function

    The callback function

getCustomerCardByNum

(
  • permissionId
  • ccName
  • num
  • cb
)

Get a customer card.

Parameters:

  • permissionId String

    The permission identifier of the customer card in asterisk.rest_cti_permissions

  • ccName String

    The customer card name

  • num String

    The number used to search the customer card

  • cb Function

    The callback function

getCustomerCardHTML

(
  • templateName
  • nameDescr
  • data
)
String private

Return the customer card in HTML format.

Parameters:

  • templateName String

    The name of the template file

  • nameDescr String

    The customer card description name

  • data Array

    The customer card data

Returns:

String:

The customer card in HTML format or an empty string in error case.

getCustomerCardPreview

(
  • query
  • dbconnId
  • templateName
  • cb
)

Get a customer card.

Parameters:

  • query String

    The query

  • dbconnId String

    The db connection identifier

  • templateName String

    The template name

  • cb Function

    The callback function

getCustomerCardsList

(
  • username
  • cb
)

Return the list of the customer cards.

Parameters:

  • username String

    The identifier of the user

  • cb Function

    The callback function

initEjsTemplates

() private

Initializes the ejs templates used to render the customer cards.

on

(
  • type
  • cb
)
Object

Subscribe a callback function to a custom event fired by this object. It's the same of nodejs events.EventEmitter.on method.

Parameters:

  • type String

    The name of the event

  • cb Function

    The callback to execute in response to the event

Returns:

Object:

A subscription handle capable of detaching that subscription.

reload

() private

Reload the component.

reset

() private

Reload the component.

setCompAuthorization

(
  • ca
)

Set the authorization architect component used by customer card functions.

Parameters:

  • ca Object

    The authorization architect component.

setCompUser

(
  • comp
)

Set the user architect component.

Parameters:

  • comp Object

    The user architect component.

setDbconn

(
  • dbConnMod
)

Set the module to be used for database functionalities.

Parameters:

  • dbConnMod Object

    The dbconn module.

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.

start

()

Initialize the ejs templates used to render the customer cards.

Properties

compAuthorization

Object private

The authorization architect component used for customer card functions.

compUser

Object private

The user architect component.

CONFIG_FILEPATH

String private

The configuration file path.

CONFIG_PRIVACY_FILEPATH

String private

The configuration file path of the privacy.

dbconn

Object private

The dbconn module.

ejsTemplates

Object private

All the ejs templates used for the customer cards. The keys are the name of the customer card and the values are objects. These objects have two keys:

  • index: the sequence used to show the customer card in order
  • content: the content of the customer card

emitter

Object private

The event emitter.

EVT_RELOADED

String

The name of the reloaded event.

Default: "reloaded"

IDLOG

String private final

The module identifier used by the logger.

Default: [customer_card]

logger

Object private

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

Default: console

privacyStrReplace

String private final

The string used to hide phone numbers in privacy mode.

Default: "xxx"

TEMPLATE_EXTENSION

String private final

The default file extension of the customer cards templates.

Default: ".ejs"

templatesPath

String private

The directory path of the templates used by the customer card component.

Events

reloaded

Fired when the componente has been reloaded.