Class: PresenceService

Constructor

new PresenceService(presenceProvider)

The class encapsulates all presence-related features available to the user.

The presence service encapsulates such features as publishing presence, subscribing for self-presence update events, and creating presence list subscriptions to watch the presence of other users.

The service is configured with PresenceConfiguration object created by the client application as a part of the UserConfiguration.
In order to get the service object and leverage the available presence features User.getPresenceService() is used.

Parameters:
Name Type Description
presenceProvider AvayaClientServices.Providers.Interfaces.PresenceProvider

Methods

getPresenceListSubscription() → {AvayaClientServices.Services.Presence.PresenceListSubscription}

Returns presence list subscription instance. It can be used for subscribing and watching for other users presence information.

Returns:

getSelfPresence() → {AvayaClientServices.Services.Presence.SelfPresence|undefined}

Returns self-presence object associated with the user. If the self-presence is not yet retrieved by the service, this function returns undefined.
Once the self-presence is retrieved by the service, the onSelfPresenceReceivedCallback is invoked.

Deprecated:
  • Yes
See:
Returns:

publishAutomaticPresence() → {AvayaClientServices.Base.Promise.<(undefined|AvayaClientServices.Services.Presence.PresenceError)>}

Publishes automatic presence properties of the local user:

  • Phone channel state
  • Video channel state
  • Enterprise instant messaging channel state

Self-presence object properties should be updated before this function is called. Instance of self-presence object can be obtained using PresenceService.getSelfPresence() function.

Phone, video and enterprise IM channel state can be set using SelfPresence.setPhoneState(), SelfPresence.setVideoState() and SelfPresence.setEnterpriseIMState() functions.

To publish manual presence properties of the local user, use PresenceService.publishManualState(), PresenceService.publishLocationMode() and PresenceService.publishNote() functions.

See:
Returns:

publishLocationMode(mode) → {AvayaClientServices.Base.Promise.<(undefined|AvayaClientServices.Services.Presence.PresenceError)>}

Publishes the local user presence location mode to subscribers.

Parameters:
Name Type Description
mode AvayaClientServices.Services.Presence.PresenceLocationMode

Mode.

Returns:

publishManualState(state) → {AvayaClientServices.Base.Promise.<(undefined|AvayaClientServices.Services.Presence.PresenceError)>}

Publishes the local user manual presence state to subscribers.

Parameters:
Name Type Description
state AvayaClientServices.Services.Presence.PresenceManualState

State.

Returns:

publishNote(note) → {AvayaClientServices.Base.Promise.<(undefined|AvayaClientServices.Services.Presence.PresenceError)>}

Publishes the local user presence note to subscribers.

Parameters:
Name Type Description
note string | undefined

Note.

Returns:

Callbacks

addOnPresenceServiceAvailableCallback(callback)

Parameters:
Name Type Description
callback AvayaClientServices.Services.Presence.PresenceService#onPresenceServiceAvailableCallback

addOnPresenceServiceUnavailableCallback(callback)

Parameters:
Name Type Description
callback AvayaClientServices.Services.Presence.PresenceService#onPresenceServiceUnavailableCallback

addOnSelfPresenceReceivedCallback(callback)

Parameters:
Name Type Description
callback AvayaClientServices.Services.Presence.PresenceService#onSelfPresenceReceivedCallback
Deprecated:
  • Yes

removeOnPresenceServiceAvailableCallback(callback)

Parameters:
Name Type Description
callback AvayaClientServices.Services.Presence.PresenceService#onPresenceServiceAvailableCallback

removeOnPresenceServiceUnavailableCallback(callback)

Parameters:
Name Type Description
callback AvayaClientServices.Services.Presence.PresenceService#onPresenceServiceUnavailableCallback

removeOnSelfPresenceReceivedCallback(callback)

Removes existing onSelfPresenceReceivedCallback.

Parameters:
Name Type Description
callback AvayaClientServices.Services.Presence.PresenceService#onSelfPresenceReceivedCallback
Deprecated:
  • Yes

Type Definitions

onPresenceServiceAvailableCallback(presenceService)

Interface for the callback function to be invoked when the presence service is able to handle operations.

Parameters:
Name Type Description
presenceService AvayaClientServices.Services.Presence.PresenceService

The presence service instance associated with the callback.

onPresenceServiceUnavailableCallback(presenceService)

Interface for the callback function to be invoked when the presence service is not able to handle operations.

Parameters:
Name Type Description
presenceService AvayaClientServices.Services.Presence.PresenceService

The presence service instance associated with the callback.

onSelfPresenceReceivedCallback(presenceService, presence)

Interface for the callback function to be invoked when presence information is received for the local user.

This callback is deprecated and not recommended for use as it might lead to unexpected behavior.
Instead, please get self contact using User.getSelfContact() then subscribe for presence and retrieve presence using Contact.getPresence() and Contact.getPresence() functions respectively.

Parameters:
Name Type Description
presenceService AvayaClientServices.Services.Presence.PresenceService

Presence service instance associated with the callback.

presence AvayaClientServices.Services.Presence.SelfPresence

Self presence information object.

Deprecated:
  • Yes
See:
©2016 Avaya Inc. All Rights Reserved.