Parsing Lync-Published Category Instances

The following table shows how to parse some of the presence category instances published by Lync.

Category Name

Presence Data

Description

calendarData

freeBusy information

Lync 2010 describes the contiguous block of free and busy time slots according to the user’s calendar. This block of free-busy time slots is described by a Base64 encoded string of a stream of binary bits. Every 2 bits represent the smallest unit of time (or the smallest time slot). Four types of distinct time slots are used. Each represents a time when the user is free, tentative busy, busy, or out of office (OOF). The corresponding binary bits are 00, 01, 10, and 11, respectively. Thus, if the time slot is 15 minutes, a contiguous one-hour block of 30 minutes free and 30 minutes busy is described by a stream of binary bits of 00001010. The corresponding Base64 encoded string value is "Cg==".

The following is an example of a calendar data containing a freeBusy block

<calendarData xmlns="https://schemas.microsoft.com/2006/09/sip/calendarData"
        mailboxID="johnD@exchange.contoso.com">
   <freeBusy startTime="2009-11-18T08:00:00Z" granularity="PT15M" encodingVersion="1">AAAAAAAAAAAAAAAAAAAAVQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVQoAqqoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</freeBusy>
</calendarData>

In this example, the length of the smallest time slot is 15 minutes that is specified by the granularity attribute PT15M value, where PT stands for Pacific Time. The user is identified by the mailboxID attribute johnD@exchange.contoso.com value. And the free-busy block starts at midnight of the US Pacific time on November 18, 2009, which is specified by the startTime attribute. Once properly decoded, the length of the entire free-busy block is 96 hours, which can be determined by counting the number of bytes in the Base64 encoded string.

state[@type='aggregateState']

Availability

Lync 2010 interprets the received availability number as follows:

Availability number rangeAvailability modeDescription
0-2999UndefinedThe contact is not found in the network.
3000-4499AvailableThe contact is willing and able to communicate.
4500-5999Available - IdleThe contact is willing but may be unable to communicate.
6000-7499BusyThe contact is able but may be unwilling to communicate.
7500-8999Busy - IdleThe contact is able but may be unwilling to communicate
9000-11999Do Not DisturbThe contact is able but unwilling to communicate.
12000-14999Be Right BackThe contact is willing but unable to communicate.
15000-17999AwayThe contact is unable to communicate.
18000 and higherOfflineThe contact is not connected to the network.

Standard Activities

Lync 2010 interprets the received activity tokens as the following standard activity strings, if the activity element is not specified in a received aggregateState instance:

Standard activity tokenStandard activity string
in-a-meetingIn a meeting
In-a-conferenceIn a conference
on-the-phoneIn a call
out-of-officeOut of office
Urgent-interruptions-onlyUrgent interruptions only

NoteNote
Activity tokens are case-sensitive.

Default Activity Strings

Lync 2010 maps the availability modes to the following default activity strings, if no activity is specified in the received aggregateState instance.

Availability numberDefault activity string
0-2999Presence unknown
3000-4499Available
4500-5999Inactive
6000-7499Busy
7500-8999Busy
9000-11999Do not disturb
12000-14999Be right back
15000-17999Away
18000 or higherOffline
UnspecifiedOffline

Activity string display

Lync 2010 uses the following logic to display a contact’s activity string.

  • For a blocked contact, the activity string of “Blocked” is displayed.

  • If a standard activity token is specified, the corresponding standard activity string is displayed.

  • If a standard activity token is not specified but an activity string is specified, the specified activity string is displayed.

  • If a standard activity token is not specified and no activity strings are specified, the default activity string corresponding to the specified availability number is displayed.

Capabilities Summary String

Lync 2010 displays the following capabilities summary string to supplement an activity string.

Capabilities summary stringDescription
No IMThis is displayed when the availability of the most active device supporting an instant messaging capability is Offline and the aggregated availability is not Offline.
Voice OnlyThis is displayed when the availability of the most active device supporting an instant messaging capability is Offline and the aggregated availability is no less active than Inactive.
MobileThis is displayed if the only active endpoint is a mobile device.

lastActive attribute

For an inactive mode of Available – Idle, Busy – Idle, Be Right Back, Away or Offline, Lync 2010 displays the time period in which an aggregated state has remained inactive since the last active mode of Available, Busy, or Do Not Disturb. This inactive time period is appended to an inactive state as “Inactive for 5 mins”, “Away for 5 hours” or “Offline for 20 mins”. And it is computed as follows

inactiveTimePeriod = currentTime - lastActiveTime

where lastActiveTime has the value of the lastActive attribute of an appropriate aggregated state.

Location

The subscriber receives a computed location determined as follows:

When the aggregated availability number is less than 12000 and the most active machine (with the lowest availability number) has its location specified (in the endpointLocation element), this location information will be included in the state[@type='aggregateState'] instance.

NoteNote
The received location information indicates a place either set by the publisher or provided by the Microsoft Lync Server 2010 Location Information Service. Thus, the information is where publisher wants the remote watchers to see. It is not necessarily the location where the user is actually in.