How to Use 127.0.0.1 in USD CTI Calls

Leave a comment

Unified Service Desk handles CTI calls that listen to http://localhost:5000 by default. We can change the port through configuration in the USD server. However, what if instead of looking for localhost, we would like USD to recognize 127.0.0.1? I ran into this scenario recently when dealing with some telephony software that could use 127.0.0.1 but not localhost. In this post, we will look at how to set this up in USD.

First, let’s do some basic setup. Open the USD Administration App, which you can get to from https://home.dynamics.com (you might need to click Show More):

We will create a CTI Hosted Control. Go to Hosted Controls and click New:

We will set the name to CTI and the USD Component Type to CTI Desktop Manager:

Set the Assembly info to:

URI: Microsoft.Crm.UnifiedServiceDesk.GenericListener

Type: Microsoft.Crm.UnifiedServiceDesk.GenericListener.DesktopManager

Note if you don’t do that, you will get the message “The Instance couldn’t be created” when loading USD.

Now let’s create a new Windows Navigation Rule:

Give it a name, e.g. Route CTI, and from our new CTI hosted control:

Save it, then select CTI tab. Create a new Action:

Like below, that will display a message that the CTI has run:

And add it:

At this point, if we get a CTI request, we should get a message displayed. Let’s try it. Note we’re using the out of the box generic listener located at http://localhost:5000. First, open USD:

Now open a web browser and go to http://localhost:5000:

We get the message:

Now if we try hitting http://127.0.0.1:5000:

We get:

Bad Request – Invalid Hostname


HTTP Error 400. The request hostname is invalid.

So let’s make a USD server-side change. We will add a new option:

 

  • Name = GenericListener
  • Value = http://127.0.0.1:5000/ Note to add the trailing / or you will get an error on load.

Restart USD. Now let’s try http://127.0.0.1:5000 again.

We get the CTI message:

And http://localhost:5000 still works:

In many cases this should work. You may find scenarios where due to policies you will need to enable http://127.0.0.1:5000 at a DOS level or you run into the error “Failed to Initialize Hosted Application CTI Generic Listener, Access is Denied” when starting USD. To do this:

  1. Reset the ACL using below if you need to:
    netsh http delete urlacl url=http://127.0.0.1:5000/
  2. Add the URL to the ACL for everyone:
    netsh http add urlacl url=http://127.0.0.1:5000/ user=everyone
  3. Or add the URL to the ACL for certain users:
    netsh http add urlacl url=http://127.0.0.1:5000/ user=DOMAIN\User

Be sure to keep the trailing forward slash or you will receive a DOS 87 error.

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *