API Docs for: 2.6
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 nethcti2.user_settings database.

fromDbUserSettingsToJSON

(
  • arr
  • username
)
Object

Adapts user settings taken from db to JSON format.

Parameters:

  • arr Array

    The user settings received from the database

  • username String

    The name of the user

Returns:

Object:

The user settings in JSON format.

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.

getC2CAutoPhonePass

(
  • username
)
String

Returns the phone password.

Parameters:

  • username String

    The name of the user

Returns:

String:

The phone password used to acces to phone of the user.

getC2CAutoPhoneUser

(
  • username
)
String

Returns the phone username.

Parameters:

  • username String

    The name of the user

Returns:

String:

The phone username used to acces to phone of the user.

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.

Parameters:

  • username String

    The username to get the default extension

Returns:

String:

The default extension identifier.

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.

isAutomaticClick2callEnabled

(
  • username
)
Boolean

Returns true if the user has enabled the automatic click2call.

Parameters:

  • username String

    The username to check

Returns:

Boolean:

True if the user has enabled the automatic click2call

loadAllUsersSettings

() private

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

phoneAgentSupportAutoC2C

(
  • agent
)
Boolean

Returns true if the specified phone is supported by the automatic click2call. 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 support automatic click2call

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.

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

setUserClick2CallConf

(
  • data
  • cb
)

Saves the specified notification setting for the user.

Parameters:

  • data Object
    • username String

      The user identifier

    • type String

      The click to call type

    • [user] String optional

      The username of the device

    • [password] String optional

      The password of the device

  • 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.

compComNethctiWs

Object private

The websocket communication module.

compDbconn

Object private

The dbconn module.

compUser

Object private

The user module.

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

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 nethcti2.user_settings and into this object.

Default: {}