Michael Dunn wrote a really nice article about the differences between UCMA v2.0 and Speech Server 2007, you can find this artikel here
Friday, October 31, 2008
Thursday, September 11, 2008
Microsoft just released 5 new UC development sample's
Integrating Web Chat Functionality
- Microsoft Unified Communications AJAX API Sample
http://www.microsoft.com/downloads/details.aspx?FamilyId=C8C3F762-7BE4-4541-9B18-82499DB61293&displaylang=en
WPF Presence Controls for Microsoft Office Communicator 2007
- Microsoft Office Communicator 2007 SDK Sample
http://www.microsoft.com/downloads/details.aspx?FamilyId=5001D612-533A-4721-91EA-DA990D94FF0F&displaylang=en
Dynamics CRM Integration
with Office Communications Server
http://www.microsoft.com/downloads/details.aspx?FamilyId=6E2EA762-A6C9-43BD-8C84-BF610073765C&displaylang=en
Customer Relationship Management (CRM) Activity
- Microsoft Unified Communications Managed API 1.0 Sample
http://www.microsoft.com/downloads/details.aspx?FamilyId=16303459-DD75-451F-B7C0-FB2EB0D9A84A&displaylang=en
Communicator 2007 Custom Tabs
- Microsoft Office Communicator 2007 Sample
http://www.microsoft.com/downloads/details.aspx?FamilyId=621C675C-46B7-4F68-ADDC-9F44E5594BFB&displaylang=en
Friday, September 5, 2008
Patrick passed away..
Although I didn’t knew Patrick in person, I always enjoyed watching him speak at conferences (really loved the dutch/belgian english accent he had:).
My deepest condolences to Patrick’s family, friends and his colleagues at U2U..
Thursday, July 10, 2008
OCSDKWrapper Project on CodePlex
George Durzi wrote a really nice wrapper for the Office Communicator SDK. He also included a sample application to get you started.
The Office Communicator SDK is actually pretty easy to use, but some parts could have been easier. Especially cleaning up when the connection is lost. Monitoring the status of the connection. Connecting to communicator.
And exactly that functionality he addressed with this OCSDKWraper.
Please check out his blogpost: OCSDKWrapper Project on CodePlex
Tuesday, July 1, 2008
Joachim just received the Microsoft MVP Award
I have to congratulate Joachim Farla for receiving the MVP award.
http://Unified-communications.blogspot.com
Marc
Getting/Setting presence protocols
About a month ago I downloaded all of the Microsoft Office Protocol Documents as a single zip file. I did the same today because I noticed that there were new version of these documents.
What really made me wonder was that it weren't the same number of documents. As I am especially interested in the sip protocols, I noticed that the protocols for getting presence weren't in there anymore.....[MS-SIP].
Turned out that they were moved to a different location.
For anyone who is interested: http://msdn.microsoft.com/en-us/library/cc239903.aspx
Presence Protocols
Microsoft has just released a final version of their presence protocols (the one I used for presence subscription with UCMA).
For any one who is interested in a deeper understanding of presence, this document can give you more insight.
Friday, June 27, 2008
WPF Presence Screen saver
Based on the WPF Custom Screen Saver Art artikel by Erik Klimczak on coding4fun, a colleague of mine, Michiel van Oudheusden decided to extend this screen saver to show real presence.
Showing presence icons and the friendly name of the user. Next to this presence there is a kind of notification for incoming messages. The icon is going to blink.
The presence information is build with Microsoft Office Communicator 2007 SDK.
You can download the source code of this C# sample project code from codeplex.
More information here.
For running this sample you have to need Office Communicator 2007 installed. This code doesn't run on 64 bit machines.
There is one strange thing I encountered. The presence only changes if there is an other product running that is integrating with communicator (Outlook).
For more information you can contact Michiel.van.Oudheusden@e-office.com or me sip:Marc.Wetters@e-office.com
UC Development Samples
For all who want to start developing UC apps here are some new samples from Microsoft.
Incoming Call Screen Pop
Microsoft Unified Communications Client API 1.0 Sample Registers for incoming calls and pops up another app based on the caller ID info.
http://www.microsoft.com/downloads/details.aspx?FamilyId=84AC7DD7-99D3-48F7-99D7-A281BD616407&displaylang=en
Presence in a Communications Web Client
Microsoft Unified Communications AJAX API Sample Shows how to use the UC AJAX Services API to put presence and IM into a web app.
http://www.microsoft.com/downloads/details.aspx?FamilyId=AEBFA4E2-B30E-43A6-BF34-6403465BC9A9&displaylang=en
Presence in Web Applications
Microsoft Office Communicator 2007 Automation API Sample Shows how to use the MOC automation API to show presence in web pages. Uses the name.ctrl that SharePoint uses as well as
the custom ActiveX presence control.
http://www.microsoft.com/downloads/details.aspx?FamilyId=32CA6DA5-42A2-4B96-B13C-644AD8256645&displaylang=en
Presence in Managed Applications
Microsoft Office Communicator 2007 Automation API Sample
Uses the MOC automation API and two custom WinForms controls to show
presence in WinForms apps and launch collaboration sessions.
http://www.microsoft.com/downloads/details.aspx?FamilyId=CBD51E8A-13BB-4F06-9CD5-E737E51E4B54&displaylang=en
Presence in Rich Clients
Unified Communications 2007 AJAX Service Sample Shows how to use the UC AJAX Services to provide presence and IM in a rich client app.
http://www.microsoft.com/downloads/details.aspx?FamilyId=7F11D95D-5AFD-4B8A-84AF-4B7A9720AADF&displaylang=en
Ethical Walls for Microsoft Office Communications Server 2007
Microsoft Office Communications Server 2007 API Sample Uses the OC Server API to show how to block sessions between specified users at the server level.
http://www.microsoft.com/downloads/details.aspx?FamilyId=070DBCAB-472A-4EC1-AEAC-9273ECCD70C9&displaylang=en
Custom Alerting
Microsoft Office Communications Server 2007 API Sample Uses a custom desktop client written using the UCC API and an alert sender written using the UCMA API to send alerts to users.
http://www.microsoft.com/downloads/details.aspx?FamilyId=9EFC784B-E443-4441-926C-5FD405D41BD9&displaylang=en
Group and Contact Management Using WMI
Microsoft Office Communications Server 2007 WMI API Sample Sample of using the WMI managment API for OCS to create and maintain contacts and contact groups for users.
http://www.microsoft.com/downloads/details.aspx?FamilyId=5FAF0725-7139-401C-A848-086A529CC78E&displaylang=en
Group and Contact Management Using Communicator Automation
Microsoft Office Communicator 2007 Automation API Sample Shows how to use the MOC automation API to manage users and groups on the client desktop.
http://www.microsoft.com/downloads/details.aspx?FamilyId=C334685A-4C9D-416F-BCFB-BD79613EE34C&displaylang=en
Office Communicator 2007 Automation API Capabilities
Microsoft Office Communicator 2007 Automation API Sample Shows some of the more advanced features of the MOC automation API such as custom conversation logging and causing incoming session windows to get focus.
http://www.microsoft.com/downloads/details.aspx?FamilyId=36E27ADD-D45E-4057-9CD6-7F62B792B0B6&displaylang=en
Thursday, June 12, 2008
Creating a CWA client with Silverlight 2: Upgrading from the beta 1 to beta 2.
First things I did was uninstalling Blend 2.5 March preview and the Silverlight 2 beta 1 Visual Studio tools.
Then Installed the Blend 2.5 June Preview end the Silverlight 2 beta 2 SDK.
I opened my existing Silverlight 2 beta 1 project. Got the question to convert it, converted it and I could build my solution without a problem.
No problems till I first started to run the project. Got the statement that I had to Uninstall the beta 2 and reinstall the beta. This was an easy problem to solve. When you upgrade from silverlight 2 beta 1 to the beta 2 the silverlight project is upgraded. But what wasn't upgraded was the web page that is hosting your silverlight app. This is easy to fix . In your web application properties remove and add your silverlight application.
Now you can start your silverlight application.
Invalid cross-thread access
It looked as if everything was working, until I logged in. Then I got an Invalid cross-thread access error.
Hmm something really has changed. In de Microsoft® Silverlight™ 2 Software Development Kit Beta 2 Documentation which has to be downloaded separately there is a list breaking changes between Beta 1 and the Beta 2.
In this case the changes on the HttpWebRequest caused the error. All delegates on the HttpWebRequest are changed to return on a background thread. If you try to update your UI from a background threat you get this error.
The solution
It's quite easy to handle this problem. On all Silverlight Controlls there is a Dispatcher property. Use this property to update your UI
this.Dispatcher.BeginInvoke(delegate()
{
//DO your UI update
});
That were the only things that I had to do upgrading from the beta 1 to the beta 2.
What's coming up next on silverlight beta 2 and CWA. The Beta 2 has a new tabbed control. I had created one my self and I will have a look how easy it is to use this new control.
For more information sip:Marc.Wetters@e-office.com
Friday, June 6, 2008
CWA Client with Silverlight 2 beta 2
I have been able to download Microsoft® Silverlight™ 2 Software Development Kit Beta 2 Documentation. And took a look at something what was really important for me in building a communicator web access with Silverlight 2.
The first thing I looked at was the support for Headers in the HttpWebResponse Class. And too bad it still isn't in there :-(.
For everybody asking why this is such a big deal. This would have made it possible to use silverlight HttpWebRequest/ HttpWebResponse and no need any more for the browsers / ActiveX XMLHttpRequest. So hosting Silverlight controls who access our CWA server still have to run on our CWA server :-( and we still have to develop our silverlight CWA client on a CWA server directly.
What is good is that Silverlight 2 beta 2 now has a tabbed control.
See also: Creating a CWA client with Silverlight 2 beta1 (part 1).
Please contact Marc Wetters @
Sip:Marc.Wetters@e-office.com or send me an email on Marc.Wetters@e-office.com . Enjoy and please feel free to give me your feedback.
Wednesday, June 4, 2008
CWA Client with Silverlight 2 beta 1 Update
Silverlight 2 Beta 2 is nearly here (out at the end of this week).
As soon as I get my hands on the Silverlight 2 Beta 2. I will try and update my application. And will post my findings to see if things have changed for the better.
Main things that should have been changed is the improved cross-domain access and the tabbed control will be introduced.
See also:Envision: Silverlight 2 Beta 2 and the competition
For more information sip:Marc.Wetters@e-office.com
Subscriptions using UCMA part 5: Enhanced Presence
This one is the real interesting one, how can you subscribe to enhanced presence. See also Subscriptions in UCMA part 3: Presence
The sample code here shows how to subscribe to one user. Actually this is a batch subscribe and is easy extensible for multiple users.
This one is much more complex then subscribing to presence using PIDF. The real thing here is enhanced presence. You can subscribe to multiple categories.
First let's create ISipSubscriptionProcessor again. We have to send a message and we have to set our signaling headers correct. This sample doesn't show how to handle the notification message.
public class PresenceSubscriptionEnhanced : ISipSubscriptionProcessor
{
private string _uri = "";
#region ISipSubscriptionProcessor Members
void ISipSubscriptionProcessor.GetExtensionHeaders(SipSubscription.RequestType requestType, out IEnumerable<SignalingHeader> extensionHeaders)
{
List<SignalingHeader> list = new List<SignalingHeader>();
list.Add(new SignalingHeader("Accept", "application/msrtc-event-categories+xml"));
list.Add(new SignalingHeader("Accept", "application/rlmi+xml"));
list.Add(new SignalingHeader("Accept", "multipart/related"));
list.Add(new SignalingHeader("Content-Type", "application/msrtc-adrl-categorylist+xml"));
list.Add(new SignalingHeader("supported", "eventlist"));
list.Add(new SignalingHeader("supported", "ms-piggyback-first-notify"));
list.Add(new SignalingHeader("Require", "adhoclist"));
list.Add(new SignalingHeader("Require", "categoryList"));
extensionHeaders = list;
}
void ISipSubscriptionProcessor.GetMessageBody(SipSubscription.RequestType requestType, out ContentType contentType, out byte[] messageBody)
{
contentType = new ContentType("application/msrtc-adrl-categorylist+xml");
string message = "<batchSub xmlns=\"http://schemas.microsoft.com/2006/01/sip/batch-subscribe\" uri=\"sip:Marc.Wetters@e-office.com\" name=\"\"> <action name=\"subscribe\" id=\"63792024\"> <adhocList> <resource uri=\""+_uri+"\"/> </adhocList> <categoryList xmlns=\"http://schemas.microsoft.com/2006/09/sip/categorylist\"> <category name=\"calendarData\"/> <category name=\"contactCard\"/> <category name=\"note\"/> <category name=\"services\"/> <category name=\"state\"/> </categoryList> </action> </batchSub>";
messageBody = System.Text.Encoding.UTF8.GetBytes(message);
}
void ISipSubscriptionProcessor.ProcessErrorResponse(SipResponseData message)
{
//TODO;
}
public void ProcessNotification(SipMessageData message)
{
string s = message.GetMessageBodyString();
//TODO
}
void ISipSubscriptionProcessor.SubscriptionStateChanged(SubscriptionStateChangedEventArgs eventArg)
{
//TODO
}
#endregion
public string Uri
{
get { return _uri;}
set { _uri = value; }
}
}
Let's subscribe.
public void SubscribePresence(string sip)
{
PresenceSubscriptionPIDF presenceSubscription = new PresenceSubscriptionPIDF();
presenceSubscription.Uri = sip;
SipEndpoint myEndpoint = _endPoint;
RealTimeAddress cgAddress = new RealTimeAddress(sip);
SipSubscription mySubScription = new SipSubscription(myEndpoint, cgAddress, "presence", presenceSubscription);
mySubScription.BeginSubscribe(BeginSubscribeCallback, mySubScription);
}
public void BeginSubscribeCallback(IAsyncResult asyncResult)
{
SipSubscription mySubscription = asyncResult.AsyncState as SipSubscription;
try
{
mySubscription.EndSubscribe(asyncResult);
}
catch (PublishSubscribeException)
{
//Error("An exception occurred when unregistering the session.\n{0}", endpoint.ToString());
}
catch (RealTimeException)
{
//Error("An exception occurred when unregistering the session.\n{0}", endpoint.ToString());
}
}
For more information/questions/remarks please contact me sip:marc.wetters@e-office.com
Subscriptions in UCMA part 4: Presence (PIDF)
In this part I'll show you how to implement subscriptions using PIDF. See also Subscriptions in UCMA part 3: Presence.
First we need as with all subscriptions the ISipSubscriptionProcessor.
public class PresenceSubscriptionPIDF : ISipSubscriptionProcessor
{
#region ISipSubscriptionProcessor Members
void ISipSubscriptionProcessor.GetExtensionHeaders(SipSubscription.RequestType requestType, out IEnumerable<SignalingHeader> extensionHeaders)
{
extensionHeaders = null;
}
void ISipSubscriptionProcessor.GetMessageBody(SipSubscription.RequestType requestType, out ContentType contentType, out byte[] messageBody)
{
contentType = null;
messageBody = new Byte[0];
}
void ISipSubscriptionProcessor.ProcessErrorResponse(SipResponseData message)
{
Console.WriteLine("error = " + message.ResponseCode);
}
public void ProcessNotification(SipMessageData message)
{
string s = message.GetMessageBodyString();
string status = "online";
string sip = "";
try{
XmlDocument doc = new XmlDocument();
doc.LoadXml(s);
XmlNamespaceManager nsmanager = new XmlNamespaceManager(doc.NameTable);
nsmanager.AddNamespace("p", "urn:ietf:params:xml:ns:pidf");
nsmanager.AddNamespace("ep", "urn:ietf:params:xml:ns:pidf:status:rpid-status");
nsmanager.AddNamespace("ci", "urn:ietf:params:xml:ns:pidf:cipid");
XmlNode node = null;
node = doc.SelectSingleNode("//p:presence", nsmanager);
sip = node.Attributes["entity"].Value;
node = doc.SelectSingleNode("//p:presence/p:tuple/p:status/p:basic", nsmanager);
if (node.InnerText == "closed")
{
status = "offline";
}
else{
node = doc.SelectSingleNode("//ep:activities/ep:activity", nsmanager);
status = node.InnerText;
}
}catch{
}
//TODO
}
void ISipSubscriptionProcessor.SubscriptionStateChanged(SubscriptionStateChangedEventArgs eventArg)
{
//TODO
}
#endregion
}
Let's subscribe:
public void SubscribePresence(string sip)
{
PresenceSubscriptionPIDF presenceSubscription = new PresenceSubscriptionPIDF();
SipEndpoint myEndpoint = _endPoint;
RealTimeAddress cgAddress = new RealTimeAddress(sip);
SipSubscription mySubScription = new SipSubscription(myEndpoint, cgAddress, "presence", presenceSubscription);
mySubScription.BeginSubscribe(BeginSubscribeCallback, mySubScription);
}
public void BeginSubscribeCallback(IAsyncResult asyncResult)
{
SipSubscription mySubscription = asyncResult.AsyncState as SipSubscription;
try
{
mySubscription.EndSubscribe(asyncResult);
}
catch (PublishSubscribeException)
{
//Error("An exception occurred when unregistering the session.\n{0}", endpoint.ToString());
}
catch (RealTimeException)
{
//Error("An exception occurred when unregistering the session.\n{0}", endpoint.ToString());
}
}
For more information/questions/remarks please contact me sip:marc.wetters@e-office.com
Subscriptions in UCMA part 3: Presence
This is the most interesting kind of subscription. There are actually 3 kinds of presence subscriptions with different kind of document formats:
- PIDF(Content-Type: application:pidf+xml)
- MSRTC(Content-Type: text/xml+mrstc.pidf)
- Enhanced presence(Content-Type: application/msrtc-event-categories+xml)
Each of these having more functionality/Information. PIDF(Presence Information Document Format) is the easiest to implement using UCMA. Where enhanced presence is actually the way to go. The other 2 are there for backwards compatibility. OCS server supports all 3.
The next two parts will cover how to implement subscriptions using PIDF and Enhanced Presence.
For more information please contact me: Sip:Marc.Wetters@e-office.com.
Friday, May 30, 2008
Subscriptions in UCMA part 2: Self
In Part 1 we have seen how we can subcribe to Roaming Contacts in this part we will take a look at Self subscription.
You may ask why do we want to subscribe to our self? actually Self subscription returns some important information. Which categories do we have set up. Which containers do we have and the membership of those containers. And who is subscribed to me. The last one can be very handy. For instance we have created a bot, and we want to tell everybody who is using it that it will be down for maintenance or that new functionality has been added.
This one is a little more difficult then the one we have seen in part 1. We actually have to send a message during the subscription.
The class implementing the ISipSubscriptionProcessor interface:
public class RoamingSelfSubscription : ISipSubscriptionProcessor
{
void ISipSubscriptionProcessor.GetExtensionHeaders(SipSubscription.RequestType requestType, out IEnumerable<SignalingHeader> extensionHeaders)
{
extensionHeaders = null;
}
void ISipSubscriptionProcessor.GetMessageBody(SipSubscription.RequestType requestType, out ContentType contentType, out byte[] messageBody)
{
contentType = null;
messageBody = new Byte[0];
if (requestType == SipSubscription.RequestType.Subscribe ||
requestType == SipSubscription.RequestType.Refresh)
{
contentType = new ContentType("application/vnd-microsoft-roaming-self+xml");
StringWriter sw = new StringWriter(new StringBuilder(128), CultureInfo.InvariantCulture);
XmlTextWriter writer = new XmlTextWriter(sw);
writer.WriteStartElement("roamingList");
writer.WriteAttributeString("xmlns", "http://schemas.microsoft.com/2006/09/sip/roaming-self");
this.AddRoamingType(writer, "categories");
this.AddRoamingType(writer, "containers");
this.AddRoamingType(writer, "subscribers");
writer.WriteEndElement();
sw.Close();
writer.Close();
messageBody = System.Text.Encoding.UTF8.GetBytes(sw.ToString());
}
}
void ISipSubscriptionProcessor.ProcessErrorResponse(SipResponseData message)
{
// TODO
}
void ISipSubscriptionProcessor.SubscriptionStateChanged(SubscriptionStateChangedEventArgs e)
{
//TODO
}
private void AddRoamingType(XmlTextWriter writer, string roamingType)
{
writer.WriteStartElement("roaming");
writer.WriteAttributeString("type", roamingType);
writer.WriteEndElement();
}
public void ProcessNotification(SipMessageData message)
{
String s = message.GetMessageBodyString();
//TODO
}
}
public void SubscribeRoamingSelf()
{
RoamingSelfSubscription mycgSubscription = new RoamingSelfSubscription();
SipEndpoint myEndpoint = _endPoint;
RealTimeAddress cgAddress = new RealTimeAddress(_endPoint.Uri);
SipSubscription mySubScription = new SipSubscription(myEndpoint, cgAddress, "vnd-microsoft-roaming-self", mycgSubscription);
mySubScription.BeginSubscribe(SubscribeRoamingSelfCallback, mySubScription);
}
private void SubscribeRoamingSelfCallback(IAsyncResult asyncResult)
{
SipSubscription mySubscription = asyncResult.AsyncState as SipSubscription;
try
{
mySubscription.EndSubscribe(asyncResult);
}
catch (PublishSubscribeException)
{
//TODO
}
catch (RealTimeException)
{
//TODO
}
}
For more information/questions/remarks please contact me sip:marc.wetters@e-office.com
Subscriptions in UCMA Part 1: Roaming Contacts
Looking at the UCMA 1.0 SDK stated that it is possible to use subscriptions. The only thing that is missing is how to implement them? What do we need to send? What do we get back?
For this information you have to dig deep into the protocols.
Recently Microsoft published preliminary versions of these protocols. You can find them here: Office Protocol Documents. It's almost 90 Mb in PDF documents :-(.
For me the most important subscriptions are at the moment: "Roaming Contacts", "Self", and the most important one "presence".
This part I'll focus on Roaming Contacts. This subscription returns all the groups and contacts you are subscribed to.
First we have to create a class that implements the ISipSubscriptionProcessor. Next to setting the message and the SignalingHeaders, the main thing for this class is handling the notifications.
public class RoamingContactsSubscription : ISipSubscriptionProcessor
{
void ISipSubscriptionProcessor.GetExtensionHeaders(SipSubscription.RequestType requestType, out IEnumerable<SignalingHeader> extensionHeaders)
{
extensionHeaders = null;
}
void ISipSubscriptionProcessor.GetMessageBody(SipSubscription.RequestType requestType, out ContentType contentType, out byte[] messageBody)
{
contentType = null;
messageBody = new Byte[0];
}
void ISipSubscriptionProcessor.ProcessErrorResponse(SipResponseData message)
{
//Not implemented
}
void ISipSubscriptionProcessor.SubscriptionStateChanged(SubscriptionStateChangedEventArgs e)
{
//Not implemented
}
public void ProcessNotification(SipMessageData message)
{
String s = message.GetMessageBodyString();
ContentType contentType = message.ContentType;
// TODO; Do somthing with the notification message!!!
}
}
Next we have to subscribe. For this code I already registered an endpoint. The event package name is : "vnd-microsoft-roaming-contacts"
public void SubscribeRoamingContacts()
{
RoamingContactsSubscription myRCSubscription = new RoamingContactsSubscription();
SipEndpoint myEndpoint = _endPoint;
RealTimeAddress RCAddress = new RealTimeAddress(_endPoint.Uri);
SipSubscription mySubScription = new SipSubscription(myEndpoint, RCAddress, "vnd-microsoft-roaming-contacts", myRCSubscription);
mySubScription.BeginSubscribe(SubscribeRoamingContactsCallback, mySubScription);
}
private void SubscribeRoamingSelfCallback(IAsyncResult asyncResult)
{
SipSubscription mySubscription = asyncResult.AsyncState as SipSubscription;
try
{
mySubscription.EndSubscribe(asyncResult);
}
catch (PublishSubscribeException)
{
//TODO
}
catch (RealTimeException)
{
//TODO
}
}
That is actually all. Here is a sample of the Notification message:
<contactList deltaNum="4">
<group id="1" name="~" externalURI="" />
<contact uri="Joachim.Farla@e-office.com" name="" groups="1" subscribed="true" externalURI="" />
<contact uri="Marc.Wetters@e-office.com" name="" groups="1" subscribed="true" externalURI="" />
</contactList>
Next Part will be self subscribe.
For more information/questions/remarks please contact me sip:marc.wetters@e-office.com
Thursday, May 29, 2008
Getting and setting presence using UCMA
After publishing the first 2 articles about getting and setting presence using UCMA, Paolo Tuninetto came up with a scenario in which it didn't quite behaved the way I expected it to be.
If you did set the presence of your application it did show up online in the OC Clients. If you were getting the presence of some one using the OC client it got the correct presence back. That was the scenario I used and tested.
But if you set the presence using one application and getting it with an other the way I described it. It didn't work. Still in the OC client the correct presence was set.
So what was going on? Actually the problem was in both the setting and getting the presence. Getting the presence the way I described uses the old (legacy) way of getting presence. And we set the presence using the new (enhanced presence) way.
The solution was either getting the enhanced presence or setting the legacy presence. Actually it's better to do both. The way I was getting the presence only supports the old way. The best way for getting presence is actually subscribing to presence, which I will address in an other article.
So we had to set the legacy presence also.
This is almost the same as publishing the enhanced presence, except that the category is different.
string PresenceBlobLegacy = "<publish xmlns=\"http://schemas.microsoft.com/2006/09/sip/rich-presence\"><publications uri=\"{0}\"><publication categoryName=\"legacyInterop\" instance=\"0\" container=\"{1}\" version=\"{2}\" expireType=\"user\"><legacyInterop availability=\"3500\" /></publication></publications></publish>";
For more information contact sip:marc.wetters@e-office.com
What's coming up...
I've been really busy with a lot of questions and issues regarding to UC development. Here is a short overview of what I've been working on and what you can expect from me the next few weeks.
CWA and Silverlight 2 beta 1.
I'm still working on this one here is a screenshot of the current application:
Next part of this series will show you how to handle presence events.
UCMA
After publishing the articles about how to get and how to set presence, I got a series of questions and issues. To solve these I had to take a deep dive into the presence and SIP protocols. Microsoft recently published preliminary versions of these protocols.
Here is a list of the things I worked on:
- Getting and Setting presence(update article coming soon)
- Subscriptions
- self(Categories, Containers, Subscribers)
- roaming contacts (groups and contacts)
- presence (in fact there are 3 ways how you can implement presence subscriptions).
- ContainerMembership
For more information contact sip:marc.wetters@e-office.com
Friday, May 23, 2008
Using UCMA to create a custom routing bot!
Using UCMA to create a custom routing bot!
Scenario (case):
A service/help desk wanted to expand their services using OCS as an extra communication channel. The big question in this case is how can we use a single point of entry for the employees who want to connect to the service desk? How can we show that the service desk is online? How do we make sure that an available service desk employee gets the question/incoming messages? How can we maintain the pool of service desk employees?
Solution:
Create a custom application using UCMA . This application registers itself as THE service desk. If one of the employees of the service desk is online/available the service desk is online/available. If none of the employees is online the application shows itself as offline. If somebody sends a message to the service desk the message will be routed to the next available service desk employee. We wanted this to use for text messages but also for incoming video and audio calls.
Example application:
For demo purposes we created a Windows application.
In this case, if at least one of the 3 users is online/available the application is online. The colors show the availability of the different users.
If we send a message to the application (in this case TUser4), we are routed to the next available user.
The logic to which person to route is build in the application.
The biggest technical problems we encountered:
1. How can set the presence of the application.
2. How can we get the status of the different users in the “pool”.
3. Even better how can subscribe to the presence of the users in the “pool”.
4. How can we refer the incoming session to a different user.
The solution for these problems:
1. You can set the presence using the UCMA api by creating a presence container(this is done by a SipServiceRequest) , after the presence container is created you can publish the presence ( also a SipServiceRequest) .Setting Pressence using UCMA
2. If you want to get the status of a user in the “pool” you can send a SipServiceRequest to the user from which you want to know the presence. See also Getting presence using UCMA
3. Subscribing to presence was really a difficult one. In this case we used a SipSubscription and a class implementing the ISipSubscriptionProcessor interface.
4. At the moment you cannot refer a SignalingSession to a different user(OC client doesn’t support it). So there are two scenario’s. Use the application to set up a session from the application and proxy Instant messages back and forth through the application. This only works for instant message and not for audio and video calls. So the other solution is that to use TerminateWithRedirection on the incoming SignalingSession this also works with audio and video calls.
At this moment I cannot get deeper into the exact details of the SipServiceRequest , SipSubscription , ISipSubscriptionProcessor we used in this application.
Microsoft says that it is not possible using the UCMA to get the presence or subscribe to presence. But actually it is, if you know the exact protocols to use!!!!
For more information contact sip:marc.wetters@e-office.com
Setting Presence using the UCMA
Using the UCMA there are actually 2 ways in setting the presence.
The first one found in the Microsoft samples is as an automaton. This means that you tell the OCS server that your presence won't change. This is usefull for creating bots. They are normally always online.
But what is your application isn't always online. What if you only want your bot to be online during business hours.
So I will focus on setting the presence not as an automaton.
First you have to register your end-point.
Let's define some constants. The real change here is "expireType". which is set to user and not endpoint!
Constansts
public const string CategoryPublicationContentType = "application/msrtc-category-publish+xml";
public const string ContainerMemberContentType = "application/msrtc-setcontainermembers+xml";
public const string PresenceBlobUser = "<publish xmlns=\"http://schemas.microsoft.com/2006/09/sip/rich-presence\"><publications uri=\"{0}\"><publication categoryName=\"state\" instance=\"0\" container=\"{1}\" version=\"{2}\" expireType=\"user\"><state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"aggregateState\"><availability>{3}</availability></state></publication></publications></publish>";
public const string ContainerMembership = "<setContainerMembers xmlns=\"http://schemas.microsoft.com/2006/09/sip/container-management\"><container id=\"{0}\" version=\"{1}\"><member action=\"add\" type=\"sameEnterprise\" /></container></setContainerMembers>";
public const int PresenceContainer = 7000;
public enum PresenceState
{
Online = 3500,
DoNotDisturb = 9500,
Offline = 18500
}
Next is setting up the presence container.
public void SetupPresenceContainer()
{
SipEndpoint endpoint = _endPoint;
if (endpoint != null)
{
ContentType contentType = new ContentType(Constants.ContainerMemberContentType);
string ContainerACL = String.Format(Constants.ContainerMembership, Constants.PresenceContainer, _presenceContainerVersion);
byte[] body = Encoding.UTF8.GetBytes(ContainerACL);
SipServiceRequest request = new SipServiceRequest(endpoint, contentType, body);
request.BeginService(SetupContainerCallback, request);
}
}
private void SetupContainerCallback(IAsyncResult ar)
{
SipServiceRequest request = ar.AsyncState as SipServiceRequest;
try
{
request.EndService(ar);
}
catch (FailureResponseException e)
{
string s = e.ResponseData.GetMessageBodyString();
s.IndexOf("curVersion");
string s2 = s.Substring(s.IndexOf("curVersion") + 12, 10);
string[] array = { "\"" };
string[] s3 = s2.Split(array, 2, StringSplitOptions.None);
_presenceContainerVersion = int.Parse(s3[0]);
SetupPresenceContainer();
}
catch (RealTimeException )
{
}
}
Now it's time to set our Presence
public void PublishPresenceState(PresenceState availability)
{
if (_endPoint != null)
{
int availabilityValue = (int)availability;
ContentType contentType = new ContentType(Constants.CategoryPublicationContentType);
string presenceBlob = String.Format(Constants.PresenceBlobUser, ConnectionSettings.Uri, Constants.PresenceContainer, _presenceVersion, availabilityValue);
byte[] body = Encoding.UTF8.GetBytes(presenceBlob);
SipServiceRequest request = new SipServiceRequest(_endPoint, contentType, body);
request.BeginService(PublishPresenceStateCallback, request);
}
}
private void PublishPresenceStateCallback(IAsyncResult ar)
{
SipServiceRequest request = ar.AsyncState as SipServiceRequest;
try
{
request.EndService(ar);
}
catch (PublishSubscribeException e)
{
// This exception is most likely due to a version conflict. Parsing the Response body
// to retrieve the current version, and publish again.
string s = e.ResponseData.GetMessageBodyString();
s.IndexOf("curVersion");
string s2 = s.Substring(s.IndexOf("curVersion") + 12, 10);
string[] array = { "\"" };
string[] s3 = s2.Split(array, 2, StringSplitOptions.None);
_presenceVersion = int.Parse(s3[0]);
PublishPresenceState(_presence);
}
catch (RealTimeException)
{
}
}
For more information contact sip:marc.wetters@e-office.com
Monday, May 19, 2008
Unified Communications (UC) Platform Developer Metro Training
Last week I followed this 2 day training in the Netherlands. It really gives developers a good overview where to start. If you want to start developing on the UC platform, I really recommend that you follow that training. I have been working with some of the SDKs and APIs a little longer and still learned quite a bit.
Main topics are:
- Unified Communications: Behind the Scenes with OCS 2007, OC 2007 and Exchange 2007
- Driving Contextual Collaboration with OC 2007
- Building Contextual Collaboration Clients for the Web using the UC AJAX SDK
- Building Asynchronous Contextual Collaboration with Exchange Web Services
- Business Process Communication with the UCMA
- Anywhere Information Access with OCS 2007 Speech Server
Any questions/ comments please feel free to contact me.
Sip:Marc.Wetters@e-office.com or email:Marc.Wetters@e-office.com
Getting Presence using the UCMA
Yes, it can be done, but I have to warn. It is not officially supported by Microsoft.
Here is a code sample how to do it using a SipServiceRequest. Note that you must have created an endpoint before you can use this code. I used a RealTimeClientConnectionManager to create the endpoint.
The request:
The callback, which handles the response data.
Any questions/ comments please feel free to contact us.
Sip:Marc.Wetters@e-office.com or email:Marc.Wetters@e-office.com or Sip:Joachim.Farla@e-office.com or email:Joachim.Farla@e-office.com.
Developing middle tier UC applications, where to start?
This is not an easy question. There are multiple SDK’s and API’s, which one should I use in which scenario?
I have been in discussion with some UC developers and people from Microsoft about some of the issues I was facing, and what the possible solutions are.
The first API that comes to my mind is the UCMA (Unified Communications Managed API). The second would be the UC AJAX SDK. Then we have the UCCA (Unified Communications Client API) and the OC (Office Communicator SDK).
The UCCA and OC SDK are client oriented. The UCCA is the one to create a new client if you don’t want to use the Office Communicator client. The OC SDK is to interact with the Office Communicator client. So for creating middle tier UC applications these are not really suited.
I have been in discussion with some UC developers and people from Microsoft about some
Let’s try and start with some scenario’s.
Broadcasting messages
This should be an easy answer. Let us use the UCMA. The UCMA is really a good choice, it’s intended to for such a scenario. It can handle high volumes and is scalable. However, it is not the only possible API to use. What about the UC AJAX SDK, can it do the trick? Sure it can, as long as you stick to text messages. Can it handle high volumes, and is it scalable? Does it perform well? In fact it does. I do not have exact figures, but I am really surprised of the performance. And the UC AJAX SDK is much easier to understand then the UCMA. What are the drawbacks of using the UC AJAX SDK? Only two come to my mind: you can only use text message and you need a CWA (Communicator Web Access) server.
Bots
First one again the UCMA. But in fact the UC AJAX SDK can be used as well. In this case, the reaction time of the UC AJAX solution reacts a little slower then the UCMA solution. This is caused by the polling mechanism for getting events. The advantage of the UCMA is that you can set the presence as an automaton(Always online). Normally there is a limit of 200 subscriptions. Publishing your presence as an automaton doesn’t have that limitation.
You can use the System.Speech in .NET 3.0 to handle more complex grammar recognition.
Bots that needs presence
Now we get to the real discussion. Can we use the UCMA? Officially getting presence and subscribing to presence is not supported in the UCMA!!!
So what are the alternatives? You could use the UCMA and use UC AJAX SDK for getting presence information. This is a good combination, and you could use the advantages of both. If you only need text messages, the UC AJAX SDK is a good choice.
UCMA and presence!!!
Presence in Office Communicator server is done with sip requests and sip subscriptions. I have seen a lot of questions on the net if it is possible to get presence using the UCMA. Everybody at Microsoft I have spoken to or reactions that have been posted to these questions stated that presence information in UCMA is not possible. My first reaction was why is it not possible? The UCMA supports sip requests and sip subscriptions. At that time, I took a deep dive in the protocols and tried to find out if it was really not possible. Can you make the correct sip request or sip subscription in UCMA to get presence? Using the Office Communicator Server Resource kit I found out that actually you can.
I presented my findings to some people at Microsoft. They were surprised. In fact you can do it but it is officially not supported. For me the big question was why is it not supported. Actually the answer is quite simple. The correct protocols for presence are not public. The only applications that use those specific protocols are all Microsoft applications. For future versions these protocols can be subject to change. So the application you create may not work anymore with future versions or updates.
Will it keep me from using these protocols und keep me from using UCMA for presence? No it will not. And the main reason for that is that the Office communicator client, the CWA server, Office Communicator server, the UCCA all use the same protocol. If Microsoft will change that protocol none of these applications will be compatible anymore with the new version.
Any questions/ comments please feel free to contact us.
Sip:Marc.Wetters@e-office.com or email:Marc.Wetters@e-office.com or Sip:Joachim.Farla@e-office.com or email:Joachim.Farla@e-office.com.
Creating a CWA client with Silverlight 2 beta 1 (part 5)
In Part 4 we have seen how to get events from the cwa-server. But we still have to schedule this. The pollWaitTime tells us when we can get our next events.
You could use the System.Windows.Threading.DispatcherTimer but this ticks with a regular interval and as our interval is dynamic I went for a stroryboard in Silverlight.
Creating the timer
Just add a story board to XAML in your application/usercontrol.
In the code file add the code that handles the TimerCompleted Event. In this Method we set the timer duration stop the timer, get our events and start the timer again.
We still have to start our timer manually the first time. We can only do this only after we have signed in. So from our userAgent we raise our event that we have successfully signed in. Then start our timer. As you can see in that eventhandler I also hide our login part.
Creating the User controls
So now let’s finally start and do something in the UI. We have our Page.xaml. Just add a StackPanel and name it Contacts . In this StackPanel we want to show our groups and contacts belonging to these groups. A way of doing this is creating 2 usercontrol. A GroupControl and a ContactControl.
In Part 4 in our userAgent class we created events we raise when we get groupEvents and contactEvents. In the first event we get from our server we first get back the groups and then our contacts belonging to that groups. In the presenceEvent, which probably will be addressed in one of the next parts of this series, we get detailed information of these contacts and status information. For now we only get the sip uris and to which groups the contact belongs.
Let’s create our contactControl.
As you can see this is simple control. For the status indication I use an Ellipse with brush. I added a name attribute to the gradient stop color. This makes it easier to change the status color later on.
This control will be extended later with a private method, which changes the color depending on the availability of the user. If we do not have a display name yet we just show the sip address of the contact.
Create the GroupControl. Again with some sample xaml and the code belonging to that user control.
Adding event handlers.
Let’s get back to our main page. In one of the first parts we created the login boxes and a button to signin. After clicking that button we create an instance of our UserAgent, sign in and handle our events. As you see below the GroupEvent and ContactEvent.
GroupEvent
Let’s Handle our group events. For now I only handle the added action.
ContactEvent
Let’s Handle our contact events. For now I only handle the added action. As you can see I use an extra function to find the correct control.
Please note that this is a series how you can create a cwa silverlight application, not a complete sample yet. Next part of this series will show you how to handle presence events.
Any questions/ comments please free to contact us.
Sip:Marc.Wetters@e-office.com or email:Marc.Wetters@e-office.com or Sip:joachim.farla@e-office.com or email:Joachim.Farla@e-office.com.
Creating a CWA client with Silverlight 2 beta 1 (part 4)
In Part 3 we have seen how to setup our session. In this part we’re going to get the events from the server. In this case we are not going to use synchronous calls, but asynchronous calls. We do not want to block our UI thread.
Let’s get back to our UserAgent class and create our CheckEvents Method. If there is still a request to the server running, don’t create a new request. You get some internal error you can’t catch!!!
This has to be a public Method. I’ll explain in the next Part why. But First we have to create our data channel Url.
The datachannel url needs two parameters we have to provide.
Of course the Sid (the id of the session we created) and the AckID (acknowledge ID).
With the AckID we let the CWA server know which events we already got. If we don’t send the new acknowledge ID with our request, we get all events over and over again.
Next create our CkeckEvents method.
So we got our response. Let’s handle the response stream we got back.
First thing you see is that we get the ackID from the response. We’ll send it with the next request we make. Let’s process our ContactGroups.
Next is we have to create a user class and a group class so we can store our information. Then we have to create extra eventArgs so we can raise Events to our Silverlight application to handle them in our UI.
So we now we can handle some events. Next is how we can set a timer to get call the CheckEvents Method and do something in our Silverlight application to actually show we got something back.
We going to make a start with that in the next Part of this series.
Please note that this is a series how you can create a cwa silverlight application, not a complete sample yet.
Any questions/ comments please feel free to contact us.
Sip:Marc.Wetters@e-office.com or email:Marc.Wetters@e-office.com or Sip:Joachim.Farla@e-office.com or email:Joachim.Farla@e-office.com
Creating a CWA client with Silverlight 2 beta1 (part 3)
In Part 2 we created the logon request and send it. We got our CWA-ticket(authentication ticket) back. We will need this for all future request.
Now let’s do something with the response.
The method above will be used for all synchronous request. In this sample for logging in, creating a session. And for all commands we send to the cwa server.
When we login we get the Uri(our sip address) back belonging to the authentication information we used to login. And we get our signInData back. We need this for Initiating our session.
The other 2 things I handle in processing the response are the SID (session ID) we get that back from after initiating our session. And the PollWaitTime, this I will address in part 4.
Now we are authenticated next step is to set up a session.
This looks pretty the same as login in, but it uses a different request and a different url to send the request to. We need to add some code to the things we did in Part 2.
First the url we add to our UserAgent class.
Next is adding functionality to our Request builder. And to our constants.
So now we have setup our session. Next is to let our main application know that we successfully created the session. As you can see I raise an event in our UserAgent class. Our main Silverlight can handle that event. Hiding the login textboxes. Intializing our main UI.
What do we need for raising that event.
Now we have our session. We know how to send commands to the server. Next is checking for events from the server. Which we want to do asynchronously. That is going to be Part 4 of this series.
Any questions/ comments please feel free to contact us.
Sip:Marc.Wetters@e-office.com or email:Marc.Wetters@e-office.com or Sip:Joachim.Farla@e-office.com or email:Joachim.Farla@e-office.com