Commit 40ca8aca authored by François Grisez's avatar François Grisez

Merge remote-tracking branch 'public/dev_refactor_cpp' into dev_doc_generator

parents 19555f44 0945515d
......@@ -106,3 +106,4 @@ tools/lp-test-ecc
tools/lp-sendmsg
*.pyc
liblinphone.spec
......@@ -68,6 +68,7 @@ cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS NO)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
......@@ -272,6 +273,7 @@ else()
"-Wunused"
)
list(APPEND STRICT_OPTIONS_CXX
"-Wnon-virtual-dtor"
"-Woverloaded-virtual"
)
CHECK_CXX_COMPILER_FLAG("-Wsuggest-override" SUGGEST_OVERRIDE)
......
############################################################################
# CMakeLists.txt
# Copyright (C) 2017 Belledonne Communications, Grenoble France
# Copyright (C) 2017-2018 Belledonne Communications, Grenoble France
#
############################################################################
#
......@@ -20,7 +20,7 @@
#
############################################################################
if (NOT CPACK_PACKAGE_NAME)
if(NOT CPACK_PACKAGE_NAME)
set(CPACK_PACKAGE_NAME "liblinphone")
ENDIF()
......@@ -40,13 +40,14 @@ set(CPACK_SOURCE_IGNORE_FILES
bc_project_build_version(${PROJECT_VERSION} PROJECT_VERSION_BUILD)
if(PROJECT_VERSION_BUILD)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${PROJECT_VERSION_BUILD}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${PROJECT_VERSION_BUILD}")
endif()
message("-- Package file name is ${CPACK_PACKAGE_FILE_NAME}" )
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rpm/liblinphone.spec.in ${CMAKE_CURRENT_SOURCE_DIR}/../liblinphone.spec)
bc_generate_rpm_specfile("rpm/liblinphone.spec.cmake" "${PROJECT_SOURCE_DIR}/liblinphone.spec")
include(CPack)
# -*- rpm-spec -*-
## rpmbuild options
# These 2 lines are here because we can build the RPM for flexisip, in which
# case we prefix the entire installation so that we don't break compatibility
# with the user's libs.
# To compile with bc prefix, use rpmbuild -ba --with bc [SPEC]
%define pkg_name %{?_with_bc:bc-liblinphone}%{!?_with_bc:liblinphone}
%{?_with_bc: %define _prefix /opt/belledonne-communications}
%define _prefix @CMAKE_INSTALL_PREFIX@
%define pkg_prefix @BC_PACKAGE_NAME_PREFIX@
# re-define some directories for older RPMBuild versions which don't. This messes up the doc/ dir
# taken from https://fedoraproject.org/wiki/Packaging:RPMMacros?rd=Packaging/RPMMacros
......@@ -15,18 +10,20 @@
%define _docdir %{_datadir}/doc
%define build_number @PROJECT_VERSION_BUILD@
%if %{build_number}
%define build_number_ext -%{build_number}
%endif
Name: %{pkg_name}
Name: @CPACK_PACKAGE_NAME@
Version: @PROJECT_VERSION@
Release: %build_number%{?dist}
Release: %{build_number}%{?dist}
Summary: Phone anywhere in the whole world by using the Internet
Group: Applications/Communications
License: GPL
URL: http://www.linphone.org
Source0: %{name}-%{version}-%{build_number}.tar.gz
Source0: %{name}-%{version}%{?build_number_ext}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Requires: %{pkg_prefix}bctoolbox
......@@ -34,15 +31,13 @@ Requires: %{pkg_prefix}ortp
Requires: %{pkg_prefix}mediastreamer
Requires: %{pkg_prefix}belle-sip
Requires: %{pkg_prefix}belr
%if %{?_with_soci:1}%{!?_with_soci:0}
%if @ENABLE_SOCI_STORAGE@
Requires: %{pkg_prefix}soci
%endif
%description
liblinphone is the voip sdk used by Linphone
%define video %{?_without_video:0}%{!?_without_video:1}
%package devel
Summary: Development libraries for liblinphone
......@@ -61,11 +56,15 @@ develop programs using the liblinphone library.
%define ctest_name ctest
%endif
# This is for debian builds where debug_package has to be manually specified, whereas in centos it does not
%define custom_debug_package %{!?_enable_debug_packages:%debug_package}%{?_enable_debug_package:%{nil}}
%custom_debug_package
%prep
%setup -n %{name}-%{version}-%build_number
%setup -n %{name}-%{version}%{?build_number_ext}
%build
%{expand:%%%cmake_name} . -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} -DCMAKE_PREFIX_PATH:PATH=%{_prefix} -DENABLE_VIDEO=%{video}
%{expand:%%%cmake_name} . -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} -DCMAKE_PREFIX_PATH:PATH=%{_prefix} @RPM_ALL_CMAKE_OPTIONS@
make %{?_smp_mflags}
%install
......@@ -84,25 +83,32 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS README.md TODO
%{_bindir}/linphonec
%{_bindir}/linphonecsh
%{_bindir}/lp-auto-answer
%{_bindir}/lp-test-ecc
%if @ENABLE_DAEMON@ || @ENABLE_CONSOLE_UI@
%{_bindir}/*
%endif
%{_libdir}/*.so.*
#%{_mandir}/*
%{_datadir}/linphone
%{_datadir}/sounds/linphone
%{_datadir}/Linphone/rootca.pem
%files devel
%defattr(-,root,root)
%{_bindir}/*
%{_includedir}/linphone
%if @ENABLE_CXX_WRAPPER@
%{_includedir}/linphone++
%endif
%if @ENABLE_STATIC@
%{_libdir}/*.a
%endif
%if @ENABLE_SHARED@
%{_libdir}/*.so
#%{_docdir}
%endif
%if @ENABLE_DOC@
%{_docdir}/linphone*/html
%{_docdir}/linphone*/xml
%endif
%{_datadir}/Linphone/cmake/*.cmake
%{_datadir}/liblinphone_tester
%{_datadir}/LinphoneCxx/cmake/*.cmake
%{_datadir}/belr/grammars/cpim_grammar
......
......@@ -930,6 +930,7 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
return 1;
}
linphone_core_set_firewall_policy(lc,LinphonePolicyUseNatAddress);
setting = linphone_core_get_nat_address(lc);
}
}
......
......@@ -975,7 +975,7 @@ linphonec_idle_call ()
linphone_core_iterate(opm);
if (answer_call){
fprintf (stdout, "-------auto answering to call-------\n" );
linphone_core_accept_call(opm,NULL);
linphone_core_accept_call(opm, linphone_core_get_current_call(opm));
answer_call=FALSE;
}
/* auto call handling */
......
......@@ -156,11 +156,11 @@ static char *argv_to_line(int argc, char *argv[]) {
}
#endif
#define MAX_ARGS 10
#define MAX_ARGS 20
#ifndef _WIN32
static void spawn_linphonec(int argc, char *argv[]){
char * args[MAX_ARGS];
char * args[MAX_ARGS+1];
int i,j;
pid_t pid;
j=0;
......@@ -168,10 +168,10 @@ static void spawn_linphonec(int argc, char *argv[]){
args[j++]="--pipe";
args[j++]="-c";
args[j++]="/dev/null";
for(i=0;i<argc;++i){
for(i=0;i<argc && i<MAX_ARGS;++i){
args[j++]=argv[i];
}
args[j++]=NULL;
args[j]=NULL;
#ifdef __uClinux__
pid = vfork();
......
......@@ -91,7 +91,18 @@ static char* _get_identity(const LinphoneAccountCreator *creator) {
LinphoneAddress* addr;
addr = linphone_proxy_config_normalize_sip_uri(proxy, creator->username ? creator->username : creator->phone_number);
if (addr == NULL) goto end;
if (addr == NULL) {
if (creator->username && creator->domain) {
char *url = ms_strdup_printf("sip:%s@%s", creator->username, creator->domain);
addr = linphone_address_new(url);
ms_free(url);
if (addr == NULL) {
goto end;
}
} else {
goto end;
}
}
identity = linphone_address_as_string(addr);
linphone_address_unref(addr);
......@@ -139,6 +150,9 @@ LinphoneProxyConfig * linphone_account_creator_create_proxy_config(const Linphon
snprintf(buff, sizeof(buff), "%d", dial_prefix_number);
linphone_proxy_config_set_dial_prefix(cfg, buff);
}
if (linphone_proxy_config_get_server_addr(cfg) == NULL && creator->domain != NULL) {
linphone_proxy_config_set_server_addr(cfg, creator->domain);
}
linphone_proxy_config_enable_register(cfg, TRUE);
......
......@@ -170,6 +170,23 @@ bctbx_list_t * linphone_core_read_call_logs_from_config_file(LinphoneCore *lc){
* Public functions *
******************************************************************************/
LinphoneCallLog *linphone_core_create_call_log(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, LinphoneCallDir dir,
int duration, time_t start_time, time_t connected_time, LinphoneCallStatus status, bool_t video_enabled, float quality) {
LinphoneCallLog *log = linphone_call_log_new(dir, linphone_address_ref(from), linphone_address_ref(to));
log->duration = duration;
log->start_date_time = start_time;
set_call_log_date(log,log->start_date_time);
log->connected_date_time = connected_time;
log->status = status;
log->video_enabled = video_enabled;
log->quality = quality;
linphone_core_store_call_log(lc, log);
return log;
}
const char *linphone_call_log_get_call_id(const LinphoneCallLog *cl){
return cl->call_id;
}
......@@ -198,7 +215,11 @@ const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl){
return cl->refkey;
}
LinphoneAddress *linphone_call_log_get_remote_address(const LinphoneCallLog *cl){
const LinphoneAddress *linphone_call_log_get_local_address(const LinphoneCallLog *cl) {
return (cl->dir == LinphoneCallIncoming) ? cl->to : cl->from;
}
const LinphoneAddress *linphone_call_log_get_remote_address(const LinphoneCallLog *cl){
return (cl->dir == LinphoneCallIncoming) ? cl->from : cl->to;
}
......@@ -610,7 +631,10 @@ int linphone_core_get_call_history_size(LinphoneCore *lc) {
sqlite3_stmt *selectStatement;
int returnValue;
if (!lc || lc->logs_db == NULL) return 0;
if (!lc)
return 0;
if (!lc->logs_db)
return (int)bctbx_list_size(lc->call_logs);
buf = sqlite3_mprintf("SELECT count(*) FROM call_history");
returnValue = sqlite3_prepare_v2(lc->logs_db, buf, -1, &selectStatement, NULL);
......
......@@ -39,6 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "c-wrapper/c-wrapper.h"
#include "call/call-p.h"
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-room/chat-room.h"
#include "chat/chat-room/server-group-chat-room-p.h"
#include "conference/participant.h"
......@@ -255,7 +256,9 @@ static void call_terminated(SalOp *op, const char *from) {
}
static void call_failure(SalOp *op) {
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
shared_ptr<LinphonePrivate::CallSession> session;
if (op->get_user_pointer())
session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer())->getSharedFromThis();
if (!session) {
ms_warning("Failure reported on already terminated CallSession");
return;
......@@ -565,7 +568,7 @@ static void message_delivery_update(SalOp *op, SalMessageDeliveryStatus status)
// Check that the message does not belong to an already destroyed chat room - if so, do not invoke callbacks
if (msg->getChatRoom())
msg->updateState((LinphonePrivate::ChatMessage::State)chatStatusSal2Linphone(status));
L_GET_PRIVATE(msg)->setState((LinphonePrivate::ChatMessage::State)chatStatusSal2Linphone(status));
}
static void info_received(SalOp *op, SalBodyHandler *body_handler) {
......@@ -668,20 +671,25 @@ static void on_expire(SalOp *op){
static void on_notify_response(SalOp *op){
LinphoneEvent *lev=(LinphoneEvent*)op->get_user_pointer();
if (!lev)
return;
if (lev==NULL) return;
/*this is actually handling out of dialogs notify - for the moment*/
if (!lev->is_out_of_dialog_op) return;
switch (linphone_event_get_subscription_state(lev)){
case LinphoneSubscriptionIncomingReceived:
if (op->get_error_info()->reason == SalReasonNone){
linphone_event_set_state(lev, LinphoneSubscriptionTerminated);
}else{
linphone_event_set_state(lev, LinphoneSubscriptionError);
}
break;
default:
ms_warning("Unhandled on_notify_response() case %s", linphone_subscription_state_to_string(linphone_event_get_subscription_state(lev)));
if (lev->is_out_of_dialog_op) {
switch (linphone_event_get_subscription_state(lev)) {
case LinphoneSubscriptionIncomingReceived:
if (op->get_error_info()->reason == SalReasonNone)
linphone_event_set_state(lev, LinphoneSubscriptionTerminated);
else
linphone_event_set_state(lev, LinphoneSubscriptionError);
break;
default:
ms_warning("Unhandled on_notify_response() case %s",
linphone_subscription_state_to_string(linphone_event_get_subscription_state(lev)));
break;
}
} else {
ms_warning("on_notify_response in dialog");
_linphone_event_notify_notify_response(lev);
}
}
......@@ -742,10 +750,12 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
return;
}
} else {
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ChatRoomId(addr, IdentityAddress(op->get_to()))));
if (!cr)
cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr, FALSE);
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->join();
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
ChatRoomId(addr, IdentityAddress(op->get_to()))
);
if (!chatRoom)
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom("", addr.asString(), false);
chatRoom->join();
static_cast<SalReferOp *>(op)->reply(SalReasonNone);
return;
}
......
......@@ -36,6 +36,7 @@
#include "linphone/wrapper_utils.h"
#include "c-wrapper/c-wrapper.h"
#include "call/call.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"
......@@ -149,12 +150,9 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op,
}
void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call) {
if (linphone_core_realtime_text_enabled(lc)) {
shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr =
static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
L_GET_PRIVATE(rttcr)->realtimeTextReceived(character, call);
//L_GET_PRIVATE(static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr)))->realtimeTextReceived(character, call);
}
if (!(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getCapabilities() & LinphonePrivate::ChatRoom::Capabilities::RealTimeText))
return;
L_GET_PRIVATE_FROM_C_OBJECT(cr, RealTimeTextChatRoom)->realtimeTextReceived(character, L_GET_CPP_PTR_FROM_C_OBJECT(call));
}
unsigned int linphone_chat_message_store(LinphoneChatMessage *msg) {
......
......@@ -76,6 +76,46 @@ LINPHONE_PUBLIC const char *linphone_publish_state_to_string(LinphonePublishStat
return NULL;
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneEventCbs);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneEventCbs, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // marshal
FALSE
);
static LinphoneEventCbs *linphone_event_cbs_new(void) {
return belle_sip_object_new(LinphoneEventCbs);
}
LinphoneEventCbs *linphone_event_cbs_ref(LinphoneEventCbs *cbs) {
belle_sip_object_ref(cbs);
return cbs;
}
void linphone_event_cbs_unref(LinphoneEventCbs *cbs) {
belle_sip_object_unref(cbs);
}
void *linphone_event_cbs_get_user_data(const LinphoneEventCbs *cbs) {
return cbs->user_data;
}
void linphone_event_cbs_set_user_data(LinphoneEventCbs *cbs, void *ud) {
cbs->user_data = ud;
}
LinphoneEventCbsNotifyResponseCb linphone_event_cbs_get_notify_response(const LinphoneEventCbs *cbs) {
return cbs->notify_response_cb;
}
void linphone_event_cbs_set_notify_response(LinphoneEventCbs *cbs, LinphoneEventCbsNotifyResponseCb cb) {
cbs->notify_response_cb = cb;
}
static void linphone_event_release(LinphoneEvent *lev){
if (lev->op) {
/*this will stop the refresher*/
......@@ -86,6 +126,7 @@ static void linphone_event_release(LinphoneEvent *lev){
static LinphoneEvent * linphone_event_new_base(LinphoneCore *lc, LinphoneSubscriptionDir dir, const char *name, LinphonePrivate::SalEventOp *op){
LinphoneEvent *lev=belle_sip_object_new(LinphoneEvent);
lev->callbacks = linphone_event_cbs_new();
lev->lc=lc;
lev->dir=dir;
lev->op=op;
......@@ -446,6 +487,7 @@ static void linphone_event_destroy(LinphoneEvent *lev){
if (lev->to_address) linphone_address_unref(lev->to_address);
if (lev->from_address) linphone_address_unref(lev->from_address);
if (lev->remote_contact_address) linphone_address_unref(lev->remote_contact_address);
linphone_event_cbs_unref(lev->callbacks);
ms_free(lev->name);
}
......@@ -523,6 +565,16 @@ static belle_sip_error_code _linphone_event_marshall(belle_sip_object_t *obj, ch
return err;
}
void _linphone_event_notify_notify_response(const LinphoneEvent *lev) {
LinphoneEventCbsNotifyResponseCb cb = linphone_event_cbs_get_notify_response(lev->callbacks);
if (cb)
cb(lev);
}
LinphoneEventCbs *linphone_event_get_callbacks(const LinphoneEvent *ev) {
return ev->callbacks;
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneEvent);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneEvent, belle_sip_object_t,
......
......@@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "c-wrapper/c-wrapper.h"
#include "address/address-p.h"
// TODO: From coreapi. Remove me later.
#include "private.h"
......@@ -145,6 +147,7 @@ LinphoneFactory *linphone_factory_get(void) {
}
void linphone_factory_clean(void){
LinphonePrivate::AddressPrivate::clearSipAddressesCache();
if (_factory){
belle_sip_object_unref(_factory);
_factory = NULL;
......@@ -238,6 +241,10 @@ LinphoneCallCbs * linphone_factory_create_call_cbs(const LinphoneFactory *factor
return _linphone_call_cbs_new();
}
LinphoneChatRoomCbs * linphone_factory_create_chat_room_cbs(const LinphoneFactory *factory) {
return _linphone_chat_room_cbs_new();
}
LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) {
return _linphone_vcard_new();
}
......
......@@ -413,7 +413,7 @@ void linphone_friend_add_phone_number(LinphoneFriend *lf, const char *phone) {
}
}
bctbx_list_t* linphone_friend_get_phone_numbers(LinphoneFriend *lf) {
bctbx_list_t* linphone_friend_get_phone_numbers(const LinphoneFriend *lf) {
if (!lf || !lf->vcard) return NULL;
if (linphone_core_vcard_supported()) {
......@@ -1134,7 +1134,7 @@ void linphone_friend_destroy(LinphoneFriend *lf) {
linphone_friend_unref(lf);
}
LinphoneVcard* linphone_friend_get_vcard(LinphoneFriend *fr) {
LinphoneVcard* linphone_friend_get_vcard(const LinphoneFriend *fr) {
if (fr && linphone_core_vcard_supported()) return fr->vcard;
return NULL;
}
......
......@@ -634,10 +634,13 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
list->friends = bctbx_list_erase_link(list->friends, elem);
if(lf->refkey) {
bctbx_iterator_t * it = bctbx_map_cchar_find_key(list->friends_map, lf->refkey);
if (!bctbx_iterator_cchar_equals(it, bctbx_map_cchar_end(list->friends_map))){
bctbx_iterator_t * end = bctbx_map_cchar_end(list->friends_map);
if (!bctbx_iterator_cchar_equals(it, end)){
linphone_friend_unref((LinphoneFriend*)bctbx_pair_cchar_get_second(bctbx_iterator_cchar_get_pair(it)));
bctbx_map_cchar_erase(list->friends_map, it);
}
if (it) bctbx_iterator_cchar_delete(it);
if (end) bctbx_iterator_cchar_delete(end);
}
phone_numbers = linphone_friend_get_phone_numbers(lf);
......@@ -647,14 +650,17 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
const char *uri = linphone_friend_phone_number_to_sip_uri(lf, number);
if(uri) {
bctbx_iterator_t * it = bctbx_map_cchar_find_key(list->friends_map_uri, uri);
if (!bctbx_iterator_cchar_equals(it, bctbx_map_cchar_end(list->friends_map_uri))){
bctbx_iterator_t * end = bctbx_map_cchar_end(list->friends_map_uri);
if (!bctbx_iterator_cchar_equals(it, end)){
linphone_friend_unref((LinphoneFriend*)bctbx_pair_cchar_get_second(bctbx_iterator_cchar_get_pair(it)));
bctbx_map_cchar_erase(list->friends_map_uri, it);
}
bctbx_iterator_cchar_delete(it);
if (it) bctbx_iterator_cchar_delete(it);
if (end) bctbx_iterator_cchar_delete(end);
}
iterator = bctbx_list_next(iterator);
}
if (phone_numbers) bctbx_list_free(phone_numbers);
addresses = linphone_friend_get_addresses(lf);
iterator = (bctbx_list_t *)addresses;
......@@ -663,13 +669,16 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
char *uri = linphone_address_as_string_uri_only(lfaddr);
if(uri) {
bctbx_iterator_t * it = bctbx_map_cchar_find_key(list->friends_map_uri, uri);
if (!bctbx_iterator_cchar_equals(it, bctbx_map_cchar_end(list->friends_map_uri))){
bctbx_iterator_t * end = bctbx_map_cchar_end(list->friends_map_uri);
if (!bctbx_iterator_cchar_equals(it, end)){
linphone_friend_unref((LinphoneFriend*)bctbx_pair_cchar_get_second(bctbx_iterator_cchar_get_pair(it)));
bctbx_map_cchar_erase(list->friends_map_uri, it);
}
bctbx_iterator_cchar_delete(it);
if (it) bctbx_iterator_cchar_delete(it);
if (end) bctbx_iterator_cchar_delete(end);
ms_free(uri);
}
iterator = bctbx_list_next(iterator);
}
......@@ -766,7 +775,7 @@ void linphone_friend_list_synchronize_friends_from_server(LinphoneFriendList *li
LinphoneFriend * linphone_friend_list_find_friend_by_address(const LinphoneFriendList *list, const LinphoneAddress *address) {
LinphoneAddress *clean_addr = linphone_address_clone(address);
LinphoneFriend *lf;
if (linphone_address_has_param(clean_addr, "gr")) {
if (linphone_address_has_uri_param(clean_addr, "gr")) {
linphone_address_remove_uri_param(clean_addr, "gr");
}
char *uri = linphone_address_as_string_uri_only(clean_addr);
......
......@@ -1395,6 +1395,9 @@ static void sip_config_read(LinphoneCore *lc) {
/*this is to filter out unsupported encryption schemes*/
linphone_core_set_media_encryption(lc,linphone_core_get_media_encryption(lc));
/*enable the reconnection to the primary server when it is up again asap*/
lc->sal->enable_reconnect_to_primary_asap(!!lp_config_get_int(lc->config,"sip","reconnect_to_primary_asap",0));
/*for tuning or test*/
lc->sip_conf.sdp_200_ack = !!lp_config_get_int(lc->config,"sip","sdp_200_ack",0);
lc->sip_conf.register_only_when_network_is_up=
......@@ -2142,6 +2145,7 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
while ((part = linphone_content_get_part(body, i))) {
i++;
L_GET_PRIVATE(cgcr)->notifyReceived(linphone_content_get_string_buffer(part));
linphone_content_unref(part);
}
} else
L_GET_PRIVATE(cgcr)->notifyReceived(linphone_content_get_string_buffer(body));
......@@ -2320,7 +2324,7 @@ void linphone_core_start (LinphoneCore *lc) {
lp_config_set_string(lc->config,"misc","uuid",tmp);
}else if (strcmp(uuid,"0")!=0) /*to allow to disable sip.instance*/
lc->sal->set_uuid(uuid);
if (lc->sal->get_root_ca()) {
belle_tls_crypto_config_set_root_ca(lc->http_crypto_config, lc->sal->get_root_ca());
belle_http_provider_set_tls_crypto_config(lc->http_provider, lc->http_crypto_config);
......@@ -2384,7 +2388,8 @@ LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
}
LinphoneCore *linphone_core_ref(LinphoneCore *lc) {
return reinterpret_cast<LinphoneCore *>(belle_sip_object_ref(BELLE_SIP_OBJECT(lc)));
belle_sip_object_ref(BELLE_SIP_OBJECT(lc));
return lc;
}
void linphone_core_unref(LinphoneCore *lc) {
......@@ -3417,11 +3422,16 @@ LinphoneCall * linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *
system.
*/
static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const LinphoneAddress *dest){
bctbx_list_t *ret=NULL;
const char *local_route=linphone_proxy_config_get_route(proxy);
const LinphoneAddress *srv_route=linphone_proxy_config_get_service_route(proxy);
if (local_route){
ret=bctbx_list_append(ret,sal_address_new(local_route));
bctbx_list_t *ret = NULL;
const bctbx_list_t *proxy_routes = linphone_proxy_config_get_routes(proxy);
bctbx_list_t *proxy_routes_iterator = (bctbx_list_t *)proxy_routes;
const LinphoneAddress *srv_route = linphone_proxy_config_get_service_route(proxy);
while (proxy_routes_iterator) {
const char *local_route = (const char *)bctbx_list_get_data(proxy_routes_iterator);
if (local_route) {
ret = bctbx_list_append(ret, sal_address_new(local_route));
}
proxy_routes_iterator = bctbx_list_next(proxy_routes_iterator);
}
if (srv_route){
ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_OBJECT(srv_route)->getInternalAddress()));
......@@ -3445,7 +3455,7 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const L
LinphoneProxyConfig *default_cfg=lc->default_proxy;