📜 ⬆️ ⬇️

Lync SDK 2013. Experience in developing your own Lync-based instant messenger (Skype for Business)

About what?


In this article I will talk about what Microsoft offers us in its Lync SDK to create “beautiful” interfaces and new features for the Lync client. I will also discuss in detail the interaction with Lync client in UI Suppression mode, which we had to deal with very closely in the process of developing our own corporate messenger based on Skype for Business. And, most importantly, I will try to describe in detail what limitations we had to face.

How did it all start?


In the spring of 2014, our company had the idea to create a corporate instant messenger based on Lync (now Skype for Business). Rather, at first there was no discussion about the messenger, we just modified Lync for ourselves to work more efficiently. In fact, we used the Lync client in “normal mode”, and our application was just an add-on for it that managed contacts. It allowed you to conveniently place your favorite contacts across the entire width of the screen, which was convenient for work on desktops, assumed quick access to contacts and arranged them into groups. The application was called EasyLy (from "Easy Lync") and distributed among "its".

The first version of the program
Figure 1. First version of the program

Gradually, new functions were added to the application. For example, it was possible to correspond with both from Lync and EasyLy, and in the latter the history of correspondence was preserved. And one epoch-making day, it was decided to abandon the Lync interface and implement all of its functionality itself, so that the Lync track would remain only in the task manager. That is, we decided to make our own, more convenient instant messenger for Lync-based desktops. And everything seemed to start well.
')

What did we want to get in the end?


At the beginning, one of the main disadvantages of Lync for us was the absence of a more or less adequate mechanism for storing and viewing the history of conversations. Lync, of course, keeps (after a certain time) its history in Outlook, but it is extremely inconvenient to use. In addition, the story may not be saved at all, for example, if you close the window with a conversation before saving occurs.

As for usability, we preached the concept of “One click” to save user time and increase the efficiency of his work and tried to create the application as simple as possible, understandable and convenient for an office worker. The target group that we have identified for ourselves is not fashionable “mobile employees” running with the smartphone through the “fields”, but real office workers working for 8 hours behind a large monitor, where everything should be ergonomic.

In addition to the Favorites tab that appeared earlier, there were ideas to create the Groups, Dialogs tabs, as well as a call log with comments, an online meeting window, the ability to send a message to an offline subscriber, integration with calendars, OneDrive, and many other interesting features. . We planned, without discarding the existing Lync functionality (and then Skype for Business), to create additional value for the user through UI for desktops, quick access to existing functions and the creation of new corporate functionality.

This is how EasyLy looks now.
Figure 2. This is how EasyLy looks now.

Development


The first thing that was done was the “Favorites” tab, where the user could arrange all his contacts, and even sort them into groups.

We started to work and implemented this idea without any problems using Lync SDK 2013. We made all contacts in the form of cards on which you can view the list of meetings and meetings of this user, as well as call him (audio and video calls) or write a message. When clicking on these buttons, the standard Lync Conversation Window was invoked.

Hover contact icon
Figure 3. A hover contact icon

It was simple enough. Inspired by the success, we began to move on and completely abandoned the Lync UI (translated Lync client into UI Suppression mode). This gave us the opportunity to abandon the standard windows of conversations, calls (and indeed all windows) and implement all the basic functionality of the application itself.

I will not talk about the authorization of the user, the description can be found here . I'll tell you about our second and most important tab “Dialogs”, which we have been implementing for almost a year.

Conversations tab with multi chat enabled
Figure 4. Dialog tab with multi chat enabled

We began, as it should, with text conversations. Everything went well, but not very quickly, because, in addition to simply sending and receiving messages, it was necessary to implement typing, emoticons, support for rtf formatting, etc. The implementation of Lync IM Conversation can be taken from here .

We implemented saving messages and call records based on SQLite, which the user can flexibly manage. We also introduced support for several open chat rooms (up to 3) simultaneously in one window, for even more high-speed communication with employees.

