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

Merge branch 'master' into feature/python_wrapper

parents d32bbcf0 aff2ace3
......@@ -44,7 +44,7 @@ MARK_AS_ADVANCED(SOCI_INCLUDE_DIRS)
#
FIND_LIBRARY(SOCI_LIBRARIES
NAMES soci_core soci_core${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
PATH_SUFFIXES Frameworks lib lib64)
MARK_AS_ADVANCED(SOCI_LIBRARIES)
GET_FILENAME_COMPONENT(SOCI_LIBRARY_DIR ${SOCI_LIBRARIES} PATH)
......@@ -61,7 +61,7 @@ IF(SOCI_INCLUDE_DIRS AND SOCI_LIBRARIES)
FIND_LIBRARY(
SOCI_${plugin}_PLUGIN
NAMES soci_${plugin} soci_${plugin}${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
PATH_SUFFIXES Frameworks lib lib64)
MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN)
IF(SOCI_${plugin}_PLUGIN)
......
......@@ -450,9 +450,8 @@ LinphoneAccountCreatorPhoneNumberStatusMask linphone_account_creator_set_phone_n
if (!normalized_phone_number) {
return LinphoneAccountCreatorPhoneNumberStatusInvalid;
}
// if phone is valid, we lastly want to check that length is OK
{
// if phone is valid, we lastly want to check that length is OK in case phone_nunber was normilized
if (strcmp(normalized_phone_number,phone_number) != 0 || phone_number[0] != '+') {
const DialPlan &plan = DialPlan::findByCcc(creator->phone_country_code);
int size = (int)strlen(phone_number);
if (plan.isGeneric()) {
......
......@@ -37,6 +37,7 @@
#include "c-wrapper/c-wrapper.h"
#include "call/call.h"
#include "chat/chat-room/chat-room-params.h"
#include "chat/chat-room/basic-chat-room.h"
#include "chat/chat-room/client-group-chat-room.h"
#include "chat/chat-room/client-group-to-basic-chat-room.h"
......@@ -44,6 +45,7 @@
#include "chat/chat-room/real-time-text-chat-room.h"
#include "content/content-type.h"
#include "core/core-p.h"
#include "linphone/api/c-chat-room-params.h"
using namespace std;
......@@ -80,8 +82,8 @@ LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call){
return cr;
}
LinphoneChatRoom *linphone_core_get_chat_room (LinphoneCore *lc, const LinphoneAddress *addr) {
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(*L_GET_CPP_PTR_FROM_C_OBJECT(addr)));
LinphoneChatRoom *linphone_core_get_chat_room (LinphoneCore *lc, const LinphoneAddress *peerAddr) {
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(*L_GET_CPP_PTR_FROM_C_OBJECT(peerAddr)));
}
LinphoneChatRoom *linphone_core_get_chat_room_2 (
......@@ -95,14 +97,48 @@ LinphoneChatRoom *linphone_core_get_chat_room_2 (
)));
}
LinphoneChatRoom *linphone_core_create_client_group_chat_room (LinphoneCore *lc, const char *subject, bool_t fallback) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(L_C_TO_STRING(subject), !!fallback, false));
//Deprecated
LinphoneChatRoom *linphone_core_create_client_group_chat_room(LinphoneCore *lc, const char *subject, bool_t fallback) {
return linphone_core_create_client_group_chat_room_2(lc, subject, fallback, FALSE);
}
LinphoneChatRoom *linphone_core_create_client_group_chat_room_2 (LinphoneCore *lc, const char *subject, bool_t fallback, bool_t encrypted) {
//Deprecated
LinphoneChatRoom *linphone_core_create_client_group_chat_room_2(LinphoneCore *lc, const char *subject, bool_t fallback, bool_t encrypted) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(L_C_TO_STRING(subject), !!fallback, !!encrypted));
}
LinphoneChatRoom *linphone_core_create_chat_room(LinphoneCore *lc, const LinphoneChatRoomParams *params, const LinphoneAddress *localAddr, const char *subject, const bctbx_list_t *participants) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(LinphonePrivate::ChatRoomParams::toCpp(params)->clone()->toSharedPtr(), LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(localAddr)), L_C_TO_STRING(subject), L_GET_CPP_LIST_FROM_C_LIST_2(participants, LinphoneAddress *, LinphonePrivate::IdentityAddress, [] (LinphoneAddress *addr) {
return LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(addr));
})));
}
LinphoneChatRoom *linphone_core_create_chat_room_2(LinphoneCore *lc, const LinphoneChatRoomParams *params, const char *subject, const bctbx_list_t *participants) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(LinphonePrivate::ChatRoomParams::toCpp(params)->clone()->toSharedPtr(), L_C_TO_STRING(subject), L_GET_CPP_LIST_FROM_C_LIST_2(participants, LinphoneAddress *, LinphonePrivate::IdentityAddress, [] (LinphoneAddress *addr) {
return LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(addr));
})));
}
LinphoneChatRoom *linphone_core_create_chat_room_3(LinphoneCore *lc, const char *subject, const bctbx_list_t *participants) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(L_C_TO_STRING(subject), L_GET_CPP_LIST_FROM_C_LIST_2(participants, LinphoneAddress *, LinphonePrivate::IdentityAddress, [] (LinphoneAddress *addr) {
return LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(addr));
})));
}
LinphoneChatRoom *linphone_core_create_chat_room_4(LinphoneCore *lc, const LinphoneChatRoomParams *params, const LinphoneAddress *localAddr, const LinphoneAddress *participant) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(LinphonePrivate::ChatRoomParams::toCpp(params)->clone()->toSharedPtr(), LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(localAddr)), LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant))));
}
LinphoneChatRoom *linphone_core_create_chat_room_5(LinphoneCore *lc, const LinphoneAddress *participant) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant))));
}
LinphoneChatRoomParams *linphone_core_create_default_chat_room_params(LinphoneCore *lc) {
auto params = LinphonePrivate::ChatRoomParams::getDefaults(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getSharedFromThis());
params->ref();
return params->toC();
}
LinphoneChatRoom *_linphone_core_create_server_group_chat_room (LinphoneCore *lc, LinphonePrivate::SalCallOp *op) {
return _linphone_server_group_chat_room_new(lc, op);
}
......@@ -134,7 +170,7 @@ LinphoneChatRoom *linphone_core_find_one_to_one_chat_room (
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findOneToOneChatRoom(
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(local_addr)),
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant_addr)),
false)
false, false)
);
}
......@@ -147,7 +183,7 @@ LinphoneChatRoom *linphone_core_find_one_to_one_chat_room_2 (
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findOneToOneChatRoom(
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(local_addr)),
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant_addr)),
!!encrypted)
false, !!encrypted)
);
}
......@@ -155,9 +191,9 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, LinphonePrivate:
LinphoneReason reason = LinphoneReasonNotAcceptable;
std::string peerAddress;
std::string localAddress;
const char *session_mode = sal_custom_header_find(op->getRecvCustomHeaders(), "Session-mode");
if (linphone_core_conference_server_enabled(lc)) {
localAddress = peerAddress = op->getTo();
} else {
......@@ -174,15 +210,15 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, LinphonePrivate:
reason = L_GET_PRIVATE(chatRoom)->onSipMessageReceived(op, sal_msg);
else if (!linphone_core_conference_server_enabled(lc)) {
/* Client mode but check that it is really for basic chatroom before creating it.*/
if (session_mode && strcasecmp(session_mode, "true") == 0){
if (session_mode && strcasecmp(session_mode, "true") == 0) {
lError() << "Message is received in the context of a client chatroom for which we have no context.";
reason = LinphoneReasonNotAcceptable;
}else{
} else {
chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(conferenceId);
if (chatRoom)
reason = L_GET_PRIVATE(chatRoom)->onSipMessageReceived(op, sal_msg);
}
}else{
} else {
/* Server mode but chatroom not found. */
reason = LinphoneReasonNotFound;
}
......
......@@ -39,6 +39,7 @@ static void error_info_clone(LinphoneErrorInfo *ei, const LinphoneErrorInfo *oth
ei->warnings = bctbx_strdup(other->warnings);
ei->full_string = bctbx_strdup(other->full_string);
ei->protocol_code = other->protocol_code;
ei->retry_after = other->retry_after;
}
BELLE_SIP_INSTANCIATE_VPTR(LinphoneErrorInfo, belle_sip_object_t,
......@@ -137,6 +138,23 @@ static const error_code_reason_map_t error_code_reason_map[] = {
{ 603, LinphoneReasonDeclined }
};
static const error_code_reason_map_t retry_after_code_reason_map[] = {
{ 404, LinphoneReasonNotFound },
{ 480, LinphoneReasonTemporarilyUnavailable },
{ 486, LinphoneReasonBusy },
{ 503, LinphoneReasonIOError },
{ 600, LinphoneReasonDoNotDisturb },
{ 603, LinphoneReasonDeclined }
};
bool_t linphone_error_code_is_retry_after(int err) {
size_t i;
for (i = 0; i < (sizeof(retry_after_code_reason_map) / sizeof(retry_after_code_reason_map[0])); i++) {
if (retry_after_code_reason_map[i].error_code == err) return true;
}
return false;
}
LinphoneReason linphone_error_code_to_reason(int err) {
size_t i;
for (i = 0; i < (sizeof(error_code_reason_map) / sizeof(error_code_reason_map[0])); i++) {
......@@ -160,6 +178,7 @@ static void linphone_error_info_reset(LinphoneErrorInfo *ei){
STRING_RESET(ei->full_string);
STRING_RESET(ei->warnings);
ei->protocol_code = 0;
ei->retry_after = 0;
if (ei->sub_ei) {
linphone_error_info_unref(ei->sub_ei);
ei->sub_ei = NULL;
......@@ -172,6 +191,7 @@ void linphone_error_info_from_sal(LinphoneErrorInfo *ei, const SalErrorInfo *sei
ei->full_string = bctbx_strdup(sei->full_string);
ei->warnings = bctbx_strdup(sei->warnings);
ei->protocol_code = sei->protocol_code;
ei->retry_after = sei->retry_after;
ei->protocol = bctbx_strdup(sei->protocol);
}
......@@ -220,6 +240,7 @@ void linphone_error_info_fields_to_sal(const LinphoneErrorInfo* ei, SalErrorInfo
sei->full_string = bctbx_strdup(ei->full_string);
sei->warnings = bctbx_strdup(ei->warnings);
sei->protocol_code = ei->protocol_code;
sei->retry_after = ei->retry_after;
sei->protocol = bctbx_strdup(ei->protocol);
}
......@@ -242,6 +263,9 @@ void linphone_error_info_set(LinphoneErrorInfo *ei, const char *protocol, Linpho
ei->warnings = bctbx_strdup(warning);
}
int linphone_error_info_get_retry_after(const LinphoneErrorInfo *ei){
return ei->retry_after;
}
LinphoneReason linphone_error_info_get_reason(const LinphoneErrorInfo *ei) {
return ei->reason;
......@@ -272,6 +296,10 @@ LinphoneErrorInfo * linphone_error_info_get_sub_error_info(const LinphoneErrorIn
return ei->sub_ei;
}
void linphone_error_info_set_retry_after(LinphoneErrorInfo *ei, int retry_after){
ei->retry_after = retry_after;
}
void linphone_error_info_set_reason(LinphoneErrorInfo *ei, LinphoneReason reason){
ei->reason = reason;
}
......
This diff is collapsed.
This diff is collapsed.
Android portability
===============
===================
Video
-----
......@@ -15,4 +15,4 @@ Here's the complete code:
TextureView mCaptureView = view.findViewById(R.id.videoCaptureSurface);
mCore.setNativeVideoWindowId(mVideoView);
mCore.setNativePreviewWindowId(mCaptureView);
\ No newline at end of file
mCore.setNativePreviewWindowId(mCaptureView);
Chat room and messaging
=======================
There are different types of chat rooms. Basic chat rooms are simple chat rooms between two participants, they do not require a conference server and are considered as one-to-one chat rooms. Group chat rooms allow more than one peer user and require a conference server. Group chat rooms can also be considered as one-to-one if they have only one peer participant at the time of their creation and if the parameter "enable_one_to_one_chat_room" is set to true, otherwise a basic chat room will be created instead. Secured chat rooms are group chat rooms where LIME X3DH end-to-end encryption is enabled, they can be either group chat rooms or one-to-one chat rooms but not basic chat rooms.
There are different types of chat rooms. Basic chat rooms are simple chat rooms between two participants, they do not require a conference server and are considered as one-to-one chat rooms.
Group chat rooms allow more than one peer user and require a conference server.
Group chat rooms can also be considered as one-to-one if they have only one peer participant at the time of their creation and if the parameter "enable_one_to_one_chat_room" is set to true, otherwise a basic chat room will be created instead.
Secured chat rooms are group chat rooms where LIME X3DH end-to-end encryption is enabled, they can be either group chat rooms or one-to-one chat rooms but not basic chat rooms.
Chat rooms parameters
---------------------
Chat rooms creation and behavior can be controlled with the use of :cpp:type:`LinphoneChatRoomParams`.
.. code-block:: c
LinphoneChatRoomParams *params = linphone_core_create_default_chat_room_params(linphoneCore);
Default parameters will create an un-encrypted basic chat room (See next section).
You can change parameters prior to chat room creation. Possible types are :cpp:enumerator:`LinphoneChatRoomBackendBasic` and :cpp:enumerator:`LinphoneChatRoomBackendFlexisipChat`
.. code-block:: c
//Change chat room type
linphone_chat_room_params_set_backend(params, LinphoneChatRoomBackendBasic);
linphone_chat_room_params_set_backend(params, LinphoneChatRoomBackendFlexisipChat);
//Enable encryption
linphone_chat_room_params_enable_encryption(params, TRUE);
//Enable group chat (valid only with LinphoneChatRoomFlexisipChat)
linphone_chat_room_params_enable_group(params, TRUE);
//Enable real time text (valid only with LinphoneChatRoomBasic)
linphone_chat_room_params_enable_rtt(params, TRUE);
//Check that parameters are valid
assert(linphone_chat_room_params_is_valid(params));
.. _chat-room-creation:
Chat room creation
------------------
Chat rooms can be created with :cpp:func:`linphone_core_create_chat_room <linphone_core_create_chat_room>`.
The full list of parameters includes a :cpp:type:`LinphoneChatRoomParams` object, a subject, a local sip address to use and a list of participants.
Convenience methods are provided to ease chat room creation by passing only minimum required parameters.
Non-provided parameters will be created and default values will be used.
Functions accepting a list of participants with a size greater than 1 will create a group chat room (unless LinphoneChatRoomBackendBasic is used in parameters, in which case the chat room creation will fail).
* :cpp:func:`linphone_core_create_chat_room_2 <linphone_core_create_chat_room_2>`
* :cpp:func:`linphone_core_create_chat_room_3 <linphone_core_create_chat_room_3>`
* :cpp:func:`linphone_core_create_chat_room_4 <linphone_core_create_chat_room_4>`
* :cpp:func:`linphone_core_create_chat_room_5 <linphone_core_create_chat_room_5>`
NULL will be returned if the chat room creation failed.
Basic chat rooms
----------------
Basic chat rooms can be created with :cpp:func:`linphone_core_get_chat_room <linphone_core_get_chat_room>` using a peer sip uri.
See :ref:`chat-room-creation` for creating basic chat rooms.
.. code-block:: c
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(linphoneCore, "sip:joe@sip.linphone.org");
LinphoneChatRoomParams *params = linphone_core_create_default_chat_room_params(linphoneCore);
LinphoneChatRoom* chat_room = linphone_core_create_chat_room_2(linphoneCore, params, "Subject", "sip:joe@sip.linphone.org");
//Or more simply:
LinphoneChatRoom* chat_room = linphone_core_create_chat_room_5(linphoneCore, "sip:joe@sip.linphone.org");
Once created, messages are sent using :cpp:func:`linphone_chat_room_send_message`.
......@@ -29,19 +86,16 @@ Incoming message are received through callbacks which can be set after the chat
Group chat rooms
----------------
Group chat rooms can be created with :cpp:func:`linphone_core_create_client_group_chat_room <linphone_core_create_client_group_chat_room>`. The third argument is a "fallback" boolean which is taken into account when creating a group chat room with only one peer which does not support group chat. In this case and if this argument is true, a basic chat room will be created instead of not being able to create a group chat room.
.. code-block:: c
LinphoneChatRoom *chatRoom = linphone_core_create_client_group_chat_room(linphoneCore, "Colleagues", FALSE);
See :ref:`chat-room-creation` for creating group chat rooms.
A "fallback" mecanism exists when creating a group chat room with only one peer which does not support group chat. A basic chat room will be created instead. This mecanism is disabled by default and not accessible through normal creation functions. If you want to enable it, use :cpp:func:`linphone_core_create_client_group_chat_room` with `TRUE` as third argument to create the chat room.
Participants can be invited to the chat room using :cpp:func:`linphone_chat_room_add_participant <linphone_chat_room_add_participant>` or :cpp:func:`linphone_chat_room_add_participants <linphone_chat_room_add_participants>`. Participants can be removed using :cpp:func:`linphone_chat_room_remove_participant <linphone_chat_room_remove_participant>`.
.. code-block:: c
linphone_chat_room_add_participants(chatRoom, participantsAddressList);
linphone_chat_room_remove_participant(marieChatRoom, laureParticipant); // remove Laure from Marie's chat room
LinphoneChatRoomParams *params; //Create parameters
LinphoneChatRoom *chatRoom = linphone_core_create_chat_room(linphoneCore, params, "Subject", participantsAddressList);
linphone_chat_room_remove_participant(chatRoom, laureParticipant); // remove Laure from chat room
The list of participants of a chat room can be obtained with :cpp:func:`linphone_chat_room_get_participants <linphone_chat_room_get_participants>`. Note that Marie is not considered as a participant in Marie's chat rooms, one's own participant can be obtained with :cpp:func:`linphone_chat_room_get_me <linphone_chat_room_get_me>`.
......@@ -70,11 +124,14 @@ Concerning admins, events, history and instant message disposition notifications
Secured chat rooms
------------------
LIME X3DH end-to-end encryption for instant messages are enabled in secured chat rooms, also known as encrypted chat rooms, which can be created with :cpp:func:`linphone_core_create_client_group_chat_room_2 <linphone_core_create_client_group_chat_room_2>`. Secured chat rooms and regular chat rooms can coexist, even if they have exactly the same participants.
LIME X3DH end-to-end encryption for instant messages are enabled in secured chat rooms, also known as encrypted chat rooms.
Secured chat rooms and regular chat rooms can coexist, even if they have exactly the same participants.
.. code-block:: c
LinphoneChatRoom *securedChatRoom = linphone_core_create_client_group_chat_room_2(linphoneCore, "Secured Conversation", FALSE, TRUE);
LinphoneChatRoomParams *params; //Create parameters
linphone_chat_room_params_enable_encryption(params, TRUE); //Enable encryption
LinphoneChatRoom *securedChatRoom = linphone_core_create_chat_room_2(linphoneCore, params, "Secured Conversation", participants);
Encrypted chat rooms only allow encrypted messages and files to transit (except for error IMDNs in case a message was incorrectly decrypted). Encrypted chat rooms have a concept of security level based on LIME X3DH trust level of each participant device in the conference. The current security level of a chat room can be obtained with :cpp:func:`linphone_chat_room_get_security_level <linphone_chat_room_get_security_level>`.
......
......@@ -38,7 +38,7 @@ This pseudo code demonstrates basic registration operations:
linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/
linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/
Registration sate call back:
Registration state call back:
.. code-block:: c
......
......@@ -77,7 +77,7 @@ int main(int argc, char *argv[]){
/*Next step is to create a chat root*/
chat_room = linphone_core_get_chat_room_from_uri(lc,dest_friend);
chat_room = linphone_core_create_chat_room(lc, dest_friend);
linphone_chat_room_send_message(chat_room,"Hello world"); /*sending message*/
......
This diff is collapsed.
......@@ -143,6 +143,48 @@ static void linphone_android_ortp_log_handler(const char *domain, OrtpLogLevel l
bctbx_free(str);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Logger
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
extern "C" {
static void java_log(JNIEnv* env, BctbxLogLevel loglevel, jstring jdomain, jstring jmsg) {
const char* domain = jdomain ? env->GetStringUTFChars(jdomain, NULL) : NULL;
const char* msg = jmsg ? env->GetStringUTFChars(jmsg, NULL) : NULL;
BCTBX_SLOG(domain, loglevel) << msg;
if (msg) env->ReleaseStringUTFChars(jmsg, msg);
if (domain) env->ReleaseStringUTFChars(jdomain, domain);
}
JNIEXPORT void JNICALL Java_org_linphone_core_tools_Log_d(JNIEnv* env, jobject thiz, jstring jdomain, jstring jmsg) {
java_log(env, BCTBX_LOG_DEBUG, jdomain, jmsg);
}
JNIEXPORT void JNICALL Java_org_linphone_core_tools_Log_i(JNIEnv* env, jobject thiz, jstring jdomain, jstring jmsg) {
java_log(env, BCTBX_LOG_MESSAGE, jdomain, jmsg);
}
JNIEXPORT void JNICALL Java_org_linphone_core_tools_Log_w(JNIEnv* env, jobject thiz, jstring jdomain, jstring jmsg) {
java_log(env, BCTBX_LOG_WARNING, jdomain, jmsg);
}
JNIEXPORT void JNICALL Java_org_linphone_core_tools_Log_e(JNIEnv* env, jobject thiz, jstring jdomain, jstring jmsg) {
java_log(env, BCTBX_LOG_ERROR, jdomain, jmsg);
}
JNIEXPORT void JNICALL Java_org_linphone_core_tools_Log_f(JNIEnv* env, jobject thiz, jstring jdomain, jstring jmsg) {
java_log(env, BCTBX_LOG_FATAL, jdomain, jmsg);
}
JNIEXPORT void JNICALL Java_org_linphone_core_tools_Log_setDomain(JNIEnv* env, jobject thiz, jstring jdomain) {
const char* domain = jdomain ? env->GetStringUTFChars(jdomain, NULL) : NULL;
bctbx_set_log_level_mask(domain, (int)bctbx_get_log_level_mask(BCTBX_LOG_DOMAIN));
if (domain) env->ReleaseStringUTFChars(jdomain, domain);
}
} // extern C
int dumbMethodForAllowingUsageOfCpuFeaturesFromStaticLibMediastream() {
return (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM && (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0);
}
......@@ -1654,6 +1696,8 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*
ljb->setCore(core);
LinphoneCore *lc = linphone_factory_create_core_2(linphone_factory_get(), cbs, userConfig, factoryConfig, ljb, context);
ms_warning("This app is currently using the legacy java wrapper");
jlong nativePtr = (jlong)lc;
ReleaseStringUTFChars(env, juserConfig, userConfig);
ReleaseStringUTFChars(env, jfactoryConfig, factoryConfig);
......@@ -3148,7 +3192,7 @@ extern "C" void Java_org_linphone_core_LinphoneAuthInfoImpl_setUsername
*/
extern "C" void Java_org_linphone_core_LinphoneAuthInfoImpl_setAlgorithm
(JNIEnv *env, jobject, jlong auth_info, jstring jalgorithm) {
const char* username = GetStringUTFChars(env, jalgorithm);
const char* algorithm = GetStringUTFChars(env, jalgorithm);
linphone_auth_info_set_algorithm((LinphoneAuthInfo*)auth_info,algorithm);
ReleaseStringUTFChars(env, jalgorithm, algorithm);
}
......
......@@ -228,6 +228,8 @@ static const char *_linphone_logging_service_log_domains[] = {
"mediastreamer",
"bzrtp",
"tunnel",
"lime",
"linphone-android", // Used by Log.java in every java code + android app
BCTBX_LOG_DOMAIN, /* which is "liblinphone", set from CMakeList.txt*/
NULL
};
......
......@@ -741,7 +741,7 @@ bool_t linphone_config_get_skip_flag_for_section(const LpConfig *lpconfig, const
}
void linphone_config_set_string(LpConfig *lpconfig,const char *section, const char *key, const char *value){
LpItem *item;
LpItem *item;
LpSection *sec=linphone_config_find_section(lpconfig,section);
if (sec!=NULL){
item=lp_section_find_item(sec,key);
......
......@@ -107,11 +107,11 @@ static const char *person_prefix = "/pidf:presence/dm:person";
* PRIVATE FUNCTIONS *
****************************************************************************/
/* Defined in http://www.w3.org/TR/REC-xml/ */
/* Defined in https://www.w3.org/TR/REC-xml-names/#NT-NCName */
static char presence_id_valid_characters[] = "0123456789abcdefghijklmnopqrstuvwxyz-.";
/* NameStartChar (NameChar)* */
static char presence_id_valid_start_characters[] = ":_abcdefghijklmnopqrstuvwxyz";
static char presence_id_valid_start_characters[] = "_abcdefghijklmnopqrstuvwxyz";
static char * generate_presence_id(void) {
char id[7];
......@@ -2155,6 +2155,7 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa
ms_free(tmp);
}
linphone_friend_set_presence_model(lf, presence);
linphone_presence_model_unref(presence);
lf->subscribe_active=TRUE;
lf->presence_received = TRUE;
lf->out_sub_state = linphone_subscription_state_from_sal(ss);
......
......@@ -151,6 +151,8 @@ const LinphoneAddress *_linphone_proxy_config_get_contact_without_params (const
void linphone_friend_list_invalidate_subscriptions(LinphoneFriendList *list);
void linphone_friend_list_notify_presence_received(LinphoneFriendList *list, LinphoneEvent *lev, const LinphoneContent *body);
void linphone_friend_list_subscription_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state);
void linphone_friend_list_invalidate_friends_maps(LinphoneFriendList *list);
/**
* Removes all bodyless friend lists.
* @param[in] lc #LinphoneCore object
......@@ -190,6 +192,7 @@ LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *
LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize);
LinphoneFriendListCbs * linphone_friend_list_cbs_new(void);
void linphone_friend_list_set_current_callbacks(LinphoneFriendList *friend_list, LinphoneFriendListCbs *cbs);
void linphone_friend_add_addresses_and_numbers_into_maps(LinphoneFriend *lf, LinphoneFriendList *list);
int linphone_parse_host_port(const char *input, char *host, size_t hostlen, int *port);
int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen, int default_port);
......
......@@ -717,6 +717,7 @@ struct _LinphoneErrorInfo{
char *phrase; /*from SIP response*/
char *warnings; /*from SIP response*/
char *full_string; /*concatenation of status_string + warnings*/
int retry_after;
struct _LinphoneErrorInfo *sub_ei;
};
......@@ -840,7 +841,7 @@ namespace LinphonePrivate {
bctbx_list_t *chat_rooms; \
bctbx_list_t *callsCache; \
bool_t dns_set_by_app; \
int auto_download_incoming_files_max_size; \
int auto_download_incoming_files_max_size;
#define LINPHONE_CORE_STRUCT_FIELDS \
LINPHONE_CORE_STRUCT_BASE_FIELDS \
......@@ -848,6 +849,8 @@ namespace LinphonePrivate {
bctbx_mutex_t zrtp_cache_db_mutex; \
sqlite3 *logs_db; \
sqlite3 *friends_db; \
bool_t debug_storage;
bool_t debug_storage; \
void *system_context; \
bool_t is_unreffing;
#endif /* _PRIVATE_STRUCTS_H_ */
......@@ -577,6 +577,14 @@ void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char
cfg->dial_prefix=NULL;
}
if (prefix && prefix[0]!='\0') cfg->dial_prefix=ms_strdup(prefix);
if (cfg->lc) {
bctbx_list_t *elem;
for (elem = cfg->lc->friends_lists; elem != NULL; elem = bctbx_list_next(elem)) {
LinphoneFriendList *list = (LinphoneFriendList *)bctbx_list_get_data(elem);
linphone_friend_list_invalidate_friends_maps(list);
}
}
}
const char *linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg){
......@@ -869,9 +877,6 @@ LinphoneStatus linphone_proxy_config_done(LinphoneProxyConfig *cfg)
if (linphone_proxy_config_compute_publish_params_hash(cfg)) {
ms_message("Publish params have changed on proxy config [%p]",cfg);
if (cfg->presence_publish_event) {
if (cfg->publish) {
linphone_proxy_config_set_etag(cfg, linphone_event_get_custom_header(cfg->presence_publish_event, "SIP-ETag"));
}
/*publish is terminated*/
linphone_event_terminate(cfg->presence_publish_event);
}
......@@ -1066,7 +1071,7 @@ LinphoneStatus linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyCon
void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cfg){
/* check this proxy config is in the list before doing more*/
if (bctbx_list_find(lc->sip_conf.proxies,cfg)==NULL){
if (bctbx_list_find(lc->sip_conf.proxies,cfg)==NULL) {
ms_error("linphone_core_remove_proxy_config: LinphoneProxyConfig [%p] is not known by LinphoneCore (programming error?)",cfg);
return;
}
......@@ -1089,8 +1094,13 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
linphone_proxy_config_set_state(cfg, LinphoneRegistrationNone,"Registration disabled");
}
linphone_proxy_config_write_all_to_config_file(lc);
//Update the associated linphone specs on the core
linphone_proxy_config_set_conference_factory_uri(cfg, NULL);
}
void linphone_core_clear_proxy_config(LinphoneCore *lc){
bctbx_list_t* list=bctbx_list_copy(linphone_core_get_proxy_config_list((const LinphoneCore*)lc));
bctbx_list_t* copy=list;
......@@ -1574,7 +1584,6 @@ void linphone_proxy_config_notify_publish_state_changed(LinphoneProxyConfig *cfg
break;
default:
break;
}
}
}
......@@ -1590,7 +1599,21 @@ void linphone_proxy_config_set_conference_factory_uri(LinphoneProxyConfig *cfg,
linphone_core_add_linphone_spec(cfg->lc, "groupchat");
}
} else if (cfg->lc) {
linphone_core_remove_linphone_spec(cfg->lc, "groupchat");
bool_t remove = TRUE;
//Check that no other proxy config needs the specs before removing it
bctbx_list_t *it = NULL;
for (it = cfg->lc->sip_conf.proxies; it; it = it->next) {
if (it->data != cfg) {
const char *confUri = linphone_proxy_config_get_conference_factory_uri((LinphoneProxyConfig *) it->data);
if (confUri && strlen(confUri)) {
remove = FALSE;
break;
}
}
}
if (remove) {
linphone_core_remove_linphone_spec(cfg->lc, "groupchat");
}
}
}
......
......@@ -63,6 +63,7 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
}
#define NOTIFY_IF_EXIST(function_name, ...) \
if (lc->is_unreffing) return; /* This is to prevent someone from taking a ref in a callback called while the Core is being destroyed after last unref */ \
bctbx_list_t* iterator; \
VTableReference *ref; \
bool_t has_cb = FALSE; \
......@@ -110,13 +111,17 @@ void linphone_core_notify_registration_state_changed(LinphoneCore *lc, LinphoneP
}
void linphone_core_notify_notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf) {
NOTIFY_IF_EXIST(notify_presence_received, lc, lf);
cleanup_dead_vtable_refs(lc);
if (linphone_config_get_int(lc->config, "misc", "notify_each_friend_individually_when_presence_received", 1)) {
NOTIFY_IF_EXIST(notify_presence_received, lc, lf);
cleanup_dead_vtable_refs(lc);
}
}
void linphone_core_notify_notify_presence_received_for_uri_or_tel(LinphoneCore *lc, LinphoneFriend *lf, const char *uri_or_tel, const LinphonePresenceModel *presence_model) {
NOTIFY_IF_EXIST(notify_presence_received_for_uri_or_tel, lc, lf, uri_or_tel, presence_model);
cleanup_dead_vtable_refs(lc);
if (linphone_config_get_int(lc->config, "misc", "notify_each_friend_individually_when_presence_received", 1)) {
NOTIFY_IF_EXIST(notify_presence_received_for_uri_or_tel, lc, lf, uri_or_tel, presence_model);
cleanup_dead_vtable_refs(lc);
}
}
void linphone_core_notify_new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char *url) {
......
......@@ -84,6 +84,7 @@ set(C_API_HEADER_FILES
c-chat-message.h
c-chat-room-cbs.h
c-chat-room.h
c-chat-room-params.h
c-content.h
c-dial-plan.h
c-event-log.h
......@@ -139,7 +140,7 @@ set(LINPHONE_HEADER_FILES ${ROOT_HEADER_FILES} ${C_API_HEADER_FILES} ${ENUMS_HEA
set(LINPHONE_HEADER_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}" PARENT_SCOPE)
# ------------------------------------------------------------------------------
if (IOS AND ENABLE_SHARED)
if (APPLE AND ENABLE_SHARED)
#cmake 3.10 seems not able to handle subdirectories for PUBLIC_HEADER. My be rework in the futur
set(DEST_ROOT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/Frameworks/linphone.framework/Headers")
else()
......
/*
* c-chat-room-params.h
* Copyright (C) 2010-2019 Belledonne Communications SARL
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.