コード例 #1
0
        public Motor(AnaPencere anapencere)
        {
            this.anaPencere    = anapencere;
            this.bulunmaDurumu = false;                                       // bulunma durumu(çevrimiçi,meþgul vs.) ayarlanmadý
            this.kayitDurumu   = RTC_REGISTRATION_STATE.RTCRS_NOT_REGISTERED; // Henüz kayýt olmadýk
            htPencereler       = new Hashtable();                             // uri key leri ile pencereler takip edilir
            Oturumlar          = new ArrayList();                             // açýlan oturumlarla(sessionEvent.Sessison) oturumlar takip edilir
            try
            {
                istemci = new RTCClientClass();
                istemci.Initialize();
                istemci.EventFilter = Sabitler.RTC_EVENTFILTERS;
                istemci.ListenForIncomingSessions          = RTC_LISTEN_MODE.RTCLM_BOTH; // Gelen mesajlarý dinle, SIP portunu açar(5060)
                istemci.IRTCEventNotification_Event_Event += new IRTCEventNotification_EventEventHandler(istemci_IRTCEventNotification_Event_Event);

                istemci.SetPreferredMediaTypes(Sabitler.RTC_MEDIA_SABITLERI, true);
                gelenMedia           = istemci.get_IVideoWindow(RTC_VIDEO_DEVICE.RTCVD_RECEIVE);
                gidenMedia           = istemci.get_IVideoWindow(RTC_VIDEO_DEVICE.RTCVD_PREVIEW);
                istemci.ClientName   = "RTCClient";
                istemci.ClientCurVer = "1.0";
            }
            catch (COMException hata)
            {
                this.anaPencere.MesajGoster(hata.ToString(), "Hata");
            }
        }
コード例 #2
0
        public Motor(AnaPencere anapencere)
        {
            this.anaPencere = anapencere;
            this.bulunmaDurumu = false; // bulunma durumu(çevrimiçi,meþgul vs.) ayarlanmadý
            this.kayitDurumu = RTC_REGISTRATION_STATE.RTCRS_NOT_REGISTERED; // Henüz kayýt olmadýk
            htPencereler = new Hashtable(); // uri key leri ile pencereler takip edilir
            Oturumlar = new ArrayList(); // açýlan oturumlarla(sessionEvent.Sessison) oturumlar takip edilir
            try
            {
                istemci = new RTCClientClass();
                istemci.Initialize();
                istemci.EventFilter = Sabitler.RTC_EVENTFILTERS;
                istemci.ListenForIncomingSessions = RTC_LISTEN_MODE.RTCLM_BOTH; // Gelen mesajlarý dinle, SIP portunu açar(5060)
                istemci.IRTCEventNotification_Event_Event += new IRTCEventNotification_EventEventHandler(istemci_IRTCEventNotification_Event_Event);

                istemci.SetPreferredMediaTypes(Sabitler.RTC_MEDIA_SABITLERI, true);
                gelenMedia = istemci.get_IVideoWindow(RTC_VIDEO_DEVICE.RTCVD_RECEIVE);
                gidenMedia = istemci.get_IVideoWindow(RTC_VIDEO_DEVICE.RTCVD_PREVIEW);
                istemci.ClientName = "RTCClient";
                istemci.ClientCurVer = "1.0";
            }
            catch(COMException hata)
            {
                this.anaPencere.MesajGoster(hata.ToString(), "Hata");
            }
        }
