예제 #1
0
 public void OnRegistrationChanged(IntPtr lc, IntPtr cfg, LinphoneRegistrationState cstate, string message)
 {
     if (LinphoneCore.IsNonZero())
     {
         RegistrationStateChangedEvent?.Invoke(cstate);
     }
 }
예제 #2
0
        private void LinphoneWrapper_RegistrationStateChangedEvent(LinphoneRegistrationState state)
        {
            switch (state)
            {
            case LinphoneRegistrationState.LinphoneRegistrationProgress:
                ConnectState = ConnectState.Progress;
                break;

            case LinphoneRegistrationState.LinphoneRegistrationOk:
                ConnectState = ConnectState.Connected;
                PhoneConnectedEvent?.Invoke();
                break;

            case LinphoneRegistrationState.LinphoneRegistrationCleared:
                ConnectState = ConnectState.Disconnected;
                PhoneDisconnectedEvent?.Invoke();
                break;

            case LinphoneRegistrationState.LinphoneRegistrationFailed:
                LinphoneWrapper.DestroyPhone();
                ErrorEvent?.Invoke(null, Error.RegisterFailed);
                break;

            case LinphoneRegistrationState.LinphoneRegistrationNone:
            default:
                break;
            }
        }
예제 #3
0
        // TODO: Add CallStateChangedEvent and ChatMessageChangedEvent.

        void OnRegistrationChanged(IntPtr lc, IntPtr cfg, LinphoneRegistrationState cstate, string message)
        {
            if (this.linphoneCore == IntPtr.Zero || !this.running)
            {
                return;
            }

            if (this.RegistrationStateChangedEvent != null)
            {
                this.RegistrationStateChangedEvent(cstate);
            }
        }
예제 #4
0
파일: Linphone.cs 프로젝트: prakash3129/CM
 void OnRegistrationChanged(IntPtr lc, IntPtr cfg, LinphoneRegistrationState cstate, string message)
 {
     if (linphoneCore == IntPtr.Zero || !running)
     {
         return;
     }
     #if (TRACE)
     Console.WriteLine("OnRegistrationChanged: {0}", cstate);
     #endif
     if (RegistrationStateChangedEvent != null)
     {
         RegistrationStateChangedEvent(cstate);
     }
 }
예제 #5
0
		public LinphoneService(ServiceManagerBase manager)
		{
            this.currentRegistrationState = LinphoneRegistrationState.LinphoneRegistrationNone;
			this.manager = manager;
            commandQueue = new Queue<LinphoneCommand>();
			preferences = new Preferences();
			_isStarting = false;
			_isStarted = false;
		    _vcardSupported = true;
		}
예제 #6
0
		void OnRegistrationChanged (IntPtr lc, IntPtr cfg, LinphoneRegistrationState cstate, string message) 
		{
			if (linphoneCore == IntPtr.Zero) return;
            // Liz E. - I think that here - if the registration state has not actually changed, just return
            if (currentRegistrationState == cstate)
            {
//                LOG.Info("LinphoneService.OnRegistrationChanged called - but there is no change. Do nothing.");
                return;
            }
		    var erroeReason = LinphoneAPI.linphone_error_info_get_reason(cfg);

            LOG.InfoFormat("LinphoneService.OnRegistrationChanged [{0}] Reg State was: {1} Changed to {2}",  cfg, 
                currentRegistrationState, cstate);
            
		    if (cfg == proxy_cfg)
		    {
		        var reason = LinphoneAPI.linphone_proxy_config_get_error(cfg);
		        currentRegistrationState = cstate;
		        if (RegistrationStateChangedEvent != null)
		            RegistrationStateChangedEvent(cstate, reason);
		        switch (cstate)
		        {
		            case LinphoneRegistrationState.LinphoneRegistrationOk:
		                LinphoneAPI.linphone_core_enable_keep_alive(linphoneCore, true);
		                break;
		            case LinphoneRegistrationState.LinphoneRegistrationFailed:
		            case LinphoneRegistrationState.LinphoneRegistrationCleared:
		                LinphoneAPI.linphone_core_enable_keep_alive(linphoneCore, false);
		                break;
		        }

                if (_clearProxyInformation && cstate == LinphoneRegistrationState.LinphoneRegistrationCleared)
                    ClearProxyInformation();
		    }
		}
 public LocalContactViewModel()
 {
     _videoMailCount = 0;
     _registrationState = LinphoneRegistrationState.LinphoneRegistrationCleared;
 }
