Commit 39bfd587 authored by Sylvain Berfini's avatar Sylvain Berfini

Added a menu to disable/enable sip register

parent 109bf28f
......@@ -280,8 +280,8 @@ namespace Linphone.Model
ConfigureLogger();
server.LinphoneCoreFactory.CreateLinphoneCore(this, config);
server.LinphoneCore.SetRootCA("Assets/rootca.pem");
Debug.WriteLine("[LinphoneManager] LinphoneCore created");
Debug.WriteLine("[LinphoneManager] LinphoneCore created");
AudioRoutingManager.GetDefault().AudioEndpointChanged += AudioEndpointChanged;
CallController.MuteRequested += MuteRequested;
CallController.UnmuteRequested += UnmuteRequested;
......@@ -343,10 +343,10 @@ namespace Linphone.Model
{
// To have the debug output in the debugger use the following commented configure and set your debugger to native mode
//server.BackgroundModeLogger.Configure(SettingsManager.isDebugEnabled, OutputTraceDest.Debugger, "");
// Else output the debug traces to a file
// Else output the debug traces to a file
ApplicationSettingsManager appSettings = new ApplicationSettingsManager();
appSettings.Load();
server.BackgroundModeLogger.Configure(appSettings.DebugEnabled, appSettings.LogDestination, appSettings.LogOption);
server.BackgroundModeLogger.Configure(appSettings.DebugEnabled, appSettings.LogDestination, appSettings.LogOption);
server.LinphoneCoreFactory.OutputTraceListener = server.BackgroundModeLogger;
server.LinphoneCoreFactory.SetLogLevel(appSettings.LogLevel);
Logger.Instance.TraceListener = server.BackgroundModeLogger;
......
This diff is collapsed.
......@@ -279,7 +279,7 @@ http://www.linphone.org/m/help
<value>Password</value>
</data>
<data name="SIPProxy" xml:space="preserve">
<value>Proxy</value>
<value>Proxy (not mandatory)</value>
</data>
<data name="SIPUsername" xml:space="preserve">
<value>Username</value>
......@@ -468,7 +468,7 @@ http://www.linphone.org/m/help
<value>edit password</value>
</data>
<data name="DisplayName" xml:space="preserve">
<value>Display name</value>
<value>Display name (not mandatory)</value>
</data>
<data name="VibratorSetting" xml:space="preserve">
<value>Vibrate on incoming message</value>
......@@ -535,7 +535,7 @@ Do you want to report it to the developpers ? It will help fix it faster.</value
<value>Send by email</value>
</data>
<data name="SIPUserId" xml:space="preserve">
<value>Auth userid</value>
<value>Auth userid (not mandatory)</value>
</data>
<data name="FirewallPolicyIce" xml:space="preserve">
<value>ICE</value>
......@@ -561,4 +561,10 @@ Do you want to report it to the developpers ? It will help fix it faster.</value
<data name="ISACCodec" xml:space="preserve">
<value>iSAC</value>
</data>
<data name="ConnectMenu" xml:space="preserve">
<value>Enable register</value>
</data>
<data name="DisconnectMenu" xml:space="preserve">
<value>Disable register</value>
</data>
</root>
\ No newline at end of file
......@@ -5,6 +5,8 @@ using Linphone.Resources;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
......@@ -151,6 +153,20 @@ namespace Linphone
NavigationService.Navigate(new Uri("/Views/Console.xaml", UriKind.RelativeOrAbsolute));
}
private void disconnect_Click_1(object sender, EventArgs e)
{
EnableRegister(false);
ApplicationBar.MenuItems.Clear();
BuildLocalizedApplicationBar();
}
private void connect_Click_1(object sender, EventArgs e)
{
EnableRegister(true);
ApplicationBar.MenuItems.Clear();
BuildLocalizedApplicationBar();
}
private async void BuildLocalizedApplicationBar()
{
ApplicationBar = new ApplicationBar();
......@@ -193,6 +209,22 @@ namespace Linphone
appBarConsole.Click += console_Click_1;
ApplicationBar.MenuItems.Add(appBarConsole);
}
if (IsAccountConfigured())
{
if (IsRegisterEnabled())
{
ApplicationBarMenuItem appBarDisconnect = new ApplicationBarMenuItem(AppResources.DisconnectMenu);
appBarDisconnect.Click += disconnect_Click_1;
ApplicationBar.MenuItems.Add(appBarDisconnect);
}
else
{
ApplicationBarMenuItem appBarConnect = new ApplicationBarMenuItem(AppResources.ConnectMenu);
appBarConnect.Click += connect_Click_1;
ApplicationBar.MenuItems.Add(appBarConnect);
}
}
}
private void Title_Tap(object sender, System.Windows.Input.GestureEventArgs e)
......@@ -216,5 +248,35 @@ namespace Linphone
{
numpad.Visibility = Visibility.Visible;
}
private bool IsRegisterEnabled()
{
LinphoneCore lc = LinphoneManager.Instance.LinphoneCore;
LinphoneProxyConfig cfg = lc.GetDefaultProxyConfig();
if (cfg != null)
{
return cfg.IsRegisterEnabled();
}
return true;
}
private bool IsAccountConfigured()
{
LinphoneCore lc = LinphoneManager.Instance.LinphoneCore;
LinphoneProxyConfig cfg = lc.GetDefaultProxyConfig();
return cfg != null;
}
private void EnableRegister(bool enable)
{
LinphoneCore lc = LinphoneManager.Instance.LinphoneCore;
LinphoneProxyConfig cfg = lc.GetDefaultProxyConfig();
if (cfg != null)
{
cfg.Edit();
cfg.EnableRegister(enable);
cfg.Done();
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment