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

Improved call stubs + started call logs stubs

parent 7fb9f2a2
......@@ -46,6 +46,7 @@ namespace Linphone.Agents
LinphoneCall call = new LinphoneCall(callerName, callerNumber);
Globals.Instance.LinphoneCore.IncomingCall = call;
Debug.WriteLine("[KeepAliveAgent] Incoming call added to LinphoneCore, notifyComplete");
base.NotifyComplete();
}
else
......
......@@ -48,6 +48,7 @@
<CustomBuildAfterTargets>PostBuildEvent</CustomBuildAfterTargets>
<OutDir>$(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\</OutDir>
<IntDir>$(PlatformTarget)\$(Configuration)\</IntDir>
<ExtensionsToDeleteOnClean>*.winmd;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<TargetName>$(RootNamespace)</TargetName>
......
......@@ -96,5 +96,16 @@ namespace Linphone
Udating = 17,
Released = 18
};
/// <summary>
/// Represents a call status
/// </summary>
public enum class LinphoneCallStatus : int
{
Success = 0,
Aborted = 1,
Missed = 2,
Declined = 3
};
}
}
\ No newline at end of file
......@@ -5,17 +5,17 @@ using namespace Linphone::Core;
Platform::String^ LinphoneAddress::GetDisplayName()
{
return nullptr;
return this->displayName;
}
Platform::String^ LinphoneAddress::GetUserName()
{
return nullptr;
return this->username;
}
Platform::String^ LinphoneAddress::GetDomain()
{
return nullptr;
return this->domain;
}
int LinphoneAddress::GetPort()
......@@ -25,17 +25,17 @@ int LinphoneAddress::GetPort()
void LinphoneAddress::SetDisplayName(Platform::String^ name)
{
this->displayName = name;
}
void LinphoneAddress::SetUserName(Platform::String^ username)
{
this->username = username;
}
void LinphoneAddress::SetDomain(Platform::String^ domain)
{
this->domain = domain;
}
void LinphoneAddress::SetPort(int port)
......@@ -63,7 +63,25 @@ Platform::String^ LinphoneAddress::ToString()
return this->address;
}
LinphoneAddress::LinphoneAddress(Platform::String^ address)
LinphoneAddress::LinphoneAddress(Platform::String^ address) :
address(address),
displayName(nullptr),
username(nullptr),
domain(nullptr)
{
}
LinphoneAddress::LinphoneAddress(Platform::String^ username, Platform::String^ domain, Platform::String^ displayName) :
address("sip:" + username + "@" + domain),
displayName(displayName),
username(username),
domain(domain)
{
}
LinphoneAddress::~LinphoneAddress()
{
this->address = address;
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ namespace Linphone
{
namespace Core
{
ref class LinphoneCoreFactory;
/// <summary>
/// Object that represents a SIP address.
/// It's an opaque object that represents a SIP address, i.e. the content of SIP's "from" and "to" headers.
......@@ -66,10 +68,17 @@ namespace Linphone
/// </summary>
Platform::String^ ToString();
private:
friend ref class Linphone::Core::LinphoneCoreFactory;
LinphoneAddress(Platform::String^ address);
LinphoneAddress::LinphoneAddress(Platform::String^ username, Platform::String^ domain, Platform::String^ displayName);
~LinphoneAddress();
private:
Platform::String^ address;
Platform::String^ username;
Platform::String^ domain;
Platform::String^ displayName;
};
}
}
\ No newline at end of file
......@@ -5,6 +5,8 @@
#include "LinphoneCallParams.h"
#include "Server.h"
#include "ApiLock.h"
#include "LinphoneCoreFactory.h"
#include "Globals.h"
using namespace Linphone::Core;
using namespace Windows::Phone::Networking::Voip;
......@@ -16,7 +18,8 @@ LinphoneCallState LinphoneCall::GetState()
LinphoneAddress^ LinphoneCall::GetRemoteAddress()
{
return ref new LinphoneAddress(this->number);
LinphoneCoreFactory^ lcf = Globals::Instance->LinphoneCoreFactory;
return lcf->CreateLinphoneAddress(this->number);
}
CallDirection LinphoneCall::GetDirection()
......@@ -116,15 +119,11 @@ Platform::String^ LinphoneCall::GetRemoteContact()
void LinphoneCall::CallContext::set(Platform::Object^ cc)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
this->callContext = cc;
}
Platform::Object^ LinphoneCall::CallContext::get()
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return this->callContext;
}
......
......@@ -2,27 +2,29 @@
#include "LinphoneAddress.h"
#include "Enums.h"
#include "Server.h"
#include "Globals.h"
#include "LinphoneCoreFactory.h"
using namespace Linphone::Core;
LinphoneAddress^ LinphoneCallLog::GetFrom()
{
return nullptr;
return this->from;
}
LinphoneAddress^ LinphoneCallLog::GetTo()
{
return nullptr;
return this->to;
}
CallDirection LinphoneCallLog::GetDirection()
{
return CallDirection::Incoming;
return this->direction;
}
LinphoneCallStatus LinphoneCallLog::GetStatus()
{
return LinphoneCallStatus::Aborted;
return this->status;
}
Platform::String^ LinphoneCallLog::GetStartDate()
......@@ -44,3 +46,17 @@ int LinphoneCallLog::GetCallId()
{
return -1;
}
LinphoneCallLog::LinphoneCallLog(Platform::String^ from, Platform::String^ to, LinphoneCallStatus status, CallDirection direction) :
status(status),
direction(direction)
{
LinphoneCoreFactory^ lcf = Globals::Instance->LinphoneCoreFactory;
this->from = lcf->CreateLinphoneAddress(from);
this->to = lcf->CreateLinphoneAddress(to);
}
LinphoneCallLog::~LinphoneCallLog()
{
}
\ No newline at end of file
......@@ -6,19 +6,9 @@ namespace Linphone
{
namespace Core
{
ref class LinphoneCore;
ref class LinphoneAddress;
/// <summary>
/// Represents a call status
/// </summary>
public enum class LinphoneCallStatus : int
{
Success = 0,
Aborted = 1,
Missed = 2,
Declined = 3
};
/// <summary>
/// Call data records object
/// </summary>
......@@ -49,6 +39,17 @@ namespace Linphone
/// Returns the call id from signaling.
/// </summary>
int GetCallId();
private:
friend ref class Linphone::Core::LinphoneCore;
LinphoneAddress^ from;
LinphoneAddress^ to;
LinphoneCallStatus status;
CallDirection direction;
LinphoneCallLog(Platform::String^ from, Platform::String^ to, LinphoneCallStatus status, CallDirection direction);
~LinphoneCallLog();
};
}
}
\ No newline at end of file
......@@ -2,17 +2,21 @@
#include "LinphoneAddress.h"
#include "LinphoneAuthInfo.h"
#include "LinphoneCall.h"
#include "LinphoneCallLog.h"
#include "LinphoneCallParams.h"
#include "LinphoneProxyConfig.h"
#include "LinphoneCoreListener.h"
#include "LpConfig.h"
#include "PayloadType.h"
#include "Server.h"
#include "Enums.h"
#include "ApiLock.h"
#include <collection.h>
using namespace Linphone::Core;
using namespace Platform;
using namespace Platform::Collections;
using namespace Windows::Foundation::Collections;
Transports::Transports()
{
......@@ -96,6 +100,17 @@ void LinphoneCore::Iterate()
this->listener->CallState(this->incomingcall, LinphoneCallState::IncomingReceived);
this->call = incomingcall;
this->incomingcall = nullptr;
}
else if (this->call != nullptr && this->callAccepted && this->listener != nullptr)
{
this->callAccepted = false;
this->listener->CallState(this->call, LinphoneCallState::StreamsRunning);
}
else if (this->call != nullptr && this->callEnded && this->listener != nullptr)
{
this->callEnded = false;
this->listener->CallState(this->call, LinphoneCallState::CallEnd);
this->call = nullptr;
}
}
......@@ -128,8 +143,7 @@ LinphoneCall^ LinphoneCore::InviteAddressWithParams(LinphoneAddress^ destination
void LinphoneCore::TerminateCall(LinphoneCall^ call)
{
call = nullptr;
this->call = nullptr;
this->callEnded = true;
}
LinphoneCall^ LinphoneCore::GetCurrentCall()
......@@ -154,7 +168,8 @@ Platform::Boolean LinphoneCore::IsIncomingInvitePending()
void LinphoneCore::AcceptCall(LinphoneCall^ call)
{
this->call = call;
this->callAccepted = true;
}
void LinphoneCore::AcceptCallWithParams(LinphoneCall^ call, LinphoneCallParams^ params)
......@@ -182,9 +197,20 @@ LinphoneCallParams^ LinphoneCore::CreateDefaultCallParameters()
return nullptr;
}
Windows::Foundation::Collections::IVector<LinphoneCallLog^>^ LinphoneCore::GetCallLogs()
IVector<Object^>^ LinphoneCore::GetCallLogs()
{
return nullptr;
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
IVector<Object^>^ logs = ref new Vector<Object^>();
LinphoneCallLog^ log = ref new LinphoneCallLog(L"sip:miaou@sip.linphone.org", L"sip:waouf@sip.linphone.org", LinphoneCallStatus::Missed, CallDirection::Incoming);
logs->Append(log);
log = ref new LinphoneCallLog(L"sip:waouf@sip.linphone.org", L"sip:miaou@sip.linphone.org", LinphoneCallStatus::Success, CallDirection::Outgoing);
logs->Append(log);
log = ref new LinphoneCallLog(L"sip:cotcot@sip.linphone.org", L"sip:miaou@sip.linphone.org", LinphoneCallStatus::Success, CallDirection::Incoming);
logs->Append(log);
return logs;
}
void LinphoneCore::ClearCallLogs()
......@@ -447,16 +473,21 @@ void LinphoneCore::TerminateAllCalls()
}
Windows::Foundation::Collections::IVector<LinphoneCall^>^ LinphoneCore::GetCalls()
IVector<LinphoneCall^>^ LinphoneCore::GetCalls()
{
auto calls = ref new Platform::Collections::Vector<LinphoneCall^>();
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
Vector<LinphoneCall^>^ calls = ref new Vector<LinphoneCall^>();
calls->Append(this->call);
return calls;
}
int LinphoneCore::GetCallsNb()
{
return -1;
if (this->Call != nullptr)
return 1;
else
return 0;
}
LinphoneCall^ LinphoneCore::FindCallFromUri(Platform::String^ uri)
......@@ -641,6 +672,8 @@ void LinphoneCore::IncomingCall::set(LinphoneCall^ call)
LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener) :
call(nullptr),
incomingcall(nullptr),
callAccepted(false),
callEnded(false),
listener(coreListener)
{
......
......@@ -162,7 +162,7 @@ namespace Linphone
void UpdateCall(LinphoneCall^ call, LinphoneCallParams^ params);
LinphoneCallParams^ CreateDefaultCallParameters();
Windows::Foundation::Collections::IVector<LinphoneCallLog^>^ GetCallLogs();
Windows::Foundation::Collections::IVector<Platform::Object^>^ GetCallLogs();
void ClearCallLogs();
void RemoveCallLog(LinphoneCallLog^ log);
......@@ -411,6 +411,8 @@ namespace Linphone
LinphoneCoreListener^ listener;
LinphoneCall^ call;
LinphoneCall^ incomingcall;
bool callAccepted;
bool callEnded;
LinphoneCore(LinphoneCoreListener^ coreListener);
~LinphoneCore();
......
#include "LinphoneCoreFactory.h"
#include "LinphoneCore.h"
#include "LinphoneCoreListener.h"
#include "LinphoneAddress.h"
#include "Server.h"
using namespace Linphone::Core;
void LinphoneCoreFactory::SetDebugMode(Platform::Boolean enable, Platform::String^ tag)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
}
void LinphoneCoreFactory::CreateLinphoneCore(Linphone::Core::LinphoneCoreListener^ listener, Platform::String^ userConfig, Platform::String^ factoryConfig, Platform::Object^ userData)
......@@ -18,26 +18,22 @@ void LinphoneCoreFactory::CreateLinphoneCore(Linphone::Core::LinphoneCoreListene
void LinphoneCoreFactory::CreateLinphoneCore(Linphone::Core::LinphoneCoreListener^ listener)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
this->linphoneCore = ref new Linphone::Core::LinphoneCore(listener);
}
LinphoneAuthInfo^ LinphoneCoreFactory::CreateAuthInfo(Platform::String^ username, Platform::String^ password, Platform::String^ realm)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return nullptr;
}
LinphoneAddress^ LinphoneCoreFactory::CreateLinphoneAddress(Platform::String^ username, Platform::String^ domain, Platform::String^ displayName)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return nullptr;
return ref new LinphoneAddress(username, domain, displayName);
}
LinphoneAddress^ LinphoneCoreFactory::CreateLinphoneAddress(Platform::String^ address)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return nullptr;
return ref new LinphoneAddress(address);
}
LinphoneCore^ LinphoneCoreFactory::LinphoneCore::get()
......
......@@ -67,6 +67,7 @@
<TargetName>Linphone.$(ProjectName)</TargetName>
<OutDir>$(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\</OutDir>
<IntDir>$(PlatformTarget)\$(Configuration)\</IntDir>
<ExtensionsToDeleteOnClean>*winmd;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<TargetName>Linphone.$(ProjectName)</TargetName>
......
No preview for this file type
......@@ -29,6 +29,9 @@ namespace Linphone
/// </summary>
public BasePage Page { get; set; }
/// <summary>
/// Dispatcher used to run tasks on the UI thread.
/// </summary>
public static Dispatcher UIDispatcher;
/// <summary>
......
......@@ -312,14 +312,11 @@ namespace Linphone.Model
/// </summary>
public void EndCurrentCall()
{
//if (LinphoneCore.GetCallsNb() > 0)
//{
if (LinphoneCore.GetCallsNb() > 0)
{
LinphoneCall call = LinphoneCore.GetCurrentCall();
((VoipPhoneCall)call.CallContext).NotifyCallEnded();
LinphoneCore.TerminateCall(call);
if (CallListener != null)
CallListener.CallEnded();
//}
}
}
/// <summary>
......@@ -368,6 +365,7 @@ namespace Linphone.Model
/// </summary>
public void CallState(LinphoneCall call, LinphoneCallState state)
{
Debug.WriteLine("[LinphoneManager] Call state changed: " + call.GetRemoteContact() + " => " + state.ToString());
if (state == LinphoneCallState.IncomingReceived)
{
String contact = call.GetRemoteContact();
......@@ -404,11 +402,19 @@ namespace Linphone.Model
LinphoneCore.Call = call;
});
}
else if (state == LinphoneCallState.StreamsRunning)
{
Debug.WriteLine("[LinphoneManager] Call accepted and running");
}
else if (state == LinphoneCallState.CallEnd ||
state == LinphoneCallState.Error ||
state == LinphoneCallState.Released)
{
Debug.WriteLine("[LinphoneManager] Call ended");
((VoipPhoneCall)call.CallContext).NotifyCallEnded();
if (CallListener != null)
CallListener.CallEnded();
}
}
......
......@@ -83,6 +83,7 @@
<Interface Name="Linphone.Core.__ILinphoneCallFactory" InterfaceId="{95F1BD28-F1E2-379F-B44C-1553EEA60023}" />
<Interface Name="Linphone.Core.__ILinphoneCallStatsPublicNonVirtuals" InterfaceId="{87BCE67E-109C-3429-9255-76FC496C3382}" />
<Interface Name="Linphone.Core.__ILinphoneCallLogPublicNonVirtuals" InterfaceId="{F3C079C9-0A9C-3B02-A1CC-C61991D09E18}" />
<Interface Name="Linphone.Core.__ILinphoneCallLogFactory" InterfaceId="{30A22A32-F8CD-3801-AA3C-62DB05EF8662}" />
<Interface Name="Linphone.Core.__ILinphoneCallParamsPublicNonVirtuals" InterfaceId="{26EFBF2D-6F46-35DE-9CFA-1A784C3C5A35}" />
<Interface Name="Linphone.Core.__IPayloadTypePublicNonVirtuals" InterfaceId="{BF73ED50-6AF0-3E18-9C7B-F81A8E91287B}" />
<Interface Name="Linphone.Core.__ILinphoneProxyConfigPublicNonVirtuals" InterfaceId="{FD2DF2D0-E760-354B-AD77-D0C81FBACE0B}" />
......
#!/bin/sh
rm -rf ARM
rm -rf Agents/ARM
rm -rf Agents/obj
rm -rf Core/Bin
rm -rf CoreProxyStub/ARM
rm -rf CoreProxyStub/*.winmd
rm -rf Linphone/Bin
rm -rf Linphone/obj
\ No newline at end of file
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