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

    The primary entry point for all agent operations in the Avaya Infinity platform.

    A User instance is obtained by calling AvayaInfinityAgentSdk.init after a successful OAuth authentication. It is the single object through which your application drives the full agent lifecycle - from CX login to receiving and managing interactions, controlling agent status, accessing queue assignments, and configuring audio devices.

    1. Authenticate and initialise - call AvayaInfinityAgentSdk.init() to get a User.
    2. Subscribe to events - register handlers for UserEventType events before logging into CX so no events are missed.
    3. Log into CX — call loginToCx to make the agent available to receive interactions. The agent cannot receive calls or chats until this completes.
    4. Set agent status — use getAssignableReasonCodes and changeStatus to place the agent in the correct availability state.
    5. Handle incoming interactions - incoming interactions arrive via the UserEventType.INTERACTION_RECEIVED event.
    6. Create outbound interactions - Outbound calls can be initiated with createOutboundVoiceInteraction if canCreateOutboundVoiceInteraction is true.
    7. Clean up - call logoutFromCx before destroying the SDK session.
    Area Key methods or attributes
    Identity userId, userEmail, userFullName, userFirstName, userLastName, accountId
    Status currentStatus, getAssignableReasonCodes, canChangeStatus, changeStatus, refreshStatus
    CX Login isLoggedInToCx, canLoginToCx, loginToCx, canLogoutFromCx, logoutFromCx
    Queues defaultOutboundQueue, getAssignedQueues, refreshAssignedQueues
    Interactions getAssignedInteractions, createOutboundVoiceInteraction, canCreateOutboundVoiceInteraction
    Capabilities isEliteVoiceEnabled, isInteractionAutoAcceptEnabled
    Viewing Interactions viewInteraction, getInteractionViews, canViewInteractionPublicly, canViewInteractionPrivately, canClaimInteractionOwnership
    Audio devices getAvailableAudioDevices, getSelectedAudioDevices, canSetAudioInputDevice, setAudioInputDevice, canSetAudioOutputDevice, setAudioOutputDevice, getAudioDevicePermissionState
    WebRTC getWebRtcRegistrationState
    Events subscribe, unsubscribe

    The SDK maintains a single User instance for the session and mutates its fields in place as state changes — the object reference is stable across updates. The same holds for the collections it exposes (Interaction, Queue, and so on). Framework consumers (React, Vue, etc.) that rely on reference equality for change detection must therefore trigger their own re-render on each subscribed event — for example by bumping a version counter, re-emitting the enclosing array, or lifting the data into a store that produces a fresh snapshot per event.

    Implements

    Index

    CX Login

    • Indicates whether the agent is currently allowed to log in to the CX platform

      Use this to check the precondition before calling loginToCx.

      Returns boolean

      true if the agent can log in to CX, false otherwise

    • Logs the agent into the CX platform

      Must be called before the agent can receive interactions. When reasonCode is provided, a non-Elite agent is logged in and set to that status in a single request. Elite Voice agents must call loginToCx() without a reason, wait for login to complete, and then call changeStatus explicitly.

      Parameters

      Returns Promise<void>

      A promise that resolves when CX login is complete

      If login fails (code ASE-2007)

      If the status type is invalid (code ASE-2001)

      If the reason code is not recognized (code ASE-2002)

      If the Elite aux code is missing (code ASE-2016)

      If an Elite agent supplies an initial status (code ASE-2019)

      await user.loginToCx();
      console.log("Logged into CX:", user.isLoggedInToCx);
      const reasons = await user.getAssignableReasonCodes();
      const available = reasons.find(r => r.type === ReasonType.AVAILABLE);
      if (available) {
      await user.loginToCx(available);
      }
    • Indicates whether the agent is currently allowed to log out from the CX platform

      Use this to check the precondition before calling logoutFromCx.

      Returns boolean

      true if the agent can log out from CX, false otherwise

    • Logs the agent out from the CX platform

      Parameters

      Returns Promise<void>

      A promise that resolves when CX logout is complete

      If logout fails (code ASE-2008)

      const reasons = await user.getAssignableReasonCodes();
      const logoutReason = reasons.find(r => r.type === ReasonType.LOGOUT);
      if (logoutReason) {
      await user.logoutFromCx(logoutReason);
      }
    • get isLoggedInToCx(): boolean

      Indicates whether the agent is currently logged into the CX platform

      Returns boolean

      true if the agent is logged in to CX, false otherwise

    Capabilities

    • get canCreateOutboundVoiceInteraction(): boolean

      Indicates whether the agent has permission to initiate outbound calls

      Returns boolean

      true if outbound call creation is permitted, false otherwise

    • get isEliteVoiceEnabled(): boolean

      Indicates whether the agent is licensed for Avaya Elite Voice (hybrid agent).

      Hybrid agents handle voice via Elite Voice.

      Returns boolean

      true if Elite Voice is enabled for this user, false otherwise

    • get isInteractionAutoAcceptEnabled(): boolean

      Whether auto-accept is enabled for the agent's incoming interactions.

      When true, the SDK accepts incoming interactions on the agent's behalf across all channels. Auto-accept is suppressed for an audio interaction when another audio interaction is already in progress.

      While the SDK is auto-accepting an interaction, Interaction.canAccept returns false, and the resulting InteractionEventType.INTERACTION_ACCEPTED event carries payload.isAutoAccepted = true.

      Returns boolean

      true if auto-accept is enabled for this agent, false otherwise

    Events

    • Subscribes to agent events

      Type Parameters

      Parameters

      Returns string

      A handler ID to pass to unsubscribe when done

      const handlerId = user.subscribe(
      UserEventType.USER_STATUS_CHANGED,
      (event) => {
      console.log("Status changed to:", event.payload.status.type);
      }
      );

    Identity

    • get userId(): string

      The unique identifier for this agent

      Returns string

      The agent's user ID

    • get userEmail(): string

      The agent's email address

      Returns string

      The agent's email

    • get userFullName(): string

      The agent's full display name

      Returns string

      The agent's full name

    • get userFirstName(): string

      The agent's first name

      Returns string

      The agent's first name

    • get userLastName(): string

      The agent's last name

      Returns string

      The agent's last name

    • get accountId(): string

      The tenant identifier for the logged-in agent.

      Platform-assigned, session-level constant - the same value across every interaction the agent handles in the session.

      Returns string

      The agent's account/tenant ID

    Interactions

    • Creates and initiates an outbound call interaction

      Resolves when the call has been connected and media is set up.

      Parameters

      Returns Promise<Interaction>

      A promise that resolves to the new Interaction once the call is active

      If the call could not be created (code ASE-2006)

      if (user.canCreateOutboundVoiceInteraction) {
      const interaction = await user.createOutboundVoiceInteraction({
      queueId: "queue-123",
      phoneNumber: "+15551234567",
      });
      console.log("Call started:", interaction.interactionId);
      }
    • get canCreateOutboundVoiceInteraction(): boolean

      Indicates whether the agent has permission to initiate outbound calls

      Returns boolean

      true if outbound call creation is permitted, false otherwise

    Media

    • Returns the available audio input and output devices

      If microphone permission has not been granted, device names may be hidden and returned as generic labels such as Unknown audioinput. This method does not request microphone permission.

      Returns Promise<AvailableAudioDevices>

      A promise that resolves to the AvailableAudioDevices listing all input and output devices

      If microphone permission is denied (code ASE-4002)

      If device enumeration is unavailable or fails (code ASE-4001)

      const devices = await user.getAvailableAudioDevices();
      console.log("Inputs:", devices.inputDevices.map(d => d.label));
      console.log("Outputs:", devices.outputDevices.map(d => d.label));
    • Indicates whether an audio input device can currently be set

      Use this to check the precondition before calling setAudioInputDevice.

      Returns boolean

      true if an audio input device can be set, false otherwise

    • Sets the active audio input device

      The deviceId must be one of the IDs from getAvailableAudioDevices.

      Parameters

      • deviceId: string

        The ID of the input device to use

      Returns void

      If the device ID is not found (code ASE-2004)

      const devices = await user.getAvailableAudioDevices();
      const preferred = devices.inputDevices.find(d => d.label.includes("Headset"));
      if (preferred) {
      user.setAudioInputDevice(preferred.deviceId);
      }
    • Indicates whether an audio output device can currently be set

      Use this to check the precondition before calling setAudioOutputDevice.

      Returns boolean

      true if an audio output device can be set, false otherwise

    • Sets the active audio output device

      The deviceId must be one of the IDs from getAvailableAudioDevices.

      Parameters

      • deviceId: string

        The ID of the output device to use

      Returns void

      If the device ID is not found (code ASE-2004)

      const devices = await user.getAvailableAudioDevices();
      const preferred = devices.outputDevices.find(d => d.label.includes("Headset"));
      if (preferred) {
      user.setAudioOutputDevice(preferred.deviceId);
      }

    Queues

    • get defaultOutboundQueue(): Queue | undefined

      The configured default outbound queue when this SDK session was initialized or most recently logged into CX.

      Returns undefined for Elite Voice users or when the outbound queue is not configured.

      Returns Queue | undefined

      The default outbound queue, or undefined when not configured

    • Refreshes the agent's queue assignments from the server

      After this resolves, getAssignedQueues returns the updated list.

      Returns Promise<Queue[]>

      A promise that resolves to the updated list of Queue objects

      await user.refreshAssignedQueues();
      const queues = user.getAssignedQueues();
      console.log("Assigned queues:", queues.map(q => q.queueName));

    Status Management

    • Fetches the agent's current status from the server

      Returns Promise<ReasonCode>

      A promise that resolves to the current ReasonCode status

      If the request fails (code ASE-2005)

      const status = await user.refreshStatus();
      console.log("Current status:", status.type);
    • Fetches the available reason codes for status changes

      Use the returned reasons to pass the selected ReasonCode to changeStatus.

      Returns Promise<ReasonCode[]>

      A promise that resolves to an array of available ReasonCode objects

      If the request fails (code ASE-2005)

      const reasons = await user.getAssignableReasonCodes();
      const available = reasons.find(r => r.type === ReasonType.AVAILABLE);
      if (available) {
      await user.changeStatus(available);
      }
    • Indicates whether the agent can currently change their status

      Use this to check the precondition before calling changeStatus.

      Returns boolean

      true if a status change is possible, false otherwise

    • Changes the agent's status to the specified reason

      The reason must be one of the values returned from getAssignableReasonCodes.

      Parameters

      Returns Promise<void>

      A promise that resolves when the status change has been applied

      If the requested status and reason are already active (code ASE-0003)

      If the status type is invalid (code ASE-2001)

      If the reason code is not recognized (code ASE-2002)

      If the status change fails (code ASE-2009)

      const reasons = await user.getAssignableReasonCodes();
      const available = reasons.find(r => r.type === ReasonType.AVAILABLE);
      if (available) {
      await user.changeStatus(available);
      }

    Viewing Interactions

    • Fetches the list of interaction views available to the current user. Views define server-side filters for the interaction list (e.g., "All Active Interactions"). Call InteractionView.getInteractions on a returned view to fetch its interactions.

      Returns Promise<InteractionView[]>

      A promise that resolves to an array of InteractionView

      If the request fails (code ASE-2014)

      const views = await user.getInteractionViews();
      const defaultView = views.find(v => v.isDefault);
      if (defaultView) {
      const page = await defaultView.getInteractions({ page: 1, pageSize: 20 });
      }
    • get canClaimInteractionOwnership(): boolean

      Whether the agent may claim ownership of an interaction they are viewing.

      Returns boolean

      Whether the agent may claim ownership of a viewed interaction

    • get canViewInteractionPublicly(): boolean

      Whether the agent may view an interaction publicly (visible to the parties).

      Returns boolean

    • get canViewInteractionPrivately(): boolean

      Whether the agent may view an interaction privately (silent monitoring).

      Returns boolean