Commit 1eeb9d97 authored by Ghislain MARY's avatar Ghislain MARY

Only propose simple incoming call answering (only one button, not one button...

Only propose simple incoming call answering (only one button, not one button for audio and one button for video) + handle VoipPhoneCall media.
parent 31e6e85b
......@@ -9,6 +9,8 @@ using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Phone::Networking::Voip;
//#define ACCEPT_WITH_VIDEO_OR_WITH_AUDIO_ONLY
VoipPhoneCall^ CallController::OnIncomingCallReceived(Linphone::Core::LinphoneCall^ call, Platform::String^ contactName, Platform::String^ contactNumber, IncomingCallViewDismissedCallback^ incomingCallViewDismissedCallback)
{
gApiLock.Lock();
......@@ -17,13 +19,19 @@ VoipPhoneCall^ CallController::OnIncomingCallReceived(Linphone::Core::LinphoneCa
this->call = call;
VoipCallMedia media = VoipCallMedia::Audio;
#ifdef ACCEPT_WITH_VIDEO_OR_WITH_AUDIO_ONLY
if (Globals::Instance->LinphoneCore->IsVideoSupported() && Globals::Instance->LinphoneCore->IsVideoEnabled()) {
bool automatically_accept = false;
LinphoneCallParams^ remoteParams = call->GetRemoteParams();
LinphoneCallParams^ localParams = call->GetCurrentParamsCopy();
if ((remoteParams != nullptr) && remoteParams->IsVideoEnabled() && (localParams != nullptr) && localParams->IsVideoEnabled()) {
VideoPolicy^ policy = Globals::Instance->LinphoneCore->GetVideoPolicy();
if (policy != nullptr) {
automatically_accept = policy->AutomaticallyAccept;
}
if ((remoteParams != nullptr) && remoteParams->IsVideoEnabled() && automatically_accept) {
media = VoipCallMedia::Audio | VoipCallMedia::Video;
}
}
#endif
if (this->customIncomingCallView) {
this->callCoordinator->RequestNewOutgoingCall(
......@@ -76,8 +84,19 @@ void CallController::OnAcceptCallRequested(VoipPhoneCall^ incomingCall, CallAnsw
if (this->onIncomingCallViewDismissed != nullptr)
this->onIncomingCallViewDismissed();
if (this->call != nullptr)
if (this->call != nullptr) {
#ifdef ACCEPT_WITH_VIDEO_OR_WITH_AUDIO_ONLY
LinphoneCallParams^ params = call->GetCurrentParamsCopy();
if ((args->AcceptedMedia & VoipCallMedia::Video) == VoipCallMedia::Video) {
params->EnableVideo(true);
} else {
params->EnableVideo(false);
}
Globals::Instance->LinphoneCore->AcceptCallWithParams(this->call, params);
#else
Globals::Instance->LinphoneCore->AcceptCall(this->call);
#endif
}
gApiLock.Unlock();
}
......
......@@ -1399,6 +1399,11 @@ void call_state_changed(::LinphoneCore *lc, ::LinphoneCall *call, ::LinphoneCall
}
else if (state == Linphone::Core::LinphoneCallState::StreamsRunning) {
Windows::Phone::Networking::Voip::VoipPhoneCall^ platformCall = (Windows::Phone::Networking::Voip::VoipPhoneCall^) lCall->CallContext;
if (lCall->IsCameraEnabled()) {
platformCall->CallMedia = VoipCallMedia::Audio | VoipCallMedia::Video;
} else {
platformCall->CallMedia = VoipCallMedia::Audio;
}
platformCall->NotifyCallActive();
}
......
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