Commit f8931324 authored by Erwan Croze's avatar Erwan Croze 👋🏻
Browse files

Merge branch 'dev_refactor_cpp_qrcode' of...

Merge branch 'dev_refactor_cpp_qrcode' of gitlab.linphone.org:BC/public/linphone into dev_refactor_cpp
Add QRCode API
parents b0f5d446 3a33105b
......@@ -52,7 +52,6 @@ option(ENABLE_JAVADOC "Add a target to generate documentation for Java API" NO)
option(ENABLE_LDAP "Enable LDAP support." NO)
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
option(ENABLE_ROOTCA_DOWNLOAD "Download rootca.pem at build time." YES)
option(ENABLE_SOCI_STORAGE "Turn on compilation soci storage, for messages, contacts, history" YES)
option(ENABLE_SQLITE_STORAGE "Turn on compilation sqlite storage, for messages, contacts, history" YES)
option(ENABLE_STRICT "Build with strict compile options." YES)
option(ENABLE_TOOLS "Turn on or off compilation of tools." YES)
......@@ -255,7 +254,6 @@ if(MSVC)
include_directories(${MSVC_INCLUDE_DIR})
endif()
add_definitions("-DLINPHONE_EXPORTS")
set(LINPHONE_CPPFLAGS ${BELCARD_CPPFLAGS} ${BELLESIP_CPPFLAGS} ${MEDIASTREAMER2_CPPFLAGS} ${BCTOOLBOX_CPPFLAGS} ${BELR_CPPFLAGS})
if(ENABLE_STATIC)
list(APPEND LINPHONE_CPPFLAGS "-DLINPHONE_STATIC")
......
......@@ -31,6 +31,9 @@ Requires: %{pkg_prefix}ortp
Requires: %{pkg_prefix}mediastreamer
Requires: %{pkg_prefix}belle-sip
Requires: %{pkg_prefix}belr
%if @ENABLE_VCARD@
Requires: %{pkg_prefix}belcard
%endif
%if @ENABLE_SOCI_STORAGE@
Requires: %{pkg_prefix}soci
%endif
......@@ -83,7 +86,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS README.md TODO
%if @ENABLE_DAEMON@ || @ENABLE_CONSOLE_UI@
%if @ENABLE_DAEMON@ || @ENABLE_CONSOLE_UI@ || @ENABLE_TOOLS@
%{_bindir}/*
%endif
%{_libdir}/*.so.*
......
......@@ -25,6 +25,7 @@
#
SET(_SOCI_ALL_PLUGINS mysql sqlite3)
SET(_SOCI_REQUIRED_VARS SOCI_INCLUDE_DIRS SOCI_LIBRARIES)
SET(_SOCI_VERSION "_4_0")
#
### FIRST STEP: Find the soci headers.
......@@ -37,7 +38,7 @@ MARK_AS_ADVANCED(SOCI_INCLUDE_DIRS)
### SECOND STEP: Find the soci core library. Respect LIB_SUFFIX
#
FIND_LIBRARY(SOCI_LIBRARIES
NAMES soci_core
NAMES soci_core soci_core${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
MARK_AS_ADVANCED(SOCI_LIBRARIES)
......@@ -54,7 +55,7 @@ IF(SOCI_INCLUDE_DIRS AND SOCI_LIBRARIES)
FIND_LIBRARY(
SOCI_${plugin}_PLUGIN
NAMES soci_${plugin}
NAMES soci_${plugin} soci_${plugin}${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN)
......@@ -88,4 +89,3 @@ ENDIF()
#
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Soci DEFAULT_MSG ${_SOCI_REQUIRED_VARS})
......@@ -97,6 +97,7 @@ set(LINPHONE_SOURCE_FILES_CXX
conference.cc
tester_utils.cpp
)
if(ENABLE_JAVA_WRAPPER)
list(APPEND LINPHONE_SOURCE_FILES_CXX ${LINPHONE_JNI_SOURCES})
set_source_files_properties(${LINPHONE_JNI_SOURCES} PROPERTIES GENERATED TRUE)
......@@ -140,8 +141,8 @@ bc_git_version(liblinphone ${PROJECT_VERSION})
add_definitions(
-DUSE_BELLESIP
-DLIBLINPHONE_EXPORTS
-DBCTBX_LOG_DOMAIN="liblinphone"
-DLINPHONE_EXPORTS
)
set_source_files_properties(${LINPHONE_SOURCE_FILES_C} PROPERTIES LANGUAGE CXX)
......
......@@ -61,7 +61,7 @@ LinphoneAuthInfo *linphone_auth_info_new_for_algorithm(const char *username, con
if (!algorithm)
obj->algorithm = ms_strdup("MD5");
if(algorithm && strcmp(algorithm, "MD5") && strcmp(algorithm, "SHA-256")){
if(algorithm && strcasecmp(algorithm, "MD5") && strcasecmp(algorithm, "SHA-256")){
ms_error("Given algorithm %s is not correct.", algorithm);
return NULL;
}
......@@ -258,12 +258,12 @@ void linphone_auth_info_write_config(LpConfig *config, LinphoneAuthInfo *obj, in
}
if (!obj->ha1 && obj->realm && obj->passwd && (obj->username || obj->userid) && store_ha1_passwd) {
/* Default algorithm is MD5 if it's NULL */
if((obj->algorithm==NULL)||(!(strcmp(obj->algorithm, "MD5")))){
if((obj->algorithm==NULL)||(!(strcasecmp(obj->algorithm, "MD5")))){
obj->ha1 = reinterpret_cast<char *>(ms_malloc(33));
sal_auth_compute_ha1(obj->userid ? obj->userid : obj->username, obj->realm, obj->passwd, obj->ha1);
}
/* If algorithm is SHA-256, calcul ha1 by sha256*/
if((obj->algorithm)&&(!(strcmp(obj->algorithm, "SHA-256")))){
if((obj->algorithm)&&(!(strcasecmp(obj->algorithm, "SHA-256")))){
obj->ha1 = reinterpret_cast<char *>(ms_malloc(65));
sal_auth_compute_ha1_for_algorithm(obj->userid ? obj->userid : obj->username, obj->realm, obj->passwd, obj->ha1,65, obj->algorithm);
}
......
......@@ -515,11 +515,11 @@ static bool_t fill_auth_info(LinphoneCore *lc, SalAuthInfo* sai) {
* exit. The default algorithm is MD5 if it's NULL.
*/
if (sai->algorithm && ai->algorithm) {
if (strcmp(ai->algorithm, sai->algorithm))
if (strcasecmp(ai->algorithm, sai->algorithm))
return TRUE;
} else if (
(ai->algorithm && strcmp(ai->algorithm, "MD5")) ||
(sai->algorithm && strcmp(sai->algorithm, "MD5"))
(ai->algorithm && strcasecmp(ai->algorithm, "MD5")) ||
(sai->algorithm && strcasecmp(sai->algorithm, "MD5"))
)
return TRUE;
......
......@@ -60,7 +60,7 @@ int lime_getCachedSndKeysByURI(void *cachedb, limeURIKeys_t *associatedKeys) {
/* Note: retrieved potentially expired keys, just to be able to send a different status to caller(no keys found is not expired key found) */
/* if we do not have self uri in associatedKeys, just retrieve any available key matching peer URI */
if (associatedKeys->selfURI == NULL) {
stmt = sqlite3_mprintf("SELECT zu.zuid, zu.zid as peerZID, l.sndkey, l.sndSId, l.sndIndex, l.valid FROM ziduri as zu LEFT JOIN zrtp as z ON z.zuid=zu.zuid LEFT JOIN lime as l ON z.zuid=l.zuid WHERE zu.peeruri=? AND z.pvs=?;");
stmt = sqlite3_mprintf("SELECT zu.zuid, zu.zid as peerZID, l.sndkey, l.sndSId, l.sndIndex, l.valid FROM ziduri as zu INNER JOIN zrtp as z ON z.zuid=zu.zuid INNER JOIN lime as l ON z.zuid=l.zuid WHERE zu.peeruri=? AND z.pvs=?;");
ret = sqlite3_prepare_v2(db, stmt, -1, &sqlStmt, NULL);
sqlite3_free(stmt);
if (ret != SQLITE_OK) {
......@@ -69,7 +69,7 @@ int lime_getCachedSndKeysByURI(void *cachedb, limeURIKeys_t *associatedKeys) {
sqlite3_bind_text(sqlStmt, 1, associatedKeys->peerURI,-1, SQLITE_TRANSIENT);
sqlite3_bind_blob(sqlStmt, 2, pvsOne, 1, SQLITE_TRANSIENT);
} else { /* we have a self URI, so include it in the query */
stmt = sqlite3_mprintf("SELECT zu.zuid, zu.zid as peerZID, l.sndkey, l.sndSId, l.sndIndex, l.valid FROM ziduri as zu LEFT JOIN zrtp as z ON z.zuid=zu.zuid LEFT JOIN lime as l ON z.zuid=l.zuid WHERE zu.selfuri=? AND zu.peeruri=? AND z.pvs=?;");
stmt = sqlite3_mprintf("SELECT zu.zuid, zu.zid as peerZID, l.sndkey, l.sndSId, l.sndIndex, l.valid FROM ziduri as zu INNER JOIN zrtp as z ON z.zuid=zu.zuid INNER JOIN lime as l ON z.zuid=l.zuid WHERE zu.selfuri=? AND zu.peeruri=? AND z.pvs=?;");
ret = sqlite3_prepare_v2(db, stmt, -1, &sqlStmt, NULL);
sqlite3_free(stmt);
if (ret != SQLITE_OK) {
......@@ -186,17 +186,17 @@ int lime_getCachedRcvKeyByZid(void *cachedb, limeKey_t *associatedKey, const cha
if (db == NULL) { /* there is no cache return error */
ms_error("[LIME] Get Cached Rcv Key by Zid : no cache found");
return LIME_INVALID_CACHE;
}
/* query the DB: join ziduri, lime and zrtp tables : */
/* retrieve zuid(for easier key update in cache), rcvKey, rcvSId, rcvIndex where self/peer uris and peer zid are matching constraint(unique row) and pvs is raised */
/* Note: retrieved potentially expired keys, just to be able to send a different status to caller(no keys found is not expired key found) */
/* if we do not have self uri in associatedKeys, just retrieve any available key matching peer URI */
stmt = sqlite3_mprintf("SELECT zu.zuid, l.rcvkey, l.rcvSId, l.rcvIndex FROM ziduri as zu LEFT JOIN zrtp as z ON z.zuid=zu.zuid LEFT JOIN lime as l ON z.zuid=l.zuid WHERE zu.selfuri=? AND zu.peeruri=? AND zu.zid=? AND z.pvs=? LIMIT 1;");
stmt = sqlite3_mprintf("SELECT zu.zuid, l.rcvkey, l.rcvSId, l.rcvIndex FROM ziduri as zu INNER JOIN zrtp as z ON z.zuid=zu.zuid INNER JOIN lime as l ON z.zuid=l.zuid WHERE zu.selfuri=? AND zu.peeruri=? AND zu.zid=? AND z.pvs=? LIMIT 1;");
ret = sqlite3_prepare_v2(db, stmt, -1, &sqlStmt, NULL);
sqlite3_free(stmt);
if (ret != SQLITE_OK) {
ms_error("[LIME] Get Cached Rcv Key by Zid can't prepare statement to retrieve key");
return LIME_INVALID_CACHE;
}
sqlite3_bind_text(sqlStmt, 1, selfURI,-1, SQLITE_TRANSIENT);
......@@ -214,20 +214,22 @@ int lime_getCachedRcvKeyByZid(void *cachedb, limeKey_t *associatedKey, const cha
if (length==32) { /* rcvKey */
memcpy(associatedKey->key, sqlite3_column_blob(sqlStmt, 1), (size_t)length);
} else { /* something wrong */
ms_error("[LIME] Get Cached Rcv Key by Zid fetched a rcvKey with wrong length");
sqlite3_finalize(sqlStmt);
return LIME_NO_VALID_KEY_FOUND_FOR_PEER;
return LIME_INVALID_CACHE;
}
length = sqlite3_column_bytes(sqlStmt, 2);
if (length==32) { /* rcvSId */
memcpy(associatedKey->sessionId, sqlite3_column_blob(sqlStmt, 2), (size_t)length);
} else { /* something wrong */
ms_error("[LIME] Get Cached Rcv Key by Zid fetched a rcvSid with wrong length");
sqlite3_finalize(sqlStmt);
return LIME_NO_VALID_KEY_FOUND_FOR_PEER;
return LIME_INVALID_CACHE;
}
length = sqlite3_column_bytes(sqlStmt, 3);
if (length==4) { /* rcvKey */
if (length==4) { /* rcvIndex */
uint8_t *sessionId = (uint8_t *)sqlite3_column_blob(sqlStmt, 3);
associatedKey->sessionIndex = ((uint32_t)(sessionId[0]))<<24 |
((uint32_t)(sessionId[1]))<<16 |
......@@ -235,7 +237,8 @@ int lime_getCachedRcvKeyByZid(void *cachedb, limeKey_t *associatedKey, const cha
((uint32_t)(sessionId[3]));
} else { /* something wrong */
sqlite3_finalize(sqlStmt);
return LIME_NO_VALID_KEY_FOUND_FOR_PEER;
ms_error("[LIME] Get Cached Rcv Key by Zid fetched a rcvIndex with wrong length");
return LIME_INVALID_CACHE;
}
sqlite3_finalize(sqlStmt);
......@@ -244,6 +247,7 @@ int lime_getCachedRcvKeyByZid(void *cachedb, limeKey_t *associatedKey, const cha
/* something is wrong with the cache? */
if (ret!=SQLITE_DONE) {
ms_error("[LIME] Get Cached Rcv Key by Zid : request gone bad");
return LIME_INVALID_CACHE;
}
......@@ -635,14 +639,15 @@ int lime_decryptMultipartMessage(void *cachedb, uint8_t *message, const char *se
if (peerZidHex != NULL) {
/* Convert it from hexa string to bytes string and set the result in the associatedKey structure */
bctbx_str_to_uint8(associatedKey.peerZID, (const uint8_t *)peerZidHex, (uint16_t)strlen(peerZidHex));
linphone_free_xml_text_content(peerZidHex);
/* Get the matching key from cache */
retval = lime_getCachedRcvKeyByZid(cachedb, &associatedKey, selfURI, peerURI);
if (retval != 0) {
ms_error("[LIME] Couldn't get cache rcv key by ZID");
ms_error("[LIME] Couldn't get cache rcv key by ZID. Returns %04x. PeerZid %s peerURI %s selfURI %s", retval, peerZidHex, peerURI, selfURI);
linphone_free_xml_text_content(peerZidHex);
goto error;
}
linphone_free_xml_text_content(peerZidHex);
/* Retrieve the portion of message which is encrypted with our key(seek for a pzid matching our) */
msg_object = linphone_get_xml_xpath_object_for_node_list(xml_ctx, "/doc/msg");
......@@ -770,8 +775,9 @@ bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr) {
if (zrtp_cache_db != NULL) {
bool_t res;
limeURIKeys_t associatedKeys;
char *peer = linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr));
char *peer = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_room_get_peer_address(cr))
, linphone_address_get_username(linphone_chat_room_get_peer_address(cr))
, linphone_address_get_domain(linphone_chat_room_get_peer_address(cr)));
/* retrieve keys associated to the peer URI */
associatedKeys.peerURI = bctbx_strdup(peer);
associatedKeys.selfURI = NULL; /* TODO : there is no sender associated to chatroom so check for any local URI available, shall we add sender to chatroom? */
......@@ -813,10 +819,15 @@ int lime_im_encryption_engine_process_incoming_message_cb(LinphoneImEncryptionEn
errcode = 500;
return errcode;
}
peerUri = linphone_address_as_string_uri_only(linphone_chat_message_get_from_address(msg));
selfUri = linphone_address_as_string_uri_only(linphone_chat_message_get_to_address(msg));
peerUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_message_get_from_address(msg))
, linphone_address_get_username(linphone_chat_message_get_from_address(msg))
, linphone_address_get_domain(linphone_chat_message_get_from_address(msg)));
selfUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_message_get_to_address(msg))
, linphone_address_get_username(linphone_chat_message_get_to_address(msg))
, linphone_address_get_domain(linphone_chat_message_get_to_address(msg)));
retval = lime_decryptMultipartMessage(zrtp_cache_db, (uint8_t *)linphone_chat_message_get_text(msg), selfUri, peerUri, &decrypted_body, &decrypted_content_type,
bctbx_time_string_to_sec(lp_config_get_string(lc->config, "sip", "lime_key_validity", "0")));
bctbx_time_string_to_sec(lp_config_get_string(lc->config, "sip", "lime_key_validity", "0")));
ms_free(peerUri);
ms_free(selfUri);
if (retval != 0) {
......@@ -876,8 +887,12 @@ int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneImEncryptionEn
} else {
int retval;
uint8_t *crypted_body = NULL;
char *selfUri = linphone_address_as_string_uri_only(linphone_chat_message_get_from_address(msg));
char *peerUri = linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(room));
char *peerUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_room_get_peer_address(room))
, linphone_address_get_username(linphone_chat_room_get_peer_address(room))
, linphone_address_get_domain(linphone_chat_room_get_peer_address(room)));
char *selfUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_message_get_from_address(msg))
, linphone_address_get_username(linphone_chat_message_get_from_address(msg))
, linphone_address_get_domain(linphone_chat_message_get_from_address(msg)));
retval = lime_createMultipartMessage(zrtp_cache_db, linphone_chat_message_get_content_type(msg), (uint8_t *)linphone_chat_message_get_text(msg), selfUri, peerUri, &crypted_body);
if (retval != 0) { /* fail to encrypt */
......
......@@ -19,9 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "linphone/api/c-content.h"
#include "linphone/core_utils.h"
#include "linphone/core.h"
#include "linphone/lpconfig.h"
#include "linphone/logging.h"
#include "linphone/lpconfig.h"
#include "linphone/sipsetup.h"
#include "private.h"
......@@ -41,8 +42,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <ortp/telephonyevents.h>
#include <mediastreamer2/zrtp.h>
#include <mediastreamer2/dtls_srtp.h>
#include <bctoolbox/defs.h>
#include <belr/grammarbuilder.h>
#include "bctoolbox/defs.h"
#include "bctoolbox/regex.h"
#include "belr/grammarbuilder.h"
#include "mediastreamer2/dtmfgen.h"
#include "mediastreamer2/mediastream.h"
......@@ -53,6 +55,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mediastreamer2/msogl.h"
#include "mediastreamer2/msvolume.h"
#include "mediastreamer2/msqrcodereader.h"
#include "bctoolbox/charconv.h"
#include "chat/chat-room/client-group-chat-room-p.h"
......@@ -69,6 +72,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "address/address-p.h"
#include "c-wrapper/c-wrapper.h"
#ifdef INET6
#ifndef _WIN32
#include <netdb.h>
......@@ -1282,33 +1286,57 @@ static void sound_config_read(LinphoneCore *lc)
_linphone_core_set_tone(lc,LinphoneReasonBusy,LinphoneToneBusy,NULL);
}
static int _linphone_core_tls_postcheck_callback(void *data, const bctbx_x509_certificate_t *peer_cert){
LinphoneCore *lc = (LinphoneCore *) data;
const char *tls_certificate_subject_regexp = lp_config_get_string(lc->config,"sip","tls_certificate_subject_regexp", NULL);
int ret = 0;
if (tls_certificate_subject_regexp){
ret = -1;
/*the purpose of this handling is to a peer certificate for which there is no single subject matching the regexp given
* in the "tls_certificate_subject_regexp" property.
*/
bctbx_list_t *subjects = bctbx_x509_certificate_get_subjects(peer_cert);
bctbx_list_t *elem;
for(elem = subjects; elem != NULL; elem = elem->next){
const char *subject = (const char *)elem->data;
ms_message("_linphone_core_tls_postcheck_callback: subject=%s", subject);
if (bctbx_is_matching_regex(subject, tls_certificate_subject_regexp)){
ret = 0;
ms_message("_linphone_core_tls_postcheck_callback(): successful by matching '%s'", subject);
break;
}
}
bctbx_list_free_with_data(subjects, bctbx_free);
}
if (ret == -1){
ms_message("_linphone_core_tls_postcheck_callback(): postcheck failed, nothing matched.");
}
return ret;
}
static void certificates_config_read(LinphoneCore *lc) {
LinphoneFactory *factory = linphone_factory_get();
const char *data_dir = linphone_factory_get_data_resources_dir(factory);
char *root_ca_path = bctbx_strdup_printf("%s/rootca.pem", data_dir);
const char *rootca = lp_config_get_string(lc->config,"sip","root_ca", NULL);
// If rootca is not existing anymore, we reset it to the default value
if (rootca == NULL || ((bctbx_file_exist(rootca) != 0) && (!bctbx_directory_exists(rootca)))) {
#ifdef __linux
#ifdef __ANDROID__
const char *possible_rootca = "/system/etc/security/cacerts";
#else
const char *possible_rootca = "/etc/ssl/certs";
#endif
if (bctbx_directory_exists(possible_rootca)) {
rootca = possible_rootca;
} else
#endif
{
if (bctbx_file_exist(root_ca_path) == 0) {
rootca = root_ca_path;
}
}
// If rootca is not existing anymore, we try data_resources_dir/rootca.pem else default from belle-sip
if (rootca == NULL || ((bctbx_file_exist(rootca) != 0 && !bctbx_directory_exists(rootca)))) {
//Check root_ca_path
if ((bctbx_file_exist(root_ca_path) == 0) || bctbx_directory_exists(root_ca_path))
rootca = root_ca_path;
else
rootca = NULL;
}
linphone_core_set_root_ca(lc,rootca);
if (rootca)
linphone_core_set_root_ca(lc,rootca);
/*else use default value from belle-sip*/
linphone_core_verify_server_certificates(lc, !!lp_config_get_int(lc->config,"sip","verify_server_certs",TRUE));
linphone_core_verify_server_cn(lc, !!lp_config_get_int(lc->config,"sip","verify_server_cn",TRUE));
bctbx_free(root_ca_path);
lc->sal->setTlsPostcheckCallback(_linphone_core_tls_postcheck_callback, lc);
}
static void sip_config_read(LinphoneCore *lc) {
......@@ -2282,7 +2310,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
lc->factory = ms_factory_new_with_voip_and_directories(msplugins_dir, image_resources_dir);
lc->sal->setFactory(lc->factory);
belr::GrammarLoader::get().addPath(getPlatformHelpers(lc)->getDataPath());
belr::GrammarLoader::get().addPath(std::string(linphone_factory_get_top_resources_dir(lfactory)).append("/belr/grammars"));
linphone_task_list_init(&lc->hooks);
......@@ -7381,6 +7409,7 @@ void linphone_core_check_for_update(LinphoneCore *lc, const char *current_versio
int err;
bool_t is_desktop = FALSE;
const char *platform = NULL;
const char *mobilePlatform = NULL;
const char *version_check_url_root = lp_config_get_string(lc->config, "misc", "version_check_url_root", NULL);
if (version_check_url_root != NULL) {
......@@ -7396,9 +7425,14 @@ void linphone_core_check_for_update(LinphoneCore *lc, const char *current_versio
if (strcmp(tag, "win32") == 0) platform = "windows";
else if (strcmp(tag, "apple") == 0) platform = "macosx";
else if (strcmp(tag, "linux") == 0) platform = "linux";
else if (strcmp(tag, "ios") == 0) mobilePlatform = "ios";
else if (strcmp(tag, "android") == 0) mobilePlatform = "android";
else if (strcmp(tag, "desktop") == 0) is_desktop = TRUE;
}
if ((is_desktop == FALSE) || (platform == NULL)) {
if (!is_desktop) {
platform = mobilePlatform;
}
if (platform == NULL) {
ms_warning("Update checking is not supported on this platform");
return;
}
......
......@@ -1530,6 +1530,9 @@ public:
jcontent,
jbytes,
size);
if (jbytes) {
env->DeleteLocalRef(jbytes);
}
if (jcontent) {
env->DeleteLocalRef(jcontent);
}
......@@ -6204,7 +6207,7 @@ static jobject create_java_linphone_content(JNIEnv *env, const LinphoneContent *
jbyteArray jdata = NULL;
jint jsize = 0;
const char *tmp;
void *data;
const uint8_t *data;
contentClass = (jclass)env->FindClass("org/linphone/core/LinphoneContentImpl");
ctor = env->GetMethodID(contentClass,"<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[BLjava/lang/String;I)V");
......@@ -6226,6 +6229,9 @@ static jobject create_java_linphone_content(JNIEnv *env, const LinphoneContent *
env->DeleteLocalRef(contentClass);
env->DeleteLocalRef(jtype);
env->DeleteLocalRef(jsubtype);
if (jdata) {
env->DeleteLocalRef(jdata);
}
if (jencoding) {
env->DeleteLocalRef(jencoding);
}
......@@ -6252,6 +6258,7 @@ static jobject create_java_linphone_buffer(JNIEnv *env, const LinphoneBuffer *bu
}
jobject jobj = env->NewObject(bufferClass, ctor, jdata, jsize);
if (jdata) env->DeleteLocalRef(jdata);
env->DeleteLocalRef(bufferClass);
return jobj;
}
......
......@@ -54,17 +54,28 @@ void linphone_call_notify_next_video_frame_decoded(LinphoneCall *call);
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg);
LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, LinphonePrivate::SalCallOp *op);
LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress * to);
LINPHONE_PUBLIC LinphoneCallLog *linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress * to);
LinphonePlayer *linphone_call_build_player(LinphoneCall*call);
LinphonePrivate::SalCallOp *linphone_call_get_op(const LinphoneCall *call);
LinphoneProxyConfig * linphone_call_get_dest_proxy(const LinphoneCall *call);
// FIXME: Remove this declaration, use LINPHONE_PUBLIC as ugly workaround, already defined in tester_utils.h
LINPHONE_PUBLIC LinphoneProxyConfig *linphone_call_get_dest_proxy(const LinphoneCall *call);
LINPHONE_PUBLIC MediaStream * linphone_call_get_stream(LinphoneCall *call, LinphoneStreamType type);
LinphoneCallLog * linphone_call_get_log(const LinphoneCall *call);
IceSession * linphone_call_get_ice_session(const LinphoneCall *call);
// FIXME: Remove this declaration, use LINPHONE_PUBLIC as ugly workaround, already defined in tester_utils.h
LINPHONE_PUBLIC LinphoneCallLog * linphone_call_get_log(const LinphoneCall *call);
// FIXME: Remove this declaration, use LINPHONE_PUBLIC as ugly workaround, already defined in tester_utils.h
LINPHONE_PUBLIC IceSession *linphone_call_get_ice_session(const LinphoneCall *call);
bool_t linphone_call_get_audio_muted(const LinphoneCall *call);
void linphone_call_set_audio_muted(LinphoneCall *call, bool_t value);
bool_t linphone_call_get_all_muted(const LinphoneCall *call);
// FIXME: Remove this declaration, use LINPHONE_PUBLIC as ugly workaround, already defined in tester_utils.h
LINPHONE_PUBLIC bool_t linphone_call_get_all_muted(const LinphoneCall *call);
void _linphone_call_set_conf_ref (LinphoneCall *call, LinphoneConference *ref);
MSAudioEndpoint *_linphone_call_get_endpoint (const LinphoneCall *call);
void _linphone_call_set_endpoint (LinphoneCall *call, MSAudioEndpoint *endpoint);
......@@ -95,7 +106,10 @@ SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_attributes(const Lin
SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_media_attributes(const LinphoneCallParams *params, LinphoneStreamType type);
LinphoneCall * linphone_call_params_get_referer(const LinphoneCallParams *params);
void linphone_call_params_set_referer(LinphoneCallParams *params, LinphoneCall *referer);
bool_t linphone_call_params_get_update_call_when_ice_completed(const LinphoneCallParams *params);
// FIXME: Remove this declaration, use LINPHONE_PUBLIC as ugly workaround, already defined in tester_utils.h
LINPHONE_PUBLIC bool_t linphone_call_params_get_update_call_when_ice_completed(const LinphoneCallParams *params);
void linphone_call_params_set_update_call_when_ice_completed(LinphoneCallParams *params, bool_t value);
void linphone_call_params_set_sent_vsize(LinphoneCallParams *params, MSVideoSize vsize);
void linphone_call_params_set_recv_vsize(LinphoneCallParams *params, MSVideoSize vsize);
......@@ -107,7 +121,9 @@ void linphone_call_params_set_used_audio_codec(LinphoneCallParams *params, OrtpP
void linphone_call_params_set_used_video_codec(LinphoneCallParams *params, OrtpPayloadType *codec);
void linphone_call_params_set_used_text_codec(LinphoneCallParams *params, OrtpPayloadType *codec);
bool_t linphone_call_params_get_no_user_consent(const LinphoneCallParams *params);
void linphone_call_params_set_no_user_consent(LinphoneCallParams *params, bool_t value);
// FIXME: Remove this declaration, use LINPHONE_PUBLIC as ugly workaround, already defined in tester_utils.h
LINPHONE_PUBLIC void linphone_call_params_set_no_user_consent(LinphoneCallParams *params, bool_t value);
void linphone_auth_info_write_config(LinphoneConfig *config, LinphoneAuthInfo *obj, int pos);
LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpConfig *config, int pos);
......@@ -222,7 +238,10 @@ void _linphone_call_stats_set_type (LinphoneCallStats *stats, LinphoneStreamType
void _linphone_call_stats_set_received_rtcp (LinphoneCallStats *stats, mblk_t *m);
mblk_t *_linphone_call_stats_get_sent_rtcp (const LinphoneCallStats *stats);
void _linphone_call_stats_set_sent_rtcp (LinphoneCallStats *stats, mblk_t *m);
int _linphone_call_stats_get_updated (const LinphoneCallStats *stats);
// FIXME: Remove this declaration, use LINPHONE_PUBLIC as ugly workaround, already defined in tester_utils.h
LINPHONE_PUBLIC int _linphone_call_stats_get_updated (const LinphoneCallStats *stats);
void _linphone_call_stats_set_updated (LinphoneCallStats *stats, int updated);
void _linphone_call_stats_set_rtp_stats (LinphoneCallStats *stats, const rtp_stats_t *rtpStats);
void _linphone_call_stats_set_download_bandwidth (LinphoneCallStats *stats, float bandwidth);
......@@ -230,7 +249,10 @@ void _linphone_call_stats_set_upload_bandwidth (LinphoneCallStats *stats, float
void _linphone_call_stats_set_rtcp_download_bandwidth (LinphoneCallStats *stats, float bandwidth);
void _linphone_call_stats_set_rtcp_upload_bandwidth (LinphoneCallStats *stats, float bandwidth);
void _linphone_call_stats_set_ip_family_of_remote (LinphoneCallStats *stats, LinphoneAddressFamily family);
bool_t _linphone_call_stats_rtcp_received_via_mux (const LinphoneCallStats *stats);
// FIXME: Remove this declaration, use LINPHONE_PUBLIC as ugly workaround, already defined in tester_utils.h
LINPHONE_PUBLIC bool_t _linphone_call_stats_rtcp_received_via_mux (const LinphoneCallStats *stats);
bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md);
void linphone_core_send_initial_subscribes(LinphoneCore *lc);
......@@ -325,7 +347,8 @@ LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc);
void linphone_tunnel_configure(LinphoneTunnel *tunnel);
void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler);
int linphone_core_get_calls_nb(const LinphoneCore *lc);
// FIXME: Remove this declaration, use LINPHONE_PUBLIC as ugly workaround, already defined in tester_utils.h
LINPHONE_PUBLIC int linphone_core_get_calls_nb(const LinphoneCore *lc);
void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
void linphone_call_update_biggest_desc(LinphoneCall *call, SalMediaDescription *md);
......
......@@ -21,6 +21,9 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef _WIN32
#include <sys/ioctl.h>
#endif
#include <signal.h>
#include <iostream>
#include <iomanip>
#include <sstream>
......@@ -82,6 +85,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "commands/play.h"
#include "private.h"
using namespace std;
#define INT_TO_VOIDPTR(i) ((void*)(intptr_t)(i))
......@@ -134,6 +138,7 @@ EventResponse::EventResponse(Daemon *daemon, LinphoneCall *call, LinphoneCallSta
setBody(ostr.str().c_str());
bctbx_free(fromStr);
}
DtmfResponse::DtmfResponse(Daemon *daemon, LinphoneCall *call, int dtmf) {
......@@ -532,6 +537,10 @@ bool Daemon::pullEvent() {
void Daemon::callStateChanged(LinphoneCall *call, LinphoneCallState state, const char *msg) {
mEventQueue.push(new EventResponse(this, call, state));
if (state == LinphoneCallIncomingReceived && mAutoAnswer){
linphone_call_accept(call);
}
}
void Daemon::callStatsUpdated(LinphoneCall *call, const LinphoneCallStats *stats) {
......@@ -791,7 +800,8 @@ static void printHelp() {
"\t--disable-stats-events Do not automatically raise RTP statistics events." << endl <<
"\t--enable-lsd Use the linphone sound daemon." << endl <<
"\t-C Enable video capture." << endl <<
"\t-D Enable video display." << endl;
"\t-D Enable video display." << endl <<
"\t--auto-answer Automatically answer incoming calls."<<endl;
}
void Daemon::startThread() {
......@@ -862,6 +872,10 @@ void Daemon::enableStatsEvents(bool enabled){
mUseStatsEvents=enabled;
}