Please login or register to access secure site features.

Note: By continuing to use DevConnect Program Services you agree to our latest Registered Member Terms.

Sign in using DevConnect ID

Forgot password?

Trouble logging in?

Submit a ticket for Registration Support.

I have an SSO ID

?
sign in

Don't have a DevConnect or SSO ID ?

Create a DevConnect account or join the program.

register now
^
Forum Index » Avaya IX™ Client SDK - General » Presence not getting updated issue in setting self presence using Javascript CSDK   XML
 
Author Message
Akshada



Joined: 25/03/2020 06:04:17
Messages: 3
Offline

Hi,
I have developed an application using the JSCSDK I have to update presence of user when he is available/ on a call etc.
I have followed the following documentation for implementing presence automatic updates.
https://www.devconnectprogram.com/site/global/products_resources/avaya_client_sdk/programming_docs/current/javascript/communication/guide/publishing_presence.gsp

As per the guide , I saw a few problems. It says to register the self presence callback under contacts.addOnContactsServiceUnavailableCallback.
It should iteally be contacts.addOnContactsServiceAvailableCallback.

I get a success response when I update my presence, but when I check the user on Equinox, he still shows available.
I have implemented the following code
user.getContacts().addOnContactsServiceAvailableCallback(function () {
                
                        setTimeout(function () {
                            this.onContactsAvailableCallback(user);
                        }.bind(this), 3000);
}

        onContactsAvailableCallback: function (user) {
            var selfContact = user.getSelfContact();
            selfContact.addOnPresenceChangedCallback(function (contact, selfPresence) {
                    console.log('Overall self presence state is ' + selfPresence.getOverallState());
                    this.handlePresenceChangedCallback(contact, selfPresence)
                }.bind(this));
            selfContact.startPresence().then(
                function () {
                    console.log('Successfully subscribed for self presence');
                },
                /**
                 * @param {AvayaClientServices.Services.Presence.PresenceError} error
                 */
                function (error) {
                    console.error('Failed to subscribe for self presence updates', error);
                }
            );
            // Remove this callback once it's called for the first time as we already retrieved self contact
            // this._user.getContacts().removeOnContactsServiceUnavailableCallback(onContactsAvailableCallback);
        },

        handlePresenceChangedCallback: function (contact, selfPresence) {
            this._selfPresence = selfPresence;
            console.log("******* Self presence*****123", this._selfPresence);
            return this._selfPresence;
        },


        handleManualPresence: function (state) {
            setTimeout(function () {
                var selfUser = this._user;
                this._selfPresence.setPhoneState(state);
//this._selfPresence._setOverallState(state); Calling this API also returns success but the presence actually does not get updated 
                selfUser._presenceService.publishAutomaticPresence().then(
                    function () {
                        console.log('Channel (automatic) presence has been published successfully'); // I get success response
                    },
                    /**
                     * @param {AvayaClientServices.Services.Presence.PresenceError} error
                     */
                    function (error) {
                        console.log('Failed to publish channel (automatic) presence', error);
                    }
                );
            }.bind(this), 2000);
        },

This message was edited 1 time. Last update was at 25/03/2020 06:39:11

JMiddleton



Joined: 01/04/2019 10:39:55
Messages: 10
Offline

Hi,

The method handleManualPresence is attempting to publish automatic presence. If you want to publish manual presence see that section in the doc. I don't see any obvious errors with the attempt to publish automatic presence, assuming the "state" is a valid value. When you mention you don't see the presence change on Equinox, do you mean with an Equinox (IX Workplace) client that is logged in as a different user or the same user? I would test with a different user.

Also, if testing auto presence be sure that no other client has published manual presence for that user. Manual presence overrides auto presence.

Note that you shouldn't use methods that start with an _ in the SDK (like this._selfPresence._setOverallState()). They are intended for internal use only.

Yes, the addOnContactsServiceUnavailableCallback seems to be an error in the doc.

Logs may provide more info.
AlokKulkarni



Joined: 05/01/2017 04:31:26
Messages: 26
Offline

Hi Jeff,
We are calling publishAutomaticPresence and not the manual one.
We do not have a use case in the application where the user can set his presence manually because its not an Equinox kind of application.
We will double confirm on that the user is not logged on to any other client.
We are checking this users presence from a different user using Avaya IX WorkPlace.
we will share logs after some more testing
Regards,
Akshada



Joined: 25/03/2020 06:04:17
Messages: 3
Offline

Hi Jeff,

PFA logs of publish automatic presence.
 Filename publishAutomaticPresence_logs.zip [Disk] Download
 Description No description given
 Filesize 16 Kbytes
 Downloaded:  63 time(s)

This message was edited 1 time. Last update was at 26/03/2020 09:46:16

JMiddleton



Joined: 01/04/2019 10:39:55
Messages: 10
Offline

Thanks for the logs. Looking at 'selfPresence Logs.log' I see that the app started presence on the self contact:

AvayaClientServices-4.4.0.14.min.js:1 [3/26/2020, 6:22:51 PM] UserService: API called: User.getSelfContact
AvayaClientServices-4.4.0.14.min.js:1 [3/26/2020, 6:22:51 PM] ContactsService: API called: Contact.startPresence


The message went out performing that subscription, and then a message was received with the user's presence status:

AvayaClientServices-4.4.0.14.min.js:1 [3/26/2020, 6:22:52 PM] CSGPresenceAndCallProvider: Received notification {rlPresenceUpdatedEvent: "{"presentities":[{"userIdentity":{"userId":"ahealt…0+04:00"},"calendar":null}]}],"watcherInfo":null}"}
...
loginControllerAv.js:200 ******* Self presence*****123 e {_presentity: "ahealth@avayatoday.com", _locationMode: "PRESENCE_LOCATION_MODE_UNSPECIFIED", _calendarState: "PRESENCE_STATE_UNSPECIFIED", _manualState: "PRESENCE_STATE_AVAILABLE", _overallState: "PRESENCE_STATE_AVAILABLE", …}


The second log is yours but the _manualState of "PRESENCE_STATE_AVAILABLE" indicates that a manual presence state has been set for this user. When a manual presence state is set it will override any auto presence state.

Later on in 'successful publishAutomaticPresence().log' I see that the presence state is being published

AvayaClientServices-4.4.0.14.min.js:1 [3/26/2020, 6:26:14 PM] PresenceService: API called: PresenceService.publishAutomaticPresence


A message is going out to indicate that the phone state should be ON_A_CALL.

AvayaClientServices-4.4.0.14.min.js:1 [3/26/2020, 6:26:14 PM] NetworkProvider: CallGatewayProvider,PROVIDER:,RestProvider,URL:,https://meetings.avayatoday.com:443/csa/bsid/ec5f7485-6746-4945-a475-d8a32570d048/resources/users/ahealth@avayatoday.com/clients/ec5f7485-6746-4945-a475-d8a32570d048/presence-publications/pub-1,
MESSAGE SENT:,{
  "presencePublication": {
    "channelPresence": [
      {
        "channel": "video",
        "contact": "REMOVED",
        "stateEnum": "OFFLINE",
        "subType": "AVAYA_COMMUNICATOR"
      },
      {
        "channel": "im",
        "contact": "REMOVED",
        "stateEnum": "OFFLINE",
        "subType": "AVAYA_COMMUNICATOR"
      },
      {
        "channel": "phone",
        "contact": "REMOVED",
        "stateEnum": "ON_A_CALL",
        "subType": "AVAYA_COMMUNICATOR"
      }
    ]
  }
},


But we are never updated of a change in the presence state from the server. I believe this is because of the manual presence state.

Please try to either publish PRESENCE_STATE_UNSPECIFIED as a manual state using your app and the SDK, or login with an IX Workplace client and change the presence state to a manual state and then back to automatic, then check to see if the manual presence state is cleared as I did above and if so retry the publishing of the automatic presence state.

 
 
Go to: