Commit 4f28a872 authored by Sylvain Berfini's avatar Sylvain Berfini

Moved customization file to Agents project + custom property to set busy as...

Moved customization file to Agents project + custom property to set busy as default decline reason (default is disabled)
parent ffedac01
......@@ -85,6 +85,7 @@
<ItemGroup>
<Compile Include="AgentHost.cs" />
<Compile Include="BackgroundManager.cs" />
<Compile Include="Customs.cs" />
<Compile Include="LinphoneCallInProgressAgent.cs" />
<Compile Include="LinphoneForegroundLifeTimeAgent.cs" />
<Compile Include="LinphoneScheduledAgent.cs" />
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Linphone.Model
{
/// <summary>
/// Booleans to enable/disable features and custom strings
/// </summary>
public class Customs
{
internal static bool IsTunnelEnabled = false;
internal static bool AddPasswordInContactsParams = false;
internal static bool UseCustomIncomingCallView = false;
internal static string PictureUploadScriptURL = "https://linphone.org:444/upload.php";
internal static string UserAgent = "LinphoneWP8";
internal static bool EnableG729 = false;
internal static bool EnableVideo = false;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Linphone.Agents
{
/// <summary>
/// Booleans to enable/disable features and custom strings
/// </summary>
public class Customs
{
public static bool IsTunnelEnabled = false;
public static bool AddPasswordInContactsParams = false;
public static bool UseCustomIncomingCallView = false;
public static string PictureUploadScriptURL = "https://linphone.org:444/upload.php";
public static string UserAgent = "LinphoneWP8";
public static bool EnableG729 = false;
public static bool EnableVideo = false;
internal static bool DeclineCallWithBusyReason = false;
}
}
......@@ -22,6 +22,12 @@ namespace Linphone.Agents
AgentHost.OnAgentStarted();
//Force the callController to be initialized now to avoid creating it at the last moment (workaroud outgoing call crash after app started)
Globals.Instance.CallController.IncomingCallViewDismissed = null;
// Changes the decline reason if needed.
if (Customs.DeclineCallWithBusyReason)
{
Globals.Instance.CallController.DeclineReason = DeclineReason.LinphoneReasonBusy;
}
}
/// <summary>
......
......@@ -110,7 +110,7 @@ void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallReje
//This will call notifyCallEnded on the call state changed callback
if (this->call != nullptr)
Globals::Instance->LinphoneCore->DeclineCall(this->call, DeclineReason::LinphoneReasonBusy);
Globals::Instance->LinphoneCore->DeclineCall(this->call, this->declineReason);
gApiLock.Unlock();
}
......@@ -188,12 +188,28 @@ void CallController::CustomIncomingCallView::set(Platform::Boolean value)
gApiLock.Unlock();
}
DeclineReason CallController::DeclineReason::get()
{
gApiLock.Lock();
Linphone::Core::DeclineReason value = this->declineReason;
gApiLock.Unlock();
return value;
}
void CallController::DeclineReason::set(Linphone::Core::DeclineReason value)
{
gApiLock.Lock();
this->declineReason = value;
gApiLock.Unlock();
}
CallController::CallController() :
callInProgressPageUri(L"/Views/InCall.xaml"),
voipServiceName(nullptr),
defaultContactImageUri(nullptr),
linphoneImageUri(nullptr),
ringtoneUri(nullptr),
declineReason(Linphone::Core::DeclineReason::LinphoneReasonDeclined),
callCoordinator(VoipCallCoordinator::GetDefault())
{
// URIs required for interactions with the VoipCallCoordinator
......
#pragma once
#include <windows.phone.networking.voip.h>
#include "Enums.h"
#include "ApiLock.h"
namespace Linphone
......@@ -45,6 +46,15 @@ namespace Linphone
/// <returns>The system VoipPhoneCall that has been created</returns>
Windows::Phone::Networking::Voip::VoipPhoneCall^ NewIncomingCallForCustomIncomingCallView(Platform::String^ contactNumber);
/// <summary>
/// Changes the reason used when declining an incoming call.
/// </summary>
property Linphone::Core::DeclineReason DeclineReason
{
Linphone::Core::DeclineReason get();
void set(Linphone::Core::DeclineReason cb);
}
/// <summary>
/// Callback to be called when the PushNotification Agent has to be dismissed, i.e. after a call has been accepted, denied or stopped by the caller.
/// </summary>
......@@ -69,6 +79,8 @@ namespace Linphone
Platform::String^ voipServiceName;
Platform::String^ callInProgressPageUri;
Linphone::Core::DeclineReason declineReason;
// The URI to the contact image, jpg or png, 1mb max !
Windows::Foundation::Uri^ defaultContactImageUri;
......
......@@ -67,7 +67,7 @@ namespace Linphone
/// <summary>
/// Gets the current instance of the native call controller
/// </summary>
property CallController^ CallController
property CallController^ CallController
{
Linphone::Core::CallController^ get();
}
......
......@@ -124,7 +124,6 @@
<Compile Include="Model\CallLog.cs" />
<Compile Include="Model\ContactManager.cs" />
<Compile Include="Model\ContactPictureConverter.cs" />
<Compile Include="Model\Customs.cs" />
<Compile Include="Model\EchoCalibratorListener.cs" />
<Compile Include="Model\Conversation.cs" />
<Compile Include="Model\DatabaseManager.cs" />
......
using Linphone.Core;
using Linphone.Agents;
using Linphone.Core;
using Linphone.Resources;
using Microsoft.Phone.Net.NetworkInformation;
using System;
......
......@@ -5,6 +5,7 @@ using System;
using System.Windows;
using System.Collections.Generic;
using System.Windows.Navigation;
using Linphone.Agents;
namespace Linphone.Views
{
......
using Linphone.Core;
using Linphone.Model;
using Linphone.Resources;
using Microsoft.Phone.Shell;
using System;
using Linphone.Agents;
using Linphone.Core;
using Linphone.Model;
using Linphone.Resources;
using Microsoft.Phone.Shell;
using System;
using System.Windows.Navigation;
namespace Linphone.Views
......
......@@ -21,6 +21,7 @@ using System.Threading.Tasks;
using System.IO.IsolatedStorage;
using System.Net.Http.Headers;
using Microsoft.Xna.Framework.Media;
using Linphone.Agents;
namespace Linphone.Views
{
......
using Linphone.Model;
using Linphone.Agents;
using Linphone.Model;
using Linphone.Resources;
using Microsoft.Phone.Shell;
using System;
......
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