Commit 171a42c7 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Updated submodules + started to include liblinphone in Core wrapper

parent ca13a6c0
......@@ -59,7 +59,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<PreprocessorDefinitions>_WINRT_DLL;WIN32_LEAN_AND_MEAN;IN_LINPHONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_WINRT_DLL;_XKEYCHECK_H;WIN32_LEAN_AND_MEAN;IN_LINPHONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
......@@ -75,6 +75,7 @@
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
<GenerateXMLDocumentationFiles Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</GenerateXMLDocumentationFiles>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(ProjectDir)../submodules\oRTP\include;$(ProjectDir)../submodules/mediastreamer2/include;$(ProjectDir)../submodules/linphone;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Async</ExceptionHandling>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
......@@ -144,6 +145,7 @@ popd</Command>
<ClInclude Include="Enums.h" />
<ClInclude Include="PayloadType.h" />
<ClInclude Include="Server.h" />
<ClInclude Include="Utils.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ApiLock.cpp" />
......@@ -159,6 +161,7 @@ popd</Command>
<ClCompile Include="LinphoneProxyConfig.cpp" />
<ClCompile Include="LpConfig.cpp" />
<ClCompile Include="PayloadType.cpp" />
<ClCompile Include="Utils.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="OopServerRegistrationHelper.exe">
......
......@@ -140,7 +140,7 @@ LinphoneCoreFactory^ Globals::LinphoneCoreFactory::get()
return this->linphoneCoreFactory;
}
LinphoneCore^ Globals::LinphoneCore::get()
Linphone::Core::LinphoneCore^ Globals::LinphoneCore::get()
{
return this->linphoneCoreFactory->LinphoneCore;
}
......
......@@ -64,6 +64,7 @@ void Linphone::Core::LinphoneCore::ClearProxyConfigs()
void Linphone::Core::LinphoneCore::AddProxyConfig(Linphone::Core::LinphoneProxyConfig^ proxyCfg)
{
this->proxyCfgAdded = true;
linphone_core_add_proxy_config(this->lc, proxyCfg->proxy_config);
}
void Linphone::Core::LinphoneCore::SetDefaultProxyConfig(Linphone::Core::LinphoneProxyConfig^ proxyCfg)
......@@ -76,6 +77,12 @@ Linphone::Core::LinphoneProxyConfig^ Linphone::Core::LinphoneCore::GetDefaultPro
return nullptr;
}
Linphone::Core::LinphoneProxyConfig^ Linphone::Core::LinphoneCore::CreateEmptyProxyConfig()
{
Linphone::Core::LinphoneProxyConfig^ proxyConfig = ref new Linphone::Core::LinphoneProxyConfig(this->lc);
return proxyConfig;
}
Windows::Foundation::Collections::IVector<Linphone::Core::LinphoneProxyConfig^>^ Linphone::Core::LinphoneCore::GetProxyConfigList()
{
return nullptr;
......@@ -704,6 +711,21 @@ void Linphone::Core::LinphoneCore::IncomingCall::set(Linphone::Core::LinphoneCal
this->incomingcall = call;
}
void call_state_changed(::LinphoneCore *lc, ::LinphoneCall *call, ::LinphoneCallState cstate, const char *msg)
{
}
void registration_state_changed(::LinphoneCore *lc, ::LinphoneProxyConfig *cfg, ::LinphoneRegistrationState cstate, const char *message)
{
}
void global_state_changed(::LinphoneCore *lc, ::LinphoneGlobalState gstate, const char *msg)
{
}
Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener) :
call(nullptr),
incomingcall(nullptr),
......@@ -714,12 +736,18 @@ Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener) :
proxyCfgRegistered(false),
startup(true),
on(false),
listener(coreListener)
listener(coreListener),
lc(nullptr)
{
LinphoneCoreVTable *vtable = (LinphoneCoreVTable*) malloc(sizeof(LinphoneCoreVTable));
memset (vtable, 0, sizeof(LinphoneCoreVTable));
vtable->global_state_changed = global_state_changed;
vtable->registration_state_changed = registration_state_changed;
vtable->call_state_changed = call_state_changed;
this->lc = linphone_core_new(vtable, NULL, "Assets/linphone_rc", NULL);
}
Linphone::Core::LinphoneCore::~LinphoneCore()
{
free(this->lc);
}
......@@ -3,6 +3,8 @@
#include "Enums.h"
#include "LinphoneCoreListener.h"
#include "coreapi\linphonecore.h"
namespace Linphone
{
namespace Core
......@@ -75,6 +77,12 @@ namespace Linphone
/// null if no default proxy config.
/// </returns>
LinphoneProxyConfig^ GetDefaultProxyConfig();
/// <summary>
/// Creates an empty proxy config.
/// </summary>
LinphoneProxyConfig^ CreateEmptyProxyConfig();
Windows::Foundation::Collections::IVector<LinphoneProxyConfig^>^ GetProxyConfigList();
void ClearAuthInfos();
......@@ -428,6 +436,8 @@ namespace Linphone
LinphoneCore(LinphoneCoreListener^ coreListener);
~LinphoneCore();
::LinphoneCore *lc;
};
}
}
\ No newline at end of file
......@@ -4,39 +4,67 @@
#include "LinphoneAddress.h"
#include "Server.h"
using namespace Linphone::Core;
using namespace Linphone::Core;
using namespace Platform;
void LinphoneCoreFactory::SetDebugMode(Platform::Boolean enable, Platform::String^ tag)
#define MAX_TRACE_SIZE 512
#define MAX_SUITE_NAME_SIZE 128
static OutputTraceListener^ sTraceListener;
static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args)
{
if (sTraceListener) {
wchar_t wstr[MAX_TRACE_SIZE];
std::string str;
str.resize(MAX_TRACE_SIZE);
vsnprintf((char *)str.c_str(), MAX_TRACE_SIZE, fmt, args);
mbstowcs(wstr, str.c_str(), sizeof(wstr));
String^ msg = ref new String(wstr);
sTraceListener->outputTrace(lev, msg);
}
}
static void LinphoneNativeOutputTraceHandler(OrtpLogLevel lev, const char *fmt, va_list args)
{
char fmt2[MAX_TRACE_SIZE];
snprintf(fmt2, MAX_TRACE_SIZE, "%s\n", fmt);
nativeOutputTraceHandler((int)lev, fmt2, args);
}
void LinphoneCoreFactory::SetDebugMode(Platform::Boolean enable, OutputTraceListener^ traceListener)
{
sTraceListener = traceListener;
}
void LinphoneCoreFactory::CreateLinphoneCore(Linphone::Core::LinphoneCoreListener^ listener, Platform::String^ userConfig, Platform::String^ factoryConfig, Platform::Object^ userData)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
linphone_core_enable_logs_with_cb(LinphoneNativeOutputTraceHandler);
this->linphoneCore = ref new Linphone::Core::LinphoneCore(listener);
}
void LinphoneCoreFactory::CreateLinphoneCore(Linphone::Core::LinphoneCoreListener^ listener)
{
this->linphoneCore = ref new Linphone::Core::LinphoneCore(listener);
LinphoneCoreFactory::CreateLinphoneCore(listener, nullptr, nullptr, nullptr);
}
LinphoneAuthInfo^ LinphoneCoreFactory::CreateAuthInfo(Platform::String^ username, Platform::String^ password, Platform::String^ realm)
Linphone::Core::LinphoneAuthInfo^ LinphoneCoreFactory::CreateAuthInfo(Platform::String^ username, Platform::String^ password, Platform::String^ realm)
{
return nullptr;
}
LinphoneAddress^ LinphoneCoreFactory::CreateLinphoneAddress(Platform::String^ username, Platform::String^ domain, Platform::String^ displayName)
Linphone::Core::LinphoneAddress^ LinphoneCoreFactory::CreateLinphoneAddress(Platform::String^ username, Platform::String^ domain, Platform::String^ displayName)
{
return ref new LinphoneAddress(username, domain, displayName);
}
LinphoneAddress^ LinphoneCoreFactory::CreateLinphoneAddress(Platform::String^ address)
Linphone::Core::LinphoneAddress^ LinphoneCoreFactory::CreateLinphoneAddress(Platform::String^ address)
{
return ref new LinphoneAddress(address);
}
LinphoneCore^ LinphoneCoreFactory::LinphoneCore::get()
Linphone::Core::LinphoneCore^ LinphoneCoreFactory::LinphoneCore::get()
{
return this->linphoneCore;
}
......
......@@ -12,6 +12,12 @@ namespace Linphone
ref class LinphoneAuthInfo;
ref class LinphoneAddress;
public interface class OutputTraceListener
{
public:
void outputTrace(int level, Platform::String^ msg);
};
public ref class LinphoneCoreFactory sealed
{
public:
......@@ -20,7 +26,7 @@ namespace Linphone
Linphone::Core::LinphoneCore^ get();
}
void SetDebugMode(Platform::Boolean enable, Platform::String^ tag);
void SetDebugMode(Platform::Boolean enable, OutputTraceListener^ traceListener);
void CreateLinphoneCore(LinphoneCoreListener^ listener, Platform::String^ userConfig, Platform::String^ factoryConfig, Platform::Object^ userData);
void CreateLinphoneCore(LinphoneCoreListener^ listener);
......
#include "LinphoneProxyConfig.h"
#include "LinphoneCore.h"
#include "Server.h"
#include "Utils.h"
void Linphone::Core::LinphoneProxyConfig::Edit()
{
linphone_proxy_config_edit(this->proxy_config);
}
void Linphone::Core::LinphoneProxyConfig::Done()
{
linphone_proxy_config_done(this->proxy_config);
}
void Linphone::Core::LinphoneProxyConfig::SetIdentity(Platform::String^ identity)
{
const char* cc = Utils::pstoccs(identity);
linphone_proxy_config_set_identity(this->proxy_config, cc);
delete(cc);
}
Platform::String^ Linphone::Core::LinphoneProxyConfig::GetIdentity()
{
return nullptr;
return Utils::cctops(linphone_proxy_config_get_identity(this->proxy_config));
}
void Linphone::Core::LinphoneProxyConfig::SetProxy(Platform::String^ proxyUri)
{
const char* cc = Utils::pstoccs(proxyUri);
linphone_proxy_config_set_server_addr(this->proxy_config, cc);
delete(cc);
}
void Linphone::Core::LinphoneProxyConfig::EnableRegister(Platform::Boolean enable)
......@@ -54,7 +59,7 @@ void Linphone::Core::LinphoneProxyConfig::SetDialEscapePlus(Platform::Boolean va
Platform::String^ Linphone::Core::LinphoneProxyConfig::GetDomain()
{
return nullptr;
return Utils::cctops(linphone_proxy_config_get_domain(this->proxy_config));
}
Platform::Boolean Linphone::Core::LinphoneProxyConfig::IsRegistered()
......@@ -64,12 +69,14 @@ Platform::Boolean Linphone::Core::LinphoneProxyConfig::IsRegistered()
void Linphone::Core::LinphoneProxyConfig::SetRoute(Platform::String^ routeUri)
{
const char* cc = Utils::pstoccs(routeUri);
linphone_proxy_config_set_route(this->proxy_config, cc);
delete(cc);
}
Platform::String^ Linphone::Core::LinphoneProxyConfig::GetRoute()
{
return nullptr;
return Utils::cctops(linphone_proxy_config_get_route(this->proxy_config));
}
void Linphone::Core::LinphoneProxyConfig::EnablePublish(Platform::Boolean enable)
......@@ -106,3 +113,13 @@ int Linphone::Core::LinphoneProxyConfig::LookupCCCFromE164(Platform::String^ e16
{
return -1;
}
Linphone::Core::LinphoneProxyConfig::LinphoneProxyConfig(::LinphoneCore *lc)
{
this->proxy_config = linphone_core_create_proxy_config(lc);
}
Linphone::Core::LinphoneProxyConfig::~LinphoneProxyConfig()
{
free(this->proxy_config);
}
\ No newline at end of file
......@@ -114,6 +114,14 @@ namespace Linphone
/// Returns the international prefix for the given country.
/// </summary>
int LookupCCCFromE164(Platform::String^ e164);
private:
friend ref class Linphone::Core::LinphoneCore;
LinphoneProxyConfig(::LinphoneCore *lc);
~LinphoneProxyConfig();
::LinphoneProxyConfig *proxy_config;
};
}
}
\ No newline at end of file
#include "Utils.h"
std::string Linphone::Core::Utils::wstos(std::wstring ws)
{
std::string s;
s.assign(ws.begin(), ws.end());
return s;
}
std::string Linphone::Core::Utils::pstos(Platform::String^ ps)
{
return wstos(std::wstring(ps->Data()));
}
const char* Linphone::Core::Utils::pstoccs(Platform::String^ ps)
{
std::string s = pstos(ps);
char* cc = (char*) malloc(s.length()+1);
memcpy(cc, s.c_str(), s.length());
cc[s.length()] = '\0';
return cc;
}
Platform::String^ Linphone::Core::Utils::cctops(const char* cc)
{
std::string s_str = std::string(cc);
std::wstring wid_str = std::wstring(s_str.begin(), s_str.end());
const wchar_t* w_char = wid_str.c_str();
return ref new Platform::String(w_char);
}
\ No newline at end of file
#include <string>
namespace Linphone
{
namespace Core
{
class Utils
{
public:
static std::string wstos(std::wstring ws);
static std::string pstos(Platform::String^ ps);
static const char* pstoccs(Platform::String^ ps);
static Platform::String^ Linphone::Core::Utils::cctops(const char*);
};
}
}
\ No newline at end of file
......@@ -40,6 +40,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibLinphone", "submodules\l
{4C225A82-800B-427B-BA7B-61686A9B347F} = {4C225A82-800B-427B-BA7B-61686A9B347F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmswasapi", "submodules\mswasapi\mswasapi\mswasapi\mswasapi.vcxproj", "{D22BD217-D0F8-4274-9B3A-F3F35F46482C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -306,6 +308,26 @@ Global
{08DD0D38-D9B5-4626-B60D-B4D76B571142}.Release|x64.ActiveCfg = Release|Win32
{08DD0D38-D9B5-4626-B60D-B4D76B571142}.Release|x86.ActiveCfg = Release|Win32
{08DD0D38-D9B5-4626-B60D-B4D76B571142}.Release|x86.Build.0 = Release|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|Any CPU.ActiveCfg = Debug|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|ARM.ActiveCfg = Debug|ARM
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|ARM.Build.0 = Debug|ARM
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|Win32.ActiveCfg = Debug|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|Win32.Build.0 = Debug|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|x64.ActiveCfg = Debug|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|x86.ActiveCfg = Debug|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Debug|x86.Build.0 = Debug|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|Any CPU.ActiveCfg = Release|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|ARM.ActiveCfg = Release|ARM
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|ARM.Build.0 = Release|ARM
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|Mixed Platforms.Build.0 = Release|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|Win32.ActiveCfg = Release|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|Win32.Build.0 = Release|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|x64.ActiveCfg = Release|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|x86.ActiveCfg = Release|Win32
{D22BD217-D0F8-4274-9B3A-F3F35F46482C}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
No preview for this file type
[net]
mtu=1300
[sip]
default_proxy=0
ping_with_options=0
register_only_when_network_is_up=0
[rtp]
audio_rtp_port=8090
video_rtp_port=8092
[video]
display=0
capture=0
show_local=0
size=vga
enabled=0
self_view=0
automatically_initiate=0
automatically_accept=0
device=StaticImage: Static picture
\ No newline at end of file
......@@ -161,6 +161,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Assets\linphone_rc" />
<None Include="packages.config" />
<None Include="Properties\AppManifest.xml" />
<None Include="Properties\WMAppManifest.xml">
......
......@@ -12,7 +12,7 @@
<VisualStudio>
<FlavorProperties GUID="{C089C8C0-30E0-4E22-80C0-CE093F111A43}">
<SilverlightMobileCSProjectFlavor>
<FullDeploy>True</FullDeploy>
<FullDeploy>False</FullDeploy>
<DebuggerType>Managed</DebuggerType>
<Tombstone>False</Tombstone>
</SilverlightMobileCSProjectFlavor>
......
......@@ -19,7 +19,7 @@ namespace Linphone.Model
/// <summary>
/// Utility class to handle most of the LinphoneCore (and more globally the C++/CX API) methods calls.
/// </summary>
public sealed class LinphoneManager : LinphoneCoreListener
public sealed class LinphoneManager : LinphoneCoreListener, OutputTraceListener
{
private LinphoneManager()
{
......@@ -174,6 +174,21 @@ namespace Linphone.Model
}
#endregion
/// <summary>
/// Creates and adds the LinphoneProxyConfig in LinphoneCore.
/// </summary>
public void InitProxyConfig()
{
server.LinphoneCore.ClearProxyConfigs();
SettingsManager sm = new SettingsManager();
if (sm.Username != null && sm.Username.Length > 0 && sm.Domain != null && sm.Domain.Length > 0)
{
var proxy = server.LinphoneCore.CreateEmptyProxyConfig();
server.LinphoneCore.AddProxyConfig(proxy);
}
}
/// <summary>
/// Creates a new LinphoneCore (if not created yet) using a LinphoneCoreFactory.
/// </summary>
......@@ -184,11 +199,7 @@ namespace Linphone.Model
server.LinphoneCoreFactory.CreateLinphoneCore(this);
SettingsManager sm = new SettingsManager();
if (sm.Username != null && sm.Username.Length > 0 && sm.Domain != null && sm.Domain.Length > 0)
{
server.LinphoneCore.AddProxyConfig(null);
}
InitProxyConfig();
timer = new Timer(LinphoneCoreIterate, null, 1, 20);
Debug.WriteLine("[LinphoneManager] LinphoneCore created");
......@@ -219,7 +230,7 @@ namespace Linphone.Model
/// <param name="enable">true to enable debug traces, false to disable them</param>
public void EnableDebug(bool enable)
{
server.LinphoneCoreFactory.SetDebugMode(enable, AppResources.ApplicationTitle);
server.LinphoneCoreFactory.SetDebugMode(enable, this);
}
#region CallLogs
......@@ -472,5 +483,10 @@ namespace Linphone.Model
}
#endregion
public void outputTrace(int level, String msg)
{
System.Diagnostics.Debug.WriteLine(msg);
}
}
}
......@@ -72,6 +72,7 @@
<Interface Name="Linphone.Core.__IGlobalsPublicNonVirtuals" InterfaceId="{01600449-19D0-3E52-80E3-382A2C93CBB1}" />
<Interface Name="Linphone.Core.__IGlobalsStatics" InterfaceId="{828E0FFB-4077-39EF-A334-6F19365E4FFE}" />
<Interface Name="Linphone.Core.LinphoneCoreListener" InterfaceId="{638C6F72-6792-3858-80B6-2DC341C00F6F}" />
<Interface Name="Linphone.Core.OutputTraceListener" InterfaceId="{4610D6D0-5644-3B6D-B42D-04C95ED4BFFD}" />
<Interface Name="Linphone.Core.__ILinphoneCoreFactoryPublicNonVirtuals" InterfaceId="{C83B6E96-A239-311E-BD2B-880114A4E240}" />
<Interface Name="Linphone.Core.__ITransportsPublicNonVirtuals" InterfaceId="{9CF934BB-9476-3105-B0DF-49E2F4B2A580}" />
<Interface Name="Linphone.Core.__ITransportsFactory" InterfaceId="{3376B207-4618-313D-B564-D5500B8EFB64}" />
......
......@@ -47,8 +47,7 @@ namespace Linphone.Views
_appSettings.Proxy = Domain.Text;
_appSettings.OutboundProxy = OutboundProxy.IsChecked;
LinphoneManager.Instance.LinphoneCore.ClearProxyConfigs();
LinphoneManager.Instance.LinphoneCore.AddProxyConfig(new Core.LinphoneProxyConfig());
LinphoneManager.Instance.InitProxyConfig();
NavigationService.GoBack();
}
......
antlr3 @ 5ed4fec7
Subproject commit 3f36e85674934d4bfd77f1c3de7a9a5e044fba17
Subproject commit 5ed4fec737f88c69da3192871fb2553bffe46bfa
belle-sip @ 5b3a6d54
Subproject commit 1d1d287c1a4d6990427cd2b4512bae6a3e7ea673
Subproject commit 5b3a6d54523bbc213d87ea7326d6b0e776e9f043
linphone @ fa8135be
Subproject commit f1928d246f85e0d6c1a0a4491b8d0f921ab346c4
Subproject commit fa8135be0351dbaa115f72997886b2aa5258599c
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