diff --git a/CMakeLists.txt b/CMakeLists.txt index b51bb5ea6..10511205b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,13 +21,13 @@ ############################################################################ cmake_minimum_required(VERSION 3.0) -project(LINPHONE C CXX) +project(linphone VERSION 3.9.1 LANGUAGES C CXX) -set(LINPHONE_MAJOR_VERSION "3") -set(LINPHONE_MINOR_VERSION "9") -set(LINPHONE_MICRO_VERSION "1") -set(LINPHONE_VERSION "${LINPHONE_MAJOR_VERSION}.${LINPHONE_MINOR_VERSION}.${LINPHONE_MICRO_VERSION}") +set(LINPHONE_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) +set(LINPHONE_MINOR_VERSION ${PROJECT_VERSION_MINOR}) +set(LINPHONE_MICRO_VERSION ${PROJECT_VERSION_PATCH}) +set(LINPHONE_VERSION ${PROJECT_VERSION}) set(LINPHONE_SO_VERSION "8") file(GLOB LINPHONE_PO_FILES RELATIVE "${CMAKE_CURRENT_LIST_DIR}/po" "${CMAKE_CURRENT_LIST_DIR}/po/*.po") @@ -36,7 +36,8 @@ string(REPLACE ";" " " LINPHONE_ALL_LANGS "${LINPHONE_ALL_LANGS_LIST}") include(CMakeDependentOption) -option(ENABLE_STATIC "Build static library (default is shared library)." NO) +option(ENABLE_SHARED "Build shared library." YES) +option(ENABLE_STATIC "Build static library." YES) option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES) option(ENABLE_DATE "Use build date in internal version number." NO) option(ENABLE_DOC "Enable documentation generation with Doxygen." YES) @@ -81,6 +82,12 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(CheckSymbolExists) include(CMakePushCheckState) +include(GNUInstallDirs) + +if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) + message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}") +endif() set(MSVC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/MSVC") if(MSVC) @@ -275,13 +282,13 @@ if(ENABLE_RELATIVE_PREFIX) else() set(LINPHONE_DATA_DIR "${CMAKE_INSTALL_PREFIX}") endif() -set(LINPHONE_PLUGINS_DIR "${LINPHONE_DATA_DIR}/lib/liblinphone/plugins") +set(LINPHONE_PLUGINS_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_LIBDIR}/liblinphone/plugins") if(WIN32) set(LINPHONE_CONFIG_DIR "Linphone") endif() -set(PACKAGE_LOCALE_DIR "${LINPHONE_DATA_DIR}/share/locale") -set(PACKAGE_DATA_DIR "${LINPHONE_DATA_DIR}/share") -set(PACKAGE_SOUND_DIR "${LINPHONE_DATA_DIR}/share/sounds/linphone") +set(PACKAGE_LOCALE_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}/locale") +set(PACKAGE_DATA_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}") +set(PACKAGE_SOUND_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}/sounds/linphone") set(PACKAGE_RING_DIR "${PACKAGE_SOUND_DIR}/rings") set(PACKAGE_FREEDESKTOP_DIR "${PACKAGE_DATA_DIR}/applications") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) @@ -333,13 +340,13 @@ configure_file(cmake/LinphoneConfig.cmake.in @ONLY ) -set(ConfigPackageLocation lib/cmake/Linphone) +set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/Linphone/cmake") install(EXPORT ${EXPORT_TARGETS_NAME}Targets FILE LinphoneTargets.cmake - DESTINATION ${ConfigPackageLocation} + DESTINATION ${CONFIG_PACKAGE_LOCATION} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfigVersion.cmake" - DESTINATION ${ConfigPackageLocation} + DESTINATION ${CONFIG_PACKAGE_LOCATION} ) diff --git a/README b/README index 7e0b97524..7b54bdd42 100644 --- a/README +++ b/README @@ -11,6 +11,7 @@ This is Linphone, a free (GPL) video softphone based on the SIP protocol. - belle-sip>=1.3.0 - speex>=1.2.0 (including libspeexdsp part) - libxml2 + - bctoolbox + if you want the gtk/glade interface: - libgtk >=2.16.0 diff --git a/cmake/FindZlib.cmake b/cmake/FindZlib.cmake index 17b2d1e39..f29d2a8db 100644 --- a/cmake/FindZlib.cmake +++ b/cmake/FindZlib.cmake @@ -26,10 +26,6 @@ # ZLIB_INCLUDE_DIRS - the zlib include directory # ZLIB_LIBRARIES - The libraries needed to use zlib -set(_ZLIB_ROOT_PATHS - ${CMAKE_INSTALL_PREFIX} -) - find_path(ZLIB_INCLUDE_DIRS NAMES zlib.h HINTS _ZLIB_ROOT_PATHS @@ -41,20 +37,13 @@ if(ZLIB_INCLUDE_DIRS) endif() if(ENABLE_STATIC) - if(IOS OR QNX) - set(_ZLIB_STATIC_NAMES z) - else() - set(_ZLIB_STATIC_NAMES zstatic zlibstatic zlibstaticd) - endif() find_library(ZLIB_LIBRARIES - NAMES ${_ZLIB_STATIC_NAMES} - HINTS ${_ZLIB_ROOT_PATHS} + NAMES zstatic zlibstatic zlibstaticd z PATH_SUFFIXES bin lib ) else() find_library(ZLIB_LIBRARIES NAMES z zlib zlibd - HINTS ${_ZLIB_ROOT_PATHS} PATH_SUFFIXES bin lib ) endif() diff --git a/cmake/LinphoneConfig.cmake.in b/cmake/LinphoneConfig.cmake.in index 9a349cc41..1ef175934 100644 --- a/cmake/LinphoneConfig.cmake.in +++ b/cmake/LinphoneConfig.cmake.in @@ -48,7 +48,11 @@ endif() get_filename_component(LINPHONE_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) set(LINPHONE_INCLUDE_DIRS "${LINPHONE_CMAKE_DIR}/../../../include") -set(LINPHONE_LIBRARIES linphone) +if(@ENABLE_SHARED@) + set(LINPHONE_LIBRARIES linphone) +else() + set(LINPHONE_LIBRARIES linphone-static) +endif() set(LINPHONE_LDFLAGS @LINK_FLAGS@) list(APPEND LINPHONE_INCLUDE_DIRS ${MEDIASTREAMER2_INCLUDE_DIRS} ${BELLESIP_INCLUDE_DIRS}) list(APPEND LINPHONE_LIBRARIES ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES}) diff --git a/console/CMakeLists.txt b/console/CMakeLists.txt index 4b7f4df24..3ec2b9e44 100644 --- a/console/CMakeLists.txt +++ b/console/CMakeLists.txt @@ -47,8 +47,8 @@ if(WIN32) endif() install(TARGETS ${INSTALL_TARGETS} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index 52f516fd8..2b1515939 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -186,47 +186,65 @@ apply_compile_flags(LINPHONE_SOURCE_FILES_C "CPP" "C") apply_compile_flags(LINPHONE_SOURCE_FILES_CXX "CPP" "CXX") apply_compile_flags(LINPHONE_SOURCE_FILES_OBJC "CPP" "OBJC") +add_library(linphone-objects OBJECT ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC}) +set_target_properties(linphone-objects PROPERTIES POSITION_INDEPENDENT_CODE TRUE) +add_dependencies(linphone-objects liblinphone-git-version) + if(ENABLE_STATIC) - add_library(linphone STATIC ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC}) - target_link_libraries(linphone ${LIBS}) -else() - add_library(linphone SHARED ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC}) + add_library(linphone-static STATIC $) + set_target_properties(linphone-static PROPERTIES OUTPUT_NAME linphone) + target_link_libraries(linphone-static ${LIBS}) + if(IOS) + target_link_libraries(linphone-static "-framework Foundation" "-framework AVFoundation") + endif() + install(TARGETS linphone-static EXPORT ${EXPORT_TARGETS_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) +endif() +if(ENABLE_SHARED) + add_library(linphone SHARED $) set_target_properties(linphone PROPERTIES VERSION ${LINPHONE_SO_VERSION} LINKER_LANGUAGE CXX) target_link_libraries(linphone ${LIBS}) + if(WIN32 AND CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set_target_properties(linphone PROPERTIES PREFIX "lib") + endif() if(MSVC) if(CMAKE_BUILD_TYPE STREQUAL "Debug") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/linphone.pdb - DESTINATION bin + DESTINATION ${CMAKE_INSTALL_BINDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) endif() endif() -endif() -if(IOS) - target_link_libraries(linphone "-framework Foundation" "-framework AVFoundation") -endif() -add_dependencies(linphone liblinphone-git-version) -if(WIN32 AND CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - set_target_properties(linphone PROPERTIES PREFIX "lib") + install(TARGETS linphone EXPORT ${EXPORT_TARGETS_NAME}Targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) endif() if(ICONV_FOUND) if(APPLE) # Prevent conflict between the system iconv.h header and the one from macports. - target_compile_options(linphone PRIVATE "-include" "${ICONV_INCLUDE_DIRS}/iconv.h") + if(ENABLE_STATIC) + target_compile_options(linphone-static PRIVATE "-include" "${ICONV_INCLUDE_DIRS}/iconv.h") + endif() + if(ENABLE_SHARED) + target_compile_options(linphone PRIVATE "-include" "${ICONV_INCLUDE_DIRS}/iconv.h") + endif() else() - target_include_directories(linphone PRIVATE ${ICONV_INCLUDE_DIRS}) + if(ENABLE_STATIC) + target_include_directories(linphone-static PRIVATE ${ICONV_INCLUDE_DIRS}) + endif() + if(ENABLE_SHARED) + target_include_directories(linphone PRIVATE ${ICONV_INCLUDE_DIRS}) + endif() endif() endif() -install(TARGETS linphone EXPORT ${EXPORT_TARGETS_NAME}Targets - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE -) - install(FILES ${LINPHONE_HEADER_FILES} - DESTINATION include/linphone + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linphone PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index 99e84f293..b74baedb2 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -165,6 +165,7 @@ TunnelManager::~TunnelManager(){ udpMirror->stop(); } if(mTunnelClient) delete mTunnelClient; + sal_set_tunnel(mCore->sal,NULL); linphone_core_remove_listener(mCore, mVTable); linphone_core_v_table_destroy(mVTable); } @@ -197,7 +198,7 @@ void TunnelManager::processTunnelEvent(const Event &ev){ _linphone_core_apply_transports(mCore); doRegistration(); } - + } } else { ms_error("TunnelManager: tunnel has been disconnected"); @@ -336,6 +337,7 @@ void TunnelManager::processUdpMirrorEvent(const Event &ev){ ms_message("TunnelManager: UDP mirror test succeed"); if(mTunnelClient) { if(mTunnelizeSipPackets) doUnregistration(); + sal_set_tunnel(mCore->sal,NULL); delete mTunnelClient; mTunnelClient = NULL; if(mTunnelizeSipPackets) doRegistration(); diff --git a/coreapi/chat.c b/coreapi/chat.c index e25eecb25..3f9d6692c 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -264,6 +264,10 @@ LinphoneChatRoom *linphone_core_get_chat_room_from_uri(LinphoneCore *lc, const c return _linphone_core_get_or_create_chat_room(lc, to); } +bool_t linphone_chat_room_lime_enabled(LinphoneChatRoom *cr) { + return linphone_core_lime_enabled(cr->lc) != LinphoneLimeDisabled/*&& TODO: check that cr->peer_url has a verified token */; +} + static void linphone_chat_room_delete_composing_idle_timer(LinphoneChatRoom *cr) { if (cr->composing_idle_timer) { if (cr->lc && cr->lc->sal) @@ -377,7 +381,7 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage char *peer_uri = linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr)); const char *content_type; - if (linphone_core_lime_enabled(cr->lc)) { + if (linphone_chat_room_lime_enabled(cr)) { /* ref the msg or it may be destroyed by callback if the encryption failed */ if (msg->content_type && strcmp(msg->content_type, "application/vnd.gsma.rcs-ft-http+xml") == 0) { /* it's a file transfer, content type shall be set to diff --git a/coreapi/chat_file_transfer.c b/coreapi/chat_file_transfer.c index 4dc39ec07..e4c55f152 100644 --- a/coreapi/chat_file_transfer.c +++ b/coreapi/chat_file_transfer.c @@ -172,7 +172,8 @@ static void linphone_chat_message_process_response_from_post_file(void *data, belle_sip_body_handler_t *first_part_bh; /* shall we encrypt the file */ - if (linphone_core_lime_for_file_sharing_enabled(msg->chat_room->lc)) { + if (linphone_chat_room_lime_enabled(msg->chat_room) && + linphone_core_lime_for_file_sharing_enabled(msg->chat_room->lc)) { char keyBuffer [FILE_TRANSFER_KEY_SIZE]; /* temporary storage of generated key: 192 bits of key + 64 bits of initial vector */ diff --git a/coreapi/conference.cc b/coreapi/conference.cc index 215f5d462..02f6d3763 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -686,15 +686,25 @@ int RemoteConference::addParticipant(LinphoneCall *call) { } int RemoteConference::removeParticipant(const LinphoneAddress *uri) { - char *tmp, *refer_to; + char *refer_to; + LinphoneAddress *refer_to_addr; int res; switch(m_state) { case LinphoneConferenceReady: - tmp = linphone_address_as_string_uri_only(uri); - refer_to = ms_strdup_printf("%s;method=BYE", tmp); + if(findParticipant(uri) == NULL) { + char *tmp = linphone_address_as_string(uri); + ms_error("Conference: could not remove participant '%s': not in the participants list", tmp); + ms_free(tmp); + return -1; + } + +// refer_to = ms_strdup_printf("%s;method=BYE", tmp); + refer_to_addr = linphone_address_clone(uri); + linphone_address_set_method_param(refer_to_addr, "BYE"); + refer_to = linphone_address_as_string(refer_to_addr); + linphone_address_unref(refer_to_addr); res = sal_call_refer(m_focusCall->op, refer_to); - ms_free(tmp); ms_free(refer_to); if(res == 0) { diff --git a/coreapi/conference.h b/coreapi/conference.h index cc9762bf1..d14ff2f9d 100644 --- a/coreapi/conference.h +++ b/coreapi/conference.h @@ -86,6 +86,7 @@ LINPHONE_PUBLIC bool_t linphone_conference_params_video_requested(const Linphone * Remove a participant from a conference * @param obj A #LinphoneConference * @param uri SIP URI of the participant to remove + * @warning The passed SIP URI must be one of the URIs returned by linphone_conference_get_participants() * @return 0 if succeeded, -1 if failed */ LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *obj, const LinphoneAddress *uri); diff --git a/coreapi/friend.c b/coreapi/friend.c index 5e448c66f..e12ba2b57 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -272,7 +272,7 @@ void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, SalOp *op) sal_op_release(op); lf->insubs = ms_list_remove(lf->insubs, op); } - + } static void linphone_friend_unsubscribe(LinphoneFriend *lf){ @@ -734,7 +734,7 @@ LinphoneFriend * linphone_friend_new_from_config_file(LinphoneCore *lc, int inde if (tmp==NULL) { return NULL; } - lf=linphone_friend_new_with_address(tmp); + lf=linphone_core_create_friend_with_address(lc, tmp); if (lf==NULL) { return NULL; } diff --git a/coreapi/help/CMakeLists.txt b/coreapi/help/CMakeLists.txt index 3a550e294..f3062f307 100644 --- a/coreapi/help/CMakeLists.txt +++ b/coreapi/help/CMakeLists.txt @@ -38,7 +38,7 @@ if(DOXYGEN_FOUND) ) add_custom_target(linphone-doc ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/doc/html/index.html") install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doc/html" "${CMAKE_CURRENT_BINARY_DIR}/doc/xml" - DESTINATION "share/doc/linphone-${LINPHONE_VERSION}") + DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/linphone-${LINPHONE_VERSION}") else() message(WARNING "The dot program is needed to generate the linphone documentation. You can get it from http://www.graphviz.org/.") endif() diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 86720ec4f..8fb81de76 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1860,18 +1860,26 @@ bool_t linphone_core_get_guess_hostname(LinphoneCore *lc){ return lc->sip_conf.guess_hostname; } -void linphone_core_enable_lime(LinphoneCore *lc, bool_t val){ +void linphone_core_enable_lime(LinphoneCore *lc, LinphoneLimeState val){ if (linphone_core_ready(lc)){ lp_config_set_int(lc->config,"sip","lime",val); } } -bool_t linphone_core_lime_enabled(const LinphoneCore *lc){ - return (lp_config_get_int(lc->config,"sip", "lime", FALSE) && lime_is_available()); +bool_t linphone_core_lime_available(const LinphoneCore *lc){ + return lime_is_available(); } -bool_t linphone_core_lime_for_file_sharing_enabled(const LinphoneCore *lc){ - return linphone_core_lime_enabled(lc) && (lp_config_get_int(lc->config,"sip", "lime_for_file_sharing", TRUE) && lime_is_available()); +LinphoneLimeState linphone_core_lime_enabled(const LinphoneCore *lc){ + return linphone_core_lime_available(lc) ? lp_config_get_int(lc->config,"sip", "lime", LinphoneLimeDisabled) : LinphoneLimeDisabled; +} + +LinphoneLimeState linphone_core_lime_for_file_sharing_enabled(const LinphoneCore *lc){ + LinphoneLimeState s = linphone_core_lime_enabled(lc); + if (s != LinphoneLimeDisabled) { + s = lp_config_get_int(lc->config,"sip", "lime_for_file_sharing", LinphoneLimeMandatory); + } + return s; } LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc){ @@ -7054,6 +7062,11 @@ bool_t linphone_core_sound_resources_locked(LinphoneCore *lc){ MSList *elem; for(elem=lc->calls;elem!=NULL;elem=elem->next) { LinphoneCall *c=(LinphoneCall*)elem->data; + + if (linphone_call_media_in_progress(c)) { + return TRUE; + } + switch (c->state) { case LinphoneCallOutgoingInit: case LinphoneCallOutgoingProgress: diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 4fc54ebce..d30c5b4ab 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1243,6 +1243,12 @@ typedef enum _LinphoneChatMessageState { LinphoneChatMessageStateFileTransferDone /**< File transfer has been completed successfully. */ } LinphoneChatMessageState; +typedef enum _LinphoneLimeState { + LinphoneLimeDisabled, /**< Lime is not used at all */ + LinphoneLimeMandatory, /**< Lime is always used */ + LinphoneLimePreferred, /**< Lime is used only if we already shared a secret with remote */ +} LinphoneLimeState; + /** * Call back used to notify message delivery status * @param msg #LinphoneChatMessage object @@ -2584,8 +2590,9 @@ LINPHONE_PUBLIC bool_t linphone_core_get_guess_hostname(LinphoneCore *lc); * Tells to LinphoneCore to use Linphone Instant Messaging encryption * */ -LINPHONE_PUBLIC void linphone_core_enable_lime(LinphoneCore *lc, bool_t val); -LINPHONE_PUBLIC bool_t linphone_core_lime_enabled(const LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_enable_lime(LinphoneCore *lc, LinphoneLimeState val); +LINPHONE_PUBLIC LinphoneLimeState linphone_core_lime_enabled(const LinphoneCore *lc); +LINPHONE_PUBLIC bool_t linphone_core_lime_available(const LinphoneCore *lc); LINPHONE_PUBLIC bool_t linphone_core_ipv6_enabled(LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 53b18a8d6..79b133065 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -514,9 +514,11 @@ jobject getChatMessage(JNIEnv *env, LinphoneChatMessage *msg){ return jobj; } -jobject getFriend(JNIEnv *env, LinphoneFriend *lfriend){ +jobject getFriend(JNIEnv *env, LinphoneFriend *lfriend, int *isLocalRef){ jobject jobj=0; + if (isLocalRef) *isLocalRef = FALSE; + if (lfriend != NULL){ LinphoneCore *lc = linphone_friend_get_core(lfriend); LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc); @@ -533,6 +535,9 @@ jobject getFriend(JNIEnv *env, LinphoneFriend *lfriend){ if (jobj == NULL){ jobj=env->NewObject(ljb->friendClass, ljb->friendCtrId, (jlong)lfriend); linphone_friend_set_user_data(lfriend,(void*)env->NewWeakGlobalRef(jobj)); + }else{ + //java object is still valid, we will return a local ref to it. + if (isLocalRef) *isLocalRef = TRUE; } } } @@ -857,6 +862,9 @@ public: static void notify_presence_received(LinphoneCore *lc, LinphoneFriend *my_friend) { JNIEnv *env = 0; jint result = jvm->AttachCurrentThread(&env,NULL); + int isLocalRef = FALSE; + jobject jfriend = NULL; + if (result != 0) { ms_error("cannot attach VM"); return; @@ -868,8 +876,9 @@ public: env->CallVoidMethod(lcData->listener ,ljb->notifyPresenceReceivedId ,lcData->core - ,getFriend(env,my_friend)); + ,(jfriend=getFriend(env,my_friend, &isLocalRef))); handle_possible_java_exception(env, lcData->listener); + if (isLocalRef) env->DeleteLocalRef(jfriend); } static void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *my_friend, const char* url) { JNIEnv *env = 0; @@ -885,7 +894,7 @@ public: env->CallVoidMethod(lcData->listener ,ljb->newSubscriptionRequestId ,lcData->core - ,getFriend(env,my_friend) + ,getFriend(env,my_friend, NULL) ,url ? env->NewStringUTF(url) : NULL); handle_possible_java_exception(env, lcData->listener); } @@ -2089,9 +2098,11 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendList(JN for (int i = 0; i < friendsSize; i++) { LinphoneFriend* lfriend = (LinphoneFriend*)friends->data; - jobject jfriend = getFriend(env,lfriend); + int isLocalRef; + jobject jfriend = getFriend(env,lfriend,&isLocalRef); if(jfriend != NULL){ env->SetObjectArrayElement(jFriends, i, jfriend); + if (isLocalRef) env->DeleteLocalRef(jfriend); } friends = friends->next; } @@ -3564,7 +3575,7 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getFriendByAddress(JN LinphoneFriend *lf = linphone_core_get_friend_by_address((LinphoneCore*)ptr, address); env->ReleaseStringUTFChars(jaddress, address); if(lf != NULL) { - jobject jfriend = getFriend(env,lf); + jobject jfriend = getFriend(env,lf, NULL); return jfriend; } else { return NULL; diff --git a/coreapi/private.h b/coreapi/private.h index 54364dbc0..edb70fef5 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -154,16 +154,16 @@ struct _LinphoneCallParams{ bool_t has_video; bool_t avpf_enabled; /* RTCP feedback messages are enabled */ bool_t implicit_rtcp_fb; - + bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/ bool_t in_conference; /*in conference mode */ bool_t low_bandwidth; bool_t no_user_consent;/*when set to TRUE an UPDATE request will be used instead of reINVITE*/ - + uint16_t avpf_rr_interval; /*in milliseconds*/ bool_t internal_call_update; /*use mark that call update was requested internally (might be by ice) - unused for the moment*/ bool_t video_multicast_enabled; - + bool_t audio_multicast_enabled; bool_t realtimetext_enabled; bool_t update_call_when_ice_completed; @@ -357,7 +357,7 @@ struct _LinphoneCall{ bool_t paused_by_app; bool_t broken; /*set to TRUE when the call is in broken state due to network disconnection or transport */ - + LinphoneConference *conf_ref; /**> Point on the associated conference if this call is part of a conference. NULL instead. */ }; @@ -400,7 +400,7 @@ void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig *obj); void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc); void _linphone_proxy_config_release(LinphoneProxyConfig *cfg); void _linphone_proxy_config_unpublish(LinphoneProxyConfig *obj); - + /* * returns service route as defined in as defined by rfc3608, might be a list instead of just one. * Can be NULL @@ -584,6 +584,7 @@ int linphone_chat_room_upload_file(LinphoneChatMessage *msg); void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg); LinphoneChatMessageCbs *linphone_chat_message_cbs_new(void); LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call); +bool_t linphone_chat_room_lime_enabled(LinphoneChatRoom *cr); /**/ struct _LinphoneProxyConfig @@ -958,12 +959,12 @@ struct _LinphoneCore bool_t auto_net_state_mon; bool_t sip_network_reachable; bool_t media_network_reachable; - + bool_t network_reachable_to_be_notified; /*set to true when state must be notified in next iterate*/ bool_t use_preview_window; bool_t network_last_status; bool_t ringstream_autorelease; - + bool_t vtables_running; bool_t send_call_stats_periodical_updates; bool_t forced_ice_relay; @@ -1508,14 +1509,14 @@ LINPHONE_PUBLIC void _linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreV LINPHONE_PUBLIC MSWebCam *linphone_call_get_video_device(const LinphoneCall *call); MSWebCam *get_nowebcam_device(MSFactory *f); #endif -bool_t linphone_core_lime_for_file_sharing_enabled(const LinphoneCore *lc); +LinphoneLimeState linphone_core_lime_for_file_sharing_enabled(const LinphoneCore *lc); BELLE_SIP_DECLARE_VPTR(LinphoneTunnelConfig); int linphone_core_get_default_proxy_config_index(LinphoneCore *lc); char *linphone_presence_model_to_xml(LinphonePresenceModel *model) ; - + #ifdef __cplusplus } #endif diff --git a/gtk/CMakeLists.txt b/gtk/CMakeLists.txt index 436a6919b..aa04fdcce 100644 --- a/gtk/CMakeLists.txt +++ b/gtk/CMakeLists.txt @@ -120,9 +120,9 @@ set_target_properties(linphone-gtk PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "") install(TARGETS linphone-gtk - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) diff --git a/gtk/linphone.h b/gtk/linphone.h index aa243912c..c2a3356f3 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -293,6 +293,7 @@ LINPHONE_PUBLIC void linphone_gtk_mtu_set(GtkWidget *w); LINPHONE_PUBLIC void linphone_gtk_mtu_changed(GtkWidget *w); LINPHONE_PUBLIC void linphone_gtk_use_sip_info_dtmf_toggled(GtkWidget *w); LINPHONE_PUBLIC void linphone_gtk_ipv6_toggled(GtkWidget *w); +LINPHONE_PUBLIC void linphone_gtk_lime_changed(GtkComboBoxText *comboext); LINPHONE_PUBLIC void linphone_gtk_disabled_udp_port_toggle(GtkCheckButton *button); LINPHONE_PUBLIC void linphone_gtk_random_udp_port_toggle(GtkCheckButton *button); LINPHONE_PUBLIC void linphone_gtk_udp_port_value_changed(GtkSpinButton *button); diff --git a/gtk/parameters.ui b/gtk/parameters.ui index 93ad5ffe9..7326a5070 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -1,6 +1,6 @@ - + -1 @@ -2244,24 +2244,10 @@ True False - 0.49000000953674316 + 0.51999998092651367 Use Lime for outgoing chat messages - - - True - True - False - 0.40000000596046448 - True - - - - 1 - 2 - - True @@ -2289,6 +2275,22 @@ 3 + + + True + False + + Disabled + Mandatory + Preferred + + + + + 1 + 2 + + diff --git a/gtk/propertybox.c b/gtk/propertybox.c index a94322980..60b22b1df 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1309,8 +1309,8 @@ void linphone_gtk_set_media_encryption_mandatory(GtkWidget *button){ linphone_core_set_media_encryption_mandatory(linphone_gtk_get_core(),gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))); } -void linphone_gtk_enable_lime(GtkWidget *button){ - linphone_core_enable_lime(linphone_gtk_get_core(), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))); +void linphone_gtk_lime_changed(GtkComboBoxText *combotext) { + linphone_core_enable_lime(linphone_gtk_get_core(), gtk_combo_box_get_active(GTK_COMBO_BOX(combotext))); } static void linphone_gtk_show_media_encryption(GtkWidget *pb){ @@ -1366,7 +1366,7 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){ LinphoneMediaEncryption menc=linphone_core_get_media_encryption(lc); gtk_widget_show(linphone_gtk_get_widget(pb,"encryption_label")); gtk_widget_show(linphone_gtk_get_widget(pb,"encryption_table")); - + switch(menc){ case LinphoneMediaEncryptionNone: gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0); @@ -1395,8 +1395,10 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){ } gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"media_encryption_mandatory_checkbox")), linphone_core_is_media_encryption_mandatory(lc)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"chat_lime_checkbox")), - linphone_core_lime_enabled(lc)); + + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"chat_lime_combo")), linphone_core_lime_enabled(lc)); + gtk_widget_set_sensitive(linphone_gtk_get_widget(pb,"chat_lime_combo"), linphone_core_lime_available(lc)); + g_object_unref(G_OBJECT(model)); } diff --git a/mediastreamer2 b/mediastreamer2 index 0b367d23f..685beb165 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0b367d23fac75167d61795a49003663958f03f14 +Subproject commit 685beb165ee050e38ea33eb0e4a1d6a87f7b5520 diff --git a/oRTP b/oRTP index ba12aea51..de0aee3f2 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit ba12aea51f115d72b044ec383ec42d321834f5e6 +Subproject commit de0aee3f2024cfd1a24fee5f4ed56be5a2032206 diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index 191865c4b..eb0c56663 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -67,13 +67,13 @@ if(IOS) target_include_directories(linphonetester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common) target_link_libraries(linphonetester linphone ${CUNIT_LIBRARIES}) install(TARGETS linphonetester - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) install(FILES "liblinphone_tester.h" "common/bc_tester_utils.h" - DESTINATION include/linphone + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linphone PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") @@ -94,15 +94,15 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") set_target_properties(linphone_tester_runtime PROPERTIES LINK_FLAGS "/WINMDFILE:BelledonneCommunications.Linphone.Tester.winmd") install(TARGETS linphone_tester_runtime - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BelledonneCommunications.Linphone.Tester.winmd" DESTINATION lib) if(CMAKE_BUILD_TYPE STREQUAL "Debug") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/BelledonneCommunications.Linphone.Tester.pdb - DESTINATION lib + DESTINATION ${CMAKE_INSTALL_LIBDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) endif() diff --git a/tester/Makefile.am b/tester/Makefile.am index ec46807a9..ae81dcca1 100644 --- a/tester/Makefile.am +++ b/tester/Makefile.am @@ -164,6 +164,8 @@ AM_CFLAGS += $(LIBGTK_CFLAGS) $(LIBGTKMAC_CFLAGS) -DHAVE_GTK endif +AM_LDFLAGS=-Wl,-rpath -Wl,$(libdir) + bin_PROGRAMS= if !BUILD_IOS diff --git a/tester/call_tester.c b/tester/call_tester.c index 5d7af52b2..77c787f02 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -95,12 +95,14 @@ void call_stats_updated(LinphoneCore *lc, LinphoneCall *call, const LinphoneCall } if (lstats->updated & LINPHONE_CALL_STATS_PERIODICAL_UPDATE ) { int tab_size = sizeof (counters->audio_download_bandwidth)/sizeof(int); - int index = (counters->current_bandwidth_index++) % tab_size; - - counters->audio_download_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->download_bandwidth; - counters->audio_upload_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->upload_bandwidth; - counters->video_download_bandwidth[index] = (int)linphone_call_get_video_stats(call)->download_bandwidth; - counters->video_upload_bandwidth[index] = (int)linphone_call_get_video_stats(call)->upload_bandwidth; + int index = (counters->current_bandwidth_index[lstats->type]++) % tab_size; + if (lstats->type == LINPHONE_CALL_STATS_AUDIO) { + counters->audio_download_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->download_bandwidth; + counters->audio_upload_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->upload_bandwidth; + } else { + counters->video_download_bandwidth[index] = (int)linphone_call_get_video_stats(call)->download_bandwidth; + counters->video_upload_bandwidth[index] = (int)linphone_call_get_video_stats(call)->upload_bandwidth; + } } } diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 37dd5543b..f4776c546 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -239,7 +239,7 @@ typedef struct _stats { int video_download_bandwidth[3]; int video_upload_bandwidth[3]; - int current_bandwidth_index; + int current_bandwidth_index[2] /*audio and video only*/; int number_of_rtcp_generic_nack; }stats; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 88cd09173..0a871aba5 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -49,9 +49,9 @@ target_link_libraries(lp-gen-wrappers ${LP_GEN_WRAPPERS_LIBS}) install(TARGETS lp-gen-wrappers - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) @@ -69,9 +69,9 @@ target_link_libraries(lp-auto-answer linphone) install(TARGETS lp-auto-answer - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) @@ -89,12 +89,8 @@ target_link_libraries(lp-sendmsg linphone) install(TARGETS lp-sendmsg - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) - - - -