Then we added support for audio, video calls, screen sharing and applications. Adding Application Sharing support to the conversation had to be implemented for a long time. In normal Lync mode, the screen is shown in the conversation itself, and in UI Suppression mode all the capabilities of the sharing need to be implemented by using the “Linko” ApplicationSharingView control, which is used to display the shared resource, which needs a parent window handle to work.

Here is a brief list of what we have done to support the sharing:
• Created a window for viewing the sharing, implemented a redrawing of the picture when the size of the parent window was changed.
• Concluded a list of resources (screen, applications) that can be fumbled.
• Stroke the framework of shared resources.
• Implemented additional features: for example, the transfer of control to a conference participant (so that he could drive with the mouse and click on the screen of the “fumbling” user).

Sharing in Lync (in UI Suppression mode) is a capricious thing: it likes to fall off often for unknown reasons, and when I switch to Skype for Business 2016 I started doing it almost constantly. When viewing the sharing, a black screen often appears, and nothing can be done about it, since the ApplicationSharingView control, which is written above, does the playback. Also, the successful launch of sharinga is strongly influenced by the connection speed.

Next, we moved on to creating the last tab, “Groups,” which would load the lists of groups from Lync and provide the user with the ability to fully edit and sort them in the required order. This tab was supposed to develop into a corporate tab in which groups for employees previously created in Active Directory (in Lync they are called Distribution Groups) would be placed: for example, “Order a pass”, “Write a statement”, etc. Participants in these groups are employees who deal with specific issues in the company. Clicking on this group opens a chat or audio call with the first member of the group with the status “online”. Editing these groups should be handled by the Lync server administrator.

Of course, in the process of implementing all our plans, we had problems that we periodically solved. But there was a special group of problems associated with the incorrect operation of the Lync SDK library in Lync Suppression mode. We sent their description to Microsoft and thought that we could get support and find a solution.

Problems




As it turned out, Outlook integration is lost in UI Suppression mode:
• lost contact status;
• there is no opportunity to create a conversation from the contact card;
• The “Create Skype meeting” button has fallen off.

