In this blog post I will explain how we have resolved the issue of the C4C CTI Adapter not working correctly in a Citrix Environment. The problem is detailed by SAP on the page below:
https://apps.support.sap.com/sap/support/knowledge/public/en/2433195
To start, we needed the source code of the CTI Adapter, which is a .net application, in order to make changes. SAP may provide this on request, but once you make a change to it, you have to support the application yourself going forward. We made these changes several years ago and have not had any particular problems.
How C4C’s Live Activity pane and CTI Adapter interact
It’s important to understand this first. SAP already provide documentation on how to configure your phone system’s CTI to pass call details to the CTI Adapter by calling a URL in the format below, so I won’t deal with that in detail:
http://localhost:36729/?CID=BCM1234&ANI=customer_phoneno&DNIS= number_dialled&BP=&SerialNo=&TicketID=&ExternalReferenceID=call_ref&Custom_1=&Custom_2=&Custom_3=&Custom_4
You can pass as many or as few parameters as you like. I’ve shown some examples above:
customer_phoneno The customer’s phone number as identified by Caller Line Identification
number_dialled The number called by the customer
call_ref A unique ID for the phone call within the system eg an Avaya UCID
The parameters sent on the most recent call to the CTI Adapter are stored in memory.
To retrieve this call data, the Live Activity in C4C polls the CTI Adapter every few seconds by calling the following URL as an AJAX XMLHttpRequest:
http://localhost:36729/ctipayload/
If there is no call data stored in the CTI Adapter, it returns “No Payload”. If there is call data stored it is passed back to Live Activity. Once the call data is sent to Live Activity, the data is cleared from the CTI Adapter.
Why this does not work in Citrix
In the post from SAP above, it is correctly stated that the problem occurs because the CTI Adapter is listening on a particular IP (127.0.0.1 which is localhost) and port, either 36729 for http connections or 36731 if Secure CTI (HTTPS) is enabled in Scoping. The Live Activity within C4C polls the CTI Adapter every few seconds for details of new phone calls (called a Payload Request), but the CTI Adapter cannot tell which user is connecting to it.
If you have more than one agent logged into one Citrix server this following scenario is certain:
- Agent 1 receives a phone call, your phone system’s CTI calls the CTI Adapter and passes the call details which are stored by the CTI Adapter, awaiting the next call to it from C4C
- Agent 2 has not received a phone call, but Agent 2’s Live Activity is the next to poll the CTI Adapter to see if there are any call details stored and it receives the details of the call Agent 1 is dealing with and presents them to Agent 2
- Agent 1’s C4C session then polls the CTI Adapter but does not get the call details, because they have already been passed incorrectly to Agent 2. Call details are deleted from the CTI Adapter once passed to Live Activity.
This is a common problem within Citrix, and our specialists looked at the options detailed below which normally would fix this, but in this case the approaches mentioned do not work:
https://docs.citrix.com/en-us/xenapp-and-xendesktop/7-15-ltsr/manage-deployment/virtual-ip-virtual-l...
Changes made to the CTI Adapter
We have made the following changes to the CTI Adapter:
- Changing it from a standalone EXE to a Windows Service. This was not required to fix the problem, but having the CTI Adapter as a Windows Service makes it easier for the Citrix support teams to manage initial installation, updates and monitoring.
- Implementing Windows Authentication on requests to the CTI Adapter to resolve the issue above.
- Creating a “CTI Simulator” Work Centre View in C4C
There are numerous articles on the internet explaining how to create Windows Services, so I’ll just deal with points 2 and 3
Point 2: Fixing the CTI Adapter to work in Citrix
Step 1: Identify the code that needs to change
Changes need to be applied to CTIHttpServer.cs
Step 2: Require Authentication for connections to the CTI Adapter
Add the line highlighted below to require all requests to the CTI Adapter to authenticate
Step 3: Identify the userid for the CTI or Payload request
Note: Calls to the CTI Adapter from Live Activity will automatically Authenticate in response to a request from the CTI Adapter to do so but your Phone System’s CTI may not do so by default.
Step 4: Modify the CTI Adapter code to store and provide call details based on the identified userid
Providing the code would probably be too difficult to show here as there are changes in various places, but it’s not that hard to implement.
Within the CTI Adapter the code was changed to maintain a List of the userids that have been identified by Windows Authentication when phone call details were passed, and then store the related details of the current phone call for each userid.
In the example below, the Phone System has sent a phone call to Eric Jones from the number 01234454133 and CTI has passed the call details to the CTI Adapter. Other data has been passed for other users. All the data is stored within the CTI Adapter in a List:
In the example, when Eric Jones’s Live Activity polls the CTI Adapter for call details, the Live Activity request is authenticated with Eric's Windows User ID
Eric.Jones. The CTI Adapter then knows the request was from Eric Jones’s web browser and the Payload returned is from the second line of the table which is returned and displayed in Live Activity.
Point 3: Creating a CTI Simulate Work Centre View
Since the customised CTI Adapter is now a Windows Service, it has no user interface. For testing, we sometimes want to use the Simulation option that is in the out of the box version:
To do that, we created a simple html CTISimulate.htm page with a form in it, added it to the Windows Service deployment package, and created a Custom Work Centre View to display it in C4C. The URL of the page is
http://localhost:36729/CTISimulate.htm
When the form is submitted it makes a GET request to the CTI Adapter, passing all the parameters entered, exactly as a CTI call would do.
Partial HTML
<form name="simulateform" method="get" action="/">
<input type="hidden" name="CID" value="BCM1234" />
<b>SAP CTI Simulator</b>
<table width="450px" id="mytab1">
<tr>
<td valign="top">
<label for="ANI">Caller No</label>
</td>
<td valign="top">
<input type="text" name="ANI" id="ANI" maxlength="50" size="30">
</td>
</tr>
...
<tr id = "c3">
<td colspan="2">
<input type="submit" value="Submit">
</td>
</tr>
</table>
Conclusion
SAP have recommended Citrix users look at Widget based integration for C4C CTI, but this only works on RUI client and also requires the Phone System vendor to provide the widget. In this blog I’ve demonstrated how it’s possible to adapt the CTI Adapter to work in Citrix. If there is an interest in the source code, I can provide that, but I would need to remove any code/config specific to our setup. Please reply to me if that’s of interest and I’ll try to do that.