Fastpath agent & workgroup presence issues

Hi,

Apologies in advance for the lengthy post, but I’d like to gather any thoughts on the below fastpath related issues to determine what may be a bug and what is expected behaviour.

  1. If all agents are set to “away” status (e.g. using org.jivesoftware.smackx.workgroup.agent.AgentSession.setStatus()) then the entire workgroup is made unavailable. e.g. FastPath webchat plugin displays it as “offline”.

This may or may not be a bug, but in my scenario I do not want to stop accepting requests into the queue if all agents are currently away. If all agents are offline (e.g. we call AgentSession.setOnline(false)) then yes this is valid, but not necessarily when they have been set away, as we use this when they are busy taking some wrapup or admin action, and want to temporarily not receive another chat. We still wish to keep queuing however. Ideally this behaviour would be configurable at the workgroup level.

I have what I think is a valid workaround for this, and it appears to be working, and it still seems to take the workgroup offline if AgentSession.setOnline(false) is used on all sessions. This involved changing org.jivesoftware.xmpp.workgroup.Workgroup.isOpen()

from:

private boolean isOpen() {
        boolean opened = false;
        for (RequestQueue requestQueue : getRequestQueues()) {
            opened = requestQueue.getAgentSessionList().containsAvailableAgents();
            if (opened) {
                break;
            }
        }
        return opened;
    }

to:

private boolean isOpen() {
        boolean opened = false;
        for (RequestQueue requestQueue : getRequestQueues()) {
            opened = requestQueue.getAgentSessionList().getAgentSessionCount() > 0;
            if (opened) {
                break;
            }
        }
        return opened;
    }
  1. More of a Smack client related issue, but because of the above behaviour calling org.jivesoftware.smackx.workgroup.agent.AgentSession.setStatus(Mode.away, “away”) when you are either the only agent logged in, or no other agents are currently available throws an XMPPException. This is because the response from the server is actually the workgroup status, which is now unavailable due to no agents being available, and the smack AgentSession class treats this as an error. The above change resolves this, however.

The code causing this is in the various setStatus() methods:

if (!presence.isAvailable()) {
            throw new XMPPException("No response from server on status set.");
}
  1. The following sequence of calls via Smack results in an inconsistent state, with a brand new session:
session.setOnline(true); // Makes the agent available by default
session.setStatus(Mode.away, "away"); // Sets the agent away - they cannot receive chat requests.
// nb the above throws an XMPPException if we are the only remaining active agent
session.getPresenceMode(); // returns "away"
// Take the session offline and back online, does presence mode remain "away"?
session.setOnline(false);
session.setOnline(true);
session.getPresenceMode(); // returns "away"

At this point the session is actually available, and will receive and can accept chat offers from the server, yet getPresenceMode() returns “away” which is inconsistent. I think the correct behaviour should be to keep the status as “away” as taking the session on or offline should be independent of the presence mode.

Thanks

Stuart