Class: Agent

Constructor

new Agent(agentService)

Constructor function for Agent Model

Parameters:
Name Type Description
agentService AvayaCustomerServices.Services.Agent.AgentService

Members

active :boolean

True if agent is in a activate state, otherwise false

Type:
  • boolean

capabilities :AvayaCustomerServices.Services.Agent.Capabilities

A defined list of all Agent Capabilities

Type:
  • AvayaCustomerServices.Services.Agent.Capabilities

data :object

Generic object in which to store model data

Type:
  • object
Inherited From:

id :string

A unique identifier for this model instance

Type:
  • string
Inherited From:

isNew :boolean

Flag to indicate if model instance is new

Type:
  • boolean
Inherited From:

role :string

An agent's role. Can be "AGENT", "SUPERVISOR" or "ADMIN"

Type:
  • string

state :string

An agent's current state

Type:
  • string

states :AvayaCustomerServices.Services.Agent.States

A defined list of all Agent States that can be set

Type:
  • AvayaCustomerServices.Services.Agent.States

Methods

activate(username, profileId, extension, clientSessionId) → {AvayaCustomerServices.Base.Promise}

Activates an agent. If no profile is defined, the agent will be activated using default profile.
Similarly, if an extension is not defined, the default extension for that agent will be used.

Parameters:
Name Type Argument Description
username string

Agent username

profileId string <optional>

Profile ID to activate

extension string <optional>

Override default extension for agent

clientSessionId string <optional>

preceding clientSessionId used for resyncing sessions on refresh

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

addOnActivatedCallback(callback)

Adds a callback that is executed when an agent has been activated

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onActivatedCallback

Function that handles on activated event response

addOnConfigurationAddedCallback(callback)

Adds a callback that is executed when a user configuration has been added

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onUserConfigurationAdded

Function that is executed on user configuration added callback

addOnConfigurationRemovedCallback(callback)

Adds a callback that is executed when a user configuration has been removed

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onUserConfigurationRemoved

Function that is executed on configuration removed callback

addOnConfigurationUpdatedCallback(callback)

Adds a callback that is executed when a user configuration has been updated

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onUserConfigurationUpdated

Function that is executed on configuration updated callback

addOnDeactivatedCallback(callback)

Adds a callback that is executed when an agent has been deactivated

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onDeactivatedCallback

Function that handles on deactivated event response

addOnReasonCodesUpdatedCallback(callback)

Adds a callback that is executed when reason codes have beed updated

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onReasonCodesUpdated

Function that is executed on reason codes updated callback

addOnStateAfterContactWorkCallback(callback)

Adds a callback that is executed when an agent's state has been changed to after contact work

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onAfterContactWorkCallback

Function that handles on after contact work event response

Since:
  • 3.4.0.1

addOnStateAfterContactWorkPendingCallback(callback)

Adds a callback that is executed when an agent's state has been changed to after contact work pending

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onAfterContactWorkPendingCallback

Function that handles on after contact work pending event response

Since:
  • 3.4.0.1

addOnStateCompleteCallback(callback)

Adds a callback that is executed when an agent's state has been changed to complete

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onCompleteStateCallback

Function that handles on complete event response

addOnStateLoggedOutCallback(callback)

Adds a callback that is executed when an agent's state has been changed to logged out

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onLoggedOutCallback

Function that handles on logged out event response

addOnStateLoginPendingCallback(callback)

Adds a callback that is executed when an agent's state has been changed to login pending

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onLoginPendingCallback

Function that handles on login pending event response

addOnStateLogoutPendingCallback(callback)

Adds a callback that is executed when an agent's state has been changed to logout pending

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onLogoutPendingCallback

Function that handles on logout pending event response

addOnStateNotReadyCallback(callback)

Adds a callback that is executed when an agent's state has been changed to not ready

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onNotReadyCallback

Function that handles on not ready event response

addOnStateNotReadyPendingCallback(callback)