コード例 #3
0
        public RTCPresenceCore(IRTCPresenceUI presenceUI)
        {
            Trace.WriteLine("Entering RTCPresenceCore.RTCPresenceCore");

            this.presenceUI = presenceUI;
            this.presenceEnabled = false;
            this.registrationState = RTC_REGISTRATION_STATE.RTCRS_NOT_REGISTERED;

            try
            {
                this.client = new RTCClientClass();

                this.client.Initialize();

                // Set the event filter
                this.client.EventFilter = RTCConst.RTCEF_REGISTRATION_STATE_CHANGE |
                    RTCConst.RTCEF_CLIENT |
                    RTCConst.RTCEF_BUDDY |
                    RTCConst.RTCEF_BUDDY2 |
                    RTCConst.RTCEF_WATCHER |
                    RTCConst.RTCEF_WATCHER2 |
                    RTCConst.RTCEF_ROAMING |
                    RTCConst.RTCEF_PROFILE |
                    RTCConst.RTCEF_PRESENCE_PROPERTY |
                    RTCConst.RTCEF_PRESENCE_DATA;

                this.client.IRTCEventNotification_Event_Event += new IRTCEventNotification_EventEventHandler(OnRTCEvent);

                this.client.ClientName = "RTCPresence";
                this.client.ClientCurVer = "1.0";

                // Don't Initialize presence status -- exception if called
                // RTC_E_PRESENCE_NOT_ENABLED 0x80EE0028L
                //DoSetPresence(RTC_PRESENCE_STATUS.RTCXS_PRESENCE_ONLINE);
            }
            catch(COMException ex1COM)
            {
                Trace.WriteLine("COMException " + ex1COM.Message);

                throw;
            }
        }
コード例 #4
0
        public RTCPresenceCore(IRTCPresenceUI presenceUI)
        {
            Trace.WriteLine("Entering RTCPresenceCore.RTCPresenceCore");

            this.presenceUI        = presenceUI;
            this.presenceEnabled   = false;
            this.registrationState = RTC_REGISTRATION_STATE.RTCRS_NOT_REGISTERED;

            try
            {
                this.client = new RTCClientClass();

                this.client.Initialize();

                // Set the event filter
                this.client.EventFilter = RTCConst.RTCEF_REGISTRATION_STATE_CHANGE |
                                          RTCConst.RTCEF_CLIENT |
                                          RTCConst.RTCEF_BUDDY |
                                          RTCConst.RTCEF_BUDDY2 |
                                          RTCConst.RTCEF_WATCHER |
                                          RTCConst.RTCEF_WATCHER2 |
                                          RTCConst.RTCEF_ROAMING |
                                          RTCConst.RTCEF_PROFILE |
                                          RTCConst.RTCEF_PRESENCE_PROPERTY |
                                          RTCConst.RTCEF_PRESENCE_DATA;

                this.client.IRTCEventNotification_Event_Event += new IRTCEventNotification_EventEventHandler(OnRTCEvent);

                this.client.ClientName   = "RTCPresence";
                this.client.ClientCurVer = "1.0";

                // Don't Initialize presence status -- exception if called
                // RTC_E_PRESENCE_NOT_ENABLED 0x80EE0028L
                //DoSetPresence(RTC_PRESENCE_STATUS.RTCXS_PRESENCE_ONLINE);
            }
            catch (COMException ex1COM)
            {
                Trace.WriteLine("COMException " + ex1COM.Message);

                throw;
            }
        }
コード例 #5
0
        void OnRTCRegistrationStateChangeEvent(IRTCRegistrationStateChangeEvent registerEvent)
        {
            Trace.WriteLine("Entering RTCPresenceCore.OnRTCRegistrationStateChangeEvent "
                + registerEvent.State);

            switch(registerEvent.State)
            {
                case RTC_REGISTRATION_STATE.RTCRS_UNREGISTERING:
                    this.presenceUI.OnLoggingOff();
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_NOT_REGISTERED:
                    this.DoDisablePresence();
                    this.presenceUI.OnLoggedOff();
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_REGISTERING:
                    this.presenceUI.OnLoggingOn();
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_REGISTERED:
                    this.presenceUI.OnLoggedOn();
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_REJECTED:
                case RTC_REGISTRATION_STATE.RTCRS_ERROR:
                {
                    int statusCode = registerEvent.StatusCode;

                    Trace.WriteLine("RTCRS_REJECTED/ERROR " + statusCode);

                    // Logon failed. Most likely the server could no be found,
                    // or the user needs to authenticate.
                    if ((statusCode == RTCConst.RTC_E_STATUS_CLIENT_UNAUTHORIZED) ||
                        (statusCode == RTCConst.RTC_E_STATUS_CLIENT_PROXY_AUTHENTICATION_REQUIRED) ||
                        (statusCode == RTCConst.RTC_E_STATUS_CLIENT_FORBIDDEN) ||
                        (statusCode == RTCConst.RTC_E_STATUS_CLIENT_NOT_FOUND))
                    {
                        AuthData authData = this.presenceUI.ShowAuthDialog();

                        if (authData != null && authData.IsValid())
                        {
                            this.DoAuth(authData.Uri, authData.Account, authData.Password);
                        }
                        else
                        {
                            this.DoLogOff();
                            this.DoDisablePresence();
                            this.presenceUI.OnLoggedOff();
                            // If we were logging on the show error
                            if (registrationState == RTC_REGISTRATION_STATE.RTCRS_REGISTERING)
                            {
                                this.presenceUI.ShowMessage("Logon failed!", "Warning");
                            }
                            return;

                        }
                    }
                    else
                    {
                        // Logon failed
                        this.DoLogOff();
                        this.DoDisablePresence();
                        this.presenceUI.OnLoggedOff();
                        // If we were logging on the show error
                        if (this.registrationState == RTC_REGISTRATION_STATE.RTCRS_REGISTERING)
                        {
                            this.presenceUI.ShowMessage("Logon failed!", "Warning");
                        }
                        return;
                    }
                }
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_LOGGED_OFF:
                    // The server has removed the registration for this profile.
                    // Incoming requests are no longer forwarded.
                    this.DoLogOff();
                    this.presenceUI.OnLoggingOff();
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_LOCAL_PA_LOGGED_OFF:
                    // The server has revoked the status as a presence agent for
                    // this user. Incoming presence subscriptions are no longer
                    // forwarded and our presence status is no longer visible to
                    // others from this client.
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_REMOTE_PA_LOGGED_OFF:
                    // The client that was the presence agent for this user has
                    // logged off. It may be possible to register as a presence
                    //agent from this client.
                    break;

                default:
                    break;
            }

            this.registrationState = registerEvent.State;
        }
コード例 #6
0
        void OnRTCRegistrationStateChangeEvent(IRTCRegistrationStateChangeEvent registerEvent)
        {
            Trace.WriteLine("Entering RTCPresenceCore.OnRTCRegistrationStateChangeEvent "
                            + registerEvent.State);

            switch (registerEvent.State)
            {
            case RTC_REGISTRATION_STATE.RTCRS_UNREGISTERING:
                this.presenceUI.OnLoggingOff();
                break;

            case RTC_REGISTRATION_STATE.RTCRS_NOT_REGISTERED:
                this.DoDisablePresence();
                this.presenceUI.OnLoggedOff();
                break;

            case RTC_REGISTRATION_STATE.RTCRS_REGISTERING:
                this.presenceUI.OnLoggingOn();
                break;

            case RTC_REGISTRATION_STATE.RTCRS_REGISTERED:
                this.presenceUI.OnLoggedOn();
                break;

            case RTC_REGISTRATION_STATE.RTCRS_REJECTED:
            case RTC_REGISTRATION_STATE.RTCRS_ERROR:
            {
                int statusCode = registerEvent.StatusCode;

                Trace.WriteLine("RTCRS_REJECTED/ERROR " + statusCode);

                // Logon failed. Most likely the server could no be found,
                // or the user needs to authenticate.
                if ((statusCode == RTCConst.RTC_E_STATUS_CLIENT_UNAUTHORIZED) ||
                    (statusCode == RTCConst.RTC_E_STATUS_CLIENT_PROXY_AUTHENTICATION_REQUIRED) ||
                    (statusCode == RTCConst.RTC_E_STATUS_CLIENT_FORBIDDEN) ||
                    (statusCode == RTCConst.RTC_E_STATUS_CLIENT_NOT_FOUND))
                {
                    AuthData authData = this.presenceUI.ShowAuthDialog();

                    if (authData != null && authData.IsValid())
                    {
                        this.DoAuth(authData.Uri, authData.Account, authData.Password);
                    }
                    else
                    {
                        this.DoLogOff();
                        this.DoDisablePresence();
                        this.presenceUI.OnLoggedOff();
                        // If we were logging on the show error
                        if (registrationState == RTC_REGISTRATION_STATE.RTCRS_REGISTERING)
                        {
                            this.presenceUI.ShowMessage("Logon failed!", "Warning");
                        }
                        return;
                    }
                }
                else
                {
                    // Logon failed
                    this.DoLogOff();
                    this.DoDisablePresence();
                    this.presenceUI.OnLoggedOff();
                    // If we were logging on the show error
                    if (this.registrationState == RTC_REGISTRATION_STATE.RTCRS_REGISTERING)
                    {
                        this.presenceUI.ShowMessage("Logon failed!", "Warning");
                    }
                    return;
                }
            }
            break;

            case RTC_REGISTRATION_STATE.RTCRS_LOGGED_OFF:
                // The server has removed the registration for this profile.
                // Incoming requests are no longer forwarded.
                this.DoLogOff();
                this.presenceUI.OnLoggingOff();
                break;

            case RTC_REGISTRATION_STATE.RTCRS_LOCAL_PA_LOGGED_OFF:
                // The server has revoked the status as a presence agent for
                // this user. Incoming presence subscriptions are no longer
                // forwarded and our presence status is no longer visible to
                // others from this client.
                break;

            case RTC_REGISTRATION_STATE.RTCRS_REMOTE_PA_LOGGED_OFF:
                // The client that was the presence agent for this user has
                // logged off. It may be possible to register as a presence
                //agent from this client.
                break;

            default:
                break;
            }

            this.registrationState = registerEvent.State;
        }
