Create a CTI Desktop Manager in Unified Service Desk

The CTI Desktop Manager component is the interface between the computer telephony integration (CTI) system and Unified Service Desk or User Interface Integration (UII). The CTI Desktop Manager component creates the following two objects that collectively manage the state and data in a call:

  • CallStateManager: The CtiCallStateManager class is used as the base class that contains properties, methods, and events for communicating with the CTI Connector component to issue commands related to call management such as answer call, hang up, hold call, and transfer call. It provides multi-call management features and pre-wired events for the CTI Controls (user interface) to connect to, and base implementation and extensibility points for vendor specific customizations.

  • AgentStateManager: The CtiAgentStateManager is used as the base class that contains properties, methods, and events for communicating with the CTI Connector component related to agent state management (agent’s availability such as available, busy, and away). It provides pre-wired events for the CTI Controls (user interface) to connect to, and base implementation and extensibility points for vendor specific customizations.

Define a CTI Desktop Manager component

The CTI Desktop Manager implements the following interfaces:

  • ICtiAgentStateManager

  • ICtiCallStateManager

    You define a CTI Desktop Manager component in the same project as the one that you use for defining your CTI Connector using the USD CTI Connector project template. For more information about using this template, see Create a CTI Connector.

    Use the BaseCtiDesktopManagerControl.cs file in the USD CTI Connector project template to configure your CTI Desktop Manager, and the AgentStateManager.cs and CallStateManager.cs files in to configure call and agent states. These files provide pre-wired methods and instructions (in the form of comments) to help you create a CTI Desktop Manager component.

    Manage CTI Desktop Manager

Raise a search request when a call arrives

When a new call arrives, you can invoke a search request to look up the automatic number identification (ANI) number in a Dynamics 365 repository, get extra information, such as first name, last name, and so on, and create a session. User Interface Integration (UII) provides the CtiLookupRequest class that describes a customer lookup request that the CTI system sends to a customer search provider. This class describes common data elements that the CTI system will provide. It also gives you the ability to add custom data to the request.

The customer lookup or search is implemented depending on whether you are searching in Unified Service Desk or UII:

  • Unified Service Desk: The search request is handled by the Global Manager hosted control.

  • User Interface Integration (UII): The lookup request is sent to ICustomerSearch, and it is up to you how you want to implement the search control. You can also send additional data to the search request using the String) method. UII provides you project templates to create a Windows Forms-based or WPF-based customer search control with the CTI search request pre-wired.

Access call data and events

Use the CallInfoData class to access information about a call that is in process in UII desktop (such as Unified Service Desk). The following example shows the syntax of this class:

CallInfoData calldata = GetCallInfoData(ctiCallRefCallId);  

Enable or disable call actions

Use the CtiCallActionOptions class to enable or disable call actions. The following example code shows how to use this class to handle a call.

public override void OnCallStateChanged(CtiCoreEventArgs e)  
{  
   CallEventArgs CallArgs = (CallEventArgs)e.EventInfo;  
  
   // Set the state of the call in the call list.   
   CallInfoData calldata = GetCallInfoData(CallArgs.Call.CallID.ToString(CultureInfo.CurrentUICulture));  
   if (calldata != null)  
      calldata.CurrentCallState = string.IsNullOrEmpty(CallArgs.State.ToString()) ? string.Empty : CallArgs.State.ToString();  
  
   UpdateCallInfoItemEntry(calldata); // update call data..   
  
   CtiCallEventArgs args = null;  
   switch (CallArgs.State)  
   {  
      case CallClassProvider.CallState.Connected:  
      args = new CtiCallEventArgs(calldata.GetCtiCallRefId, CtiCallStates.OFFHOOK, new CtiCallActionOptions());  
      break;  
  
      case CallClassProvider.CallState.Disconnected:  
      args = new CtiCallEventArgs(calldata.GetCtiCallRefId, CtiCallStates.DISCONNECTED, new CtiCallActionOptions());  
      break;  
  
      case CallClassProvider.CallState.Hold:  
      args = new CtiCallEventArgs(calldata.GetCtiCallRefId, CtiCallStates.ONHOLD, new CtiCallActionOptions());  
      break;  
  
      case CallClassProvider.CallState.Idle:  
      args = new CtiCallEventArgs(calldata.GetCtiCallRefId, CtiCallStates.DISCONNECTED, new CtiCallActionOptions());  
      break;  
  
      case CallClassProvider.CallState.Incoming_Call:  
      args = new CtiCallEventArgs(calldata.GetCtiCallRefId, CtiCallStates.PICKUPPENDING, new CtiCallActionOptions());  
      break;  
  
      case CallClassProvider.CallState.Ringing:  
      args = new CtiCallEventArgs(calldata.GetCtiCallRefId, CtiCallStates.RINGING, new CtiCallActionOptions());  
      break;  
  
      default:  
      System.Diagnostics.Trace.WriteLine(ResourceStrings.UNSUPPORTEDEVENT + CallArgs.State.ToString());  
      break;  
   }  
   // Raise status change event.   
   RaiseCallStateChangeEvent(args);  
}  
  

Configure CTI Desktop Manager hosted control in Unified Service Desk

After you have created the CTI Desktop Manager along with your CTI connector, you must configure these as hosted controls in Unified Service Desk. Unified Service Desk provides a hosted control of type CTI Desktop Manager that can be used to configure your CTI Desktop Manager in Unified Service Desk. The CTI Connector should be configured as a UII hosted control. More information: Configure a hosted control for CTI Connector in Unified Service Desk

  1. Sign in to Dynamics 365.

  2. On the nav bar, choose Microsoft Dynamics 365 > Settings > Unified Service Desk.

  3. On the Unified Service Desk page, click Hosted Controls.

  4. On the Hosted Controls page, click New.

  5. On the New Hosted Control page, specify the following values:

    Field Value
    Name Give name as per your choice.
    USD Component Type CTI Desktop Manager
    Display Group HiddenPanel
    Assembly URI This is the name of your assembly (.dll) file that you built in the previous step.
    Assembly Type This is the name of your assembly followed by a dot, and then the class name of your CTI Connector. For example, if your assembly name is MyCtiManager, and the name of the class of your CTI project is DesktopManager, then you must type the following in this field: MyCtiManager.DesktopManager.

    Configure a CTI Desktop Manager hosted control

  6. Click Save to create the hosted control.

Important

After you have configured the CTI Desktop Manager hosted control in Unified Service Desk, you must configure:

  • Actions for your CTI Desktop Manager hosted control. More information: Actions supported for telephony functions
    • Window navigation rules to route the CTI search requests appropriately to create sessions and display the search results in Unified Service DeskMore information: CTI search

See also

Configure the CTI Desktop Manager hosted control for generic listener adapter
Create a CTI Connector
Create a CTI Control
Walkthrough: Use CTI Desktop Manager ro create a CTI adapter
UII Computer Telephony Integration (CTI) framework