Пример #1
0
 public void OnTerminate(IUccSession pEventSource, IUccOperationProgressEvent pEventData)
 {
     if (Terminated != null)
     {
         Terminated(pEventSource, pEventData);
     }
 }
Пример #2
0
 public EndpointEventArgs(IUccOperationProgressEvent eventData, AuthenticationMode authMode)
 {
     this.IsOperationCompleteFailed = Helpers.IsOperationCompleteFailed(eventData);
     this.StatusCode = eventData.StatusCode;
     this.StatusText = Errors.ToString(eventData.StatusCode);
     this.AuthMode   = authMode;
 }
        /// <summary>
        /// Handle OnAddParticipant events. Display when it fails to add the participant.
        /// </summary>
        /// <param name="eventSource"></param>
        /// <param name="eventData"></param>
        void _IUccSessionEvents.OnAddParticipant(
            IUccSession eventSource,
            IUccOperationProgressEvent eventData)
        {
            if (eventData.IsComplete && eventData.StatusCode < 0)
            {
                //eventData.StatusCode = 180;
                switch (eventSource.Type)
                {
                case UCC_SESSION_TYPE.UCCST_INSTANT_MESSAGING:
                    this.imSession = null;
                    this.mainForm.WriteStatusMessage("IM Session failed to connect to " + this.imRemoteUri);
                    break;

                case UCC_SESSION_TYPE.UCCST_AUDIO_VIDEO:
                    this.avSession = null;

                    this.mainForm.WriteStatusMessage("AV Session failed to connect to " + this.avRemoteUri);
                    break;

                default:
                    break;
                }
            }
        }
Пример #4
0
        public void OnEnable(IUccEndpoint pEventSource, IUccOperationProgressEvent pEventData)
        {
            try
            {
                if (pEventData.IsComplete)
                {
                    if (pEventData.StatusCode >= 0)
                    {
                        // Sign in succeeded. Proceed with subscription and publication.


                        // Create a session manager object to handle session related functionality and events.
                        this._sessionManager = pEventSource as IUccSessionManager;

                        // Advise session manager instance of this class as endpoint sink.
                        Advise <_IUccSessionManagerEvents>(this._sessionManager, this);
                        PublishAvailability("Available");
                    }
                    else
                    {
                        // Recover from failure to sign in.
                    }
                }
                else
                {
                    // Sign in failed. Make the endpoint null.
                    pEventSource = null;
                }
            }
            catch (COMException ex)
            {
                throw ex;
            }
        }
Пример #5
0
        //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)));
                    }
                }
            }
        }
Пример #6
0
 public void OnRemoveParticipant(IUccSession pEventSource, IUccOperationProgressEvent pEventData)
 {
     if (RemoveParticipant != null)
     {
         RemoveParticipant(pEventSource, pEventData);
     }
 }
Пример #7
0
        void _IUccEndpointEvents.OnDisable(IUccEndpoint eventSource, IUccOperationProgressEvent eventData)
        {
            if (eventData.IsComplete)
            {
                CleanupEndpoint();
                this.IsDisabled = true;

                OnDisabled(new EndpointEventArgs(eventData));
            }
        }
Пример #8
0
        void _IUccSessionEvents.OnRemoveParticipant(IUccSession eventSource, IUccOperationProgressEvent eventData)
        {
            ParticipantLog log = this.GetPartipantLog(GetParticipantUri(eventData.OriginalOperationContext.Context));

            if (Helpers.IsOperationCompleteFailed(eventData))
            {
                log.SetState(PartipantLogState.RemoveFailed, eventData.StatusCode);
            }
            if (Helpers.IsOperationCompleteOk(eventData))
            {
                log.State = PartipantLogState.RemoveSuccess;
            }
        }
Пример #9
0
        void _IUccSubscriptionEvents.OnUnsubscribe(
            UccSubscription subscription,
            UccSubscriptionEvent eventInfo)
        {
            Debug.WriteLine("OnUnsubscribe");

            if (eventInfo.IsComplete)
            {
                foreach (UccPresentity presenty in eventInfo.Presentities)
                {
                    IUccOperationProgressEvent progressEvent = eventInfo.GetOperationInfo(presenty);

                    Debug.WriteLine(String.Format("Presentity: <{0}> {1}", presenty.Uri.AddressOfRecord.ToString(), Errors.ToString(progressEvent.StatusCode)), "OnUnsubscribe");
                }
            }
        }
Пример #10
0
 void _IUccPlatformEvents.OnShutdown(
     UccPlatform eventSource,
     IUccOperationProgressEvent eventData)
 {
     if (eventData.IsComplete)
     {
         if (eventData.StatusCode >= 0)
         {
             this.platform = null;
         }
         else
         {
             this.mainForm.WriteStatusMessage("Failed to shutdown platform. Error: " +
                                              eventData.StatusCode.ToString("X"));
         }
     }
 }
