2

I'm trying to start a Lync Conversation which appears to be working on my local environment which is also where Microsoft Lync is installed. Now When I try to move this code onto a website hosted on a server, and then try to run this code on a browser from my local computer, it won't run. I get the error, "microsoft.Lync.Model.clientNotFoundException". I'm guessing its because its looking for the Lync Client on the server and not on the User's local computer? How do I get it to look for the client on the User's computer? Thanks!

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Lync.Model.Extensibility;
using Microsoft.Lync.Model;
namespace PlusLyncDial

{
    public class LyncDial
    {        
        public static void DialNumber(string number)
        {
            number = number.Trim();
            if(number[0]!='1')
            {
                number = "1" + number;
            }
            List<string> participants = new List<string>();
            participants.Add("tel:+" + number);
            LyncClient.GetClient();
            // Start the conversation.
            LyncClient.GetAutomation().BeginStartConversation(
                AutomationModalities.Audio,
                participants,
                null,
                (ar) =>
                {
                    try
                    {
                        ConversationWindow newWindow = LyncClient.GetAutomation().EndStartConversation(ar);
                    }
                    catch { }
                },
                null);
        }
    }  
}

2 Answers2

1

You cannot control a user's Lync client from your server. If you want the user's client to start a call, make a hyperlink with the tel: prefix:

<a href="tel:+9900032etc">Click to call</a>

When a user clicks this link, the browser invokes the handler for telephone links, which should be the user's Lync client (or skype, or his mobile phone when he is browsing using that).

w5l
  • 5,341
  • 1
  • 25
  • 43
0

As Willem has pointed out you can't affect the Lync client directly from another machine. If you want to start a call on behalf of a user you could use a UCMA based (server based) application to create calls and add participants as appropriate.

The UCMA SDK is available from http://www.microsoft.com/en-us/download/details.aspx?id=10566

Paul Hodgson
  • 939
  • 8
  • 15