Adds a callback that is executed when an agent's state has been changed to not ready pending

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onNotReadyPendingCallback

Function that handles on not ready pending event response

addOnStateReadyCallback(callback)

Adds a callback that is executed when an agent's state has been changed to ready

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onReadyCallback

Function that handles on ready event response

addOnStateUnknownCallback(callback)

Adds a callback that is executed when an agent's state has been changed to unknown

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onUnknownCallback

Function that handles on unknown event response

addOnSystemPreferenceAddedCallback(callback)

Adds a callback that is executed when a system preference has been added

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onSystemPreferenceAdded

Function that is executed on system preference added callback

addOnSystemPreferenceRemovedCallback(callback)

Adds a callback that is executed when a system preference has been removed

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onSystemPreferenceRemoved

Function that is executed on preference removed callback

addOnSystemPreferenceUpdatedCallback(callback)

Adds a callback that is executed when a system preference has been updated

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onSystemPreferenceUpdated

Function that is executed on system preference updated callback

addOnUserPreferenceAddedCallback(callback)

Adds a callback that is executed when a user preference has been added

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onUserPreferenceAdded

Function that is executed on user preference added callback

addOnUserPreferenceRemovedCallback(callback)

Adds a callback that is executed when a user preference has been removed

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onUserPreferenceRemoved

Function that is executed on preference removed callback

addOnUserPreferenceUpdatedCallback(callback)

Adds a callback that is executed when a user preference has been updated

Parameters:
Name Type Description
callback AvayaCustomerServices.Services.Agent.Agent~onUserPreferenceUpdated

Function that is executed on user preference updated callback

deactivate() → {AvayaCustomerServices.Base.Promise}

Deactivates an agent

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

getClientSessions(authServerUser) → {AvayaCustomerServices.Base.Promise}

Gets client sessions for a user

Parameters:
Name Type Description
authServerUser

Authorization Server User ID

Since:
  • 3.4.0.0
Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

getDevices() → {AvayaCustomerServices.Services.Agent.DeviceCollection}

Get devices for agent

Since:
  • 3.4.0.0
Returns:
{ AvayaCustomerServices.Services.Agent.DeviceCollection }

getHandle(handle) → {string}

Set an Agent's user handle

Parameters:
Name Type Description
handle

user handle to set

Returns:
{ string }

Agent's user handle

getHandle() → {string}

Return an Agent's user handle

Returns:
{ string }

Agent's user handle

getProfileId() → {string}

Returns an agent's current profile Id

Returns:
{ string }

Agent's profile ID

getRole() → {string}

Returns an Agent's role

Returns:
{ string }

Agent's role

getSystemPreferences() → {Array.<Object>}

Returns all System Preference data

Since:
  • 3.2.2
Returns:
{ Array.<Object> }

Array of System Preference objects

getUserPreferences() → {Array.<Object>}

Returns all User Preference data

Returns:
{ Array.<Object> }

Array of User Preference objects

goAfterContactWork(afterContactWorkReason) → {AvayaCustomerServices.Base.Promise}

Set Agent's state to "After Contact Work".

Parameters:
Name Type Argument Description
afterContactWorkReason string <optional>

Reason for agent going into an "After Contact Work" state

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

goNotReady(notReadyReason) → {AvayaCustomerServices.Base.Promise}

Set Agent's state to "Not Ready". In this state, agents are not available to be routed new work requests.

Parameters:
Name Type Argument Default Description
notReadyReason string <optional>
0

Reason for agent going into a "Not Ready" state

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

goReady(workMode) → {AvayaCustomerServices.Base.Promise}

Set Agent's state to "Ready". In this state, agents are available to be routed new work requests.

Parameters:
Name Type Argument Description
workMode string <optional>

Agent's work mode

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

isActivated() → {Boolean}

Returns true if an agent has been activated, otherwise false.

Returns:
{ Boolean }

True if agent is activated

