USD 4.1: Using CTI Simulator and Generic Listener

In this post, we’ll see how we can use CTI simulator along with Generic Listener provided by Microsoft.

To start, download the CTI simulator from the following location: https://onedrive.live.com/?authkey=%21AIN2jgKztrYGpok&cid=5A34CCE9728C8F4F&id=5A34CCE9728C8F4F%21274&parId=5A34CCE9728C8F4F%21169&action=locate.

Unzip it.

Open the solution file in Visual Studio and compile it.

Open the Project folder.

Navigate to bin–> Debug folder and locate the USDCTICallTester.exe as shown below.

Executing the exe, we’ll see the below screen. Few notes:
Key Value –> additional parameters that we can send to USD
Send to USD –> Raises ScreenPopRequested event of CRM Global Manager inside USD which we’ll see shortly.
URL –> by default it runs at the port 5000.

Now that we are ready with CTI simulator for testing, le’s go ahead and configure USD to respond the request from CTI simulator.

1. Create Hosted Control of type CTI Desktop Manager as shown below:

Populate Assembly URI and Type as shown below:
Assembly URI: Microsoft.Crm.UnifiedServiceDesk.GenericListener
Assembly Type: Microsoft.Crm.UnifiedServiceDesk.GenericListener.DesktopManager

2. Create Windows Navigation Rule as follows:

Configure the scenarios of Single Match, No Match and Multiple Match. This is nothing but how the system will respond when there is single match/multiple match/no match for a search operation in the system.

For Demo purpose, we’ll go through only Single Match scenario. Multiple/No match scenarios can be configured in a similar fashion.

In our case, we wanted following things to happen when there is single match:
– Create new session
– Copy few variables to context(stored as key/value pair)
– Create phone call record for the matched contact
– Load created Phone Call
– Load matched Contact
– Load Account on Contact record

3. The search operation that is done to find the match(single/multiple/no) is called CTI Search and once it’s added to the Windows Navigation Rule as shown above, it gets triggered and starts searching whenever the Windows Navigation Rule is triggered.

It’s a fetch xml query used to perform search. In our case, we wanted to search the contacts whose mobilephone is same as the value coming from CTI simulator.

The key/value passed from CTI simulator can be accessed using replacement parameter [[cti.<keyname>]] as shown below.

We wanted the windows navigation rule to be triggered only when Incoming is passed as value to the parameter CallDirection from CTI Simulator. This step is optional if the Windows Navigation Rule doesn’t need to be conditional.

4. The action call that copies key/values to the context can be configured as shown below:

5. To the sub action Calls of above action(4), configure the following action and add. This action call is responsible for creating phone call record.

Hosted Control: CRM Global Manager
Name: Create Phonecall Entity for Inbound Phonecall
Action: CreateEntity
Data: LogicalName=phonecall
directioncode=Boolean(false)
subject=Call from: [[contact.fullname]]
regardingobjectid=EntityReference(contact,[[contact.Id]])
phonenumber=[[contact.telephone1]+]
to=PartyList(er[“systemuser”,[[$User.systemuserid]+g]])
from=PartyList(er[“contact”,[[contact.Id]+]])
description=Incoming Call

6. Configure the following action call to load the phone call created in step(5) and add this action call to the Sub Action Calls of step(5).
Name: Open Phone Call Entity from phone call – Incoming Call Scenario
Data: LogicalName=phonecall
id=[[$Return.Create Phonecall Entity for Inbound Phonecall]]
Hosted Control: Phone Call
Action: Open_CRM_Page

7. Configure the following action call to load contact. Add this action call to Sub Action Calls of Step (5).
Name: Open Contact for PhoneCall
Data: url=/main.aspx?etc=2&extraqs=%3fetc%3d2&pagetype=entityrecord&navbar=off&id=[[contact.Id]]
Hosted Control: Contact
Action: Navigate

8. Configure the following action to set focus on Contact hosted control. Add this action call to the Sub Action Calls of Step(7).
Name: Show tab for Contact
Data: Contact
Action: ShowTab
Hosted Control: CRM Global Manager

9. Configure the following action call to load the account on Contact form.
Data: url=/main.aspx?etc=1&extraqs=%3fetc%3d1&pagetype=entityrecord&navbar=off&id=[[contact.parentcustomerid.Id]]
Hosted Control: Account
Action: Navigate
Name: Open Account for Contact in Contact Engagement Session

10. Add the action call on Step(9) to the DataReady event of Contact hosted control.

Now that we are done with the USD configuration, let’s open USD and CTI Simulator application.
In CTI simulator, let’s fill below key value pairs which satisfies the Single match scenario in our syetem:
— mobilephone: 0296187928(already configured the system with this mobile number for single match scenario)
— CallDirection: Incoming

Once done, clicking Send to USD will create a session in USD and will load Contact(focused tab), Phone Call and Account as shown below:

Loading Debugger window, we can also verify that ScreenPopRequested event of CRM Global Manager has been raised with the key/value pairs passed as highlighted below:

On a separate note, since the Generic Listener listens for requests at the port 5000, we can also test this functionality without opening CTI Simulator.

e.g. for the scenario in our case, we can hit the below URL in any browser and the ScreenPopRequested event of CRM Global Manager will be raised:
http://localhost:5000/?ani=1234&dnis=4355&type=phonecall&mobilephone=0296187928&CallDirection=Incoming.
Similarly, additional key value pair that we want to pass to USD can be added to the query string.

Hope it helps !!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.