Media

Class finesse.restservices.Media

Extends finesse.restservices.RestCollectionBase

Represents a non-voice media channel such as, chat or email. This object can be used to perform various actions in the media channel such as, logging into, or logging out of the media channel, setting the state of the user for the media channel (Ready, Not Ready), setting the maximum allowed number of dialogs for this media, and so on.

Example

Code Snippet
Copy_mediaCollection = mediaList.getCollection();
if (_mediaCollection.hasOwnProperty(_emailMediaId)) {
    media = _mediaCollection[_emailMediaId];
    media.login({
        maxDialogLimit: 5,
        interruptAction: 'ACCEPT',
        dialogLogoutAction: 'CLOSE',
        handlers: _handlers
    });
    ...
}
}

For additional parameters and methods, see RestCollectionBase Common Parameters.

Methods

getDialogLogoutAction()

Retrieves the action that is taken when the agent logs out with dialogs that are associated with the media.

Returns

{String} The action taken when dialog logs out. The actions are:

  • CLOSE—The dialog is closed.

  • TRANSFER—The dialog is transferred to another agent.

getId()

Retrieves the Id.

Returns

{String} The Id.

getInterruptAction()

Retrieves the action that is taken when the media is interrupted.

Returns

{String} The action taken when media is interrupted. The actions are:

  • ACCEPT—The interrupt is accepted and the agent is not allowed to work on tasks in the media.

  • IGNORE—The interrupt is ignored and the agent is allowed to work on tasks in the media.

getInterruptible()

Retrieves whether the media is interruptible.

Returns

{Boolean} True if interruptible and false if it is not interruptible.

getMaxDialogLimit()

Retrieves the maximum number of dialogs that are allowed in the media.

Returns

{String} The maximum number of dialogs in the media.

getMediaDialogs(handlers)

Retrieves the MediaDialogs collection object that is associated with the user in the media.

Example

Code Snippet
Copy First call:
    _mediaDialogs = _media.getMediaDialogs({
        onLoad: _handleMediaDialogsLoad,
        onChange: _handleTeamChange,
        onAdd: _handleMediaDialogAdd,
        onDelete: _handleMediaDialogDelete,
        onError: _errorHandler
    });
Subsequent calls on the same object, after the media dialogs are loaded:
    ...
    _mediaDialogsNew = _media.getMediaDialogs();
_dialogsCollection = _mediaDialogsNew.getCollection();
...

Parameters

Name

Type

Description

Required

handlers

Object

An object containing callback functions which are invoked when the callback scenario is triggered.

To find the list of callback scenarios, see RestCollectionBase Common Parameters.

Optional

Returns

{finesse.restservices.MediaDialogs} The MediaDialogs object.

getMediaId()

Retrieves the media Id

Returns

{String} The media Id.

getName()

Retrieves the media name.

Returns

{String} The media name.

getReasonCodeId()

Retrieves the reason code Id.

Returns

{String} The reason code Id.

getReasonCodeLabel()

Retrieves the reason code label.

Returns

{String} The reason code label.

getRoutable()

Retrieves whether the user is routable in the media.

Returns

{Boolean} True if routable, and false if the value is not routable.

getState()

Retrieves the state of the user in the media.

Returns

{String} The current (or last fetched) state of the user in the media.

isInterruptible()

Retrieves whether the user is interruptible in the media.

Returns

{Boolean} True if the user is interruptible, and false if the user is not interruptible.

isInWorkState()

Retrieves whether the user is in work state in the media.

Returns

{boolean} True if the media is in work state, and false if it is not in the work state.

isLoggedIn()

Retrieves whether the user is in any state except LOGOUT in the media.

Returns

{boolean} True if the agent is in any state except LOGOUT in the media.

isRoutable()

Retrieves if the user is routable in the media.

Returns

{Boolean} True if the user is routable, and false if the user is not routable.

login(params)

Logs the agent into the media.

Parameters

Name

Type

Description

Required

params

Object

An media object with options.

Yes

-->maxDialogLimit

String

The maximum number of dialogs that are allowed in the media.

For more information, see getMaxDialogLimit().

Yes

-->interruptAction

String

