com.genesyslab.ail
Interface InteractionChat

All Superinterfaces:
AbstractInteraction, IdObject, Interaction, InteractionMultimedia, Possible, Savable

public interface InteractionChat
extends InteractionMultimedia

A chat interaction with a customer.

This interface enables participation in a chat session. It provides the following actions:

To get instances of this interface, your application listens for an InteractionEvent, which indicates ringing chat interactions.

To receive InteractionEvent events for ringing chat interactions, use a PlaceListener (or an AgentListener) added to a Place (or Agent) object that includes the chat media. For each new chat session, your application receives an InteractionEvent for a chat interaction that has an Interaction.Status.RINGING status.

To determine which actions are available at a certain time, test the corresponding InteractionChat.Action value by calling the isPossible method. For example, use the possible actions to activate or deactivate buttons that make calls to the corresponding InteractionChat methods.

To enter the chat session, call the answerCall method. By default, the nickname is the agent name, and the party type is ChatParty.Type.AGENT. To have other values for nickname and party type, set new values before calling the answerCall method.

If the InteractionChat object is in Interaction.Status.TALKING status, your application can chat with parties. To send a message, call the sendMessage(java.lang.String) method.

Actions on the chat interaction generate events that your application can use to refresh:

To get the InteractionChatEvent events of an InteractionChat object, implement and add an InteractionChatListener to the InteractionChat interaction, as shown in the following code snippet.

public class SimpleChatExample implements InteractionChatListener
{
    public SimpleChatExample(InteractionChat exampleInteractionChat)
    {
        //Adding the listener
        exampleInteractionChat.addChatListener(this);
    }
    public void handleInteractionChatEvent(InteractionChatEvent event)
    {
        //Implement this method to refresh your application
        //with the new chat information about:
        //-New messages
        //-Parties.
    }
}

To disconnect the chat session, invoke the releaseCall method. After receiving the InteractionEvent for Interaction.Status.IDLE, use the markDone method to properly save and clean the interaction.

Note: The e-mail server can employ a routing strategy to send the transcript of the chat interaction to the contact. In this case, to disconnect, use clearCall(boolean) (or transferQueue) instead of releaseCall. The transcript is automatically sent to the contact.


Nested Class Summary
static class InteractionChat.Action
          Interaction chat actions.
 
Nested classes/interfaces inherited from interface com.genesyslab.ail.InteractionMultimedia
InteractionMultimedia.StopProcessingReason
 
Nested classes/interfaces inherited from interface com.genesyslab.ail.Interaction
Interaction.Status, Interaction.Type
 
Nested classes/interfaces inherited from interface com.genesyslab.ail.AbstractInteraction
AbstractInteraction.AbstractCallType
 
Method Summary
 InteractionChatEvent[] addChatListener(InteractionChatListener _listener, boolean getPreviousEvents)
          Registers a listener for the events on this InteractionChat.
 void clearCall(boolean bForceClose)
          Disconnects from the Chat Server in after_action mode "ForceClose" or "CloseIfNoAgents".
 void conferenceAgent(java.lang.String invitedAgentId, ChatParty.Visibility visibility, java.lang.String reason)
          Requests an agent or supervisor to join chat.
 void conferencePlace(java.lang.String placeId, ChatParty.Visibility visibility, java.lang.String reason)
          Requests a place to join chat
.
 java.lang.String getCobrowseIdParty()
          Returns the ID of the CoBrowse party; or null if there is no CoBrowse party.
 long getDuration()
          Returns the duration of this chat session in seconds.
 InteractionChatEvent[] getEvents()
          Returns the events received from the beginning of the chat session or null if no message.
 ChatMessage[] getMessages()
          Returns all the messages exchanged from the beginning of the session or null if no message.
 java.lang.String getNickName()
          Returns either the nickname if exists or the user name.
 ChatParty[] getParties()
          Returns all the known chat parties of this interaction.
 ChatParty.Type getPartyType()
          Returns the party type.
 ChatParty.Visibility getVisibility()
          Returns the visibility.
 boolean isOnLine()
          Returns true if the interaction has a corresponding session in the Chat Server.
 void pushURL(java.lang.String url)
          Pushes this URL onto the other parties' desktops.
 void removeAllChatListeners()
          Removes all the listeners for the events on this InteractionChat.
 void removeChatListener(InteractionChatListener _listener)
          Removes a listener for the events on this InteractionChat.
 void sendMessage(java.lang.String message)
          Sends a message to all the chat parties.
 void setNickName(java.lang.String nickName, ChatParty.Type type)
          Sets the nickname before the answerCall.
 void setPartyType(ChatParty.Type partyType)
          Sets the party type of this agent on this chat interaction.
 void setVisibility(ChatParty.Visibility visibility)
          Sets the visibility: before answerCall to specify the join mode or after answerCall to change visibility
 void typingStarted()
          Notifies the other parties that this agent is typing some text.
 void typingStopped()
          Notifies the other parties that this agent is no longer typing.
 
Methods inherited from interface com.genesyslab.ail.InteractionMultimedia
addSuggestedCategories, delete, getAvailableQueuesForChildInteraction, getAvailableQueuesForThisInteraction, getCategoryId, getExternalId, getInteractionSubtype, getInteractionType, getIsCategoryApproved, getMaxSubjectLength, getMediaType, getQueue, getSuggestedCategories, isMarkDoneAvailable, placeInQueue, setAttachedData, setAvailableQueuesForChildInteraction, setAvailableQueuesForThisInteraction, setCategoryId, setExternalId, setIsCategoryApproved, submit, transferAgent, transferPlace, transferQueue
 