コード例 #7
0
        private void RegistrationStateChangeEvent(IRTCRegistrationStateChangeEvent registerEvent)
        {
            switch (registerEvent.State)
            {
            case RTC_REGISTRATION_STATE.RTCRS_UNREGISTERING:
                this.anaPencere.OturumKapatiliyor(registerEvent.Profile.UserName);
                break;

            case RTC_REGISTRATION_STATE.RTCRS_NOT_REGISTERED:     // DisablePresence() çaðýrýldý, kiþiler artýk bizi offline görür
                this.BulunmaDurumuPasif();
                this.anaPencere.OturumKapandi();
                break;

            case RTC_REGISTRATION_STATE.RTCRS_REGISTERING:
                this.anaPencere.OturumAciliyor();
                break;

            case RTC_REGISTRATION_STATE.RTCRS_REGISTERED:
                this.anaPencere.OturumAcildi(registerEvent.Profile.UserName);
                break;

            case RTC_REGISTRATION_STATE.RTCRS_REJECTED:
            case RTC_REGISTRATION_STATE.RTCRS_ERROR:
            {
                int durumKodu = registerEvent.StatusCode;

                // logon baþarýsýz, server yok veya authenticate gerekli
                if ((durumKodu == Sabitler.RTC_E_STATUS_CLIENT_UNAUTHORIZED) ||
                    (durumKodu == Sabitler.RTC_E_STATUS_CLIENT_PROXY_AUTHENTICATION_REQUIRED) ||
                    (durumKodu == Sabitler.RTC_E_STATUS_CLIENT_FORBIDDEN) ||
                    (durumKodu == Sabitler.RTC_E_STATUS_CLIENT_NOT_FOUND))
                {
                    // kullanýcýya authentication ekranýný göster...
                    Bilgiler bilgi = this.anaPencere.DogrulamaFormuGoster();

                    if (bilgi != null && bilgi.GecerliMi())
                    {
                        this.DogrulamaYap(bilgi.URI, bilgi.Kimlik, bilgi.Sifre);
                    }
                    else
                    {
                        this.Cikis();
                        this.BulunmaDurumuPasif();
                        this.anaPencere.OturumKapandi();
                        // oturum açýlamadý, kullanýcýyý uyar!
                        if (kayitDurumu == RTC_REGISTRATION_STATE.RTCRS_REGISTERING)
                        {
                            this.anaPencere.MesajGoster("Giriþ Baþarýsýz!", "Hata");
                        }
                        return;
                    }
                }
                else
                {
                    this.Cikis();
                    this.BulunmaDurumuPasif();
                    this.anaPencere.OturumKapandi();
                    // oturum açýlamadý, kullanýcýyý uyar!
                    if (kayitDurumu == RTC_REGISTRATION_STATE.RTCRS_REGISTERING)
                    {
                        this.anaPencere.MesajGoster("Giriþ Baþarýsýz!", "Hata");
                    }
                    return;
                }
            }
            break;

            case RTC_REGISTRATION_STATE.RTCRS_LOGGED_OFF:     // sunucu profil kaydýný sildi.
                this.Cikis();
                this.anaPencere.OturumKapatiliyor(registerEvent.Profile.UserName);
                break;

            case RTC_REGISTRATION_STATE.RTCRS_LOCAL_PA_LOGGED_OFF:
                break;

            case RTC_REGISTRATION_STATE.RTCRS_REMOTE_PA_LOGGED_OFF:
                break;

            default:
                break;
            }

            this.kayitDurumu = registerEvent.State; // Durumu güncelle. Önemli!!!
        }
