Can't connect to Office Communication Server through Unified Communications API

3.2k views Asked by At

I am trying to connect to Office Communication Server using the Unified Communications Managed API. I have tried my user and a fresh user enabled for OCS. Both account can successfully log into the Office Communicator client, but fail using the API. When creating the network credential, if I pass in the username in the form domain\username, I get this error:

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

If I leave off the domain in the username I this error:

ResponseCode=404 ResponseText=Not Found
DiagnosticInformation=ErrorCode=4005,Source=OCS.mydomain.com,Reason=Destination URI either not enabled for SIP or does not exist
2

There are 2 answers

0
Robin Clowers On BEST ANSWER

Turns out this was an oversight on my part. Our AD domain and communicator domain are different, I had assumed they were the same.

The network credential is domain\username, and the sip address should have been sip:[email protected], I was using sip:[email protected].

1
adeel825 On

Two things to note:

  1. Username should not contain the domain. There should be a separate Domain property of NetworkCredential that you should be using.
  2. You also need to pass in the user URI as well - for example:

//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);