Friday, June 11, 2010

Communicator “14” Silverlight controls

Creating a Silverlight app with presence using the communicator “14”client, is really as easy as can be.

After installing the SDK in Visual Studio 2010 you get a new project type.
CaptureSL1 Then you can create a silverlight 3 or 4 application.
Capturesl2 Your newly created project has a sample page with all the controls.
CaptureSL4

The Controls

in the toolbar there is a new section with the available controls.
Capturesl3 
Everyone who has already seen the new Communicator “14” will see that the controls look really similar almost identical as the new Communicator ”14” Client

ContactCard

CaptureSLContact 
xaml
<controls:ContactCard Source="joachim.farla@e-office.com" />

ContactsList

CaptureSLContacts xaml
<controls:ContactsList Height="294" Width="600"/>

CustomContactsList and CustomContactsListitem

CaptureSLCustomContacts 
xaml
<controls:CustomContactsList Height="94" Width="297">
    <controls:CustomContactsListItem Source="Marc.Wetters@e-office.com" />
    <controls:CustomContactsListItem Source="Joachim.Farla@e-office.com" />
</controls:CustomContactsList>

PresenceAvailabilityIndicator

CaptureSLPresence 
xaml
<controls:PresenceAvailabilityIndicator
     x:Name="Presence"
     Source="marc.wetters@e-office.com"
     Margin="10,0" />
<TextBlock
     Text="{Binding DisplayName, ElementName=Presence}"
     Margin="10,0,0,0"/>

SearchInput

CaptureSLSearch xaml
 <controls:SearchInput x:Name="SearchTextbox" Width="500"/>

SearchResults

CaptureSLSearchresult1

CaptureSLsearchresult2

xaml
<controls:SearchResults Width="500" Height="200"
    ResultsSource="{Binding Results, ElementName=SearchTextbox}"
    ResultsState="{Binding SearchState, ElementName=SearchTextbox}" />

StartAudioConcersation

CaptureSLaudio

xaml
<controls:StartAudioConversation Source="joachim.farla@e-office.com" />

StartInstantMessagingConversation

CaptureSLmessaging

xaml
<controls:StartInstantMessagingConversation Source="joachim.farla@e-office.com" />

Hope this gives a good overview of the available silverlight controls. Next to these controls

Communicator “14” development

When starting to develop for Communicator client where do you start…

First you need to have the Communicator “14” client. Visual Studio 2010 with the tools for Silverlight and of course the Communicator “14” SDK.

Most developers who already want to start developing for the Communicator client don’t always have the possibility to setup a complete Communications server “14” environment.

So the big question is: can you use Communicator “14” with an existing OCS 2007 R2 environment?
Everyone who has tried and installed the client will say no, you can’t… It just doesn’t work. But this is only because the Communicator “14’" checks the server version!

But there is a way to disable the server check. This can be done with the following registry setting:

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Communicator]
"DisableServerCheck"=dword:00000001



Then you can use Communicator “14” and the SDK without the specific need for Communications “14” server. Specific Communications server “14” functionality won’t be available. But you can use the Silverlight and WPF controls.



sip:Marc.Wetters@e-office.com

It’s time to start Blogging again

Finally I have some time to start blogging again. And the upcoming Communications Server “14” and the new Communicator “14” are great Topics to blog about.

For client side development a lot has been changed in a very positive way. With the new Silverlight controls and the WPF controls which are included in the new Communicator SDK.

Server Side development with UCMA 3.0 has also made progress making the life for developers easier.

Friday, October 31, 2008

Speech Server 2007 vs UCMA v2.0 WF activites

Michael Dunn wrote a really nice article about the differences between UCMA v2.0 and Speech Server 2007, you can find this artikel here

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

Tags van Technorati: ,,

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.

http://msdn.microsoft.com/en-us/library/cc431501.aspx

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.
screenshot

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

sip:Marc.Wetters@e-office.com

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.

image

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
}
}



Let's Subscribe, the even package name is "vnd-microsoft-roaming-self".



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

working at e-office