Commit ec712065 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixes for calls in interface + replace callcontext from voipphonecall to platform::object

parent 36350389
......@@ -7,6 +7,7 @@
#include "ApiLock.h"
using namespace Linphone::Core;
using namespace Windows::Phone::Networking::Voip;
LinphoneCallState LinphoneCall::GetState()
{
......@@ -113,14 +114,14 @@ Platform::String^ LinphoneCall::GetRemoteContact()
return this->contact;
}
void LinphoneCall::CallContext::set(Windows::Phone::Networking::Voip::VoipPhoneCall^ cc)
void LinphoneCall::CallContext::set(Platform::Object^ cc)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
this->callContext = cc;
}
Windows::Phone::Networking::Voip::VoipPhoneCall^ LinphoneCall::CallContext::get()
Platform::Object^ LinphoneCall::CallContext::get()
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
......
......@@ -88,10 +88,10 @@ namespace Linphone
Platform::String^ GetRemoteUserAgent();
Platform::String^ GetRemoteContact();
property Windows::Phone::Networking::Voip::VoipPhoneCall^ CallContext
property Platform::Object^ CallContext
{
Windows::Phone::Networking::Voip::VoipPhoneCall^ get();
void set(Windows::Phone::Networking::Voip::VoipPhoneCall^ cc);
Platform::Object^ get();
void set(Platform::Object^ cc);
}
LinphoneCall(Platform::String^ contact, Platform::String^ number);
......@@ -99,7 +99,7 @@ namespace Linphone
private:
friend ref class Linphone::Core::LinphoneCore;
Windows::Phone::Networking::Voip::VoipPhoneCall^ callContext;
Platform::Object^ callContext;
Platform::String^ contact;
Platform::String^ number;
......
No preview for this file type
......@@ -29,8 +29,6 @@ namespace Linphone
/// </summary>
public BasePage Page { get; set; }
public static Dispatcher UIDispatcher;
/// <summary>
/// Called when a call is starting.
/// Displays the InCall.xaml page.
......@@ -52,6 +50,8 @@ namespace Linphone
{
this.Page.Dispatcher.BeginInvoke(() =>
{
System.Diagnostics.Debug.WriteLine("[CallListener] Call ended, can go back ? " + this.Page.NavigationService.CanGoBack);
if (this.Page.NavigationService.CanGoBack)
this.Page.NavigationService.GoBack();
else
......@@ -67,17 +67,14 @@ namespace Linphone
/// <summary>
/// Actualises the listener when the pages changes.
/// </summary>
/// <param name="nea"></param>
public virtual void OnNavigatedTo(NavigationEventArgs nea)
{
LinphoneManager.Instance.CallListener = this;
UIDispatcher = this.Page.Dispatcher;
}
/// <summary>
/// Actualises the listener when the pages changes.
/// </summary>
/// <param name="nea"></param>
public virtual void OnNavigatedFrom(NavigationEventArgs nea)
{
LinphoneManager.Instance.CallListener = null;
......
......@@ -297,10 +297,11 @@ namespace Linphone.Model
public void NewOutgoingCall(String sipAddress)
{
VoipPhoneCall call;
CallController.RequestNewOutgoingCall(sipAddress, "", "Linphone", VoipCallMedia.Audio, out call);
CallController.RequestNewOutgoingCall("/Linphone;component/Views/InCall.xaml?sip=" + sipAddress, sipAddress, "Linphone", VoipCallMedia.Audio, out call);
call.NotifyCallActive();
LinphoneCall LCall = LinphoneCore.Invite(sipAddress);
LCall.CallContext = call;
LinphoneCore.Call = LCall;
if (CallListener != null)
CallListener.NewCallStarted(sipAddress);
......@@ -378,21 +379,27 @@ namespace Linphone.Model
Uri iconUri = new Uri(server.Path + "\\Assets\\pnicon.png", UriKind.Absolute);
Uri ringtoneUri = new Uri(server.Path + "\\Assets\\Sounds\\Ringtone.wma", UriKind.Absolute);
CallController.RequestNewIncomingCall("/Views/InCall.xaml?sip=" + number, contact, number, contactUri, "Linphone", iconUri, "", ringtoneUri, VoipCallMedia.Audio, fifteenSecs, out vcall);
CallController.RequestNewIncomingCall("/Linphone;component/Views/InCall.xaml?sip=" + number, contact, number, contactUri, "Linphone", iconUri, "", ringtoneUri, VoipCallMedia.Audio, fifteenSecs, out vcall);
vcall.AnswerRequested += ((c, eventargs) =>
{
Debug.WriteLine("[LinphoneManager] Call accepted");
vcall.NotifyCallActive();
LinphoneCore.AcceptCall(call);
if (CallListener != null)
CallListener.NewCallStarted(number);
LinphoneCore.AcceptCall(call);
});
vcall.RejectRequested += ((c, eventargs) =>
{
Debug.WriteLine("[LinphoneManager] Call rejected");
vcall.NotifyCallEnded();
LinphoneCore.TerminateCall(call);
});
call.CallContext = vcall;
LinphoneCore.Call = call;
}
else if (state == LinphoneCallState.CallEnd ||
state == LinphoneCallState.Error ||
......
......@@ -36,6 +36,8 @@ namespace Linphone.Views
/// </summary>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
while (actions.Children.Count > 0)
{
actions.Children.RemoveAt(0);
......
......@@ -38,9 +38,10 @@ namespace Linphone
/// Method called when the page is displayed.
/// Check if the uri contains a sip address, if yes, it starts a call to this address.
/// </summary>
/// <param name="e"></param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
LinphoneManager.Instance.EnableDebug(SettingsManager.isDebugEnabled);
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
......
......@@ -32,9 +32,10 @@ namespace Linphone.Views
/// 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>
/// <param name="e"></param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
LinphoneManager.Instance.EnableDebug(SettingsManager.isDebugEnabled);
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
......
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