API Docs for:
Show:

config_manager Class

Module: config_manager

Provides the configuration manager functionalities. It sets the user configurations and stores it into the relative section of the configuration file.

Methods

checkAutoDndOffLogin

(
  • username
)
private

Checks the "auto dnd off on login" setting of the user and if it is enabled it does the DND OFF of all user extensions.

Parameters:

  • username String

    The name of the user logged in

checkAutoDndOnLogout

(
  • username
)
private

Checks the "auto dnd on logout" setting of the user and if it is enabled it does the DND ON on all user extensions.

Parameters:

  • username String

    The name of the user disonnected

checkQueueAutoLogin

(
  • username
)
private

Check the "queue automatic login" setting of the user and if it is enabled it does the login of all dynamic extension of the user into their relative queues.

Parameters:

  • username String

    The name of the user logged in

checkQueueAutoLogout

(
  • username
)
private

Checks the "queue automatic logout" setting of the user and if it is enabled it does the logout of all dynamic extension of the user from their relative queues.

Parameters:

  • username String

    The name of the user disonnected

config

(
  • path
)

It reads the JSON configuration file and set the server ip address.

Parameters:

  • path String

    The path of the configuration file

configChat

(
  • path
)

It reads the configuration file and set the chat options. The file must use the JSON syntax.

Parameters:

  • path String

    The path of the configuration file

configPhoneUrls

(
  • path
)

It reads the JSON configuration file of phone urls used to directly interact with the phones, e.g. to originate a new call. The keys contained by file must be sorted from more restrictive to the least, because they are sequentially checked.

The method can throw an Exception.

Parameters:

  • path String

    The path of the configuration file

configUser

()

Initialize all user settings reading data from the nethcti3.user_settings database.

getAllUserEndpointsJSON

() Object

Returns the endpoints of all users.

Returns:

Object:

The endpoints of all users in JSON format.

getAnswerUrlFromAgent

(
  • agent
)
String

It sequentially test a match of specified agent with the keys of phoneUrls object. If the match exists than returns the url phone to answer a call, otherwise it returns an empty string. The keys of phoneUrls are sequentially checked, so they must be present from the more restrictive to the least.

Parameters:

  • agent String

    The phone user agent

Returns:

String:

The phone url used to answer a call

getAutoDndOffLoginConf

(
  • username
)
Boolean

Returns the automatic DND OFF status when user login to cti.

Parameters:

  • username String

    The username to get the value

Returns:

Boolean:

True if it is enabled.

getAutoDndOnLogoutConf

(
  • username
)
Boolean

Returns the automatic DND ON status when user logout from cti.

Parameters:

  • username String

    The username to get the value

Returns:

Boolean:

True if it is enabled.

getCallUrlFromAgent

(
  • agent
)
String

It sequentially test a match of specified agent with the keys of phoneUrls object. If the match exists than returns the url phone to originate a new call, otherwise it returns an empty string. The keys of phoneUrls are sequentially checked, so they must be present from the more restrictive to the least.

Parameters:

  • agent String

    The phone user agent

Returns:

String:

The phone url used to originate a new call

getChatConf

() Object

Return the server chat configurations.

Returns:

Object:

The server chat configurations.

getDefaultUserExtensionConf

(
  • username
)
String

Returns the default extension of the user or the main extension if the user has never expressed the preference.

Parameters:

  • username String

    The username to get the default extension

Returns:

String:

The default extension identifier.

getDtmfUrlFromAgent

(
  • agent
)
String

It sequentially test a match of specified agent with the keys of phoneUrls object. If the match exists than returns the url phone to sedn dtmf tone to the conversation, otherwise it returns an empty string. The keys of phoneUrls are sequentially checked, so they must be present from the more restrictive to the least.

Parameters:

  • agent String

    The phone user agent

Returns:

String:

The phone url used to send dtmf tone to the conversation

getHoldUnholdUrlFromAgent

(
  • agent
)
String

It sequentially test a match of specified agent with the keys of phoneUrls object. If the match exists than returns the url phone to hold/unhold the conversation, otherwise it returns an empty string. The keys of phoneUrls are sequentially checked, so they must be present from the more restrictive to the least.

Parameters:

  • agent String

    The phone user agent

Returns:

String:

The phone url used to hold/unhold the conversation

getPostitNotificationEmailTo

(
  • username
)
String