The action that is taken when the media is interrupted. The actions are:

  • ACCEPT

  • IGNORE

For more information, see getInterruptAction().

Yes

-->dialogLogoutAction

String

The action taken with the dialogs that are associated with the media when the agent logs out. The actions are:

  • CLOSE

  • TRANSFER

For more information, see getDialogLogoutAction().

Yes

-->handlers

Object

An object containing the handlers for the request.

For more information on handlers, see Request Handlers.

Yes

Note

If maxDialogLimit, interruptAction, and dialogLogoutAction are not present, then the loginOptions specified in the call to finesse.restservices.MediaList.getMedia is used.

Returns

{finesse.restservices.Media} The media object.

logout(reasonCode, params)

Logs out the agent from the media.

Parameters

Name

Type

Description

Required

reasonCode

String

The reasonCode for the user to log out of the media. Pass null as the first parameter if no reason code is associated with the log out event.

Yes

params

Object

An media object.

Yes

-->handlers

Object

An object containing the handlers for the request.

For more information on handlers, see Request Handlers.

Yes

Returns

{finesse.restservices.Media} The media object.

refresh(retries)

Refreshes the media object and optionally refreshes the list of media dialogs that are associated with the object.

Parameters

Name

Type

Description

Required

retries

Integer

The number of attempts to retry synchronizing the media object.

Yes

refreshMediaDialogs()

Refreshes the dialog collection that is associated with the media. The refresh happens only if the media dialogs are initialized.

setMediaOptions(mediaOptions)

Sets the maxDialogLimit, interruptAction, and dialogLogoutAction settings that the application uses for the media. During a failure, these options are set in the new Cisco Finesse server.

Parameters

Name

Type

Description

Required

mediaOptions

Object

An media object with options.

Yes

-->maxDialogLimit

String

The maximum number of dialogs that are allowed in the media.

For more information, see #reference_B88B4E61310A35D369EEC261F8E41A85__d15e137.

Yes

-->interruptAction

String

The action that is taken when the media is interrupted. The actions are:

  • ACCEPT

  • IGNORE

For more information, see #reference_B88B4E61310A35D369EEC261F8E41A85__d15e89.

Yes

-->dialogLogoutAction

String

The action taken with the dialogs that are associated with the media when the agent logs out. The actions are:

  • CLOSE

  • TRANSFER

For more information, see #reference_B88B4E61310A35D369EEC261F8E41A85__d15e43.

Yes

setRoutable(options)

Sets the routable status in the media.

Parameters

Name

Type

Description

Required

options

Object

An media object with options.

Yes

-->routable

String

Determines whether the agent is routable or not.

Yes

-->handlers

Object

An object containing the handlers for the request.

For more information on handlers, see Request Handlers.

Yes

Returns

{finesse.restservices.Media} The media object.

setState(newState, reasonCode, params)

Sets the state of the user in the media.

Example

Code Snippet
Copy_media.setState(finesse.restservices.Media.States.NOT_READY, {
    id: _reasonCodeId
}, {
    handlers: {
        success: _handleStateChangeSuccess,
        error: _handleStateChangeError
    }
});

Parameters

Name

Type

Description

Required

newState

String

The new state of the user in the media.

Yes

reasonCode

String

The reasonCode for the user to log out of the media. Pass null as the first parameter if no reason code is associated with the log out event.

Yes

params

Object

An media object with options.

Yes

-->maxDialogLimit

String

The maximum number of dialogs that are allowed in the media.

For more information, see #reference_B88B4E61310A35D369EEC261F8E41A85__d15e137.

Yes

-->interruptAction

String

The action that is taken when the media is interrupted. The actions are:

  • ACCEPT

  • IGNORE

For more information, see #reference_B88B4E61310A35D369EEC261F8E41A85__d15e89.

Yes

-->dialogLogoutAction

String

The action taken with the dialogs that are associated with the media when the agent logs out. The actions are:

  • CLOSE

  • TRANSFER

For more information, see #reference_B88B4E61310A35D369EEC261F8E41A85__d15e43.

Yes

-->handlers

Object

An object containing the handlers for the request.

For more information on handlers, see Request Handlers.

Yes

Returns

{finesse.restservices.Media} The media object.