在受信任的应用程序端点中,我必须根据外部存在提供者发布用户状态,我可以这样做(稍后在外部源变为“空闲”时清除它们是一个不同的问题)
但问题是,如果我为用户 A 发布新状态,这不会反映在用户拥有的 Lync 客户端上,尽管其他人都会收到更新。
目前,我正在使用这段代码进行发布:
user.Endpoint.LocalOwnerPresence.BeginPublishPresence(
user.categories,
arBeginPublishPresence =>
{
try
{
user.Endpoint.PresenceServices.EndUpdatePresenceState(arBeginPublishPresence);
logger.log("Published presence for {0} with state {1}.", user.SipUserUri, newState.Availability);
}
catch (RealTimeException ex)
{
logger.log("Failed publishing presence for {0}. {1}", user.SipUserUri, ex);
}
},
null);
其中 user.categories 是:
PresenceCategoryWithMetaData stateWithMetaDataForPersonal = new PresenceCategoryWithMetaData(++instanceId, 400, newState);
PresenceCategoryWithMetaData stateWithMetaDataForWorkgroup = new PresenceCategoryWithMetaData(instanceId, 300, newState);
PresenceCategoryWithMetaData stateWithMetaDataForColleagues = new PresenceCategoryWithMetaData(instanceId, 200, newState);
PresenceCategoryWithMetaData stateWithMetaDataForExternal = new PresenceCategoryWithMetaData(instanceId, 100, newState);
PresenceCategoryWithMetaData stateWithMetaDataForAll = new PresenceCategoryWithMetaData(instanceId, 0, newState);
if (instanceId >= Int64.MaxValue)
{
instanceId = 1;
}
stateWithMetaDataForPersonal.ExpiryPolicy = expirypolicy;
stateWithMetaDataForWorkgroup.ExpiryPolicy = expirypolicy;
stateWithMetaDataForColleagues.ExpiryPolicy = expirypolicy;
stateWithMetaDataForExternal.ExpiryPolicy = expirypolicy;
stateWithMetaDataForAll.ExpiryPolicy = expirypolicy;
stateWithMetaDataForPersonal.Expires = timeout;
stateWithMetaDataForWorkgroup.Expires = timeout;
stateWithMetaDataForColleagues.Expires = timeout;
stateWithMetaDataForExternal.Expires = timeout;
stateWithMetaDataForAll.Expires = timeout;
user.categories =
new List<PresenceCategoryWithMetaData>()
{
stateWithMetaDataForPersonal,
stateWithMetaDataForWorkgroup,
stateWithMetaDataForColleagues,
stateWithMetaDataForExternal,
stateWithMetaDataForAll
};
这些类别正在地毯式轰炸存在状态,我只知道我做错了。不可能是这样的……乱七八糟的。
请耐心等待,我是 C#、.NET 和 UCMA 的新手,直到一个月前才接触过它。