private void Save() { _callSettings.SendDTFMsRFC2833 = rfc2833.IsOn; _callSettings.SendDTFMsSIPInfo = sipInfo.IsOn; _callSettings.Save(); _networkSettings.MEncryption = mediaEncryption.SelectedItem.ToString(); _networkSettings.FWPolicy = firewallPolicy.SelectedItem.ToString(); _networkSettings.StunServer = Stun.Text; _networkSettings.IPV6 = IPV6.IsOn; if (TunnelPanel.Visibility == Visibility.Visible) { _networkSettings.TunnelMode = tunnelMode.SelectedItem.ToString(); _networkSettings.TunnelServer = tunnelServer.Text; _networkSettings.TunnelPort = tunnelPort.Text; } _networkSettings.Save(); //_chatSettings.VibrateOnIncomingMessage = vibrator.IsOn; //_chatSettings.ScaleDownSentPictures = resizeDown.IsOn; _chatSettings.Save(); _settings.DebugEnabled = (bool)Debug.IsOn; _settings.Save(); }
/// <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(); }
private void Save() { _callSettings.SendDTFMsRFC2833 = rfc2833.IsChecked; _callSettings.SendDTFMsSIPInfo = sipInfo.IsChecked; _callSettings.Save(); _networkSettings.MEncryption = MediaEncryption.SelectedItem.ToString(); _networkSettings.FWPolicy = FirewallPolicy.SelectedItem.ToString(); _networkSettings.StunServer = Stun.Text; _networkSettings.TunnelMode = tunnelMode.SelectedItem.ToString(); _networkSettings.TunnelServer = tunnelServer.Text; _networkSettings.TunnelPort = tunnelPort.Text; _networkSettings.Save(); _chatSettings.VibrateOnIncomingMessage = vibrator.IsChecked; _chatSettings.ScaleDownSentPictures = resizeDown.IsChecked; _chatSettings.Save(); _settings.DebugEnabled = (bool)Debug.IsChecked; _settings.Save(); LinphoneManager.Instance.ConfigureLogger(); }
/// <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; }