Methods inherited from interface com.genesyslab.ail.Interaction
answerCall, countOtherPendingInteractions, getContactId, getContentBinary, getContentBinaryMimeType, getContentBinarySize, getDateCreated, getDn, getEndDate, getMedia, getNotepad, getParentInteraction, getPlace, getStatus, getStructTextMimeType, getStructuredText, getSubject, getText, getType, getUserName, isDone, markDone, merge, releaseCall, save, setContactId, setContentBinary, setContentBinaryMimeType, setContentBinarySize, setNotepad, setStructTextMimeType, setStructuredText, setSubject, setText
 
Methods inherited from interface com.genesyslab.ail.AbstractInteraction
addInteractionListener, getAttachedData, getAttachedData, getAttachedDataEx, getTConnectionId, queryStatus, removeAttachedData, removeInteractionListener, saveAttachedData, setAttachedData
 
Methods inherited from interface com.genesyslab.ail.Possible
arePossible, isPossible
 
Methods inherited from interface com.genesyslab.ail.Savable
getContactServerId, isDirty
 

Method Detail

addChatListener

InteractionChatEvent[] addChatListener(InteractionChatListener _listener,
                                       boolean getPreviousEvents)
Registers a listener for the events on this InteractionChat.

Parameters:
_listener - InteractionChatListener.
getPreviousEvents - true to return an array of the InteractionChatEvent received until now.
Returns:
InteractionChatEvent[] if getPreviousEvents is true, otherwise null.

removeChatListener

void removeChatListener(InteractionChatListener _listener)
Removes a listener for the events on this InteractionChat.

Parameters:
_listener - InteractionChatListener: the listener to remove.

removeAllChatListeners

void removeAllChatListeners()
Removes all the listeners for the events on this InteractionChat.


setNickName

void setNickName(java.lang.String nickName,
                 ChatParty.Type type)
                 throws RequestFailedException
Sets the nickname before the answerCall. Otherwise the nickname will be the user name.

Parameters:
nickName - the nickname.
type - the party type.
Throws:
RequestFailedException

getNickName

java.lang.String getNickName()
Returns either the nickname if exists or the user name.


getPartyType

ChatParty.Type getPartyType()
Returns the party type.


setPartyType

void setPartyType(ChatParty.Type partyType)
Sets the party type of this agent on this chat interaction.


setVisibility

void setVisibility(ChatParty.Visibility visibility)
                   throws RequestFailedException
Sets the visibility: before answerCall to specify the join mode or after answerCall to change visibility

Parameters:
visibility - the visibility (ALL, INT, VIP).
Throws:
RequestFailedException

getVisibility

ChatParty.Visibility getVisibility()
Returns the visibility.


conferenceAgent

void conferenceAgent(java.lang.String invitedAgentId,
                     ChatParty.Visibility visibility,
                     java.lang.String reason)
                     throws RequestFailedException
Requests an agent or supervisor to join chat.
If failure, the initiator will receive an Error InteractionEvent containing error description in extensions.
If success, the invited agent will receive a RINGING InteractionEvent containing in extensions:
RINGING_CONFERENCED = initiator
RINGING_CONFERENCE_REASON = reason
RINGING_CONFERENCE_VISIBILITY = ChatParty.Visibility

Parameters:
invitedAgentId - the agent ID.
reason - the reason of the conference.
visibility - the visibility (ALL, INT, VIP).
Throws:
RequestFailedException

conferencePlace

void conferencePlace(java.lang.String placeId,
                     ChatParty.Visibility visibility,
                     java.lang.String reason)
                     throws RequestFailedException
Requests a place to join chat
. If failure, an Error InteractionEvent will be sent containing error description in extensions.
If success, the invited agent will receive a RINGING InteractionEvent containing in extensions:
RINGING_CONFERENCED = initiator
RINGING_CONFERENCE_REASON = reason
RINGING_CONFERENCE_VISIBILITY = ChatParty.Visibility

Parameters:
placeId - the place ID.
reason - the reason of the conference.
visibility - the visibility.
Throws:
RequestFailedException

clearCall

void clearCall(boolean bForceClose)
               throws RequestFailedException
Disconnects from the Chat Server in after_action mode "ForceClose" or "CloseIfNoAgents".
To disconnect in after_action mode "KeepAlive", use releaseCall(null).

Parameters:
bForceClose - if true after_action = ForceClose, otherwise after_action = CloseIfNoAgents.
Throws:
RequestFailedException

isOnLine

boolean isOnLine()
Returns true if the interaction has a corresponding session in the Chat Server.

Returns:
true if the chat session exists.

sendMessage

void sendMessage(java.lang.String message)
                 throws RequestFailedException
Sends a message to all the chat parties.

Parameters:
message - the message to be sent to all the parties depending on the visibility.
Throws:
RequestFailedException

getParties

ChatParty[] getParties()
Returns all the known chat parties of this interaction.

Returns:
an array of ChatParty.

getMessages

ChatMessage[] getMessages()
Returns all the messages exchanged from the beginning of the session or null if no message.

Returns:
an array of ChatMessage.

getEvents

InteractionChatEvent[] getEvents()
Returns the events received from the beginning of the chat session or null if no message.

Returns:
an array of InteractionChatEvent.

getDuration

long getDuration()
Returns the duration of this chat session in seconds.

Returns:
a duration as long.

getCobrowseIdParty

java.lang.String getCobrowseIdParty()
Returns the ID of the CoBrowse party; or null if there is no CoBrowse party.


pushURL

void pushURL(java.lang.String url)
             throws RequestFailedException
Pushes this URL onto the other parties' desktops.

Throws:
RequestFailedException

typingStarted

void typingStarted()
                   throws RequestFailedException
Notifies the other parties that this agent is typing some text.

Throws:
RequestFailedException

typingStopped

void typingStopped()
                   throws RequestFailedException
Notifies the other parties that this agent is no longer typing.

Throws:
RequestFailedException