ContactCenter

Implements

IContactCenter

Description

Contact Center Plugin main class which provides functionality for agent management in Webex Contact Center. This includes capabilities for:

  • Agent login/logout
  • State management
  • Task handling
  • Call Controls
    • Mute/Unmute Call
    • Hold/Resume Call
    • Pause/Resume Call Recording
    • Transfer Task
    • Consult & Transfer Call
  • Outdial

Example

const cc = webex.cc;
await cc.register();
await cc.stationLogin({ teamId: 'team123', loginOption: 'AGENT_DN', dialNumber: '+1234567890' });
await cc.setAgentState({ state: 'Available' });

Hierarchy

  • unknown
    • ContactCenter

Implements

  • IContactCenter

Properties

LoggerProxy: typeof default = LoggerProxy

Logger for the Contact Center plugin

namespace: string = 'cc'

Plugin namespace identifier

Plugin configuration

$webex: WebexSDK

Reference to the Webex SDK instance

agentConfig: Profile

Agent configuration and profile information

eventEmitter: EventEmitter

Event emitter for handling plugin events

metricsManager: default

Manager for handling metrics and analytics

services: default

Core services for Contact Center operations

taskManager: default

Manager for handling contact center tasks

webCallingService: default

Service for handling web-based calling functionality

webexRequest: WebexRequest

Service for handling Webex API requests