コード例 #8
0
        private void RegistrationStateChangeEvent(IRTCRegistrationStateChangeEvent registerEvent)
        {
            switch (registerEvent.State)
            {
                case RTC_REGISTRATION_STATE.RTCRS_UNREGISTERING:
                    this.anaPencere.OturumKapatiliyor(registerEvent.Profile.UserName);
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_NOT_REGISTERED: // DisablePresence() çaðýrýldý, kiþiler artýk bizi offline görür
                    this.BulunmaDurumuPasif();
                    this.anaPencere.OturumKapandi();
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_REGISTERING:
                    this.anaPencere.OturumAciliyor();
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_REGISTERED:
                    this.anaPencere.OturumAcildi(registerEvent.Profile.UserName);
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_REJECTED:
                case RTC_REGISTRATION_STATE.RTCRS_ERROR:
                    {
                        int durumKodu = registerEvent.StatusCode;

                        // logon baþarýsýz, server yok veya authenticate gerekli
                        if ((durumKodu == Sabitler.RTC_E_STATUS_CLIENT_UNAUTHORIZED) ||
                            (durumKodu == Sabitler.RTC_E_STATUS_CLIENT_PROXY_AUTHENTICATION_REQUIRED) ||
                            (durumKodu == Sabitler.RTC_E_STATUS_CLIENT_FORBIDDEN) ||
                            (durumKodu == Sabitler.RTC_E_STATUS_CLIENT_NOT_FOUND))
                        {
                            // kullanýcýya authentication ekranýný göster...
                            Bilgiler bilgi = this.anaPencere.DogrulamaFormuGoster();

                            if (bilgi != null && bilgi.GecerliMi())
                            {
                                this.DogrulamaYap(bilgi.URI, bilgi.Kimlik, bilgi.Sifre);
                            }
                            else
                            {
                                this.Cikis();
                                this.BulunmaDurumuPasif();
                                this.anaPencere.OturumKapandi();
                                // oturum açýlamadý, kullanýcýyý uyar!
                                if (kayitDurumu == RTC_REGISTRATION_STATE.RTCRS_REGISTERING)
                                {
                                    this.anaPencere.MesajGoster("Giriþ Baþarýsýz!", "Hata");
                                }
                                return;
                            }
                        }
                        else
                        {
                            this.Cikis();
                            this.BulunmaDurumuPasif();
                            this.anaPencere.OturumKapandi();
                            // oturum açýlamadý, kullanýcýyý uyar!
                            if (kayitDurumu == RTC_REGISTRATION_STATE.RTCRS_REGISTERING)
                            {
                                this.anaPencere.MesajGoster("Giriþ Baþarýsýz!", "Hata");
                            }
                            return;
                        }
                    }
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_LOGGED_OFF: // sunucu profil kaydýný sildi.
                    this.Cikis();
                    this.anaPencere.OturumKapatiliyor(registerEvent.Profile.UserName);
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_LOCAL_PA_LOGGED_OFF:
                    break;

                case RTC_REGISTRATION_STATE.RTCRS_REMOTE_PA_LOGGED_OFF:
                    break;

                default:
                    break;
            }

            this.kayitDurumu = registerEvent.State; // Durumu güncelle. Önemli!!!  
        }