Walkthrough: Use the generic listener adapter for CTI event routing
This walkthrough demonstrates how you can use the CTI Desktop Manager and generic listener in Unified Service Desk to expose the CTI events as screen pops in Unified Service Desk. For this walkthrough, we will use a sample CTI Simulator application that sends CTI requests to Unified Service Desk.
In this walkthrough, you’ll:
Search for a contact record in the sample data based on an email address specified in the sample CTI Call Tester application.
Create a window navigation rule to display the matching record in a session in Unified Service Desk.
Prerequisites
Microsoft .NET Framework 4.6.2
Unified Service Desk client application; required for testing the hosted control.
Visual Studio 2012 or Visual Studio 2013
Download the sample CTI Simulator Application Visual Studio project to your computer. Build the project, and run the application (.exe file) from the bin\debug folder of the sample application project. You must run the USD CTI Simulator application on the same computer where Unified Service Desk client is running to test the application.
Step 1: Configure a CTI Desktop Manager hosted control in Unified Service Desk
Sign in to Unified Service Desk Administrator.
Select Hosted Controls under Basic Settings.
Select + New.
On the New Hosted Control page, specify the following values.
Field Value Name CTITest USD Component Type CTI Desktop Manager Display Group HiddenPanel Assembly URI Microsoft.Crm.UnifiedServiceDesk.GenericListener Assembly Type Microsoft.Crm.UnifiedServiceDesk.GenericListener.DesktopManager Note
The values specified in the Assembly URI and Assembly Type fields are the generic listener values for the CTI Desktop Manager hosted control type.
Select Save to create the hosted control.
Step 2: Test if the CTI events are raised in Unified Service Desk
Start Unified Service Desk client, and connect to your Microsoft Dataverse instance. After the client is up, choose Settings in the top-right corner to display the debugger control, and then choose Clear Debug Output to clear the desktop.
Start the USD CTI Simulator application, type Email in the Key column and specify a random value in the Value column. Click Send to USD.
A screen pop-up occurs in the client application to expose the CTI event. In this case, a
CTILookUpRequest
is initiated with the value that was specified in the USD CTI Simulator application. Because you haven’t wired it yet with a window navigation rule, nothing further happens.
Step 3: Define a window navigation rule to route the CtiLookUpRequest
Create a window navigation rule to create a session if a match is found, and then display the matching contact record in a session in Unified Service Desk
Sign in to the Dynamics 365 instance.
Navigate to the advanced find for contacts, and create a query where you search for active contacts where the email, email address 2, or email address 3 field equals a certain value, for example, someone_c@example.com.
Select Download Fetch XML to save the query as
FetchXML
.Go to the Unified Service Desk Administrator app.
Select Window Navigation Rules.
Select + New
On the New Window Navigation Rule window, specify the following values.
Field Value Name CTITestRoute Order 50 From CTITest
This is the name of your CTI Desktop Manager hosted control.Direction Both Save the rule. This enables the rest of the controls on the page.
Now, add the
FetchXML
query that was saved earlier to this rule. Under the CTI Searches area, choose Add.In the New CTI Search window, specify the following values:
Name: CTIContactSearch
Order: 1
FetchXML:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> <entity name="contact"> <attribute name="fullname" /> <attribute name="parentcustomerid" /> <attribute name="telephone1" /> <attribute name="emailaddress1" /> <attribute name="contactid" /> <order attribute="fullname" descending="false" /> <filter type="and"> <condition attribute="statecode" operator="eq" value="0" /> <filter type="or"> <condition attribute="emailaddress1" operator="eq" value="[[cti.Email]]" /> <condition attribute="emailaddress2" operator="eq" value="[[cti.Email]]" /> <condition attribute="emailaddress3" operator="eq" value="[[cti.Email]]" /> </filter> </filter> </entity> </fetch>
Note
The address someone_c@example.com was replaced with
[[cti.Email]]
so that the search is run based on the value specified for the Email key in the Unified Service Desk CTI Simulator application.
Save the CTI search rule, and return to the window navigation rule.
Under Single Match, in the Decision field, select Create Session, Load Match then Do Action.
Under Single Match, in the Action field, select the search icon to select a value, and then select + New.
On the + New Action Call page, create an action call to open the contact record by specifying the following values.
Field Value Name CTIOpenContact Hosted Control CRM Global Manager Action Open_CRM_Page Data Id=[[$Context.Id]]
LogicalName=[[$Context.LogicalName]]Save the action call, and then close the action call page to return to the window navigation rule definition page.
Under the Result area:
In the Destination field, choose Tab to display the matching contact record in a tab.
In the Target Tab field, choose the Contact hosted control. The Contact hosted control was created when you deployed a sample Unified Service Desk application on your Dataverse server using the Package Deployer tool. For more information, see Deploy sample Unified Service Desk applications to CRM server using Package Deployer.
In the Show Tab field, choose the Contact hosted control
Save the window navigation rule.
Test your CTI adapter
Start Unified Service Desk client, and connect to your Dataverse instance. After the client is up, choose Settings in the top-right corner to display the debugger control, and then choose Clear Debug Output to clear the desktop.
Start the USD CTI Simulator application, type Email in the Key column and specify a valid email ID for the contact that you want to search. In this case, type someone_d@example.com in the Value column. Select Send To USD.
The matching contact record is displayed in a session in Unified Service Desk.
Check the Debugger hosted control to view the events that got raised as a result of the CTI search. Also check out the Data Parameters tab to view the context information in the
$Context
variable and CTI information under theCTI
variable.
See also
Integrate with CTI systems
UII Computer Telephony Integration (CTI) framework