public AdvancedSettings()
        {
            this.InitializeComponent();
            SystemNavigationManager.GetForCurrentView().BackRequested += back_Click;

            _callSettings.Load();
            _networkSettings.Load();
            _chatSettings.Load();
            _settings.Load();

            rfc2833.IsOn = (bool)_callSettings.SendDTFMsRFC2833;
            sipInfo.IsOn = (bool)_callSettings.SendDTFMsSIPInfo;
            //vibrator.IsOn = (bool) _chatSettings.VibrateOnIncomingMessage;
            //resizeDown.IsOn = (bool) _chatSettings.ScaleDownSentPictures;

            List <string> mediaEncryptions = new List <string> {
                ResourceLoader.GetForCurrentView().GetString("MediaEncryptionNone")
            };

            if (LinphoneManager.Instance.Core.MediaEncryptionSupported(MediaEncryption.SRTP))
            {
                mediaEncryptions.Add(ResourceLoader.GetForCurrentView().GetString("MediaEncryptionSRTP"));
            }
            if (LinphoneManager.Instance.Core.MediaEncryptionSupported(MediaEncryption.DTLS))
            {
                mediaEncryptions.Add(ResourceLoader.GetForCurrentView().GetString("MediaEncryptionDTLS"));
            }
            if (LinphoneManager.Instance.Core.MediaEncryptionSupported(MediaEncryption.ZRTP))
            {
                mediaEncryptions.Add(ResourceLoader.GetForCurrentView().GetString("MediaEncryptionZRTP"));
            }


            mediaEncryption.ItemsSource  = mediaEncryptions;
            mediaEncryption.SelectedItem = _networkSettings.MEncryption;

            ICE.IsOn = LinphoneManager.Instance.Core.NatPolicy.IceEnabled;

            Stun.Text = _networkSettings.StunServer;

            List <string> tunnelModes = new List <string>
            {
                ResourceLoader.GetForCurrentView().GetString("TunnelModeDisabled"),
                ResourceLoader.GetForCurrentView().GetString("TunnelMode3GOnly"),
                ResourceLoader.GetForCurrentView().GetString("TunnelModeAlways"),
                ResourceLoader.GetForCurrentView().GetString("TunnelModeAuto")
            };

            tunnelMode.ItemsSource  = tunnelModes;
            tunnelMode.SelectedItem = _networkSettings.TunnelMode;
            tunnelPort.Text         = _networkSettings.TunnelPort;
            tunnelServer.Text       = _networkSettings.TunnelServer;
            IPV6.IsOn = LinphoneManager.Instance.Core.Ipv6Enabled;

            TunnelPanel.Visibility = LinphoneManager.Instance.Core.Tunnel != null ? Visibility.Visible : Visibility.Collapsed; //Hidden properties for now

            Debug.IsOn          = _settings.DebugEnabled;
            SendLogs.IsEnabled  = _settings.DebugEnabled;
            ResetLogs.IsEnabled = _settings.DebugEnabled;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method called when the page is displayed.
        /// Searches for a matching contact using the current call address or number and display information if found.
        /// </summary>
        protected override void OnNavigatedTo(NavigationEventArgs nee)
        {
            base.OnNavigatedTo(nee);
            this.ViewModel.MuteListener  = this;
            this.ViewModel.PauseListener = this;
            this.ViewModel.CallUpdatedByRemoteListener = this;
            LinphoneManager.Instance.CallStateChanged += CallStateChanged;
            AudioRoutingManager.GetDefault().AudioEndpointChanged += AudioEndpointChanged;

            if (NavigationContext.QueryString.ContainsKey("sip"))
            {
                String          calledNumber = NavigationContext.QueryString["sip"];
                LinphoneAddress address      = LinphoneManager.Instance.LinphoneCore.InterpretURL(calledNumber);
                calledNumber = String.Format("{0}@{1}", address.UserName, address.Domain);
                // While we dunno if the number matches a contact one, we consider it won't and we display the phone number as username
                Contact.Text = calledNumber;

                if (calledNumber != null && calledNumber.Length > 0)
                {
                    ContactManager cm = ContactManager.Instance;
                    cm.ContactFound += cm_ContactFound;
                    cm.FindContact(calledNumber);
                }
            }

            ApplicationSettingsManager settings = new ApplicationSettingsManager();

            settings.Load();

            // Callback CallStateChanged set too late when call is incoming, so trigger it manually
            if (LinphoneManager.Instance.LinphoneCore.CallsNb > 0)
            {
                LinphoneCall call = (LinphoneCall)LinphoneManager.Instance.LinphoneCore.Calls[0];
                if (call.State == LinphoneCallState.StreamsRunning)
                {
                    CallStateChanged(call, LinphoneCallState.StreamsRunning);
                    if (settings.VideoActiveWhenGoingToBackground)
                    {
                        LinphoneManager.Instance.LinphoneCore.VideoPolicy.AutomaticallyAccept = settings.VideoAutoAcceptWhenGoingToBackground;
                        LinphoneCallParams callParams = call.GetCurrentParamsCopy();
                        callParams.VideoEnabled = true;
                        LinphoneManager.Instance.LinphoneCore.UpdateCall(call, callParams);
                    }
                }
                else if (call.State == LinphoneCallState.UpdatedByRemote)
                {
                    // The call was updated by the remote party while we were in background
                    LinphoneManager.Instance.CallState(call, call.State, "call updated while in background");
                }
            }

            settings.VideoActiveWhenGoingToBackground = false;
            settings.Save();

            oneSecondTimer          = new DispatcherTimer();
            oneSecondTimer.Interval = TimeSpan.FromSeconds(1);
            oneSecondTimer.Tick    += timerTick;
            oneSecondTimer.Start();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Public constructor.
        /// </summary>
        public AdvancedSettings()
        {
            InitializeComponent();
            BuildLocalizedApplicationBar();

            _callSettings.Load();
            _networkSettings.Load();
            _chatSettings.Load();
            _settings.Load();

            rfc2833.IsChecked    = _callSettings.SendDTFMsRFC2833;
            sipInfo.IsChecked    = _callSettings.SendDTFMsSIPInfo;
            vibrator.IsChecked   = _chatSettings.VibrateOnIncomingMessage;
            resizeDown.IsChecked = _chatSettings.ScaleDownSentPictures;

            List <string> mediaEncryptions = new List <string>
            {
                AppResources.MediaEncryptionNone,
                AppResources.MediaEncryptionSRTP,
            };

            MediaEncryption.ItemsSource  = mediaEncryptions;
            MediaEncryption.SelectedItem = _networkSettings.MEncryption;

            List <string> firewallPolicies = new List <string>
            {
                AppResources.FirewallPolicyNone,
                AppResources.FirewallPolicyStun,
                AppResources.FirewallPolicyIce
            };

            FirewallPolicy.ItemsSource  = firewallPolicies;
            FirewallPolicy.SelectedItem = _networkSettings.FWPolicy;

            Stun.Text = _networkSettings.StunServer;

            List <string> tunnelModes = new List <string>
            {
                AppResources.TunnelModeDisabled,
                AppResources.TunnelMode3GOnly,
                AppResources.TunnelModeAlways,
                AppResources.TunnelModeAuto
            };

            tunnelMode.ItemsSource  = tunnelModes;
            tunnelMode.SelectedItem = _networkSettings.TunnelMode;
            tunnelPort.Text         = _networkSettings.TunnelPort;
            tunnelServer.Text       = _networkSettings.TunnelServer;

            TunnelPanel.Visibility = LinphoneManager.Instance.LinphoneCore.TunnelAvailable && Customs.IsTunnelEnabled ? Visibility.Visible : Visibility.Collapsed; //Hidden properties for now

            Debug.IsChecked     = _settings.DebugEnabled;
            SendLogs.IsEnabled  = _settings.DebugEnabled;
            ResetLogs.IsEnabled = _settings.DebugEnabled;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Method called when the page is leaved.
        /// </summary>
        protected override void OnNavigatedFrom(NavigationEventArgs nee)
        {
            if (((InCallModel)ViewModel).IsVideoActive)
            {
                LinphoneCall call = null;
                try
                {
                    call = (LinphoneCall)LinphoneManager.Instance.LinphoneCore.Calls[0];
                }
                catch (System.ArgumentOutOfRangeException) { }
                if (call != null)
                {
                    ApplicationSettingsManager settings = new ApplicationSettingsManager();
                    settings.Load();
                    settings.VideoActiveWhenGoingToBackground     = true;
                    settings.VideoAutoAcceptWhenGoingToBackground = LinphoneManager.Instance.LinphoneCore.VideoPolicy.AutomaticallyAccept;
                    settings.Save();
                    LinphoneManager.Instance.LinphoneCore.VideoPolicy.AutomaticallyAccept = false;
                    LinphoneCallParams callParams = call.GetCurrentParamsCopy();
                    callParams.VideoEnabled = false;
                    LinphoneManager.Instance.LinphoneCore.UpdateCall(call, callParams);
                }
            }

            oneSecondTimer.Stop();
            if (fadeTimer != null)
            {
                fadeTimer.Dispose();
                fadeTimer = null;
            }

            base.OnNavigatedFrom(nee);
            this.ViewModel.MuteListener  = null;
            this.ViewModel.PauseListener = null;
            LinphoneManager.Instance.CallStateChanged -= CallStateChanged;
            AudioRoutingManager.GetDefault().AudioEndpointChanged -= AudioEndpointChanged;
        }