如何在没有凭据的情况下建立 UserEndpoint?我在某处读到,如果应用程序/应用程序服务器受 Lync 服务器信任,它应该是可能的。情况就是这样,但它似乎不起作用。我总是得到例外
未找到该领域的匹配凭证。
拳头设置 CollaborationPlatform 使用ProvisionedApplicationPlatformSettings
:
ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings("UCMA 4", _appID);
CollaborationPlatform _collabPlatform = new CollaborationPlatform(settings);
_collabPlatform.RegisterForApplicationEndpointSettings(this.Platform_ApplicationEndpointOwnerDiscovered);
// Initialize and start-up the platform.
_collabPlatform.BeginStartup(EndPlatformStartup, _collabPlatform);
Platform_ApplicationEndpointOwnerDiscovered
然后在回调方法中设置您的应用程序端点。然后一旦完成,您就可以调用此方法并在没有凭据的情况下设置 UserEndpoint:
Use this method to create UserEndpoint
private UserEndpoint CreateUserEndpoint(CollaborationPlatform _collabPlatform, String _SIP)
{
try
{
UserEndpointSettings _settings = new UserEndpointSettings(_SIP, _serverFqdn);
_settings.SupportedMimePartContentTypes = new ContentType[] { new ContentType("text/html"), new ContentType("text/plain") };
_settings.AutomaticPresencePublicationEnabled = true;
UserEndpoint _userEndpoint = new UserEndpoint(_collabPlatform, _settings);
_userEndpoint.EndEstablish(_userEndpoint.BeginEstablish(null, null));
return _userEndpoint;
}
catch (Exception exx)
{
Console.WriteLine("\n" + _SIP + "CreateUserEndpoint : " + exx);
return null;
}
}
不确定是否要在没有凭据的情况下建立用户端点,但如果有帮助,您绝对可以在已建立的对话中模拟一个用户端点。
只需检查会话类上的 Impersonate 方法即可。
如果你想模拟你需要一个应用程序端点。
使用应用程序端点创建对话对象并...
Conversation conversation = new Conversation(_appEndpoint);
conversation.Impersonate("sip:something@something.com", "phoneUri, "Display Name");
userEndpointSettings = new UserEndpointSettings(_userURI, _serverFqdn);
if (!_useSuppliedCredentials)
{
_credential = new System.Net.NetworkCredential(_userName, _userPassword, _userDomain);
userEndpointSettings.Credential = _credential;
}
else
{
userEndpointSettings.Credential = System.Net.CredentialCache.DefaultNetworkCredentials;
}
_userURI 需要匹配当前登录用户 sip:user@blabla.com