Returns the destination email address for the new post-it notification of the user.

Parameters:

  • username String

    The username identifier

Returns:

String:

The destination email address.

getPostitNotificationSmsTo

(
  • username
)
String

Returns the destination sms number for the post-it notification of the user.

Parameters:

  • username String

    The username identifier

Returns:

String:

The destination sms number.

getQueueAutoLoginConf

(
  • username
)
Boolean

Returns the automatic queue login value of the user.

Parameters:

  • username String

    The username to get the value

Returns:

Boolean:

True if it is enabled.

getQueueAutoLogoutConf

(
  • username
)
Boolean

Returns the automatic queue logout value of the user.

Parameters:

  • username String

    The username to get the value

Returns:

Boolean:

True if it is enabled.

getServerHostname

() String

Returns the server hostname.

Returns:

String:

The server hostname.

getTotNumUsers

() Number

Returns the total number of configured users.

Returns:

Number:

The total number of configured users.

getUserEndpointsJSON

(
  • userid
)
Object

Return the user endpoints.

Parameters:

  • userid String

    The user identifier

Returns:

Object:

The user endpoints in JSON format.

getUserSettings

(
  • user
)
Object

Returns the user settings.

Parameters:

  • user String

    The user identifier

Returns:

Object:

The user settings.

getVoicemailNotificationEmailTo

(
  • username
)
String

Returns the destination email address for the voicemail notification of the user.

Parameters:

  • username String

    The username identifier

Returns:

String:

The destination email address.

getVoicemailNotificationSmsTo

(
  • username
)
String

Returns the destination sms number for the voicemail notification of the user.

Parameters:

  • username String

    The username identifier

Returns:

String:

The destination sms number.

loadAllUsersSettings

(
  • [cb]
)

Load settings of all the users in memory. See documentation about the userSettings property.

Parameters:

  • [cb] Function optional

    The callback function

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.

phoneSupportDtmfHttpApi

(
  • agent
)
Boolean

Returns true if the specified phone supports dtmf by HTTP api. It sequentially test a match of specified agent with the keys of phoneUrls object. If the match exists than returns a true value, false otherwise.

Parameters:

  • agent String

    The phone user agent

Returns:

Boolean:

True is the phone supports HTTP api.

phoneSupportHoldHttpApi

(
  • agent
)
Boolean

Returns true if the specified phone supports hold by HTTP api. It sequentially test a match of specified agent with the keys of phoneUrls object. If the match exists than returns a true value, false otherwise.

Parameters:

  • agent String

    The phone user agent

Returns:

Boolean:

True is the phone supports HTTP api.

phoneSupportHttpApi

(
  • agent
)
Boolean

Returns true if the specified phone is supported by HTTP api. It sequentially test a match of specified agent with the keys of phoneUrls object. If the match exists than returns a true value, false otherwise.

Parameters:

  • agent String

    The phone user agent

Returns:

Boolean:

True is the phone supports HTTP api.

reload

() private

Reload the component.

reset

() private

Reload the component.

retrieveUsersSettings

(
  • cb
)

Get settings of all the users in memory. See documentation about the userSettings property.

Parameters:

  • cb Function

    The callback function

setAutoDndOffLoginConf

(
  • username
  • enable
  • cb
)

Saves the automatic DND OFF status when user login to cti.

Parameters:

  • username String

    The username to set the automatic DND OFF status

  • enable Boolean

    The enable value: true if it is to enable

  • cb Function

    The callback function

setAutoDndOnLogoutConf

(
  • username
  • enable
  • cb
)

Saves the automatic DND ON status when user logout from cti.

Parameters:

  • username String

    The username to set the automatic DND ON status

  • enable Boolean

    The enable value: true if it is to enable

  • cb Function

    The callback function

setComNethctiWsListeners

() private

Sets the event listeners for the websocket communication component.

setCompAstProxy

(
  • comp
)

Sets the asterisk proxy module to be used.

Parameters:

  • comp Object

    The module.

setCompAuthorization

(
  • comp
)

Sets the module to be used.

Parameters:

  • comp Object

    The module.

setCompComNethctiWs

(
  • comp
)

Sets the websocket communication module to be used.

Parameters:

  • comp Object

    The module.

setCompDbconn

(
  • comp
)

Set the dbconn module to be used.

Parameters:

  • comp Object

    The dbconn module.

