Commit 8c16c120 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Show InCall view PN incoming call arrives and is accepted

parent 12fde540
......@@ -125,6 +125,7 @@ popd</Command>
<ItemGroup>
<ClInclude Include="ApiLock.h" />
<ClInclude Include="CallController.h" />
<ClInclude Include="CallControllerListener.h" />
<ClInclude Include="CallDirection.h" />
<ClInclude Include="Globals.h" />
<ClInclude Include="LinphoneAddress.h" />
......
......@@ -6,11 +6,19 @@ using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Phone::Networking::Voip;
void CallController::SetCallControllerListener(CallControllerListener^ listener)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
this->callControllerListener = listener;
}
bool CallController::OnIncomingCallReceived(Platform::String^ contactName, Platform::String^ contactNumber, IncomingCallViewDismissedCallback^ incomingCallViewDismissedCallback)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
VoipPhoneCall^ incomingCall = nullptr;
this->callerNumber = contactNumber;
try
{
TimeSpan ringingTimeout;
......@@ -52,6 +60,9 @@ void CallController::OnAcceptCallRequested(VoipPhoneCall^ incomingCall, CallAnsw
if (this->onIncomingCallViewDismissed != nullptr)
this->onIncomingCallViewDismissed();
if (this->callControllerListener != nullptr)
this->callControllerListener->NewCallStarted(this->callerNumber);
}
void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallRejectEventArgs^ args)
......@@ -62,6 +73,8 @@ void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallReje
if (this->onIncomingCallViewDismissed != nullptr)
this->onIncomingCallViewDismissed();
this->callerNumber = nullptr;
}
void CallController::EndCurrentCall()
......@@ -80,7 +93,9 @@ CallController::CallController() :
voipServiceName(nullptr),
defaultContactImageUri(nullptr),
linphoneImageUri(nullptr),
ringtoneUri(nullptr)
ringtoneUri(nullptr),
callerNumber(nullptr),
callControllerListener(nullptr)
{
this->callCoordinator = VoipCallCoordinator::GetDefault();
......
#pragma once
#include <windows.phone.networking.voip.h>
#include "CallControllerListener.h"
#include "ApiLock.h"
namespace Linphone
......@@ -23,13 +24,19 @@ namespace Linphone
bool OnIncomingCallReceived(Platform::String^ contactName, Platform::String^ contactNumber, IncomingCallViewDismissedCallback^ incomingCallViewDismissedCallback);
void EndCurrentCall();
void SetCallControllerListener(CallControllerListener^ listener);
private:
friend ref class Linphone::BackEnd::Globals;
CallControllerListener^ callControllerListener;
Platform::String^ voipServiceName;
Platform::String^ callerNumber;
// The relative URI to the call-in-progress page
Platform::String ^callInProgressPageUri;
Platform::String^ callInProgressPageUri;
// The URI to the contact image, jpg or png, 1mb max !
Windows::Foundation::Uri^ defaultContactImageUri;
......
#pragma once
namespace Linphone
{
namespace BackEnd
{
public interface class CallControllerListener
{
void NewCallStarted(Platform::String^ callerNumber);
};
}
}
\ No newline at end of file
......@@ -21,6 +21,14 @@ namespace Linphone
{
}
property CallController^ CallController
{
Linphone::BackEnd::CallController^ get()
{
return Globals::Instance->CallController;
};
}
property LinphoneCoreFactory^ LinphoneCoreFactory
{
Linphone::BackEnd::LinphoneCoreFactory^ get()
......
No preview for this file type
using Linphone.BackEnd;
using Linphone.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Navigation;
namespace Linphone
{
public class BaseModel : CallControllerListener
{
public BaseModel()
{
}
public BasePage Page { get; set; }
public void NewCallStarted(string callerNumber)
{
this.Page.Dispatcher.BeginInvoke(() =>
{
this.Page.NavigationService.Navigate(new Uri("/Views/InCall.xaml?sip=" + callerNumber, UriKind.RelativeOrAbsolute));
});
}
public virtual void OnNavigatedTo(NavigationEventArgs nee)
{
LinphoneManager.Instance.CallController.SetCallControllerListener(this);
}
public virtual void OnNavigatedFrom(NavigationEventArgs nee)
{
LinphoneManager.Instance.CallController.SetCallControllerListener(null);
}
}
}
using Microsoft.Phone.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Navigation;
namespace Linphone
{
public class BasePage: PhoneApplicationPage
{
protected BasePage()
: this(new BaseModel())
{
}
protected BasePage(BaseModel viewModel)
{
this.ViewModel = viewModel;
this.ViewModel.Page = this;
this.Loaded += BasePage_Loaded;
}
protected readonly BaseModel ViewModel;
protected virtual void BasePage_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = ViewModel;
}
protected override void OnNavigatedTo(NavigationEventArgs nee)
{
base.OnNavigatedTo(nee);
this.ViewModel.OnNavigatedTo(nee);
}
protected override void OnNavigatedFrom(NavigationEventArgs nee)
{
base.OnNavigatedFrom(nee);
this.ViewModel.OnNavigatedFrom(nee);
}
}
}
......@@ -93,6 +93,8 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="BaseModel.cs" />
<Compile Include="BasePage.cs" />
<Compile Include="Controls\AddressBox.xaml.cs">
<DependentUpon>AddressBox.xaml</DependentUpon>
</Compile>
......
......@@ -36,6 +36,14 @@ namespace Linphone.Model
}
}
public CallController CallController
{
get
{
return server.CallController;
}
}
#region Background Process
private bool BackgroundProcessConnected;
......
......@@ -68,8 +68,9 @@
<Instancing>multipleInstances</Instancing>
<ActivatableClass ActivatableClassId="Linphone.BackEnd.OutOfProcess.Server" />
</OutOfProcessServer>
<ProxyStub ClassId="{C140594A-6BD4-3151-944E-28C955632D15}">
<ProxyStub ClassId="{5D9117DB-3F7A-3A97-B117-A5939C332AB5}">
<Path>Linphone.BackEndProxyStub.DLL</Path>
<Interface Name="Linphone.BackEnd.CallControllerListener" InterfaceId="{5D9117DB-3F7A-3A97-B117-A5939C332AB5}" />
<Interface Name="Linphone.BackEnd.__ICallControllerPublicNonVirtuals" InterfaceId="{C140594A-6BD4-3151-944E-28C955632D15}" />
<Interface Name="Linphone.BackEnd.__IGlobalsPublicNonVirtuals" InterfaceId="{74C65E76-06C7-38A6-9E0A-61E3739B7E1E}" />
<Interface Name="Linphone.BackEnd.__IGlobalsStatics" InterfaceId="{CE34112C-C406-3477-BBB4-7E1F99EE776C}" />
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Views.About"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:linphone="clr-namespace:Linphone"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
......@@ -51,4 +52,4 @@
</Grid>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -15,7 +15,7 @@ using System.Reflection;
namespace Linphone.Views
{
public partial class About : PhoneApplicationPage
public partial class About : BasePage
{
public About()
{
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Views.AccountSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:linphone="clr-namespace:Linphone"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
......@@ -103,4 +104,4 @@
</ScrollViewer>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -12,7 +12,7 @@ using Linphone.Model;
namespace Linphone.Views
{
public partial class AccountSettings : PhoneApplicationPage
public partial class AccountSettings : BasePage
{
private SettingsManager _appSettings = new SettingsManager();
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Views.AdvancedSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:linphone="clr-namespace:Linphone"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
......@@ -78,4 +79,4 @@
</phone:Pivot>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -12,7 +12,7 @@ using Linphone.Resources;
namespace Linphone.Views
{
public partial class AdvancedSettings : PhoneApplicationPage
public partial class AdvancedSettings : BasePage
{
private SettingsManager _appSettings = new SettingsManager();
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Views.CodecsSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:linphone="clr-namespace:Linphone"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
......@@ -109,4 +110,4 @@
</ScrollViewer>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -12,7 +12,7 @@ using Linphone.Model;
namespace Linphone.Views
{
public partial class CodecsSettings : PhoneApplicationPage
public partial class CodecsSettings : BasePage
{
private SettingsManager _appSettings = new SettingsManager();
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Views.Contact"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -6,6 +6,7 @@
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:linphone="clr-namespace:Linphone"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
......@@ -36,4 +37,4 @@
</Grid>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -16,7 +16,7 @@ using Linphone.Controls;
namespace Linphone.Views
{
public partial class Contact : PhoneApplicationPage
public partial class Contact : BasePage
{
private Microsoft.Phone.UserData.Contact contact { get; set; }
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Views.Contacts"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -6,7 +6,8 @@
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:linphone="clr-namespace:Linphone.Model"
xmlns:model="clr-namespace:Linphone.Model"
xmlns:linphone="clr-namespace:Linphone"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
......@@ -30,7 +31,7 @@
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.Resources>
<linphone:ContactPictureConverter x:Key="ContactPictureConverter"/>
<model:ContactPictureConverter x:Key="ContactPictureConverter"/>
<phone:JumpListItemBackgroundConverter x:Key="BackgroundConverter"/>
<phone:JumpListItemForegroundConverter x:Key="ForegroundConverter"/>
<Style x:Key="ContactsJumpListStyle" TargetType="phone:LongListSelector">
......@@ -94,4 +95,4 @@
</Grid>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -13,7 +13,7 @@ using System.Diagnostics;
namespace Linphone.Views
{
public partial class Contacts : PhoneApplicationPage
public partial class Contacts : BasePage
{
public Contacts()
{
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Dialer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -8,6 +8,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:controls="clr-namespace:Linphone.Controls"
xmlns:linphone="clr-namespace:Linphone"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
......@@ -57,4 +58,4 @@
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging;
namespace Linphone
{
public partial class Dialer : PhoneApplicationPage
public partial class Dialer : BasePage
{
private LocalizedStrings _appStrings = new LocalizedStrings();
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Views.History"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:linphone="clr-namespace:Linphone"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
......@@ -55,4 +56,4 @@
</Grid>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -12,7 +12,7 @@ using Linphone.Resources;
namespace Linphone.Views
{
public partial class History : PhoneApplicationPage
public partial class History : BasePage
{
private bool _usingSelectionAppBar = false;
private IEnumerable<CallLog> _selection;
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Views.InCall"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -6,6 +6,7 @@
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:linphone="clr-namespace:Linphone"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
......@@ -387,4 +388,4 @@
</Grid>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -8,7 +8,7 @@ using System.Windows.Navigation;
namespace Linphone.Views
{
public partial class InCall : PhoneApplicationPage
public partial class InCall : BasePage
{
private const string speakerOn = "/Assets/AppBar/speaker.png";
private const string speakerOff = "/Assets/AppBar/speaker.png";
......@@ -32,11 +32,14 @@ namespace Linphone.Views
{
String calledNumber = NavigationContext.QueryString["sip"];
// 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;
Contact.Text = calledNumber;
ContactManager cm = ContactManager.Instance;
cm.ContactFound += cm_ContactFound;
cm.FindContact(calledNumber);
if (calledNumber != null && calledNumber.Length > 0)
{
ContactManager cm = ContactManager.Instance;
cm.ContactFound += cm_ContactFound;
cm.FindContact(calledNumber);
}
}
}
......
<phone:PhoneApplicationPage
<linphone:BasePage
x:Class="Linphone.Views.Settings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:linphone="clr-namespace:Linphone"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
......@@ -83,4 +84,4 @@
</ScrollViewer>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
</linphone:BasePage>
\ No newline at end of file
......@@ -16,7 +16,7 @@ using System.Text;
namespace Linphone.Views
{
public partial class Settings : PhoneApplicationPage
public partial class Settings : BasePage
{
private SettingsManager _appSettings = new SettingsManager();
......
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