Commit 5cda3039 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Registration working

parent 00a9097e
......@@ -649,11 +649,13 @@ void call_state_changed(::LinphoneCore *lc, ::LinphoneCall *call, ::LinphoneCall
void registration_state_changed(::LinphoneCore *lc, ::LinphoneProxyConfig *cfg, ::LinphoneRegistrationState cstate, const char *msg)
{
/*Linphone::Core::LinphoneCoreListener^ listener = Linphone::Core::Globals::Instance->LinphoneCore->CoreListener;
Linphone::Core::LinphoneCoreListener^ listener = Linphone::Core::Globals::Instance->LinphoneCore->CoreListener;
if (listener != nullptr)
{
listener->RegistrationState(cfg, cstate, Linphone::Core::Utils::cctops(msg));
}*/
Linphone::Core::RegistrationState state = (Linphone::Core::RegistrationState) cstate;
Linphone::Core::LinphoneProxyConfig^ config = reinterpret_cast<Linphone::Core::LinphoneProxyConfig^>(linphone_proxy_config_get_user_data(cfg));
listener->RegistrationState(config, state, Linphone::Core::Utils::cctops(msg));
}
}
void global_state_changed(::LinphoneCore *lc, ::LinphoneGlobalState gstate, const char *msg)
......@@ -666,6 +668,15 @@ void global_state_changed(::LinphoneCore *lc, ::LinphoneGlobalState gstate, cons
}
}
void auth_info_requested(LinphoneCore *lc, const char *realm, const char *username)
{
Linphone::Core::LinphoneCoreListener^ listener = Linphone::Core::Globals::Instance->LinphoneCore->CoreListener;
if (listener != nullptr)
{
listener->AuthInfoRequested(Linphone::Core::Utils::cctops(realm), Linphone::Core::Utils::cctops(username));
}
}
Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener) :
listener(coreListener),
lc(nullptr)
......@@ -680,11 +691,12 @@ void Linphone::Core::LinphoneCore::Init()
vtable->global_state_changed = global_state_changed;
vtable->registration_state_changed = registration_state_changed;
vtable->call_state_changed = call_state_changed;
vtable->auth_info_requested = auth_info_requested;
this->lc = linphone_core_new(vtable, NULL, "Assets/linphone_rc", NULL);
}
Linphone::Core::LinphoneCore::~LinphoneCore()
{
free(this->lc);
delete(this->lc);
}
......@@ -21,7 +21,7 @@ static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args)
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);
sTraceListener->OutputTrace(lev, msg);
}
}
......
......@@ -15,7 +15,7 @@ namespace Linphone
public interface class OutputTraceListener
{
public:
void outputTrace(int level, Platform::String^ msg);
void OutputTrace(int level, Platform::String^ msg);
};
public ref class LinphoneCoreFactory sealed
......
......@@ -137,6 +137,7 @@ int Linphone::Core::LinphoneProxyConfig::LookupCCCFromE164(Platform::String^ e16
Linphone::Core::LinphoneProxyConfig::LinphoneProxyConfig()
{
this->proxy_config = linphone_proxy_config_new();
linphone_proxy_config_set_user_data(this->proxy_config, Linphone::Core::Utils::GetRawPointer(this));
}
Linphone::Core::LinphoneProxyConfig::~LinphoneProxyConfig()
......
......@@ -33,4 +33,9 @@ Platform::String^ Linphone::Core::Utils::cctops(const char* 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);
}
void* Linphone::Core::Utils::GetRawPointer(Platform::Object^ object)
{
return reinterpret_cast<IInspectable*>(object);
}
\ No newline at end of file
#pragma once
#include <string>
#include <inspectable.h>
namespace Linphone
{
......@@ -11,7 +12,9 @@ namespace Linphone
public:
static const char* pstoccs(Platform::String^ ps);
static Platform::String^ Linphone::Core::Utils::cctops(const char*);
static Platform::String^ Linphone::Core::Utils::cctops(const char*);
static void* GetRawPointer(Platform::Object^ object);
private:
static std::string wstos(std::wstring ws);
......
No preview for this file type
......@@ -187,7 +187,9 @@ namespace Linphone.Model
{
var proxy = server.LinphoneCore.CreateEmptyProxyConfig();
proxy.SetIdentity(sm.Username, sm.Username, sm.Domain);
proxy.SetProxy(sm.Domain);
proxy.EnableRegister(true);
server.LinphoneCore.AddProxyConfig(proxy);
server.LinphoneCore.SetDefaultProxyConfig(proxy);
......@@ -451,7 +453,7 @@ namespace Linphone.Model
/// </summary>
public void RegistrationState(LinphoneProxyConfig config, RegistrationState state, string message)
{
Debug.WriteLine("[LinphoneManager] Registration state changed: " + state.ToString() + ", message=" + message);
Debug.WriteLine("[LinphoneManager] Registration state changed: " + state.ToString() + ", message=" + message + " for identity " + config.GetIdentity());
LastKnownState = state;
if (BasePage.StatusBar != null)
BasePage.StatusBar.RefreshStatusIcon(state);
......@@ -490,7 +492,10 @@ namespace Linphone.Model
}
#endregion
public void outputTrace(int level, String msg)
/// <summary>
/// Handler to get native traces and display them into VS debug console
/// </summary>
public void OutputTrace(int level, String msg)
{
System.Diagnostics.Debug.WriteLine(msg);
}
......
belle-sip @ ad5124f8
Subproject commit 5b3a6d54523bbc213d87ea7326d6b0e776e9f043
Subproject commit ad5124f80366836ae112f7445c088a946e9d05af
linphone @ 02b05eed
Subproject commit c87046dcdf1e610a32fbda83b7d52fec0ff3f8a3
Subproject commit 02b05eede44d91ea46d04cb78814c85144aaf675
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