setCompUser

(
  • comp
)

Set the user module to be used.

Parameters:

  • comp Object

    The user module.

setDefaultUserExtensionConf

(
  • username
  • exten
  • cb
)

Saves the specified default extension for the user.

Parameters:

  • username String

    The username to set the defaul extension

  • exten String

    The extension identifier

  • cb Function

    The callback function

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.

setQueueAutoLoginConf

(
  • username
  • enable
  • cb
)

Saves the automatic queue login when user login to cti.

Parameters:

  • username String

    The username to set the automatic queue login

  • enable Boolean

    The enable value: true if it is to enable

  • cb Function

    The callback function

setQueueAutoLogoutConf

(
  • username
  • enable
  • cb
)

Saves the automatic queue logout when user logout from cti.

Parameters:

  • username String

    The username to set the automatic queue logout

  • enable Boolean

    The enable value: true if it is to enable

  • cb Function

    The callback function

setUserNotifySetting

(
  • data
  • cb
)

Saves the specified notification setting for the user.

Parameters:

  • data Object
    • type String

      The type of the notification, e.g. "voicemail"

    • when String

      When receive the notification type

    • method String

      The method to use by the notification, e.g. "email"

    • username String

      The username to set the notification setting

  • cb Function

    The callback function

verifySendPostitNotification

(
  • username
  • deliveryMethod
)
Boolean

Checks the user post-it notification configurations and returns true if he wants to receives the new post-it notification by the specified delivery method.

Parameters:

  • username String

    The username identifier

  • deliveryMethod String

    The delivery method, e.g. email or sms

Returns:

Boolean:

True if the user wants to receive the new post-it notification by the specified delivery method.

verifySendPostitNotificationByEmail

(
  • username
)
Boolean

Checks the user post-it notification configurations and returns true if he wants to receives the new post-it notification by email.

Parameters:

  • username String

    The username identifier

Returns:

Boolean:

True if the user wants to receive the new post-it notification by email

verifySendPostitNotificationBySms

(
  • username
)
Boolean

Checks the user post-it notification configurations and returns true if he wants to receives the new post-it notification by sms.

Parameters:

  • username String

    The username identifier

Returns:

Boolean:

True if the user wants to receive the new post-it notification by sms

verifySendVoicemailNotification

(
  • username
  • deliveryMethod
)
Boolean

Checks the user voicemail notification configurations and returns true if he wants to receives the voicemail notification by the specified delivery method.

Parameters:

  • username String

    The username identifier

  • deliveryMethod String

    The delivery method, e.g. email or sms

Returns:

Boolean:

True if the user wants to receive the voicemail notification by the specified delivery method.

verifySendVoicemailNotificationByEmail

(
  • username
)
Boolean

Checks the user voicemail notification configurations and returns true if he wants to receives the voicemail notification by email.

Parameters:

  • username String

    The username identifier

Returns:

Boolean:

True if the user wants to receive the voicemail notification by email

verifySendVoicemailNotificationBySms

(
  • username
)
Boolean

Checks the user voicemail notification configurations and returns true if he wants to receives the voicemail notification by sms.

Parameters:

  • username String

    The username identifier

Returns:

Boolean:

True if the user wants to receive the voicemail notification by sms

Properties

chatServer

Object private

The server chat parameters. It can be customized using the JSON configuration file by means configChat method.

Default: {}

compAstProxy

Object private

The asterisk proxy module.

compAuthorization

Object private

The authorization module.

compComNethctiWs

Object private

The websocket communication module.

compDbconn

Object private

The dbconn module.

compUser

Object private

The user module.

CONFIG_CHAT_FILEPATH

String private

The chat configuration file path.

CONFIG_FILEPATH

String private

The configuration file path.

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: [config_manager]

logger

Object private

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

Default: console

PHONE_URLS_FILEPATH

String private

The configuration file path of the phone urls.

phoneUrls

Object private

The phone urls used to directly intercat with the phone, e.g. to originate a new call.

Default: {}

serverHostname

String private

The hostname of the server. It will be customized by the config method.

Default: ""

userSettings

Object private

The settings of all users. It is needed because methods to retrieve user settings from db are asynchronous while some components needs a synchronous response. Each time a user save a new setting, the data are stored into the db nethcti3.user_settings and into this object.

Default: {}

Events

reloaded

Fired when the componente has been reloaded.