Commit 40c6ddc9 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added (empty) Agents for VoIP app

parent df2e6e77
Linphone/Bin/
Linphone/obj/
\ No newline at end of file
Linphone/obj/
Linphone/*/Thumbs.db
\ No newline at end of file
No preview for this file type
using Microsoft.Phone.Networking.Voip;
using System.Diagnostics;
namespace Linphone.Agents
{
public class LinphoneCallInProgressAgent : VoipCallInProgressAgent
{
public LinphoneCallInProgressAgent() : base()
{
}
protected override void OnFirstCallStarting()
{
Debug.WriteLine("[LinphoneCallInProgressAgent] The first call has started.");
}
protected override void OnCancel()
{
Debug.WriteLine("[LinphoneCallInProgressAgent] The last call has ended. Calling NotifyComplete");
base.NotifyComplete();
}
}
}
\ No newline at end of file
using Microsoft.Phone.Networking.Voip;
using System.Diagnostics;
namespace Linphone.Agents
{
public class LinphoneForegroundLifeTimeAgent : VoipForegroundLifetimeAgent
{
public LinphoneForegroundLifeTimeAgent() : base()
{
}
protected override void OnLaunched()
{
Debug.WriteLine("[LinphoneForegroundLifeTimeAgent] The UI has entered the foreground.");
}
protected override void OnCancel()
{
Debug.WriteLine("[LinphoneForegroundLifeTimeAgent] The UI is leaving the foreground");
base.NotifyComplete();
}
}
}
\ No newline at end of file
using Microsoft.Phone.Networking.Voip;
using Microsoft.Phone.Scheduler;
using System.Diagnostics;
namespace Linphone.Agents
{
class LinphoneScheduledAgent : ScheduledTaskAgent
{
// Indicates if this agent instance is handling an incoming call or not
private bool isIncomingCallAgent;
// Strings used in tracing
private const string keepAliveAgentId = "KeepAliveAgent";
private const string incomingCallAgentId = "IncomingCallAgent";
public LinphoneScheduledAgent()
{
}
protected override void OnInvoke(ScheduledTask task)
{
Debug.WriteLine("[LinphoneScheduledAgent] ScheduledAgentImpl has been invoked with argument of type {0}.", task.GetType());
VoipHttpIncomingCallTask incomingCallTask = task as VoipHttpIncomingCallTask;
if (incomingCallTask != null)
{
isIncomingCallAgent = true;
}
else
{
VoipKeepAliveTask keepAliveTask = task as VoipKeepAliveTask;
if (keepAliveTask != null)
{
isIncomingCallAgent = false;
}
}
}
protected override void OnCancel()
{
Debug.WriteLine("[{0}] Cancel requested.", this.isIncomingCallAgent ? LinphoneScheduledAgent.incomingCallAgentId : LinphoneScheduledAgent.keepAliveAgentId);
base.NotifyComplete();
}
}
}
......@@ -8,6 +8,7 @@ using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Linphone.Resources;
using System.Windows.Media;
using Linphone.Model;
namespace Linphone
{
......@@ -62,12 +63,22 @@ namespace Linphone
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
Debug.WriteLine("[Linphone] Launching");
// Call this method below at the beginning of this handler,
// to let the background process that the UI is entering the foreground.
LinphoneManager.Instance.ConnectBackgroundProcessToInterface();
}
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
Debug.WriteLine("[Linphone] Activated");
// Call this method below at the beginning of this handler,
// to let the background process that the UI is entering the foreground.
LinphoneManager.Instance.ConnectBackgroundProcessToInterface();
}
// Code to execute when the application is deactivated (sent to background)
......
......@@ -91,6 +91,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Agents\LinphoneCallInProgressAgent.cs" />
<Compile Include="Agents\LinphoneForegroundLifeTimeAgent.cs" />
<Compile Include="Agents\LinphoneScheduledAgent.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
......@@ -290,6 +293,7 @@
<HintPath>..\packages\WPtoolkit.4.2012.10.30\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
......
......@@ -9,10 +9,16 @@ namespace Linphone.Model
{
public class ContactManager
{
private static ContactManager _instance = new ContactManager();
private static ContactManager singleton;
public static ContactManager Instance
{
get { return _instance; }
get
{
if (ContactManager.singleton == null)
ContactManager.singleton = new ContactManager();
return ContactManager.singleton;
}
}
private List<AlphaKeyGroup<Contact>> _contacts;
......
using System;
using Microsoft.Phone.Networking.Voip;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -9,13 +11,55 @@ namespace Linphone.Model
{
public class LinphoneManager
{
private static LinphoneManager _instance = new LinphoneManager();
private static LinphoneManager singleton;
public static LinphoneManager Instance
{
get { return _instance; }
get
{
if (LinphoneManager.singleton == null)
LinphoneManager.singleton = new LinphoneManager();
return LinphoneManager.singleton;
}
}
private List<CallLogs> _history;
private bool BackgroundProcessConnected;
public void ConnectBackgroundProcessToInterface()
{
if (BackgroundProcessConnected)
{
Debug.WriteLine("[LinphoneManager] Background process already connected to interface");
return;
}
int backgroundProcessID;
try
{
//VoipBackgroundProcess.Launch(out backgroundProcessID);
}
catch (Exception e)
{
Debug.WriteLine("[LinphoneManager] Error launching VoIP background process. Exception: " + e.Message);
throw;
}
BackgroundProcessConnected = true;
Debug.WriteLine("[LinphoneManager] Background process connected to interface");
}
public void DisconnectBackgroundProcessFromInterface()
{
if (!BackgroundProcessConnected)
{
Debug.WriteLine("[LinphoneManager] Background process not connected to interface yet");
return;
}
BackgroundProcessConnected = false;
Debug.WriteLine("[LinphoneManager] Background process disconnected from interface");
}
/// <summary>
/// Set the debug value for liblinphone
......
......@@ -132,7 +132,7 @@ namespace Linphone.Model
}
}
//Codecs Settings
#region Codecs Settings
public bool? AMRNB
{
get
......@@ -273,5 +273,6 @@ namespace Linphone.Model
}
}
}
#endregion
}
}
......@@ -5,13 +5,23 @@
<IconPath IsRelative="true" IsResource="false">Assets\AppIcon.png</IconPath>
<Capabilities>
<Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_SENSORS" />
<Capability Name="ID_CAP_ISV_CAMERA" />
<Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
<Capability Name="ID_CAP_MICROPHONE" />
<Capability Name="ID_CAP_PUSH_NOTIFICATION" />
<Capability Name="ID_CAP_SENSORS" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
<Capability Name="ID_CAP_VOIP" />
<Capability Name="ID_CAP_CONTACTS" />
<Capability Name="ID_CAP_MEDIALIB_AUDIO" />
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="Views/Dialer.xaml" />
<ExtendedTask Name="BackgroundTask">
<BackgroundServiceAgent Specifier="ScheduledTaskAgent" Name="IncomingAndKeepAliveAgent" Source="Linphone.Agents" Type="Linphone.Agents.LinphoneScheduledAgent" />
<BackgroundServiceAgent Specifier="VoIPCallInProgressAgent" Name="CallInProgressAgent" Source="Linphone.Agents" Type="Linphone.Agents.LinphoneCallInProgressAgent" />
<BackgroundServiceAgent Specifier="VoIPForegroundLifetimeAgent" Name="ForegroundLifetimeAgent" Source="Linphone.Agents" Type="Linphone.Agents.LinphoneForegroundLifeTimeAgent" />
</ExtendedTask>
</Tasks>
<Tokens>
<PrimaryToken TokenID="LinphoneToken" TaskName="_default">
......
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