login(loginState, workMode, notReadyReason) → {AvayaCustomerServices.Base.Promise}

Login an agent. By logging in, an agent has indicated that they are available to receive work requests.
Optionally, a login state can be passed as a param to explicitly set their state.

Parameters:
Name Type Argument Default Description
loginState string <optional>
ready

Agent's state after login

workMode string <optional>

Agent's work mode

notReadyReason string <optional>
0

Reason for going not ready

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

logout(logoutReason) → {AvayaCustomerServices.Base.Promise}

Logout an agent. By logging out, an agent has indicated that they are no longer available to receive work requests.
Optionally, a logout reason can be passed as a param to explicitly set their reason for logging out.

Parameters:
Name Type Argument Default Description
logoutReason string <optional>
0

Reason for agent logging out

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

removeCallbacks()

Remove callbacks and stop agent service

removeSystemPreference(preferenceId) → {AvayaCustomerServices.Base.Promise}

Remove System Preference

Parameters:
Name Type Description
preferenceId string | Array

Id or array of Ids used to remove System Preferences

Since:
  • 3.2.2
Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

removeSystemPreferenceData(data) → {Object|boolean}

Remove System Preference data

Parameters:
Name Type Description
data Object

System preference data to remove

Since:
  • 3.2.2
Returns:
{ Object | boolean }

Removed object or false if could not be found/removed

removeUserPreference(preferenceId, profileId, accountId) → {AvayaCustomerServices.Base.Promise}

Remove User Preference

Parameters:
Name Type Argument Description
preferenceId string | Array

Id or array of Ids used to remove User Preferences

profileId string <optional>

Profile ID to set User Preference for

accountId string <optional>

Account ID to set User Preference for

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

removeUserPreferenceData(data) → {Object|boolean}

Remove User Preference data

Parameters:
Name Type Description
data Object

User preference data to remove

Returns:
{ Object | boolean }

Removed object or false if could not be found/removed

reportActivateTimeout() → {AvayaCustomerServices.Base.Promise}

Report about expiration of activation timeout

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

setSystemPreference(preference) → {AvayaCustomerServices.Base.Promise}

Create/update System Preference

Parameters:
Name Type Description
preference Object | Array

Data to use to create/update System Preference

Since:
  • 3.2.2
Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

setSystemPreferenceData(data) → {object}

Set System Preference data

Parameters:
Name Type Description
data Object

System preference data to set

Since:
  • 3.2.2
Returns:
{ object }

Agent model data

setUserPreference(preference, profileId, accountId, clientSessionId) → {AvayaCustomerServices.Base.Promise}

Create/update User Preference

Parameters:
Name Type Argument Description
preference Object | Array

Data to use to create/update User Preference

profileId string <optional>

Profile ID to set User Preference for

accountId string <optional>

Account ID to set User Preference for

clientSessionId string <optional>

Client Session ID to set User Preference for

Returns:
{ AvayaCustomerServices.Base.Promise }

Promise

setUserPreferenceData(data) → {object}

Set User Preference data

Parameters:
Name Type Description
data Object

User preference data to set

Returns:
{ object }

Agent model data

Type Definitions

onActivatedCallback(message)

This callback handles the AgentActivateEvent response

Parameters:
Name Type Description
message AgentActivateEvent

The event that is fired when an agent has been activated

onAfterContactWorkCallback(message)

This callback handles the AgentAfterContactWorkStateEvent response

Parameters:
Name Type Description
message AgentAfterContactWorkStateEvent

The event that is fired when an agent is in a after contact work state

onAfterContactWorkPendingCallback(message)

This callback handles the AgentAfterContactWorkPendingStateEvent response

Parameters:
Name Type Description
message AgentAfterContactWorkPendingStateEvent

The event that is fired when an agent is in a after contact work state

onCompleteStateCallback(message)

This callback handles the AgentCompleteStateEvent response