예제 #8
0
 void OnRegistrationChanged(IntPtr lc, IntPtr cfg, LinphoneRegistrationState cstate, string message)
 {
     if (linphoneCore == IntPtr.Zero || !running) return;
     #if (TRACE)
     Console.WriteLine("OnRegistrationChanged: {0}", cstate);
     #endif
     if (RegistrationStateChangedEvent != null)
         RegistrationStateChangedEvent (cstate);
 }
        private void OnRegistrationChanged(LinphoneRegistrationState state, LinphoneReason reason)
        {
            if (RegistrationState == state)
                return;

            if (this.Dispatcher.Thread != Thread.CurrentThread)
            {
                this.Dispatcher.BeginInvoke((Action)(() => this.OnRegistrationChanged(state, reason)));
                return;
            }
            LOG.Info(String.Format("Registration state changed from {0} to {1}. Reason: {2}", RegistrationState, state, reason));
            var processSignOut = false;
            RegistrationState = state;
            RegistrationFailReason = reason;

            this.BtnMoreMenu.IsEnabled = true;
            _mainViewModel.ContactModel.RegistrationState = state;
            switch (state)
            {
                case LinphoneRegistrationState.LinphoneRegistrationProgress:
                    this.BtnMoreMenu.IsEnabled = false;
                    // VATRP-3225: here we want to kick off a timer - if we do not get the OK in a reasonable amount of time, then
                    //   we need to doa reset - preferably behind the scenes - and try to log in again.
                    lock (regLock)
                    {
                        if (registrationTimer == null)
                        {
                            registrationTimer = new System.Timers.Timer();
                            registrationTimer.Elapsed += new System.Timers.ElapsedEventHandler(RegistrationTimerTick);
                            registrationTimer.Interval = 30000;
                            registrationTimer.Enabled = true;
                            registrationTimer.Start();
                        }
                    }
                    return;
                case LinphoneRegistrationState.LinphoneRegistrationOk:
                    DestroyRegistrationTimer();

                    _playRegistrationFailureNotify = true;
                    if (_playRegisterNotify)
                    {
                        _playRegisterNotify = false;
                        ServiceManager.Instance.SoundService.PlayConnectionChanged(true);
                    }
                    signOutRequest = false;
                    break;
                case LinphoneRegistrationState.LinphoneRegistrationNone:
                case LinphoneRegistrationState.LinphoneRegistrationFailed:
                    DestroyRegistrationTimer();

                    if (state == LinphoneRegistrationState.LinphoneRegistrationFailed)
                    {
                        signOutRequest = false;
                        _playRegisterNotify = true;
                        if (_playRegistrationFailureNotify)
                        {
                            ServiceManager.Instance.SoundService.PlayConnectionChanged(false);
                            _playRegistrationFailureNotify = false;
                        }
                        lock (regLock)
                        {
                            registrationTimer = new System.Timers.Timer();
                            registrationTimer.Elapsed += new System.Timers.ElapsedEventHandler(RegistrationTimerTick);
                            registrationTimer.Interval = 120000;
                            registrationTimer.Start();
                        }
                        Debug.WriteLine("Start register retry timer: ");
                    }
                    break;
                case LinphoneRegistrationState.LinphoneRegistrationCleared:
                    DestroyRegistrationTimer();

                    ServiceManager.Instance.SoundService.PlayConnectionChanged(false);
                    _playRegisterNotify = true;
                    _playRegistrationFailureNotify = false;
                    if (registerRequested)
                    {
                        registerRequested = false;
                        _linphoneService.Register();
                    }
                    else if (signOutRequest || defaultConfigRequest)
                    {
                        processSignOut = true;
                    }

                    break;
                default:
                    break;
            }
            UpdateMenuSettingsForRegistrationState();
            if (processSignOut)
            {
                ProceedToLoginPage();
                signOutRequest = false;
            }
        }
예제 #10
0
 public LocalContactViewModel()
 {
     _videoMailCount    = 0;
     _registrationState = LinphoneRegistrationState.LinphoneRegistrationCleared;
 }