Commit 03ad0b7e authored by Erwan Croze's avatar Erwan Croze 👋🏻

Fix: Start video renderer before accepte incoming call

parent 2645cdbd
......@@ -24,6 +24,7 @@ using BelledonneCommunications.Linphone.Native;
using Linphone.Model;
using System.Diagnostics;
using Windows.UI.Core;
using System.Collections.Generic;
namespace Linphone
{
......@@ -96,7 +97,9 @@ namespace Linphone
public void NewCallStarted(string callerNumber)
{
Debug.WriteLine("[CallListener] NewCallStarted " + callerNumber);
rootFrame.Navigate(typeof(Views.InCall), callerNumber);
List<String> parameters = new List<String>();
parameters.Add(callerNumber);
rootFrame.Navigate(typeof(Views.InCall), parameters);
}
public void PauseStateChanged(Call call, bool isCallPaused, bool isCallPausedByRemote)
......@@ -228,7 +231,9 @@ namespace Linphone
if (addr != null && addr.AsStringUriOnly().Equals(call.RemoteAddress.AsStringUriOnly()))
{
LinphoneManager.Instance.Core.AcceptCall(call);
rootFrame.Navigate(typeof(Views.InCall), call.RemoteAddress.AsString());
List<String> parameters = new List<String>();
parameters.Add(call.RemoteAddress.AsString());
rootFrame.Navigate(typeof(Views.InCall), parameters);
acceptCall = false;
}
}
......
......@@ -22,6 +22,7 @@ using BelledonneCommunications.Linphone.Native;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;
using System.ComponentModel;
using System.Collections.Generic;
namespace Linphone.Views {
......@@ -146,8 +147,9 @@ namespace Linphone.Views {
if (LinphoneManager.Instance.Core.CallsNb > 0) {
Call call = LinphoneManager.Instance.Core.CurrentCall;
String uri = call.RemoteAddress.AsStringUriOnly();
Frame.Navigate(typeof(Views.InCall), uri);
List<String> parameters = new List<String>();
parameters.Add(call.RemoteAddress.AsStringUriOnly());
Frame.Navigate(typeof(Views.InCall), parameters);
}
if (LinphoneManager.Instance.GetUnreadMessageCount() > 0) {
......
......@@ -17,6 +17,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
using BelledonneCommunications.Linphone.Native;
using Linphone.Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using Windows.ApplicationModel.Resources;
......@@ -53,7 +54,7 @@ namespace Linphone.Views {
VideoGrid.Visibility = Visibility.Collapsed;
}
if (LinphoneManager.Instance.Core.CurrentCall.State == CallState.StreamsRunning)
if (LinphoneManager.Instance.Core.CurrentCall.State == CallState.StreamsRunning)
Status.Text = "00:00:00";
displayOrientation = ApplicationView.GetForCurrentView().Orientation;
......@@ -137,12 +138,17 @@ namespace Linphone.Views {
#endregion
protected override void OnNavigatedTo(NavigationEventArgs nee) {
List<string> parameters;
base.OnNavigatedTo(nee);
parameters = nee.Parameter as List<string>;
LinphoneManager.Instance.CallStateChangedEvent += CallStateChanged;
if ((nee.Parameter as String).Contains("sip")) {
String calledNumber = nee.Parameter as String;
if (parameters == null)
return;
if (parameters.Count >= 1 && parameters[0].Contains("sip")) {
String calledNumber = parameters[0];
Address address = LinphoneManager.Instance.Core.InterpretURL(calledNumber);
calledNumber = String.Format("{0}@{1}", address.UserName, address.Domain);
Contact.Text = calledNumber;
......@@ -153,6 +159,15 @@ namespace Linphone.Views {
// cm.FindContact(calledNumber);
}
}
if (parameters.Count >= 2 && parameters[1].Contains("incomingCall")) {
if (LinphoneManager.Instance.Core.CurrentCall != null) {
LinphoneManager.Instance.Core.AcceptCall(LinphoneManager.Instance.Core.CurrentCall);
} else {
if (Frame.CanGoBack) {
Frame.GoBack();
}
}
}
}
protected override void OnNavigatedFrom(NavigationEventArgs nee) {
......
......@@ -22,6 +22,7 @@ using Windows.UI.Xaml.Navigation;
using Windows.UI.Xaml;
using Windows.UI.Core;
using System.Diagnostics;
using System.Collections.Generic;
namespace Linphone.Views {
......@@ -103,8 +104,10 @@ namespace Linphone.Views {
private void Answer_Click(object sender, RoutedEventArgs e) {
if (LinphoneManager.Instance.Core.CurrentCall != null) {
LinphoneManager.Instance.Core.AcceptCall(LinphoneManager.Instance.Core.CurrentCall);
Frame.Navigate(typeof(Views.InCall), _callingNumber);
List<string> parameters = new List<string>();
parameters.Add(_callingNumber);
parameters.Add("incomingCall");
Frame.Navigate(typeof(Views.InCall), parameters);
}
}
......
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