USD 4.1: Implementing Click to call functionality for making outgoing calls

In this post, we’ll see how we can implement click to call functionality i.e. clicking on a phone number field on the form to make outgoing call inside USD.
NOTE: In our scenario, we have implemented custom CTI adapter to use web services of telephony provider to make the outgoing calls.

Below are the steps to achieve this.

Step 1: Create a Windows Navigation Rule that suppresses the out of the box click to call functionality to call using Skype as shown below:

Step 2: Create new UII Action for CTI Desktop Manager hosted control which is “Shoretel CTI Connector” in our case as shown below.

Step 3: Create an Action Call for the UII action we created in Step 2 as shown below. We have passed data parameter [[SUBJECTURL]] as this is the parameter which holds the phone number. This will fire MakeCall action which we’ll override to inject our custom code to make outgoing call.

Step 4: Add the action call created in Step 3 to the Windows Navigation Rule created in Step 1.

Step 5: Override DoAction method of CTI Desktop Manager. Inject your own custom code using SDK of corresponding telephony provider to make outgoing call.

  protected override void DoAction(RequestActionEventArgs args)
        {
            //The action handler allows UII to accept actions from "non CTI aware" applications in the UII Space. 
            // In this case we will show an example of outgoing call command from the search provider. 

            // Check to see if the requested action is "MakeCall" 
            if (args.Action.Equals("MakeCall", StringComparison.InvariantCultureIgnoreCase))
            {
                // The UII Call ID that we would like to make call. 
                if (!string.IsNullOrEmpty(args.Data))
                {
                    try
                    {
                        var number = args.Data.Replace("tel:", "");
                        MakeCall(number);
                    }
                    catch (Exception ex)
                    {
                        // Error here. 
                    }
                }
            }

            // ... other handlers here as necessary  

            base.DoAction(args);
        }

The method “MakeCall” on Line 15 above highlighted can be defined with custom code to place outgoing call by using the SDK sample of the telephony provider.

On Line 14 highlighted above, we are replacing “tel:” with empty string because on Step 1 while creating Windows Navigation Rule, we had put “tel:” in the URL field.

Once, done with the custom code for making outgoing call, we can compile the code and deploy the assembly in USD folder to test.

Then Run USD. In our case, we loaded Contact Hosted Control which is used to load contact form and we have Business Phone (a phone number field) on the form as shown below:

Clicking on Phone icon on the Business Phone field triggered the Windows Navigation Rule(configured on Step 1) as shown below:

The Windows Navigation Rule fires the action call(configured on step 4) as shown below, which in turn fires MakeCall action that we have overridden in Step 5 to make outgoing call.

Hope it helps !!

Leave a comment

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