Handling events from the CTI server
The HandleEvent activity converts the incoming event data to Pega format. As part of the OpenCTI framework, Pega provides data transforms, decision trees, and activities to achieve this conversion. Override these rules in the adapter layer and modify them according to the needs of your implementing adapter.
When you receive events from a service, the event data must be mapped to a clipboard page using a parse rule such as XML or JSON parser. After you map the event data to the clipboard page, call the HandleEvent activity of ChannelServices-Embed-Adapter-OpenCTI, where these properties are mapped to the CTIEvent ( ChannelServices-Event-CTILink) clipboard page. The HandleEvent activity starts the processing of an event.
The processing of an event consists of the following functions:
- Retrieving the user's device presence data using the RetrieveDevicePresence activity.
- Identify the corresponding Pega provided OpenCTI event using the SetEventType decision tree.
- Filtering the event based on the telephony mode used, and that are not rendered by the CTI toolbar using the FilterEvent activity activity.
- Filtering the event based on device capabilities using the FilterEventsOnDeviceCapabilities decision tree.
- Mapping events to a form recognized by the Pega Call framework using theConvertEvent activity.
- Sending the event to the desktop.
- Specialized processing of the event after sending the event to desktop using the EventPostProcessing activity.
The activities listed in the following section are used to process the events. These activities use the OpenCTI adapter class rules to receive any format of event data and modify it into the CTI toolbar’s required data structure.
Copy the following rules from the OpenCTI base adapter class and implement them in your implementation class.
- RetrieveDevicePresence activity
- This activity is used in the retrieval of the user’s workstation ID and client handle from the user’s presence object. The contextual data retrieved is used in building the event in a Pega format and to deliver the event to the CTI toolbar. Override the PopulatePresenceKeys data transform to populate the OpenCTI adapter implementation presence keys if the implementation is using a different key from the one provided by the OpenCTI interface.
- IdentifyEvent activity
- This activity identifies which Pega Call event corresponds with the event received. This activity uses the decision tree SetEventType to identify the event. This should only be overridden if a different decision rule type is needed.
- SetEventType decision tree
- This rule normalizes the CTI server event agent state or call state into the agent or call state used by the CTI toolbar. You can copy this decision tree into the adapter class and modify it to identify the corresponding Pega Call event.
- For example, if the CTI server event agent state is Talking then add an if condition to this rule if AgentState = “Talking” then return “Busy”. When modifying existing if conditions, do not change the return value. The return values listed in the decision tree are the states used by the CTI toolbar.
- FilterEvent activity
- This activity is used to filter any events that are not required by the Pega Call implementation. This activity uses the FilterEvent when rule to update the SendEvent property. Override this when rule to set the SendEvent property to either True or False depending on the event type. By default, this when rule returns False.
- FilterEventsOnDeviceCapabilities decision tree
- This decision tree is used to filter call or agent state events based on the CTI toolbar capabilities.
- ConvertEvent activity
- This activity maps properties to the Pega Call event page with data for each Pega Call event using PopulateEventData data transforms. These data transforms are called from the ConvertEvent activity.
- PopulateEvent data transforms
- These are a collection of data transforms that represent the events that are recognized by the Pega Call framework. These data transforms copy the data from the OpenCTI adapter implementation page to the CTI event page. Copy these data transforms from the OpenCTI interface class into the OpenCTI implementation adapter class and map the values of the properties on the source side of the data transform with the corresponding property from the adapter.
- Do not change the contents of the event name property.
- There may be instances where the event data model from the CTI server system does not fit into the OpenCTI event model when using the Decision Tree and Data Transforms listed. In these cases, there are two activities which can be copied and overridden.
- EventPostProcessingactivity
- This activity allows any processing that might be required after the event is sent.
Previous topic Subscribing to events Next topic Handling Errors