Exemple #1
0
 public void OnRegistrationChanged(IntPtr lc, IntPtr cfg, LinphoneRegistrationState cstate, string message)
 {
     if (LinphoneCore.IsNonZero())
     {
         RegistrationStateChangedEvent?.Invoke(cstate);
     }
 }
Exemple #2
0
        private void LinphoneMainLoopHandler()
        {
            while (IsRunning)
            {
                CoreModule.linphone_core_iterate(LinphoneCore);
                Thread.Sleep(Constants.LC_SLEEP_TIMEOUT);
            }

            // Phone is disabled, free resources
            NetworkModule.linphone_nat_policy_unref(NatPolicy);
            CoreModule.linphone_core_unref(LinphoneCore);

            VTablePtr.Free();
            TransportConfigPtr.Free();

            registration_state_changed = null;
            call_state_changed         = null;

            LinphoneCore       = IntPtr.Zero;
            ProxyCfg           = IntPtr.Zero;
            AuthInfo           = IntPtr.Zero;
            TransportConfigPtr = IntPtr.Zero;

            coreLoop   = null;
            Identity   = null;
            ServerHost = null;

            RegistrationStateChangedEvent?.Invoke(LinphoneRegistrationState.LinphoneRegistrationCleared);
        }
Exemple #3
0
        public void DestroyPhone()
        {
            if (LinphoneCore != null)
            {
                RegistrationStateChangedEvent?.Invoke(LinphoneRegistrationState.LinphoneRegistrationProgress);

                CallModule.linphone_core_terminate_all_calls(LinphoneCore);

                var proxySetDownTask = ComponentExtensions.ExecuteWithDelay(() =>
                {
                    if (ProxieModule.linphone_proxy_config_is_registered(ProxyCfg))
                    {
                        ProxieModule.linphone_proxy_config_edit(ProxyCfg);
                        ProxieModule.linphone_proxy_config_enable_register(ProxyCfg, false);
                        ProxieModule.linphone_proxy_config_done(ProxyCfg);
                    }
                }, Constants.LC_CORE_PROXY_DISABLE_TIMEOUT);

                proxySetDownTask.Wait(Constants.LC_CORE_PROXY_DISABLE_TIMEOUT);

                IsRunning = ProxieModule.linphone_proxy_config_is_registered(ProxyCfg);
            }
        }