Parameters:
Name Type Description
message AgentCompleteStateEvent

The event that is fired when an agent is in a complete state

onDeactivatedCallback(message)

This callback handles the AgentDeactivateEvent response

Parameters:
Name Type Description
message AgentDeactivateEvent

The event that is fired when an agent has been deactivated

onLoggedOutCallback(message)

This callback handles the AgentLoggedOutStateEvent response

Parameters:
Name Type Description
message AgentLoggedOutStateEvent

The event that is fired when an agent is in a logged out state

onLoginPendingCallback(message)

This callback handles the AgentLoginPendingStateEvent response

Parameters:
Name Type Description
message AgentLoginPendingStateEvent

The event that is fired when an agent is in a login pending state

onLogoutPendingCallback(message)

This callback handles the AgentLogoutPendingStateEvent response

Parameters:
Name Type Description
message AgentLogoutPendingStateEvent

The event that is fired when an agent is in a logout pending state

onNotReadyCallback(message)

This callback handles the AgentNotReadyStateEvent response

Parameters:
Name Type Description
message AgentNotReadyStateEvent

The event that is fired when an agent is in a not ready state

onNotReadyPendingCallback(message)

This callback handles the AgentNotReadyPendingStateEvent response

Parameters:
Name Type Description
message AgentNotReadyPendingStateEvent

The event that is fired when an agent is in a not ready pending state

onReadyCallback(message)

This callback handles the AgentReadyStateEvent response

Parameters:
Name Type Description
message AgentReadyStateEvent

The event that is fired when an agent is in a ready state

onReasonCodesUpdated(message)

This callback handles the ReasonCodesUpdatedEvent response

Parameters:
Name Type Description
message ReasonCodesUpdatedEvent

The event that is fired when reason codes have beed updated

onSsytemPreferenceUpdated(message)

This callback handles the SystemPreferenceUpdatedEvent response

Parameters:
Name Type Description
message SystemPreferenceUpdatedEvent

The event that is fired when a system preference has been updated

onSystemPreferenceAdded(message)

This callback handles the SystemPreferenceCreatedEvent response

Parameters:
Name Type Description
message SystemPreferenceCreatedEvent

The event that is fired when a system preference has been added

onSystemPreferenceRemoved(message)

This callback handles the UserPreferenceDeletedEvent response

Parameters:
Name Type Description
message SystemPreferenceDeletedEvent

The event that is fired when a system preference has been removed

onUnknownCallback(message)

This callback handles the AgentUnknownStateEvent response

Parameters:
Name Type Description
message AgentUnknownStateEvent

The event that is fired when an agent is in a unknown state

onUserConfigurationAdded(message)

This callback handles the ConfigurationCreatedEvent response

Parameters:
Name Type Description
message ConfigurationCreatedEvent

The event that is fired when a user configuration has been added

onUserConfigurationRemoved(message)

This callback handles the ConfigurationDeletedEvent response

Parameters:
Name Type Description
message ConfigurationDeletedEvent

The event that is fired when a user configuration has been removed

onUserConfigurationUpdated(message)

This callback handles the ConfigurationUpdatedEvent response

Parameters:
Name Type Description
message ConfigurationUpdatedEvent

The event that is fired when a user configuration has been updated

onUserPreferenceAdded(message)

This callback handles the UserPreferenceCreatedEvent response

Parameters:
Name Type Description
message UserPreferenceCreatedEvent

The event that is fired when a user preference has been added

onUserPreferenceRemoved(message)

This callback handles the UserPreferenceDeletedEvent response

Parameters:
Name Type Description
message UserPreferenceDeletedEvent

The event that is fired when a user preference has been removed

onUserPreferenceUpdated(message)

This callback handles the UserPreferenceUpdatedEvent response

Parameters:
Name Type Description
message UserPreferenceUpdatedEvent

The event that is fired when a user preference has been updated

©2019 Avaya Inc. All Rights Reserved.