Fully working contact cards in Outlook, we managed to return by relying on this article ( https://msdn.microsoft.com/ru-ru/library/office/jj900715.aspx?f=255&MSPPEerror=-2147217396#off15_IMIntegration_HowConnect ).

Also earned contact status. Now Outlook does not receive them from Lync, but from our application, but it updates them in some magical way, and they constantly “fall off” and stop synchronizing. That is, the person has actually appeared online and "green", and in Outlook it is still in the yellow status "Out." We wrote in support of Microsoft, to which they sent us a link to the same article. They also wrote to Yammer Microsoft, on the MSDN, Reddit forums and other sites ... Unfortunately, this problem has not been resolved.

The problem of the “Create Skype meeting” button that fell off in Outlook is wiping registry keys in UI Suppression mode along the path of HCU / Software / Microsoft / Office / 15.0 / Lync / ConfAddin / my sip /. There are three keys: Capabilities, InbandInfo, PublicMeeting. When Lync is running in normal mode, when you click on the Create Skype Meeting button, Outlook requests Lync conference information, and Lync already creates registry keys. In UI Suppresseion mode, Lync does not want to do this. Using Lync SDK 2013, you cannot get the necessary information from the Lync server. An exit was found: use another SDK ( https://msdn.microsoft.com/en-us/library/office/dn465943.aspx ) to work directly with the server. Through UCMA, we were able to obtain information about conferences from an authorized user from the server. Filled registry keys - and voila: the ability to create meetings has returned to Outlook. But in this way there are several limitations:
• UCMA library works only on 64-bit OS, on 32-bit OS - no solution;
• The user's computer and server must be in the same domain, otherwise you need to create certificates on the server for trusted applications. How to do this is described here , but this solution does not suit us, since we have to implement the functionality only on the client side.

There were bugs in the Lync SDK itself. Most critical: in the p2p video conversation when adding a 3rd party, the Lync client itself drops, steadily. Microsoft itself confirms this bug, but does not name the deadline for elimination. There were attempts to kill the p2p conversation and create a videoconference for three at once, but if the SFB client adds the 3rd participant, we cannot prevent this. Stopping and resuming the video channel also did not lead to anything.

Also, there was a problem that some users (those who have a different version of the Lync client) are unable to share the screen. This problem manifests itself as follows.

The first client works in our application (Lync version - 2013), the second one in SFB 2016, and when you open a conversation with the first one, the screen sharing button is unavailable. If the first client enters normal Lync 2013 (not Suppression mode), then the second sharing button becomes active. If the second also has Lync 2013 or our application installed, the sharing is available on both sides.

In the Lync SDK, there is no callback to deliver the message to the user. There is only a callback that the message is gone. But sometimes it can be a situation that we send a message to a person online, it leaves without an exception, but by the time the interlocutor arrives, it is already offline. Therefore, the sender thinks the message has arrived, and it is not.

“ItemNotFoundException” often occurs when receiving photo contacts, therefore, we have to display our standard contact image. Empirically, we found how many times (about 3) we need to call the photo retrieval code so that Lync will return it. However, for some contacts, this method still does not work. In addition, we introduced photo caching so that at the start a lot of exams will not spill if the user has added a lot of contacts.

There is a problem with user groups, in particular with the “Favorites group”. The problem is that for some users when calling CanInvoke (DeleteGroup) Lync returns true, although this is the standard Lync group, and it cannot be deleted. The type of this group is the same as that of the group created by the user (CustomGroup), so hiding the “Delete group” item from the menu also has to be done by additional checking for the group name, which is a hard crutch.

Revealed restrictions Lync SDK 2013


• One of the important features is not available: the ability to customize call forwarding when the user is offline. We implemented call forwarding after a certain time, but only if the user is not offline.
• With a group video call (3 or more participants), the stream that broadcasts the participants' video remains one (similar to mobile conferences), that is, Lync itself changes the video streams from different participants depending on who is speaking into the microphone now.
• File transfer is not available in UI Suppression mode. We solved this problem in 2 ways:
-added file transfer via Outlook in the form of an attachment to the letter;
- implemented the OneDrive service to upload files to the cloud and automatically send a message with a file URL.
• You cannot use the context data of the conversation (how to do this is described here https://msdn.microsoft.com/en-us/library/office/jj933248.aspx?f=255&MSPPEerror-2-2727217396 ) when the conversation was converted to a conference and exist on the server, not locally. We wanted to use this feature to synchronize various information between clients.
• The ability to write to the “Subject” field in the conference (and in the normal Lync) is disabled, for some reason in Lync 2013 they closed this feature. The person on MSDN complained that he had about 30 saved conferences in Lync 2010, each with its own title. With the transition to Lync 2013, he left only lists of participants in each conference. Now it is almost impossible to distinguish one conversation from another.
• Another feature of Lync SDK 2013 - customer support, starting with Lync 2013 and newer. Lync 2010 is not supported. However, Lync SDK 2010 works with Lync 2010, and with Lync 2013, and above. What logic is guided by Microsoft is unknown.

Conclusion


During the development process, we realized that we would not be able to fully implement the full-fledged analogue of Lync, based on the Lync SDK + UCMA. Even if we do not take into account the limitations of these technologies, it is a pity that we could not get support from Microsoft for fixing Lync SDK errors.

Today we are forced to abandon UI Suppression mode, since it is impossible to implement all the necessary functionality in it, and we are looking for ways to bypass the problems that have appeared.

I hope this article will help novice developers of applications based on Lync / Skype for Business. And, perhaps, someone from reading this will want to share their ideas. Write!

Material: Vyacheslav Nesterov

Source: https://habr.com/ru/post/306230/


All Articles