Methods

  • Unregisters the Contact Center SDK by closing all the web socket connections and removing event listeners

    Returns Promise<void>

    Resolves when deregistration is complete

    Remarks

    This method does not do a station signout.

    Throws

    If deregistration fails

    Example

    const cc = webex.cc;
    await cc.register();
    // Perform operations like login, state change, etc.
    await cc.deregister();
  • Returns the list of buddy agents who are in the given user state and media type based on their agent profile settings

    Parameters

    • data: BuddyAgents

      The data required to fetch buddy agents

    Returns Promise<BuddyAgentsResponse>

    A promise resolving to the buddy agents information

    Throws

    If fetching buddy agents fails

    Example

    const cc = webex.cc;
    await cc.register();
    await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
    await cc.getBuddyAgents({state: 'Available', mediaType: 'telephony'});
  • This is used for getting the list of queues to which a task can be consulted or transferred.

    Parameters

    • Optional search: string

      optional search string

    • Optional filter: string

      optional filter string

    • page: number = DEFAULT_PAGE

      page number (default is 0)

    • pageSize: number = DEFAULT_PAGE_SIZE

      number of items per page (default is 100)

    Returns Promise<ContactServiceQueue[]>

    Promise<ContactServiceQueue[]> Resolves with the list of queues

    Throws

    Error If the operation fails

    Example

    const cc = webex.cc;
    await cc.register();
    await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
    const queues = await cc.getQueues();
  • Initializes the Contact Center SDK by setting up the web socket connections

    Returns Promise<Profile>

    Agent profile information after successful registration

    Throws

    If registration fails

    Example

    const cc = webex.cc;
    await cc.register();
    // After registration, you can perform operations like login, state change, etc.
  • Sets the state of the agent to Available or any of the Idle states

    Parameters

    • data: StateChange

      State change parameters including the new state

    Returns Promise<SetStateResponse>

    Response with updated state information

    Throws

    If state change fails

    Example

    const cc = webex.cc;
    await cc.register();
    await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
    await cc.setAgentState({
    state: 'Available',
    auxCodeId: '12345',
    lastStateChangeReason: 'Manual state change',
    agentId: 'agent123',
    });
  • This is used for making the outdial call.

    Parameters

    • destination: string

      The destination number to dial

    Returns Promise<TaskResponse>

    Promise Resolves with the outdial task response

    Throws

    Error If the outdial operation fails

    Example

    const destination = '+1234567890';
    const cc = webex.cc;
    await cc.register();
    const task = await cc.startOutdial(destination);
    // Can do task operations like accept, reject, etc.

    Refer to ITask interface for more details.

  • Performs agent login with specified credentials and device type

    Parameters

    • data: AgentLogin

      Login parameters including teamId, loginOption and dialNumber

    Returns Promise<StationLoginResponse>

    Response containing login status and profile

    Throws

    If login fails

    Example

    const cc = webex.cc;
    await cc.register();
    await cc.stationLogin({
    teamId: 'team123',
    loginOption: 'EXTENSION',
    dialNumber: '1002'
    });
    // After successful login, you can perform operations like state change, task handling, etc.
  • Performs a station logout operation for the agent

    Parameters

    • data: Logout

      Logout parameters

    Returns Promise<StationLogoutResponse>

    Response indicating logout status

    Remarks

    A logout operation cannot happen if the agent is in an interaction or haven't logged in yet.

    Throws

    If logout fails

  • Updates the agent device type. This method allows the agent to change their device type (e.g., from BROWSER to EXTENSION or anything else). It will also throw an error if the new device type is the same as the current one.

    Parameters

    • data: AgentProfileUpdate

      type is AgentDeviceUpdate - The data required to update the agent device type, including the new login option and dial number.

    Returns Promise<UpdateDeviceTypeResponse>

    Promise Resolves with the device type update response

    Throws

    Error If the update fails

    Example

    const data = {
    loginOption: 'EXTENSION',
    dialNumber: '1234567890',
    teamId: 'team-id-if-needed', // Optional, if not provided, current team ID will be used
    };
    const result = await webex.cc.updateAgentProfile(data);
    const cc = webex.cc;
    await cc.register();
    await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
    await cc.updateAgentDeviceType(data);
  • Uploads logs to help troubleshoot SDK issues.

    This method collects the current SDK logs including network requests, WebSocket messages, and client-side events, then securely submits them to Webex's diagnostics service. The returned tracking ID, feedbackID can be provided to Webex support for faster issue resolution.

    Returns Promise<UploadLogsResponse>

    Promise Resolves with the upload logs response

    Throws

    Error If the upload fails

    Example

    const cc = webex.cc;
    try {
    await cc.register();
    }
    catch (error) {
    console.error('Error during registration:', error);
    cc.uploadLogs();
    }
  • Private

    Connects to the websocket and fetches the agent profile

    Returns Promise<Profile>

    Agent profile information

    Throws

    If connection fails or profile cannot be fetched

  • Private

    Returns the connection configuration

    Returns SubscribeRequest

    Connection configuration

  • Private

    Gets the device ID based on login option and dial number

    Parameters

    • loginOption: string

      The login option (BROWSER, EXTENSION, etc)

    • dialNumber: string

      The dial number if applicable

    Returns string

    The device ID

  • Private

    Handles connection lost events and reconnection attempts

    Parameters

    • msg: ConnectionLostDetails

      Connection lost details

    Returns Promise<void>

  • Private

    Handles device type specific configuration and setup Configures services and settings based on the login device type

    Parameters

    • deviceType: LoginOption

      The type of device being used for login

    • dn: string

      The dial number associated with the device

    Returns Promise<void>

  • Private

    Handles incoming task events and triggers appropriate notifications

    Parameters

    • task: ITask

      The incoming task object containing task details

    Returns void

  • Private

    Handles task hydration events for updating task data

    Parameters

    • task: ITask

      The task object to be hydrated with additional data

    Returns void

  • Private

    Processes incoming websocket messages and emits corresponding events Handles various event types including agent state changes, login events, and other agent-related notifications

    Parameters

    • event: string

      The raw websocket event message

    Returns void

  • Private

    Sets up event listeners for incoming tasks and task hydration Subscribes to task events from the task manager

    Returns void

  • Private

    Initializes event listeners for the Contact Center service Sets up handlers for connection state changes and other core events

    Returns void

  • Private

    Handles silent relogin after registration completion

    Returns Promise<void>