@avaya/infinity-agent-sdk - v1.0.0
    Preparing search index...

    Handling Queues

    This guide covers how to work with the queues assigned to an agent - inspecting assigned queues, logging in and logging out with a reason code when required.

    Personas: Agent, Supervisor - log in to and out of their assigned queues. Queue assignments themselves are configured by an Admin.

    Queues is the routing medium through which the contact center delivers interactions to agents. An agent can be assigned to one or more queues simultaneously, each independently logged in or out (except the personal queue which the agent cannot logout from). The SDK represents each queue as a Queue object, accessible from User.getAssignedQueues. An agent must be logged into CX first, before logging in/out from a queue.

    Queue status changes (login, logout) can also be triggered externally by an authorized supervisor or the platform. Subscribe to QueueEventType.QUEUE_STATUS_CHANGED event on each queue to keep your UI updated.

    To get all the queues assigned to the agent via User.getAssignedQueues. If queues are assigned to or removed from an agent during the session, then such changes won't be reflected in the SDK until you call User.refreshAssignedQueues. It is recommended to add an on-demand refresh mechanism where queues are displayed:

    // Use the cached list
    const queues = user.getAssignedQueues();

    // Or force a refresh from the server first
    const queues = await user.refreshAssignedQueues();

    queues.forEach(queue => {
    console.log(`${queue.queueName} - logged in: ${queue.isLoggedIn}`);
    });

    Each Queue exposes queueId, queueName, isLoggedIn, loggedInAt, and isAutoLogin.

    Login to the queue via Queue.login, the returned promise will resolve once the agent is logged into queue. Once the agent is logged into the queue the QueueEventType.QUEUE_STATUS_CHANGED event will be emitted with the value of loggedIn as true in it's payload. Make sure to gate this action on Queue.canLogin:

    for (const queue of user.getAssignedQueues()) {
    if (queue.canLogin()) {
    await queue.login();
    console.log(`Logged into ${queue.queueName}`);
    }
    }

    Queues with isAutoLogin === true are logged in automatically when the Agent logs into CX.

    Similar to logging into queue you can logout from the queue via the Queue.logout. Queue logout requires a ReasonCode of type ReasonType.LOGOUT. Get these from User.getAssignableReasonCodes; they are the same reason codes used for user status management:

    const reasons = await user.getAssignableReasonCodes();
    const logoutReason = reasons.find(r => r.type === ReasonType.LOGOUT);

    if (logoutReason) {
    for (const queue of user.getAssignedQueues()) {
    if (queue.canLogout()) {
    await queue.logout(logoutReason);
    }
    }
    }

    Queue state can change without your code initiating the call, an authorized supervisor logs the agent out, or the platform auto-logs into a queue. Subscribe to events per queue to stay in sync:

    for (const queue of user.getAssignedQueues()) {
    queue.subscribe(QueueEventType.QUEUE_STATUS_CHANGED, (event) => {
    updateQueueBadge(queue.queueId, event.payload);
    });
    }

    Failures surface as typed AvayaInfinityAgentSdkErrors with stable codes from AvayaInfinityAgentSdkErrorCodes. Errors on the Queue login/logout path belong to the ASE_3xxx family - match error.code against AvayaInfinityAgentSdkErrorCodes to identify the specific failure. If no specific code applies, the SDK falls back to ASE_3000.