public void InitClient()
        {
            IUccPlatform platform = new UccPlatform();

            platform.Initialize(this.AppName, null);

            IUccUriManager _uriManager = new UccUriManager();
            UccUri         uri         = _uriManager.ParseUri(this._sip);

            //Create an endpoint object from the platform object
            _mainEndpoint = platform.CreateEndpoint(UCC_ENDPOINT_TYPE.UCCET_PRINCIPAL_SERVER_BASED, uri, null, null);
            IUccServerSignalingSettings serverSignalingSettings = (IUccServerSignalingSettings)_mainEndpoint;

            serverSignalingSettings.Server = serverSignalingSettings.CreateSignalingServer(this._serverAddress, this.TransportMode); //ac.rockfin.com:443 //qlocsfepool.mi.corp.rockfin.com
            serverSignalingSettings.AllowedAuthenticationModes = (int)this.AuthMode;

            UccCredential credential = serverSignalingSettings.CredentialCache.CreateCredential(this._userName, this._password, this._domain);

            serverSignalingSettings.CredentialCache.SetCredential("*", credential);

            //Advise for events
            Advise <_IUccEndpointEvents>(
                this._mainEndpoint,
                this);

            this._mainEndpoint.Enable();



            while (this._sessionManager == null)
            {
                System.Threading.Thread.Sleep(1000);
            }
        }
示例#2
0
        public static bool TryParseUri(string uri, out UccUri uccUri)
        {
            lock (syncUriManager)
            {
                uccUri = null;

                try
                {
                    if (string.IsNullOrEmpty(uri) == false)
                    {
                        uccUri = uriManager.ParseUri(uri);
                    }
                }
                catch (COMException)
                {
                }

                return(uccUri != null);
            }
        }
        public void SendNewMessage(string user, string msg)
        {
            IUccSession session = null;

            if (!this._sessions.TryGetValue(user.ToLower(), out session))
            {
                var    context        = new UccContext();
                UccUri participantUri = this._uriManager.ParseUri("sip:[email protected]");

                session = this._sessionManager.CreateSession(UCC_SESSION_TYPE.UCCST_INSTANT_MESSAGING, context);
                var p = session.CreateParticipant(participantUri, null);

                Advise <_IUccInstantMessagingSessionParticipantEvents>(p, this);
                session.AddParticipant(p, null);

                Advise <_IUccSessionEvents>(session, this);

                this._sessions.Add(user.ToLower(), session);
            }

            IUccInstantMessagingSession ims = session as IUccInstantMessagingSession;

            ims.SendMessage("text/plain", msg, null);
        }
示例#4
0
 public void SetUri(UccUri uri)
 {
     base.Uri = uri.Value.ToString();
 }
示例#5
0
 public static bool IsUriEqual(string uri1, UccUri uri2)
 {
     return(Helpers.IsUriEqual(uri1, uri2.Value));
 }
示例#6
0
 public ParticipantResult GetParticipantResult(UccUri uccUri)
 {
     return(this.GetParticipantResult(uccUri.Value));
 }