Пример #11
0
        void _IUccEndpointEvents.OnEnable(IUccEndpoint eventSource, IUccOperationProgressEvent eventData)
        {
            if (eventData.IsComplete)
            {
                if (eventData.StatusCode >= 0)
                {
                    this.IsEnabled = true;

                    if (configuration.DisablePublicationsSubscriptions == false)
                    {
                        this.SelfSubscribe();
                        this.SelfPresentity.SetAvailability(this.loginAvailability);
                        this.CreateSubscription();
                        this.Subscribe(this.Presentities);
                    }

                    // "sip:[email protected];gruu;opaque=srvr:MRAS:bMOjOHEFQiCtPh2g624vPAAA";
                    this.mediaEndpointSettings.FindMediaConnectivityServers(
                        String.Format(@"sip:MRASLoc.{0}@{0}", this.uri.Host), null);
                }
                else
                {
                    this.CleanupEndpoint();
                }

                this.enableErrors.Add(new EndpointEventArgs(eventData, configuration.AuthenticationModes[enableErrors.Count]));

                if (((UInt32)eventData.StatusCode == Errors.UCC_E_SIP_STATUS_CLIENT_UNAUTHORIZED ||
                     (UInt32)eventData.StatusCode == Errors.UCC_E_SIP_AUTHENTICATION_TYPE_NOT_SUPPORTED ||
                     (UInt32)eventData.StatusCode == Errors.UCC_E_AUTHENTICATION_SERVER_UNAVAILABLE)                   //||
                    //(UInt32)eventData.StatusCode == Errors.opaque)
                    && enableErrors.Count < configuration.AuthenticationModes.Length)
                {
                    this.InternalBeginLogin();
                }
                else
                {
                    this.OnEnabled();
                }
            }
        }
Пример #12
0
 /// <summary>
 /// Display information when endpoint fires OnDisable event
 /// </summary>
 /// <param name="eventSource"></param>
 /// <param name="eventData"></param>
 void _IUccEndpointEvents.OnDisable(
     IUccEndpoint eventSource,
     IUccOperationProgressEvent eventData)
 {
     if (eventData.IsComplete)
     {
         if (eventData.StatusCode >= 0)
         {
             this.endpoint = null;
             this.mainForm.SetButtonsAfterLogout();
             this.mainForm.WriteStatusMessage("User " + this.signName +
                                              " is logged out successfully.");
         }
         else
         {
             string formatMessage = string.Format("User {0} failed to logout. Error: {1}",
                                                  this.signName, eventData.StatusCode.ToString("X"));
             this.mainForm.WriteStatusMessage(formatMessage);
         }
     }
 }
Пример #13
0
        public void Set(IUccOperationProgressEvent operationProgress)
        {
            if (this.IsComplete != operationProgress.IsComplete)
            {
                this.IsComplete = operationProgress.IsComplete;
                this.OnPropertyChanged("IsComplete");
            }

            if (this.StatusCode != operationProgress.StatusCode)
            {
                this.StatusCode = operationProgress.StatusCode;
                this.OnPropertyChanged("StatusCode");
                this.OnPropertyChanged("Error");
            }

            if (this.StatusText != operationProgress.StatusText)
            {
                this.StatusText = operationProgress.StatusText;
                this.OnPropertyChanged("StatusText");
            }
        }
Пример #14
0
 void _IUccSessionEvents.OnTerminate(
     IUccSession eventSource,
     IUccOperationProgressEvent eventData)
 {
 }
Пример #15
0
 void _IUccSessionEvents.OnRemoveParticipant(
     IUccSession eventSource,
     IUccOperationProgressEvent eventData)
 {
 }
Пример #16
0
 public static bool IsOperationCompleteFailed(IUccOperationProgressEvent eventData)
 {
     return(eventData.IsComplete && eventData.StatusCode < 0);
 }
Пример #17
0
 void _IUccSessionEvents.OnTerminate(IUccSession eventSource, IUccOperationProgressEvent eventData)
 {
     this.DetachUccSession(false);
 }
Пример #18
0
 void _IUccPlatformEvents.OnShutdown(UccPlatform eventSource, IUccOperationProgressEvent eventData)
 {
 }
 void _IUccSessionEvents.OnTerminate(
     IUccSession eventSource,
     IUccOperationProgressEvent eventData)
 {
     this.sessionList.Remove(eventSource);
 }
Пример #20
0
 public void OnDisable(IUccEndpoint pEventSource, IUccOperationProgressEvent pEventData)
 {
 }
 void _IUccSessionParticipantEvents.OnRemoveParticipantEndpoint(IUccSessionParticipant pEventSource, IUccOperationProgressEvent pEventData)
 {
 }
Пример #22
0
 void _IUccSessionParticipantEvents.OnRemoveParticipantEndpoint(IUccSessionParticipant pEventSource, IUccOperationProgressEvent pEventData)
 {
 }
 void _IUccSessionEvents.OnRemoveParticipant(
               IUccSession eventSource,
               IUccOperationProgressEvent eventData)
 {
 }
 void _IUccSessionEvents.OnTerminate(
           IUccSession eventSource,
           IUccOperationProgressEvent eventData)
 {
     this.sessionList.Remove(eventSource);
 }
Пример #25
0
 public void OnAlternate(IUccSession pEventSource, IUccOperationProgressEvent pEventData)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Handle OnAddParticipant events. Display when it fails to add the participant.
        /// </summary>
        /// <param name="eventSource"></param>
        /// <param name="eventData"></param>
        void _IUccSessionEvents.OnAddParticipant(
                        IUccSession eventSource,
                        IUccOperationProgressEvent eventData)
        {
            if (eventData.IsComplete && eventData.StatusCode < 0)
            {
                //eventData.StatusCode = 180;
                switch (eventSource.Type)
                {
                    case UCC_SESSION_TYPE.UCCST_INSTANT_MESSAGING:
                        this.imSession = null;
                        this.mainForm.WriteStatusMessage("IM Session failed to connect to " + this.imRemoteUri);
                        break;
                    case UCC_SESSION_TYPE.UCCST_AUDIO_VIDEO:
                        this.avSession = null;

                        this.mainForm.WriteStatusMessage("AV Session failed to connect to " + this.avRemoteUri);
                        break;
                    default:
                        break;
                }
            }
        }