无法通过统一通信 API 连接到 Office Communications Server
题
我正在尝试使用统一通信托管 API 连接到 Office Communications Server。我已经尝试过为 OCS 启用我的用户和新用户。两个帐户都可以成功登录 Office Communicator 客户端,但无法使用 API。创建网络凭据时,如果我以域\用户名的形式传入用户名,则会收到以下错误:
SupportedAuthenticationProtocols=Ntlm, Kerberos
Realm=SIP Communications Service
FailureReason=InvalidCredentials
ErrorCode=-2146893044
Microsoft.Rtc.Signaling.AuthenticationException: The log on was denied. Check that the proper credentials are being used and the account is active. ---> Microsoft.Rtc.Internal.Sip.AuthException: NegotiateSecurityAssociation failed, error: - 2146893044
如果我在用户名中省略域,则会出现此错误:
ResponseCode=404 ResponseText=Not Found
DiagnosticInformation=ErrorCode=4005,Source=OCS.mydomain.com,Reason=Destination URI either not enabled for SIP or does not exist
解决方案
事实证明这是我的疏忽。我们的AD域和通讯器域是不同的,我以为它们是相同的。
网络凭证是domain\username,sip地址应该是sip:username@companyname.com,我使用的是sip:username@domain.com。
其他提示
需要注意两点:
- 用户名不应包含域。您应该使用 NetworkCredential 的单独 Domain 属性。
- 您还需要传入用户 URI - 例如:
//Initialize and register the endpoint, using the credentials of the user the application will be acting as.
UserEndpointSettings userEndpointSettings = new UserEndpointSettings(_userURI, _userServer);
userEndpointSettings.Credential = _credential;
_userEndpoint = new UserEndpoint(_collabPlatform, userEndpointSettings);
_userEndpoint.BeginEstablish(EndEndpointEstablish, _userEndpoint);
不隶属于 StackOverflow