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

    Contract implemented by Interaction that describes the full API surface for managing a contact center interaction. Covers the complete lifecycle from acceptance through wrap-up, as well as call controls, transfer operations, conference management, viewer controls, event subscriptions, and interaction metadata.

    Consume this interface when you need to reference the Interaction API shape without coupling to the concrete Interaction class (e.g., in test doubles or adapters).

    interface InteractionTrait {
        currentStatus: InteractionStatus;
        interactionId: string;
        communicationType: InteractionCommType;
        communicationSubType: InteractionCommSubType;
        customer: Customer;
        queueDetails: QueueDetails;
        startTime: Date;
        isMuted: boolean;
        isHold: boolean;
        isElite: boolean;
        engagementId: string;
        initialCommunicationType: InteractionCommType;
        initialCommunicationSubType: InteractionCommSubType;
        endTime?: Date;
        routingDetails: RoutingDetails;
        ownerDetails?: OwnerDetails;
        subject: string;
        notes: string;
        customFields: Record<string, unknown>;
        classificationType?: ClassificationCode;
        classificationResult?: ClassificationCode;
        canAccept(): boolean;
        accept(): Promise<void>;
        canReject(): boolean;
        reject(): Promise<void>;
        disconnectCall(): Promise<void>;
        canClose(): boolean;
        close(resolutionStatus: ResolutionStatus): Promise<void>;
        canComplete(): boolean;
        complete(): Promise<void>;
        setNotes(notes: string): Promise<void>;
        setSubject(subject: string): Promise<void>;
        canSetSubject(): boolean;
        mergeCustomFields(fields: Record<string, unknown>): Promise<void>;
        getTransferableUsers(
            options?: GetTransferableUsersParams,
        ): Promise<TransferableUsersPage>;
        getTransferableQueues(
            options?: GetTransferableQueuesParams,
        ): Promise<TransferableQueuesPage>;
        mute(): Promise<void>;
        unmute(): Promise<void>;
        holdCall(): Promise<void>;
        resumeCall(): Promise<void>;
        subscribe<T extends InteractionEventType>(
            eventName: T,
            handler: InteractionEventHandler<T>,
        ): string;
        unsubscribe(eventName: InteractionEventType, handlerId: string): void;
        unsubscribeAll(): void;
        blindTransfer(options: BlindTransferOptions): Promise<void>;
        isOwner: boolean;
        isConsultTarget: boolean;
        sendDtmf(digit: string): void;
        canSendDtmf(): boolean;
        canMute(): boolean;
        canUnmute(): boolean;
        canHold(): boolean;
        canResume(): boolean;
        canTransfer(): boolean;
        canWrapUp(): boolean;
        wrapUpDeadline?: number;
        canExtendWrapUp(): boolean;
        extendWrapUp(): Promise<void>;
        canResolve(): boolean;
        canUnresolve(): boolean;
        canBlindTransfer(): boolean;
        canExternalBlindTransfer(): boolean;
        canAttendedTransfer(): boolean;
        canExternalAttendedTransfer(): boolean;
        canConference(): boolean;
        canCancelTransfer(): boolean;
        canCompleteTransfer(): boolean;
        canCancelConference(): boolean;
        canCompleteConference(): boolean;
        canDisconnectCall(): boolean;
        canSetNotes(): boolean;
        canMergeCustomFields(): boolean;
        setClassificationType(classification: ClassificationCode): Promise<void>;
        setClassificationResult(classification: ClassificationCode): Promise<void>;
        canSetClassification(): boolean;
        transferDetails?: TransferDetails;
        attendedTransfer(options: AttendedTransferOptions): Promise<void>;
        cancelTransfer(): Promise<void>;
        completeTransfer(): Promise<void>;
        conference(): Promise<void>;
        cancelConference(): Promise<void>;
        completeConference(): Promise<void>;
        isViewer(): boolean;
        getViewers(): Viewer[];
        currentViewingState: CurrentViewingState | undefined;
        canLeaveCall(): boolean;
        canJoinCall(): boolean;
        canLeave(): boolean;
        leaveCall(): Promise<void>;
        joinCall(): Promise<void>;
        leave(): Promise<void>;
        canBarge(): boolean;
        canUnbarge(): boolean;
        barge(): Promise<void>;
        unbarge(): Promise<void>;
        canCoach(): boolean;
        coach(): Promise<void>;
        canClaimOwnership(): boolean;
        claimOwnership(): Promise<void>;
        sendMessage(request: ChatMessageRequest): Promise<MessageIdentifier>;
        canSendMessage(): boolean;
        getMessages(options?: GetMessagesOptions): MessagesIterator;
        canGetMessages(): boolean;
    }

    Implemented by

    Index

    Properties

    currentStatus: InteractionStatus

    The current status of the interaction.

    interactionId: string

    The unique identifier for this interaction.

    communicationType: InteractionCommType

    The type of communication channel for this interaction.

    communicationSubType: InteractionCommSubType

    The sub-communication type of the interaction. Values are channel-specific.

    customer: Customer

    Information about the customer involved in this interaction.

    queueDetails: QueueDetails

    Details about the queue this interaction originated from.

    startTime: Date

    The timestamp when the interaction started.

    isMuted: boolean

    Whether the current user's microphone is currently muted on this interaction, regardless of role (owner, attended-transfer consult agent, or viewer).

    isHold: boolean

    Whether the customer call is currently on hold.

    isElite: boolean

    Whether this interaction is routed through Avaya Elite Voice. Set at interaction creation and does not change during the interaction.

    engagementId: string

    Identifier shared by interactions that belong to the same customer journey (e.g. an inbound call followed by a callback). Use this to link related interactions in CRM integrations. Stable for the lifetime of the interaction.

    initialCommunicationType: InteractionCommType

    The channel the interaction started on. Immutable - does not change even if the interaction's current communicationType switches later (e.g. a chat escalated to a voice call).

    initialCommunicationSubType: InteractionCommSubType

    The sub-communication type the interaction started with. Values are channel-specific. Immutable for the lifetime of the interaction.

    endTime?: Date

    When the interaction finished wrap-up. undefined while the interaction is still active or in wrap-up.

    routingDetails: RoutingDetails

    Routing context for the interaction. Empty string means "not populated".

    ownerDetails?: OwnerDetails

    Identity of the agent currently owning this interaction. Complements isOwner (which only tells you whether you are the owner). undefined when no agent is assigned yet.

    subject: string

    The subject or title of the interaction.

    notes: string

    Notes associated with the interaction.

    customFields: Record<string, unknown>

    Custom key/value data persisted on the interaction.

    Update via mergeCustomFields (it deep-merges; keys not mentioned are preserved).

    classificationType?: ClassificationCode

    The selected classification type for this interaction. Describes the reason the customer reached out or the purpose of the interaction.

    classificationResult?: ClassificationCode

    The selected classification result for this interaction. Describes the outcome of the interaction.

    isOwner: boolean

    Whether the current user is the owner of the interaction.

    isConsultTarget: boolean

    Whether the current user is the consulted agent (transfer target) for an in-progress attended transfer. true when the interaction is in ATTENDED_TRANSFER status and this agent's userId matches the transfer target. Viewers can use this to detect that an attended transfer is directed at them and prompt the agent to accept from the new pending interaction.

    wrapUpDeadline?: number

    Unix timestamp (seconds) when wrap-up expires. Undefined before the interaction enters wrap-up or if no timer is configured.

    transferDetails?: TransferDetails

    Transfer details for the interaction.

    currentViewingState: CurrentViewingState | undefined

    The current user's viewing state on this interaction, including audio and Elite mode details. Returns undefined if the current user is not a viewer.

    Methods

    • Whether the agent can accept this interaction.

      Returns boolean

    • Accepts the incoming interaction.

      Returns Promise<void>

      Promise that resolves when the interaction is accepted

    • Whether the agent can reject this interaction.

      Returns boolean

    • Rejects the incoming interaction.

      Returns Promise<void>

      Promise that resolves when the interaction is rejected

    • Disconnects the call for voice interactions.

      Returns Promise<void>

      Promise that resolves when the call is disconnected

    • Whether the agent can close this interaction.

      Returns boolean

    • Closes the interaction with a required resolution status.

      Parameters

      Returns Promise<void>

      Promise that resolves when the interaction is closed

    • Whether the agent can complete this interaction.

      Returns boolean

    • Completes and finalizes the interaction.

      Returns Promise<void>

      Promise that resolves when the interaction is completed

    • Sets notes for the interaction.

      Parameters

      • notes: string

        The notes text to associate with the interaction

      Returns Promise<void>

      Promise that resolves when notes are saved

    • Sets the subject for the interaction.

      Parameters

      • subject: string

        The subject text to associate with the interaction

      Returns Promise<void>

      Promise that resolves when the subject is saved

    • Whether the agent can update the subject on this interaction.

      Only applicable for the owning agent when the interaction is in CONNECTED, ATTENDED_TRANSFER, HOLD, or WRAP_UP status. Returns false for viewers.

      Returns boolean

    • Updates the interaction's custom fields. It deep-merges the provided object into the existing customFields record - keys not mentioned are preserved.

      Parameters

      • fields: Record<string, unknown>

        Custom key/value data to merge into the interaction

      Returns Promise<void>

      Promise that resolves when the custom fields are saved

    • Mutes the current user's microphone on this interaction, regardless of role (owner, attended-transfer consult agent, or viewer).

      Returns Promise<void>

    • Unmutes the current user's microphone on this interaction, regardless of role (owner, attended-transfer consult agent, or viewer).

      Returns Promise<void>

    • Returns Promise<void>

    • Returns Promise<void>

    • Subscribes to interaction-related events.

      Type Parameters

      Parameters

      • eventName: T

        The event type to subscribe to

      • handler: InteractionEventHandler<T>

        Callback function invoked when the event occurs

      Returns string

      A handler ID that can be used to unsubscribe

      InteractionEventType for available event types

    • Unsubscribes from a previously subscribed event.

      Parameters

      • eventName: InteractionEventType

        The event type to unsubscribe from

      • handlerId: string

        The handler ID returned from subscribe()

      Returns void

    • Unsubscribes from all events for this interaction.

      Returns void

    • Performs a blind (immediate, no-consultation) transfer of the interaction. Supports transfer to a queue, a specific agent, or an external phone number.

      Parameters

      Returns Promise<void>

      Promise that resolves when the transfer request is accepted

    • Sends a DTMF tone during an active voice interaction.

      Parameters

      • digit: string

        A single DTMF character: 0-9, *, #, a-d or A-D

      Returns void

      If the interaction is not in a state that allows DTMF (check canSendDtmf first)

    • Whether the agent can send DTMF tones on this interaction. Only applicable for connected voice interactions where audio is active. Not applicable for viewers.

      Returns boolean

    • Whether the current user can mute their own microphone on this interaction right now. Use canUnmute for the inverse direction.

      Returns boolean

    • Whether the current user can unmute their own microphone on this interaction right now.

      Returns boolean

    • Whether agent can hold the interaction. Only applicable if I'm the owner of interaction and it is a voice interaction and call is connected.

      Returns boolean

    • Whether agent can resume the interaction. Only applicable if I'm the owner of interaction and it is a voice interaction and call is on hold.

      Returns boolean

    • Whether agent can transfer the interaction. Only applicable if I'm the owner of interaction and it is a voice interaction and call is connected.

      Returns boolean

    • Whether agent can wrap up the interaction. Only applicable if I'm the owner of interaction and interaction is in wrapup state.

      Returns boolean

    • Whether the agent can extend the wrap-up timer. Returns true when the agent is the owner, the interaction is in wrap-up status, the queue has wrap-up extend configured, and at least 5 seconds remain.

      Returns boolean

    • Extends the wrap-up timer by the configured number of seconds. Resolves when the server confirms the extension

      Returns Promise<void>

      Promise that resolves when the extension is confirmed

    • Whether agent can resolve the interaction. Only applicable if I'm the owner of interaction and interaction is in connected or attendedTransfer state.

      Returns boolean

    • Whether agent can unresolve the interaction. Only applicable if I'm the owner of interaction and if call is disconnected.

      Returns boolean

    • Whether agent can blind transfer the interaction. Only applicable if I'm the owner of interaction.

      Returns boolean

    • Whether agent can blind transfer the interaction to an external phone number. Checks all conditions: ownership, connected status, audio active, external transfer permission enabled, not a direct agent call, and not after a completed conference.

      Returns boolean

    • Whether agent can attended transfer the interaction. Only applicable if I'm the owner of interaction and it is a voice interaction and call is connected.

      Returns boolean

    • Whether agent can attended transfer the interaction to an external phone number. Checks all base attended-transfer conditions plus: audio active and external transfer permission enabled on the queue.

      Returns boolean

    • Whether agent can initiate a conference on the interaction. Only applicable if I'm the owner of interaction and it is a voice interaction and call is connected.

      Returns boolean

    • Whether agent can cancel the transfer of the interaction. Applicable for both owner and the consulted agent answering attended call. Not appplicable if transfer was done to queue

      Returns boolean

    • Whether agent can complete the transfer of the interaction. Applicable only for owner of the interaction.

      Returns boolean

    • Whether agent can cancel the conference of the interaction. Only applicable if I'm the owner of interaction and it is a voice interaction and call is connected.

      Returns boolean

    • Whether agent can complete the conference of the interaction. Only applicable if I'm the owner of interaction and it is a voice interaction and call is connected.

      Returns boolean

    • Whether agent can disconnect the call to customer. Only applicable if I'm the owner of interaction and it is a voice interaction and call is connected.

      Returns boolean

    • Whether agent can update the notes of the interaction. Only applicable if I'm the owner of interaction and it is a voice interaction and call is connected or in wrap-up.

      Returns boolean

    • Whether the agent can set custom fields on this interaction. Only applicable if the agent is the owner and the interaction is in connected, attendedTransfer, hold, or wrapUp status. Returns false for viewers - only the owning agent may write custom fields.

      Returns boolean

    • Sets the classification type for this interaction. Describes the reason the customer reached out or the purpose of the interaction.

      Parameters

      Returns Promise<void>

      Promise that resolves when the classification type is saved

    • Sets the classification result for this interaction. Describes the outcome of the interaction.

      Parameters

      Returns Promise<void>

      Promise that resolves when the classification result is saved

    • Whether agent can set classification codes on this interaction. Only applicable if the agent is the owner and the interaction is in connected, attendedTransfer, hold, or wrapUp status.

      Returns boolean

    • Initiates an attended (consultative) transfer. The original call is placed on hold and a consult leg is established to the target user or queue.

      Parameters

      Returns Promise<void>

      Promise that resolves when the attended transfer request is accepted by server

    • Cancels an in-progress attended transfer. The originating agent is reconnected to the original customer call.

      Returns Promise<void>

      Promise that resolves when the cancel request is confirmed by server

    • Completes an in-progress attended transfer. The consulted agent is disconnected and the original call is reconnected to the customer.

      Returns Promise<void>

      Promise that resolves when the complete request is confirmed by server

    • Initiates a conference during an attended transfer, merging the agent, customer, and consulted party into a three-way call.

      After calling this, all three parties can hear each other. The agent remains in control and can either cancelConference to drop the consulted party, or completeConference to finalize the conference and allow additional participants (viewers) to be added.

      Returns Promise<void>

      Promise that resolves when the conference is established

    • Cancels an in-progress conference, disconnecting the consulted party and returning to a two-party call between the agent and customer.

      Returns Promise<void>

      Promise that resolves when the cancel request is confirmed by server

    • Completes the conference, finalizing the multi-party session.

      After completion, additional participants can join the interaction as viewers. The consulted party transitions to a viewer role with limited controls. Call this when the conference setup is done and additional participants should be able to join.

      Returns Promise<void>

      Promise that resolves when the complete request is confirmed by server

    • Whether the current user is a viewer of this interaction. A viewer is a user who joined via conference complete and has limited controls.

      Returns boolean

    • Whether the current user can leave the call as a viewer.

      Returns boolean

    • Whether the current user can join the call as a viewer.

      Returns boolean

    • Whether the current user can be removed as a viewer.

      Returns boolean

    • Leaves the call audio as a viewer (stays as viewer but disconnects audio).

      Returns Promise<void>

    • Joins the call audio as a viewer.

      Returns Promise<void>

    • Removes the current user as a viewer from this interaction.

      Returns Promise<void>

    • Whether the agent can send a chat message on this interaction. Returns true when the interaction is connected and the agent is the owner or a viewer.

      Returns boolean

    • Whether the agent can fetch message history on this interaction. Returns true when the agent is the owner or a viewer.

      Returns boolean

    Capability Guards

    • Whether the current Elite supervisor viewer can barge. Requires an Elite supervisor on the call's audio leg currently in listen-only mode.

      Returns boolean

    • Whether the current Elite supervisor viewer can stop barging. Requires an Elite supervisor on the call's audio leg currently in listen-talk mode.

      Returns boolean

    • Whether the current Elite supervisor viewer can start coaching. Requires an Elite supervisor on the call's audio leg whose mode is listen-only (or not yet confirmed by the server).

      Returns boolean

    • Whether the current viewer can claim ownership of this interaction. Evaluates viewer status, interaction status, monitoring permissions, hybrid restrictions, audio state (phone only), and queue access.

      Returns boolean

      true if the viewer is permitted to claim ownership

    Monitoring

    • Barges into the call as an Elite supervisor - the supervisor's voice becomes audible to both the agent and the customer. Resolves once the server confirms the mode transition; rejects on request failure or after a 30s timeout.

      Returns Promise<void>

      When canBarge returns false

    • Stops barging and returns the supervisor to listen-only (mic silenced). Same async confirmation pattern as barge.

      Returns Promise<void>

      When canUnbarge returns false

    • Starts coaching as an Elite supervisor - the supervisor's voice reaches only the agent (whisper coaching); the customer does not hear it. Resolves once the server confirms the mode transition; rejects on request failure or after a 30s timeout.

      There is no explicit "uncoach" - leave the call via leaveCall to exit coach mode.

      Returns Promise<void>

      When canCoach returns false

    • Claims ownership of this interaction. The current user must be a viewer.

      Returns Promise<void>

      Promise that resolves when the claim request is accepted