protected virtual void OnParticipantAdded(IUccSession eventSource, IUccSessionParticipant participant) { if (participant.IsLocal == false) { ComEvents.Advise <_IUccSessionParticipantEvents>(participant, this); } }
protected override void AttachUccSession(IUccSession uccSession) { base.AttachUccSession(uccSession); this.uccImSession = (IUccInstantMessagingSession)this.UccSession; ComEvents.Advise <_IUccInstantMessagingSessionEvents>(this.uccImSession, this); }
public int BeginUserSearch(string searchDomain, IEnumerable <string> searchTerms) { IUccUserSearchQuery query = this.userSearchManager.CreateQuery(); ComEvents.Advise <_IUccUserSearchQueryEvents>(query, this); query.SearchDomain = searchDomain; string name = null; foreach (string item in searchTerms) { if (string.IsNullOrEmpty(name)) { name = item; } else { query.set_SearchTerm(name, item); name = null; } } UccOperationContext operationContext = new UccOperationContextClass(); operationContext.Initialize(0, new UccContextClass()); query.Execute(operationContext); return(operationContext.OperationId); }
//bool _IUccSessionDescriptionEvaluator.Evaluate( // string ContentType, // string SessionDescription) //{ // return SessionDescription.ToLower().Trim() == "xxx-session"; //} #endregion _IUccSessionDescriptionEvaluator #region _IUccApplicationSessionParticipantEvents // not used //void _IUccApplicationSessionParticipantEvents.OnIncomingInvitation( // UccApplicationSessionParticipant eventSource, // UccIncomingInvitationEvent eventData // ) //{ // System.Windows.MessageBox.Show("OnIncomingInvitation"); //} //void _IUccApplicationSessionParticipantEvents.OnInvitationAccepted( // UccApplicationSessionParticipant eventSource, // UccInvitationAcceptedEvent eventData // ) //{ //} //void _IUccApplicationSessionParticipantEvents.OnOutgoingInvitation( // UccApplicationSessionParticipant eventSource, // UccOutgoingInvitationEvent eventData // ) //{ // eventData.ContentType = "xxx-l"; // eventData.SessionDescription = "xxx-session"; //} //void _IUccApplicationSessionParticipantEvents.OnRenegotiate( // UccApplicationSessionParticipant eventSource, // IUccOperationProgressEvent eventData // ) //{ //} #endregion _IUccApplicationSessionParticipantEvents #region _IUccSignalingChannelEvents // no used // experimental //void _IUccSignalingChannelEvents.OnIncomingMessage( // IUccSignalingChannel eventSource, // IUccIncomingSignalingMessageEvent eventData // ) //{ // eventData.Accept(); // System.Windows.MessageBox.Show(eventData.Message.Body); //} //void _IUccSignalingChannelEvents.OnSendRequest( // IUccSignalingChannel eventSource, // IUccOperationProgressEvent eventData // ) //{ // if (eventData.IsComplete && eventData.StatusCode >= 0) // System.Windows.MessageBox.Show("SUBS sent!"); // else // System.Windows.MessageBox.Show("SUBS failed!"); //} #endregion _IUccSignalingChannelEvents #region _IUccPublicationEvent void _IUccPublicationEvent.OnPublish( IUccPublication publication, IUccOperationProgressEvent eventData) { if (eventData.IsComplete) { ComEvents.Unadvise <_IUccPublicationEvent>(publication, this); if (eventData.StatusCode >= 0) { Debug.WriteLine("Publication - OK"); } else { if (eventData.OriginalOperationContext.Context.IsPropertySet(ContextInitialPublication)) { Debug.WriteLine(String.Format("Initial Publication Failed: {0}", Errors.ToString(eventData.StatusCode))); } else { Debug.WriteLine(String.Format("Publication Failed: {0}", Errors.ToString(eventData.StatusCode))); } } } }
private void Publish() { UccOperationContext operationContext = new UccOperationContextClass(); operationContext.Initialize(0, new UccContextClass()); IUccPublicationManager publicationManager = (IUccPublicationManager)this.endpoint; IUccCategoryInstance categoryInstance = null; //this.selfPresentity.CreatePublishableStateCategoryInstance(); if (categoryInstance == null) { categoryInstance = publicationManager.CreatePublishableCategoryInstance( CategoryName.State, 2, 0, UCC_CATEGORY_INSTANCE_EXPIRE_TYPE.UCCCIET_DEVICE, 0); operationContext.Context.AddProperty(ContextInitialPublication, true); } categoryInstance.PublicationOperation = UCC_PUBLICATION_OPERATION_TYPE.UCCPOT_ADD; IUccPresenceStateInstance stateInstance = (IUccPresenceStateInstance)categoryInstance; stateInstance.Availability = (int)this.SelfPresentity.Availability; stateInstance.Type = UCC_PRESENCE_STATE_TYPE.UCCPST_USER_STATE; IUccPublication publication = publicationManager.CreatePublication(); ComEvents.Advise <_IUccPublicationEvent>(publication, this); publication.AddPublishableCategoryInstance(categoryInstance); publication.Publish(operationContext); }
protected override void OnParticipantAdded(IUccSession eventSource, IUccSessionParticipant participant) { base.OnParticipantAdded(eventSource, participant); if (participant.IsLocal == false) { ComEvents.Advise <_IUccInstantMessagingSessionParticipantEvents>(participant, this); } }
void _IUccCategoryContextEvents.OnCategoryInstanceAdded( IUccCategoryContext categoryContext, UccCategoryInstanceEvent categoryEvent) { IUccCategoryInstance categoryInstance = categoryEvent.CategoryInstance; ComEvents.Advise <_IUccCategoryInstanceEvents>(categoryInstance, this); ProcessCategoryInstance(categoryInstance); }
void _IUccPresentityEvents.OnCategoryContextAdded( UccPresentity presentity, UccCategoryContextEvent categoryContext) { switch (categoryContext.CategoryContext.Name.Trim()) { case CategoryName.State: case CategoryName.ContactCard: case CategoryName.UserProperties: ComEvents.Advise <_IUccCategoryContextEvents>(categoryContext.CategoryContext, this); break; } }
protected override void OnParticipantAdded(IUccSession eventSource, IUccSessionParticipant participant) { base.OnParticipantAdded(eventSource, participant); IUccAudioVideoSessionParticipant avParticipant = participant as IUccAudioVideoSessionParticipant; foreach (IUccMediaChannel channel in avParticipant.Channels) { this.OnChannelAdded(avParticipant, channel); } ComEvents.Advise <_IUccMediaChannelCollectionEvents>(avParticipant, this); }
private void InitializeEndpoint(EndpointConfiguration configuration, AuthenticationMode authMode) { this.CleanupEndpoint(); // set vars if (Helpers.TryParseUri(Helpers.CorrectUri(configuration.Uri), out this.uri) == false) { throw new Exception("Sign-in address is not valid Uri"); } this.selfPresentity.SetUri(this.uri.Value); this.selfPresentityMonitor.SetUri(this.uri); this.disableImSessions = configuration.DisableImSessions; // platform events ComEvents.Advise <_IUccPlatformEvents>(this.platform, this); // create endpoint this.endpoint = this.platform.CreateEndpoint(UCC_ENDPOINT_TYPE.UCCET_PRINCIPAL_SERVER_BASED, this.uri, configuration.EndpoindIdString, null); ComEvents.Advise <_IUccEndpointEvents>(this.endpoint, this); ComEvents.Advise <_IUccSessionManagerEvents>(this.endpoint, this); // server signaling settings this.signalingSettings = (IUccServerSignalingSettings)this.endpoint; ComEvents.Advise <_IUccServerSignalingSettingsEvents>(this.signalingSettings, this); this.signalingSettings.AllowedAuthenticationModes = (int)authMode.ToUccAuthenticationMode(); UccCredential credential = authMode.IsDefaultCreditals() ? this.signalingSettings.CredentialCache.DefaultCredential : this.signalingSettings.CredentialCache.CreateCredential(configuration.Username, configuration.Password, null); this.signalingSettings.CredentialCache.SetCredential(configuration.Realm, credential); // media endpoint settings this.mediaEndpointSettings = (IUccMediaEndpointSettings)this.endpoint; ComEvents.Advise <_IUccMediaEndpointEvents>(this.endpoint, this); // create session manager this.sessionManager = (IUccSessionManager)this.endpoint; ComEvents.Advise <_IUccSessionManagerEvents>(this.sessionManager, this); // create user search manager this.userSearchManager = (IUccUserSearchManager)this.endpoint; }
protected virtual void DetachUccSession(bool terminate) { if (this.uccSession != null) { ComEvents.UnadviseAll(this); if (terminate) { this.uccSession.Terminate(UCC_REJECT_OR_TERMINATE_REASON.UCCROTR_DECLINE, null); } this.uccSession = null; foreach (ParticipantLog log in this.PartipantLogs) { log.State = PartipantLogState.SessionTerminated; } } }
protected virtual void AttachUccSession(IUccSession uccSession) { foreach (IUccSessionParticipant uccParticipant in uccSession.Participants) { //if (this.FindParticipantLog(uccParticipant.Uri.Value) == null) //ComEvents.Advise<_IUccSessionParticipantEvents>(uccParticipant, this); this.OnParticipantAdded(uccSession, uccParticipant); this.GetPartipantLog(uccParticipant).SetState(uccParticipant.State); } foreach (ParticipantLog log in this.PartipantLogs) { if (log.IsLocal) { log.State = PartipantLogState.Local; } } this.uccSession = uccSession; ComEvents.Advise <_IUccSessionEvents>(this.uccSession, this); ComEvents.Advise <_IUccSessionParticipantCollectionEvents>(this.uccSession, this); foreach (ParticipantLog log in this.PartipantLogs) { if (log.IsLocal == false) { bool exist = false; foreach (IUccSessionParticipant uccParticipant in uccSession.Participants) { if (Helpers.IsUriEqual(log.Uri, uccParticipant.Uri.Value)) { exist = true; } } if (exist == false) { this.AddPartipant(log.Uri); } } } }
public void CleanupEndpoint() { foreach (var invite in this.AvInvites) { invite.Decline(); } foreach (Session session in this.Sessions) { session.UccSession = null; } this.IsDisabled = true; this.SelfPresentity.SetAvailability(AvailabilityValues.Unknown); ComEvents.UnadviseAll(this); this.selfPresentityMonitor.DestroyUccPresentity(); if (this.selfSubscription != null && this.selfSubscription.Presentities.Count > 0) { this.selfSubscription.Unsubscribe(null); } this.selfSubscription = null; foreach (Presentity presentity in this.Presentities) { presentity.DestroyUccPresentity(); } if (this.subscription != null && this.subscription.Presentities.Count > 0) { this.subscription.Unsubscribe(null); } this.subscription = null; this.signalingSettings = null; this.mediaEndpointSettings = null; this.userSearchManager = null; this.endpoint = null; }
void _IUccPresentityEvents.OnCategoryContextRemoved( UccPresentity presentity, UccCategoryContextEvent categoryContext) { ComEvents.Unadvise <_IUccCategoryContextEvents>(categoryContext.CategoryContext, this); }
void _IUccMediaChannelCollectionEvents.OnChannelRemoved(IUccAudioVideoSessionParticipant eventSource, IUccMediaChannelCollectionEvent eventData) { ComEvents.Unadvise <_IUccMediaChannelEvents>(eventData.MediaChannel, this); }
protected virtual void OnChannelAdded(IUccAudioVideoSessionParticipant eventSource, IUccMediaChannel channel) { this.OnNegotiatedMediaChanged(channel, 0, (UCC_MEDIA_DIRECTIONS)channel.NegotiatedMedia); ComEvents.Advise <_IUccMediaChannelEvents>(channel, this); }
void _IUccCategoryContextEvents.OnCategoryInstanceRemoved( IUccCategoryContext categoryContext, UccCategoryInstanceEvent categoryEvent) { ComEvents.Unadvise <_IUccCategoryInstanceEvents>(categoryEvent.CategoryInstance, this); }
protected override void OnParticipantRemoved(IUccSession eventSource, IUccSessionParticipant participant) { base.OnParticipantRemoved(eventSource, participant); ComEvents.Unadvise <_IUccMediaChannelCollectionEvents>(participant, this); }