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

Some changes/fixes for how the interface handles call events

parent 8c16c120
......@@ -6,4 +6,5 @@
*/ARM/
*/x86/
BackEndProxyStub/Linphone.BackEnd*
ARM/
\ No newline at end of file
ARM/
Linphone.sdf
\ No newline at end of file
......@@ -9,6 +9,7 @@ using namespace Windows::Phone::Networking::Voip;
void CallController::SetCallControllerListener(CallControllerListener^ listener)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
this->callControllerListener = listener;
}
......@@ -85,9 +86,39 @@ void CallController::EndCurrentCall()
return;
this->currentCall->NotifyCallEnded();
if (this->callControllerListener != nullptr)
this->callControllerListener->CallEnded();
this->currentCall = nullptr;
}
Platform::Boolean CallController::NewOutgoingCall(Platform::String^ number, Platform::String^ name)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
if (this->currentCall != nullptr)
return false;
VoipPhoneCall^ outgoingCall = nullptr;
this->callCoordinator->RequestNewOutgoingCall(
this->callInProgressPageUri + "?sip=" + number,
name,
this->voipServiceName,
VoipCallMedia::Audio,
&outgoingCall);
outgoingCall->NotifyCallActive();
this->currentCall = outgoingCall;
this->callerNumber = number;
if (this->callControllerListener != nullptr)
this->callControllerListener->NewCallStarted(number);
return true;
}
CallController::CallController() :
callInProgressPageUri(L"/Views/InCall.xaml"),
voipServiceName(nullptr),
......
......@@ -25,6 +25,8 @@ namespace Linphone
void EndCurrentCall();
Platform::Boolean NewOutgoingCall(Platform::String^ number, Platform::String^ name);
void SetCallControllerListener(CallControllerListener^ listener);
private:
friend ref class Linphone::BackEnd::Globals;
......
......@@ -7,6 +7,8 @@ namespace Linphone
public interface class CallControllerListener
{
void NewCallStarted(Platform::String^ callerNumber);
void CallEnded();
};
}
}
\ No newline at end of file
......@@ -113,7 +113,7 @@ LinphoneCall^ LinphoneCore::InviteAddressWithParams(LinphoneAddress^ destination
void LinphoneCore::TerminateCall(LinphoneCall^ call)
{
Globals::Instance->CallController->EndCurrentCall();
}
LinphoneCall^ LinphoneCore::GetCurrentCall()
......
No preview for this file type
......@@ -27,12 +27,17 @@ namespace Linphone
});
}
public virtual void OnNavigatedTo(NavigationEventArgs nee)
public void CallEnded()
{
}
public virtual void OnNavigatedTo(NavigationEventArgs nea)
{
LinphoneManager.Instance.CallController.SetCallControllerListener(this);
}
public virtual void OnNavigatedFrom(NavigationEventArgs nee)
public virtual void OnNavigatedFrom(NavigationEventArgs nea)
{
LinphoneManager.Instance.CallController.SetCallControllerListener(null);
}
......
......@@ -239,6 +239,7 @@ namespace Linphone.Model
/// <param name="sipAddress">SIP address to call</param>
public void NewOutgoingCall(String sipAddress)
{
CallController.NewOutgoingCall(sipAddress, "");
LinphoneCore.Invite(sipAddress);
}
......@@ -250,8 +251,9 @@ namespace Linphone.Model
if (LinphoneCore.GetCallsNb() > 0)
{
LinphoneCall call = LinphoneCore.GetCalls().First();
LinphoneCore.TerminateCall(null);
LinphoneCore.TerminateCall(call);
}
CallController.EndCurrentCall();
}
/// <summary>
......@@ -284,7 +286,12 @@ namespace Linphone.Model
public void CallState(LinphoneCall call, LinphoneCallState state)
{
if (state == LinphoneCallState.CallEnd ||
state == LinphoneCallState.Error ||
state == LinphoneCallState.Released)
{
CallController.EndCurrentCall();
}
}
public void RegistrationState(LinphoneProxyConfig config, RegistrationState state, string message)
......
......@@ -66,6 +66,13 @@ namespace Linphone.Views
if (NavigationService.CanGoBack)
NavigationService.GoBack();
else
{
//If incall view directly accessed from home page, backstack is empty
//If so, instead of keeping the incall view, launch the Dialer and remove the incall view from the backstack
NavigationService.Navigate(new Uri("/Views/Dialer.xaml", UriKind.RelativeOrAbsolute));
NavigationService.RemoveBackEntry();
}
}
private void speaker_Click_1(object sender, RoutedEventArgs e)
......
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