Category Archives: Code

Code – PowerShell in C# – Part 01 of 05

(blog article under construction)

This post is part 1 of a series of 5 on writing C# applications using PowerShell modules of Skype for Business Server 2015.

I used Microsoft Visual Studio Community 2015 running Windows 10 and targeted Windows Desktop Application to .NET Framework 4.6.1.

We assume the “Skype for Business Server 2015 – Administrative Tools” are installed on your machine. they can be installed from the Skype for Business Server 2015 ISO file. After installation there is a directory with module “C:\Program Files\Common Files\Skype for Business Server 2015\ModulesSkypeForBusiness\SkypeForBusiness.psd1”.

In the App.config nothing special, just reference to .NET Framework 4.6.1.

App.config

Continue reading

Code – Sonus in C# – Part 01 of 05

This post is part 1 of a series of 5 on writing C# applications using Sonus API.

I used Microsoft Visual Studio Community 2015 running Windows 10 and targeted Windows Desktop Application to .NET Framework 4.6.1.

The REST APIs are provided for developers who want to programmatically integrate the Sonus SBC 1000/2000 into their application, and for administrators who want to script interactions with the Sonus SBC 1000/2000 gateway.

Sonus SBC 1000/2000’s REST APIs provide access to resources via URI paths. To use a REST API, your application makes HTTPs requests and parses the responses. Currently, the only supported response format is XML. Methods used by developers are standard HTTP methods such as GET, PUT, POST, and DELETE to communication resources.

In the App.config nothing special, just reference to .NET Framework 4.6.1.

App.config

Continue reading

Code – UCWA in C# – Part 01 of 05

This post is part 1 of a series of 5 on writing C# applications using UCWA 2.0.

I used Microsoft Visual Studio Community 2015 running Windows 10 and targeted Windows Desktop Application to .NET Framework 4.6.1. The application illustrates the steps like autodiscover both internal and external and the different steps involved to logon. Next some examples of using resources like Note, Location, Presence and sending a Hello World IM as well as Call via Work.

In upcoming posts more advanced code, handling redirects, implementing event channels, keeping the application alive and handle both incoming and outgoing conversations.

Later on more complete implementation of the remaining documented features of UCWA implemented, and how to access the less documented modalities such as audio and video.

In the App.config nothing special, just added the defaultProxy allowing my program to run in our company behind firewall and proxy server that would else block HTTPS traffic.

App.config

Continue reading

Code – Desktop Apps – Site By Site

I used Microsoft Visual Studio Community 2015 running Windows 10 and targeted Windows Desktop Application to .NET Framework 4.6.1. First I downloaded the Desktop Client SDK and used 7-ZIP to extract the content of the ‘lyncsdk.exe’ distribution. The ‘lyncsdk64.msi’ installed fine on my development environment providing the assemblies needed. The can be found in ‘C:\Program Files (x86)\Microsoft Office 2013\LyncSDK\Assemblies\Desktop’.

While exploring the capabilities of the desktop client API, I wanted to be able to run two instances of Skype for Business client on a single desktop. As far as I am aware this is not available out-of-the-box.

Took some time to get everything right but here is the result. On the right-hand site one instance running the official client 15.0.4711.1000, on the left-hand site a second instance running my own C# custom client version 0.0.0.1. Thus two ‘lync.exe’ instances active with different AD credentials. To be honest not yet the full functionality, things like white boarding and application sharing are not yet implemented. But I only needed this to test IM, audio and video conversations during demo on the road using a single desktop. And convincing to evangelise the power of Skype for Business Development Platform for customers that primarily focus on the infrastructure aspects of the platform.

I will not duplicate the entire process of developing applications using Lync 2013 SDK and UI suppression, as these is very well documented and many excellent code samples are available online.

The key take-away of this BLOG post and only line of code is specifying GetClient(true) instead of GetClient() as show below.

Site by Site

So creating a side-by-side endpoint is a one step process that involves calling the static LyncClient.GetClient method, except that you pass a boolean true value in the method if you want a side-by-side endpoint. If you do not provide an argument to this method, the default argument value of false is passed and a standard Lync endpoint is created.

The remaining is business as usual to write a UI suppressed application, although it takes quite some effort to have the user interface exactly as the Skype UI as in client 15.0.4711.1000.

If you run Site by Site mode you will see in Explorer in folder “C:\Users\…\AppData\Local\Microsoft\Office\15.0” next to the usual “Lync” also a “LyncSideBySide” directory structure. In fact up to 4 instances can run simultaneously.

More information can be found on https://msdn.microsoft.com/en-us/library/office/dn133125.aspx.

Code – UCWA in C#

I will publish in the upcoming months C# software I have developed based upon UCWA 1.0 and UCWA 2.0 showcasing advanced integration scenarios in on-premise environments, based upon UCWA documentation (and with a little help of Fiddler for the undocumented modalities).

Revisit this page when the Application API and JS UC Controls, UCWA JS OM, UC Controls, UCWA Mobile OM become generally available, with more options in Hybrid or Office365 environments.

I was inspired by the blog and movie of Tsuyoshi Matsuzaki san – my basic skills of the Japanese language acquired during previous employment at company NEC was most helpful to understand his point. Also the specs at MS-OCDISCWS and article of Graham Cropley explaining the discovery process.

In the meantime I recommend reviewing the basic introduction samples available on Microsoft Developer Network

  • Create UCWA Windows Store apps using C#/XAML and XML: info, code
  • Open an event channel in a UCWA app using C#/XAML and XML: code

© Microsoft Developer Network – Apache license, version 2.0
Continue reading

Code – MSPL – Forward

When replacing traditional PBX by Skype for Business Server 2015, typically legacy PBX vendors struggle to survive attempting to identify missing features. Indeed out of the box its challenging to fork or forward calls on analoge devices. But a sample MSPL script as shown below proves the openess of the Skype for Business Server 2015 platform with just a few lines of code and notepad. The prototype below illsutrated call forwarding on originator and destination, controlled with a few definitions in a text file.

PowerShell

Continue reading

Code – MSPL – Pincode dialing

When migrating hospitals from traditional PBX to Skype for Business Server 2015, a typical question occurs to preserve existing legacy PSTN features. For instance patients receive at check-in a PIN code that can be used to authenticate before making external PSTN calls and bill call expences. The prototype below illustrates a prototype handling such requirement using MSPL scripting. A 6 digit pincode is stripped from called number and validated againts valid pincodes defined text file. I a production enviroment typically handled with some managed code integrating with inhouse PMS system. The approach is technology neutral, and is valid from low-cost analoge phones up to UI suppressed Bed Site Terminals on top of Lync 2013 client or even UCWA based Bed Site Terminal.

PowerShell

Continue reading