From b504646e58eb47a295ac58bce2870327dca00468 Mon Sep 17 00:00:00 2001 From: Johan Pascal Date: Thu, 4 Feb 2016 23:32:38 +0100 Subject: [PATCH 01/27] Move crypto API to bctoolbox - LIME is yet to be ported, compilation fail with LIME enabled --- CMakeLists.txt | 2 ++ cmake/FindBcToolBox.cmake | 56 +++++++++++++++++++++++++++++++++++++++ coreapi/CMakeLists.txt | 1 + coreapi/friendlist.c | 4 +-- 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100755 cmake/FindBcToolBox.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ab84b60cb..fc7aacf61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,7 @@ if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) else() find_package(BelleSIP REQUIRED) find_package(Mediastreamer2 REQUIRED) + find_package(BcToolBox REQUIRED) endif() find_package(XML2 REQUIRED) find_package(Zlib) @@ -181,6 +182,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/coreapi/ ${BELLESIP_INCLUDE_DIRS} ${MEDIASTREAMER2_INCLUDE_DIRS} + ${BCTOOLBOX_INCLUDE_DIRS} ) if(ENABLE_TUNNEL) include_directories(${TUNNEL_INCLUDE_DIRS}) diff --git a/cmake/FindBcToolBox.cmake b/cmake/FindBcToolBox.cmake new file mode 100755 index 000000000..5bfa2eb17 --- /dev/null +++ b/cmake/FindBcToolBox.cmake @@ -0,0 +1,56 @@ +############################################################################ +# FindiBcToolBox.cmake +# Copyright (C) 2016 Belledonne Communications, Grenoble France +# +############################################################################ +# +# 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ +# +# - Find the bctoolbox include file and library +# +# BCTOOLBOX_FOUND - system has BC Toolbox +# BCTOOLBOX_INCLUDE_DIRS - the BC Toolbox include directory +# BCTOOLBOX_LIBRARIES - The libraries needed to use BC Toolbox + +include(CMakePushCheckState) +include(CheckIncludeFile) +include(CheckCSourceCompiles) +include(CheckSymbolExists) + +set(_BCTOOLBOX_ROOT_PATHS + ${CMAKE_INSTALL_PREFIX} +) + +find_path(BCTOOLBOX_INCLUDE_DIRS + NAMES bctoolbox/crypto.h + HINTS _BCTOOLBOX_ROOT_PATHS + PATH_SUFFIXES include +) + +find_library(BCTOOLBOX_LIBRARIES + NAMES bctoolbox + HINTS _BCTOOLBOX_ROOT_PATHS + PATH_SUFFIXES bin lib +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(BcToolBox + DEFAULT_MSG + BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES +) + +mark_as_advanced(BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES) diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index bd855d7e2..defbd1849 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -149,6 +149,7 @@ apply_compile_flags(LINPHONE_SOURCE_FILES_CXX "CPP" "CXX") apply_compile_flags(LINPHONE_SOURCE_FILES_OBJC "CPP" "OBJC") set(LIBS + ${BCTOOLBOX_LIBRARIES} ${BELLESIP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${XML2_LIBRARIES} diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index fd0841782..4d3203e93 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphonecore.h" #include "private.h" -#include +#include static char * create_resource_list_xml(const LinphoneFriendList *list) { @@ -392,7 +392,7 @@ void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, Linphon char *xml_content = create_resource_list_xml(list); if ((address != NULL) && (xml_content != NULL) && (linphone_friend_list_has_subscribe_inactive(list) == TRUE)) { unsigned char digest[16]; - md5((unsigned char *)xml_content, strlen(xml_content), digest); + bctoolbox_md5((unsigned char *)xml_content, strlen(xml_content), digest); if ((list->event != NULL) && (list->content_digest != NULL) && (memcmp(list->content_digest, digest, sizeof(digest)) == 0)) { /* The content has not changed, only refresh the event. */ linphone_event_refresh_subscribe(list->event); From 264f2a1672e0b6db0ecb6114a7c7a7bde3422745 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 9 Feb 2016 10:56:02 +0100 Subject: [PATCH 02/27] Continue bctoolbox integration --- CMakeLists.txt | 1 + gtk/CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc7aacf61..232e14e9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,6 +91,7 @@ endif() if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) include("${EP_bellesip_CONFIG_DIR}/BelleSIPConfig.cmake") include("${EP_ms2_CONFIG_DIR}/Mediastreamer2Config.cmake") + include("${EP_ms2_CONFIG_DIR}/BcToolboxConfig.cmake") else() find_package(BelleSIP REQUIRED) find_package(Mediastreamer2 REQUIRED) diff --git a/gtk/CMakeLists.txt b/gtk/CMakeLists.txt index f122dc209..436a6919b 100644 --- a/gtk/CMakeLists.txt +++ b/gtk/CMakeLists.txt @@ -116,6 +116,8 @@ if(APPLE) target_link_libraries(linphone-gtk "-framework Cocoa") endif() +set_target_properties(linphone-gtk PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "") + install(TARGETS linphone-gtk RUNTIME DESTINATION bin From 37d4a145329a240a52bc4de67896f30e25775873 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 9 Feb 2016 11:02:42 +0100 Subject: [PATCH 03/27] -no longer decline calls if local presence status is closed --- coreapi/callbacks.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index b884bf224..5dcb7b4c4 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -254,27 +254,19 @@ static void call_received(SalOp *h){ if (linphone_presence_model_get_basic_status(lc->presence_model) == LinphonePresenceBasicStatusClosed) { LinphonePresenceActivity *activity = linphone_presence_model_get_activity(lc->presence_model); switch (linphone_presence_activity_get_type(activity)) { - case LinphonePresenceActivityBusy: - sal_call_decline(h,SalReasonBusy,NULL); - break; - case LinphonePresenceActivityAppointment: - case LinphonePresenceActivityMeeting: - case LinphonePresenceActivityOffline: - case LinphonePresenceActivityWorship: - sal_call_decline(h,SalReasonTemporarilyUnavailable,NULL); - break; case LinphonePresenceActivityPermanentAbsence: alt_contact = linphone_presence_model_get_contact(lc->presence_model); if (alt_contact != NULL) { sal_call_decline(h,SalReasonRedirect,alt_contact); ms_free(alt_contact); + sal_op_release(h); + return; } break; default: + /*nothing special to be done*/ break; } - sal_op_release(h); - return; } if (!linphone_core_can_we_add_call(lc)){/*busy*/ From 3df1f98d88c2fe665c05601ee1c3c52f006eb4a7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 9 Feb 2016 12:14:18 +0100 Subject: [PATCH 04/27] fix make distcheck --- mediastreamer2 | 2 +- po/POTFILES.skip | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 43de256e5..bf4f672f0 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 43de256e523896f35387b4fa286c80e054591d78 +Subproject commit bf4f672f0a97100318970a8e9a7290fd730a79b6 diff --git a/po/POTFILES.skip b/po/POTFILES.skip index c85434453..b31466bd0 100755 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -47,6 +47,7 @@ mediastreamer2/src/videofilters/winvideo.c mediastreamer2/src/videofilters/winvideods.c mediastreamer2/src/videofilters/winvideo2.c mediastreamer2/src/videofilters/x11video.c +mediastreamer2/src/videofilters/msdscap.cc mediastreamer2/src/voip/ice.c build/vsx/LibLinphoneTester-wp8/LibLinphoneTester-wp8/Resources/AppResources.Designer.cs build/wp8/LibLinphoneTester-wp8/Resources/AppResources.Designer.cs From b2861b3108dfa2249a0622ba3c9be06bd0c4bb2e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 9 Feb 2016 13:33:21 +0100 Subject: [PATCH 05/27] fix bctoolbox intergation --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 232e14e9b..b2cafabd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ endif() if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) include("${EP_bellesip_CONFIG_DIR}/BelleSIPConfig.cmake") include("${EP_ms2_CONFIG_DIR}/Mediastreamer2Config.cmake") - include("${EP_ms2_CONFIG_DIR}/BcToolboxConfig.cmake") + include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake") else() find_package(BelleSIP REQUIRED) find_package(Mediastreamer2 REQUIRED) From 5b4f50fb668a967592ed51bc45e83e7b071cb83e Mon Sep 17 00:00:00 2001 From: Johan Pascal Date: Tue, 9 Feb 2016 22:02:59 +0100 Subject: [PATCH 06/27] Lime uses bctoolbox crypto API --- coreapi/lime.c | 105 ++++++++++++++++++++----------------------------- 1 file changed, 43 insertions(+), 62 deletions(-) diff --git a/coreapi/lime.c b/coreapi/lime.c index 190ea6be7..4b85139eb 100644 --- a/coreapi/lime.c +++ b/coreapi/lime.c @@ -4,19 +4,8 @@ #endif #ifdef HAVE_LIME - #include "linphonecore.h" -#include "ortp/b64.h" -#include "polarssl/gcm.h" - -/* check polarssl version */ -#include - -#if POLARSSL_VERSION_NUMBER >= 0x01030000 /* for Polarssl version 1.3 */ -#include "polarssl/sha256.h" -#else /* for Polarssl version 1.2 */ -#include "polarssl/sha2.h" -#endif +#include "bctoolbox/crypto.h" /** * @brief check at runtime if LIME is available @@ -417,13 +406,6 @@ static int lime_deriveKey(limeKey_t *key) { return LIME_UNABLE_TO_DERIVE_KEY; } -#if 0 - /*not doing anything yet since key and sessionId are array, not pointers*/ - if ((key->key == NULL) || (key->sessionId == NULL)) { - return LIME_UNABLE_TO_DERIVE_KEY; - } -#endif - /* Derivation is made derived Key = HMAC_SHA256(Key, 0x0000001||"MessageKey"||0x00||SessionId||SessionIndex||0x00000100)*/ /* total data to be hashed is 55 bytes : 4 + 10 + 1 + 32 + 4 + 4 */ inputData[0] = 0x00; @@ -448,11 +430,7 @@ static int lime_deriveKey(limeKey_t *key) { inputData[54] = 0x00; /* derive the key in a temp buffer */ -#if POLARSSL_VERSION_NUMBER >= 0x01030000 /* for Polarssl version 1.3 */ - sha256_hmac(key->key, 32, inputData, 55, derivedKey, 0); /* last param to zero to select SHA256 and not SHA224 */ -#else /* for Polarssl version 1.2 */ - sha2_hmac(key->key, 32, inputData, 55, derivedKey, 0); /* last param to zero to select SHA256 and not SHA224 */ -#endif /* POLARSSL_VERSION_NUMBER */ + bctoolbox_hmacSha256(key->key, 32, inputData, 55, 32, derivedKey); /* overwrite the old key with the derived one */ memcpy(key->key, derivedKey, 32); @@ -481,7 +459,6 @@ void lime_freeKeys(limeURIKeys_t associatedKeys) { int lime_encryptMessage(limeKey_t *key, uint8_t *plainMessage, uint32_t messageLength, uint8_t selfZID[12], uint8_t *encryptedMessage) { uint8_t authenticatedData[28]; - gcm_context gcmContext; /* Authenticated data is senderZID(12 bytes)||receiverZID(12 bytes)||sessionIndex(4 bytes) */ memcpy(authenticatedData, selfZID, 12); memcpy(authenticatedData+12, key->peerZID, 12); @@ -492,31 +469,31 @@ int lime_encryptMessage(limeKey_t *key, uint8_t *plainMessage, uint32_t messageL /* AES-GCM : key is 192 bits long, Init Vector 64 bits. 256 bits key given is AES key||IV */ /* tag is 16 bytes long and is set in the 16 first bytes of the encrypted message */ - gcm_init(&gcmContext, POLARSSL_CIPHER_ID_AES, key->key, 192); - gcm_crypt_and_tag(&gcmContext, GCM_ENCRYPT, messageLength, key->key+24, 8, authenticatedData, 28, plainMessage, encryptedMessage+16, 16, encryptedMessage); - gcm_free(&gcmContext); + return bctoolbox_aes_gcm_encrypt_and_tag(key->key, 24, + plainMessage, messageLength, + authenticatedData, 28, + key->key+24, 8, /* IV is at the end(last 64 bits) of the given key buffer */ + encryptedMessage, 16, /* the first 16 bytes of output are the authentication tag */ + encryptedMessage+16); /* actual encrypted message starts after 16 bytes of authentication tag */ return 0; } int lime_encryptFile(void **cryptoContext, unsigned char *key, size_t length, char *plain, char *cipher) { - gcm_context *gcmContext; + bctoolbox_aes_gcm_context_t *gcmContext; if (*cryptoContext == NULL) { /* first call to the function, allocate a crypto context and initialise it */ - gcmContext = (gcm_context *)malloc(sizeof(gcm_context)); - *cryptoContext = (void *)gcmContext; - gcm_init(gcmContext, POLARSSL_CIPHER_ID_AES, key, 192); - gcm_starts(gcmContext, GCM_ENCRYPT, key+24, 8, NULL, 0); /* key contains 192bits of key || 64 bits of Initialisation Vector */ + /* key contains 192bits of key || 64 bits of Initialisation Vector, no additional data */ + gcmContext = bctoolbox_aes_gcm_context_new(key, 24, NULL, 0, key+24, 8, BCTOOLBOX_GCM_ENCRYPT); + *cryptoContext = gcmContext; } else { /* this is not the first call, get the context */ - gcmContext = (gcm_context *)*cryptoContext; + gcmContext = (bctoolbox_aes_gcm_context_t *)*cryptoContext; } if (length != 0) { - gcm_update(gcmContext, length, (const unsigned char *)plain, (unsigned char *)cipher); - } else { /* lenght is 0, finish the stream */ - gcm_finish(gcmContext, NULL, 0); /* do not generate tag */ - gcm_free(gcmContext); - free(*cryptoContext); + bctoolbox_aes_gcm_process_chunk(gcmContext, (const uint8_t *)plain, length, (uint8_t *)cipher); + } else { /* lenght is 0, finish the stream, no tag to be generated */ + bctoolbox_aes_gcm_finish(gcmContext, NULL, 0); *cryptoContext = NULL; } @@ -524,23 +501,20 @@ int lime_encryptFile(void **cryptoContext, unsigned char *key, size_t length, ch } int lime_decryptFile(void **cryptoContext, unsigned char *key, size_t length, char *plain, char *cipher) { - gcm_context *gcmContext; + bctoolbox_aes_gcm_context_t *gcmContext; if (*cryptoContext == NULL) { /* first call to the function, allocate a crypto context and initialise it */ - gcmContext = (gcm_context *)malloc(sizeof(gcm_context)); - *cryptoContext = (void *)gcmContext; - gcm_init(gcmContext, POLARSSL_CIPHER_ID_AES, key, 192); - gcm_starts(gcmContext, GCM_DECRYPT, key+24, 8, NULL, 0); /* key contains 192bits of key || 64 bits of Initialisation Vector */ + /* key contains 192bits of key || 64 bits of Initialisation Vector, no additional data */ + gcmContext = bctoolbox_aes_gcm_context_new(key, 24, NULL, 0, key+24, 8, BCTOOLBOX_GCM_DECRYPT); + *cryptoContext = gcmContext; } else { /* this is not the first call, get the context */ - gcmContext = (gcm_context *)*cryptoContext; + gcmContext = (bctoolbox_aes_gcm_context_t *)*cryptoContext; } if (length != 0) { - gcm_update(gcmContext, length, (const unsigned char *)cipher, (unsigned char *)plain); + bctoolbox_aes_gcm_process_chunk(gcmContext, (const unsigned char *)cipher, length, (unsigned char *)plain); } else { /* lenght is 0, finish the stream */ - gcm_finish(gcmContext, NULL, 0); /* do not generate tag */ - gcm_free(gcmContext); - free(*cryptoContext); + bctoolbox_aes_gcm_finish(gcmContext, NULL, 0); *cryptoContext = NULL; } @@ -550,7 +524,6 @@ int lime_decryptFile(void **cryptoContext, unsigned char *key, size_t length, ch int lime_decryptMessage(limeKey_t *key, uint8_t *encryptedMessage, uint32_t messageLength, uint8_t selfZID[12], uint8_t *plainMessage) { uint8_t authenticatedData[28]; - gcm_context gcmContext; int retval; /* Authenticated data is senderZID(12 bytes)||receiverZID(12 bytes)||sessionIndex(4 bytes) */ @@ -563,10 +536,13 @@ int lime_decryptMessage(limeKey_t *key, uint8_t *encryptedMessage, uint32_t mess /* AES-GCM : key is 192 bits long, Init Vector 64 bits. 256 bits key given is AES key||IV */ /* tag is 16 bytes long and is the 16 first bytes of the encrypted message */ - gcm_init(&gcmContext, POLARSSL_CIPHER_ID_AES, key->key, 192); - /* messageLength-16 is the length of encrypted data, messageLength include the 16 bytes tag included at the begining of encryptedMessage */ - retval = gcm_auth_decrypt(&gcmContext, messageLength-16, key->key+24, 8, authenticatedData, 28, encryptedMessage, 16, encryptedMessage+16, plainMessage); - gcm_free(&gcmContext); + retval = bctoolbox_aes_gcm_decrypt_and_auth(key->key, 24, /* key is 192 bits long */ + encryptedMessage+16, messageLength-16, /* encrypted message first 16 bytes store the authentication tag, then is the actual message */ + authenticatedData, 28, /* additionnal data needed for authentication */ + key->key+24, 8, /* last 8 bytes of key is the initialisation vector */ + encryptedMessage, 16, /* first 16 bytes of message is the authentication tag */ + plainMessage); + /* add the null termination char */ plainMessage[messageLength-16] = '\0'; @@ -621,8 +597,8 @@ int lime_createMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_t uint8_t peerZidHex[25]; uint8_t sessionIndexHex[9]; xmlNodePtr msgNode; - int b64Size; - char *encryptedMessageb64; + size_t b64Size = 0; + unsigned char *encryptedMessageb64; /* encrypt message with current key */ limeKey_t *currentKey = associatedKeys.peerKeys[i]; @@ -652,9 +628,9 @@ int lime_createMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_t xmlNewTextChild(msgNode, NULL, (const xmlChar *)"index", sessionIndexHex); /* convert the cipherText to base 64 */ - b64Size = b64_encode(NULL, encryptedMessageLength, NULL, 0); - encryptedMessageb64 = (char *)malloc(b64Size+1); - b64Size = b64_encode(encryptedMessage, encryptedMessageLength, encryptedMessageb64, b64Size); + bctoolbox_base64_encode(NULL, &b64Size, encryptedMessage, encryptedMessageLength); /* b64Size is 0, so it is set to the requested output buffer size */ + encryptedMessageb64 = malloc(b64Size+1); /* allocate a buffer of requested size +1 for NULL termination */ + bctoolbox_base64_encode(encryptedMessageb64, &b64Size, encryptedMessage, encryptedMessageLength); /* b64Size is 0, so it is set to the requested output buffer size */ encryptedMessageb64[b64Size] = '\0'; /* libxml need a null terminated string */ xmlNewTextChild(msgNode, NULL, (const xmlChar *)"text", (const xmlChar *)encryptedMessageb64); free(encryptedMessage); @@ -685,7 +661,7 @@ int lime_decryptMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_ xmlChar *peerZidHex = NULL; xmlNodePtr cur; uint8_t *encryptedMessage = NULL; - uint32_t encryptedMessageLength = 0; + size_t encryptedMessageLength = 0; uint32_t usedSessionIndex = 0; xmlDocPtr xmlEncryptedMessage; @@ -750,14 +726,19 @@ int lime_decryptMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_ | (((uint32_t)lime_charToByte(sessionIndexHex[6]))<<4) | (((uint32_t)lime_charToByte(sessionIndexHex[7]))); xmlFree(sessionIndexHex); + /* get the encrypted message */ msgChildrenNode = msgChildrenNode->next; + /* convert the cipherText from base 64 */ encryptedMessageb64 = xmlNodeListGetString(cacheBuffer, msgChildrenNode->xmlChildrenNode, 1); - encryptedMessageLength = b64_decode((char *)encryptedMessageb64, strlen((char *)encryptedMessageb64), NULL, 0); + bctoolbox_base64_decode(NULL, &encryptedMessageLength, encryptedMessageb64, strlen((char *)encryptedMessageb64)); /* encryptedMessageLength is 0, so it will be set to the requested buffer length */ encryptedMessage = (uint8_t *)malloc(encryptedMessageLength); - encryptedMessageLength = b64_decode((char *)encryptedMessageb64, strlen((char *)encryptedMessageb64), encryptedMessage, encryptedMessageLength); + bctoolbox_base64_decode(encryptedMessage, &encryptedMessageLength, encryptedMessageb64, strlen((char *)encryptedMessageb64)); + xmlFree(encryptedMessageb64); + xmlFree(currentZidHex); + break; } cur = cur->next; From 2ccfd093d3aea1f895ee33453a62a4b2b1e0bb7a Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 10 Feb 2016 14:00:57 +0100 Subject: [PATCH 07/27] sal_impl.c: fix 200 OK header, proposed by Christian Spielberger --- coreapi/bellesip_sal/sal_impl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 106ae2adf..6be8142e6 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -1033,7 +1033,7 @@ static void make_supported_header(Sal *sal){ const char *tag=(const char*)it->data; size_t taglen=strlen(tag); if (alltags==NULL || (written+taglen+1>=buflen)) alltags=ms_realloc(alltags,(buflen=buflen*2)); - snprintf(alltags+written,buflen-written,it->next ? "%s, " : "%s",tag); + written+=snprintf(alltags+written,buflen-written,it->next ? "%s, " : "%s",tag); } if (alltags){ sal->supported=belle_sip_header_create("Supported",alltags); From a3efb610d433bc7c4594f431bcd7f77fa1aba430 Mon Sep 17 00:00:00 2001 From: Johan Pascal Date: Wed, 10 Feb 2016 14:36:32 +0100 Subject: [PATCH 08/27] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index bcd3042a1..a1bc31105 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bcd3042a1984088a78a7517774300b0a6647506d +Subproject commit a1bc31105bd3718659f87cd83560086bbbdc491a From 2c929a08c71950a0dab0ab1b97c574d575d3452f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 10 Feb 2016 17:00:22 +0100 Subject: [PATCH 09/27] add java method to configure user certificates --- coreapi/linphonecore_jni.cc | 6 ++++++ java/common/org/linphone/core/LinphoneCore.java | 4 ++++ java/impl/org/linphone/core/LinphoneCoreImpl.java | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index bd1ba17fc..c83d2e27d 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -6864,3 +6864,9 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setMediaNetworkRe linphone_core_set_media_network_reachable((LinphoneCore*)pcore, (bool_t) reachable); } +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setUserCertificatesPath(JNIEnv *env, jobject jobj, jlong pcore, jstring jpath){ + const char *path = jpath ? env->GetStringUTFChars(jpath, NULL) : NULL; + linphone_core_set_user_certificates_path((LinphoneCore*)pcore, path); + if (path) env->ReleaseStringUTFChars(jpath, path); +} + diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 1ef29b191..c0ccc7242 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -2280,4 +2280,8 @@ public interface LinphoneCore { **/ public void setDnsServers(String servers[]); + /** + * Set user certificates directory path (used by SRTP-DTLS). + */ + public void setUserCertificatesPath(String path); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index b29fe7d73..94911846c 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -1630,4 +1630,10 @@ class LinphoneCoreImpl implements LinphoneCore { public void setDnsServers(String servers[]){ setDnsServers(nativePtr, servers); } + + private native void setUserCertificatesPath(long nativePtr, String path); + @Override + public void setUserCertificatesPath(String path) { + setUserCertificatesPath(nativePtr, path); + } } From 4b1cfa3ddf9fd89d7f773cc65f2bd39f06447135 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 10 Feb 2016 18:13:38 +0100 Subject: [PATCH 10/27] make sure even linphone friends created with legacy constructor do not lead to a crash if used in friend-list --- coreapi/friendlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index aba3546ff..611f144a0 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -319,6 +319,7 @@ LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *lis if (tmp) ms_free(tmp); } else { friend->in_list = TRUE; + friend->lc = list->lc; /*In case not set yet*/ list->friends = ms_list_append(list->friends, linphone_friend_ref(friend)); } return LinphoneFriendListOK; From 1b7f53849df61d161cdd0233815e46af2f358e23 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 11 Feb 2016 15:51:06 +0100 Subject: [PATCH 11/27] improve soundcard management --- coreapi/linphonecore.c | 10 ++-------- mediastreamer2 | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f4c7e4e07..f1f808514 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4520,10 +4520,7 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap, M * @param devid the device name as returned by linphone_core_get_sound_devices() **/ bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *devid){ - MSSndCard *sndcard; - sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(lc->factory),devid); - if (sndcard!=NULL && (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_CAPTURE)) return TRUE; - return FALSE; + return ms_snd_card_manager_get_capture_card(ms_factory_get_snd_card_manager(lc->factory),devid) != NULL; } /** @@ -4534,10 +4531,7 @@ bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *devi * @param devid the device name as returned by linphone_core_get_sound_devices() **/ bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *devid){ - MSSndCard *sndcard; - sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(lc->factory),devid); - if (sndcard!=NULL && (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_PLAYBACK)) return TRUE; - return FALSE; + return ms_snd_card_manager_get_playback_card(ms_factory_get_snd_card_manager(lc->factory),devid) != NULL; } /** diff --git a/mediastreamer2 b/mediastreamer2 index bf4f672f0..7b3f7cb2c 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bf4f672f0a97100318970a8e9a7290fd730a79b6 +Subproject commit 7b3f7cb2c84a67226e06cb8f0e9ec2973e51d6e0 From da9c8393fc81a7bc191927d237bfdd4d838816a9 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 11 Feb 2016 16:44:04 +0100 Subject: [PATCH 12/27] linphonecall.c: fix crash in zrtp --- coreapi/linphonecall.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f2b0cfad1..bb5d5f8de 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -243,11 +243,13 @@ static void linphone_call_audiostream_auth_token_ready(void *data, const char* a * @ingroup call_control **/ void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t verified){ - if (call->audiostream==NULL){ - ms_error("linphone_call_set_authentication_token_verified(): No audio stream"); + if (call->audiostream==NULL || !media_stream_started(&call->audiostream->ms)){ + ms_error("linphone_call_set_authentication_token_verified(): No audio stream or not started"); + return; } if (call->audiostream->ms.sessions.zrtp_context==NULL){ ms_error("linphone_call_set_authentication_token_verified(): No zrtp context."); + return; } if (!call->auth_token_verified && verified){ ms_zrtp_sas_verified(call->audiostream->ms.sessions.zrtp_context); From 35f2f5081af35c3e3d612f4d0da7bc7f0fea3063 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 12 Feb 2016 15:42:46 +0100 Subject: [PATCH 13/27] commands.c: disable files usage if we are using "soundcard use " --- console/commands.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/console/commands.c b/console/commands.c index 5fca480a6..490e6d400 100644 --- a/console/commands.c +++ b/console/commands.c @@ -1261,6 +1261,8 @@ static int lpc_cmd_soundcard(LinphoneCore *lc, char *args) return 1; } + linphone_core_use_files(lc,FALSE); + dev=linphone_core_get_sound_devices(lc); index=atoi(arg2); /* FIXME: handle not-a-number */ for(i=0;dev[i]!=NULL;i++) @@ -1276,6 +1278,7 @@ static int lpc_cmd_soundcard(LinphoneCore *lc, char *args) linphonec_out("No such sound device\n"); return 1; } + if (strcmp(arg1, "capture")==0) { const char *devname=linphone_core_get_capture_device(lc); From d08bd4a4feddb9f96fa061c98d5a3c8afd419a71 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 12 Feb 2016 18:40:54 +0100 Subject: [PATCH 14/27] update ms2 to fix crash with pulseaudio --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 7b3f7cb2c..897f0ba1a 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7b3f7cb2c84a67226e06cb8f0e9ec2973e51d6e0 +Subproject commit 897f0ba1a46a56ddd79a86d9f2804decff9d6bed diff --git a/oRTP b/oRTP index 1d533c749..e7995bc78 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 1d533c7490475b26a29f3fce300ac7004ab74a88 +Subproject commit e7995bc78c801eac78aa1aec0ab8a5b565a3ad25 From e78a360a87fa332a5034e27d742718f5d86f29a2 Mon Sep 17 00:00:00 2001 From: Svalorzen Date: Fri, 12 Feb 2016 16:55:46 +0100 Subject: [PATCH 15/27] Modified soundcard show command to show whether we are using files or not --- console/commands.c | 16 ++++++++++------ coreapi/linphonecore.c | 12 ++++++++---- coreapi/linphonecore.h | 9 +++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/console/commands.c b/console/commands.c index 490e6d400..eaabc392f 100644 --- a/console/commands.c +++ b/console/commands.c @@ -1243,12 +1243,16 @@ static int lpc_cmd_soundcard(LinphoneCore *lc, char *args) if (strcmp(arg1, "show")==0) { - linphonec_out("Ringer device: %s\n", - linphone_core_get_ringer_device(lc)); - linphonec_out("Playback device: %s\n", - linphone_core_get_playback_device(lc)); - linphonec_out("Capture device: %s\n", - linphone_core_get_capture_device(lc)); + if (linphone_core_get_use_files(lc)) { + linphonec_out("Using files.\n"); + } else { + linphonec_out("Ringer device: %s\n", + linphone_core_get_ringer_device(lc)); + linphonec_out("Playback device: %s\n", + linphone_core_get_playback_device(lc)); + linphonec_out("Capture device: %s\n", + linphone_core_get_capture_device(lc)); + } return 1; } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f1f808514..e04b8d52d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1235,7 +1235,7 @@ static MSList *add_missing_supported_codecs(LinphoneCore *lc, const MSList *defa if (!elem2){ PayloadType *pt=(PayloadType*)elem->data; /*this codec from default list should be inserted in the list*/ - + if (!linphone_core_codec_supported(lc, payload_type_get_stream_type(pt), pt->mime_type)) continue; if (!last_inserted){ l=ms_list_prepend(l,pt); @@ -1712,14 +1712,14 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up"); ortp_init(); linphone_core_activate_log_serialization_if_needed(); - + lc->factory = ms_factory_new_with_voip(); linphone_core_register_default_codecs(lc); linphone_core_register_offer_answer_providers(lc); /* Get the mediastreamer2 event queue */ /* This allows to run event's callback in linphone_core_iterate() */ lc->msevq=ms_factory_create_event_queue(lc->factory); - + lc->sal=sal_init(lc->factory); sal_set_http_proxy_host(lc->sal, linphone_core_get_http_proxy_host(lc)); sal_set_http_proxy_port(lc->sal, linphone_core_get_http_proxy_port(lc)); @@ -5884,6 +5884,10 @@ void linphone_core_set_use_files(LinphoneCore *lc, bool_t yesno){ lc->use_files=yesno; } +bool_t linphone_core_get_use_files(LinphoneCore *lc) { + return lc->use_files; +} + const char * linphone_core_get_play_file(const LinphoneCore *lc) { return lc->play_file; } @@ -6466,7 +6470,7 @@ static void linphone_core_uninit(LinphoneCore *lc) linphone_core_set_state(lc,LinphoneGlobalOff,"Off"); linphone_core_deactivate_log_serialization_if_needed(); ms_list_free_with_data(lc->vtable_refs,(void (*)(void *))v_table_reference_destroy); - + ms_factory_destroy(lc->factory); } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index c14178aab..772f82276 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -3685,6 +3685,15 @@ void linphone_core_show_video(LinphoneCore *lc, bool_t show); **/ LINPHONE_PUBLIC void linphone_core_set_use_files(LinphoneCore *lc, bool_t yesno); +/** + * Gets whether linphone is currently streaming audio from and to files, rather + * than using the soundcard. + * @ingroup media_parameters + * @param[in] lc LinphoneCore object + * @return A boolean value representing whether linphone is streaming audio from and to files or not. +**/ +LINPHONE_PUBLIC bool_t linphone_core_get_use_files(LinphoneCore *lc); + /** * Get the wav file that is played when putting somebody on hold, * or when files are used instead of soundcards (see linphone_core_set_use_files()). From 47902f36295fa51481bd33be8d558ba54b2600a7 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 15 Feb 2016 14:19:20 +0100 Subject: [PATCH 16/27] Fix Python module build. --- tools/python/apixml2python.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/python/apixml2python.py b/tools/python/apixml2python.py index 94e4c0a48..ba4fa7a72 100755 --- a/tools/python/apixml2python.py +++ b/tools/python/apixml2python.py @@ -52,6 +52,7 @@ blacklisted_functions = [ 'linphone_core_get_video_port_range', # to be handwritten because of result via arguments 'linphone_core_remove_listener', 'linphone_core_serialize_logs', # There is no use to wrap this function + 'linphone_core_set_dns_servers', 'linphone_core_set_log_collection_max_file_size', # need to handle class properties 'linphone_core_set_log_collection_path', # need to handle class properties 'linphone_core_set_log_collection_prefix', # need to handle class properties From 3648f27013a957b79c45f6649ff669ef67b611f7 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 15 Feb 2016 14:46:59 +0100 Subject: [PATCH 17/27] Remove useless CMake script to search for bctoolbox. --- cmake/FindBcToolBox.cmake | 56 --------------------------------------- 1 file changed, 56 deletions(-) delete mode 100755 cmake/FindBcToolBox.cmake diff --git a/cmake/FindBcToolBox.cmake b/cmake/FindBcToolBox.cmake deleted file mode 100755 index 5bfa2eb17..000000000 --- a/cmake/FindBcToolBox.cmake +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################ -# FindiBcToolBox.cmake -# Copyright (C) 2016 Belledonne Communications, Grenoble France -# -############################################################################ -# -# 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -############################################################################ -# -# - Find the bctoolbox include file and library -# -# BCTOOLBOX_FOUND - system has BC Toolbox -# BCTOOLBOX_INCLUDE_DIRS - the BC Toolbox include directory -# BCTOOLBOX_LIBRARIES - The libraries needed to use BC Toolbox - -include(CMakePushCheckState) -include(CheckIncludeFile) -include(CheckCSourceCompiles) -include(CheckSymbolExists) - -set(_BCTOOLBOX_ROOT_PATHS - ${CMAKE_INSTALL_PREFIX} -) - -find_path(BCTOOLBOX_INCLUDE_DIRS - NAMES bctoolbox/crypto.h - HINTS _BCTOOLBOX_ROOT_PATHS - PATH_SUFFIXES include -) - -find_library(BCTOOLBOX_LIBRARIES - NAMES bctoolbox - HINTS _BCTOOLBOX_ROOT_PATHS - PATH_SUFFIXES bin lib -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(BcToolBox - DEFAULT_MSG - BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES -) - -mark_as_advanced(BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES) From e257fe832a06d0c65bababc538678afa2c836738 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 15 Feb 2016 14:47:39 +0100 Subject: [PATCH 18/27] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 900261f27..6aa0f294d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 900261f27b468fdb735b61b491eba92b0cb4701b +Subproject commit 6aa0f294deb81e0519b119553ceedccf890aad92 From 1c599d081ee047ed26e29e4fab7e69aae1eeae6e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 15 Feb 2016 16:09:49 +0100 Subject: [PATCH 19/27] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 6aa0f294d..622a95ddc 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6aa0f294deb81e0519b119553ceedccf890aad92 +Subproject commit 622a95ddcb9216d7e4a8ddb34709f39e39f798df From f14b6e73ebcd65f57fb0bb9a110ce86817a780dc Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 16 Feb 2016 11:38:31 +0100 Subject: [PATCH 20/27] linphonecore.c: linphone_core_redirect_call should interpret url as linphone_core_transfer_call does --- console/commands.c | 4 +- coreapi/linphonecore.c | 14 ++- tester/call_tester.c | 230 ++++++++++++++++++++--------------------- 3 files changed, 131 insertions(+), 117 deletions(-) diff --git a/console/commands.c b/console/commands.c index eaabc392f..aaa72fa87 100644 --- a/console/commands.c +++ b/console/commands.c @@ -743,7 +743,9 @@ lpc_cmd_redirect(LinphoneCore *lc, char *args){ while(elem!=NULL){ LinphoneCall *call=(LinphoneCall*)elem->data; if (linphone_call_get_state(call)==LinphoneCallIncomingReceived){ - linphone_core_redirect_call(lc,call,args); + if (linphone_core_redirect_call(lc,call,args) != 0) { + linphonec_out("Could not redirect call.\n"); + } didit=1; /*as the redirection closes the call, we need to re-check the call list that is invalidated.*/ elem=linphone_core_get_calls(lc); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e04b8d52d..b07cb11a6 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3854,8 +3854,20 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){ } int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char *redirect_uri){ + char *real_url=NULL; + LinphoneAddress *real_parsed_url=linphone_core_interpret_url(lc,redirect_uri); + + + if (!real_parsed_url){ + /* bad url */ + ms_error("Bad redirect URI: %s", redirect_uri?:"NULL"); + return -1; + } + if (call->state==LinphoneCallIncomingReceived){ - sal_call_decline(call->op,SalReasonRedirect,redirect_uri); + real_url=linphone_address_as_string (real_parsed_url); + sal_call_decline(call->op,SalReasonRedirect,real_url); + ms_free(real_url); sal_error_info_set(&call->non_op_error,SalReasonRedirect,603,"Call redirected",NULL); terminate_call(lc,call); }else{ diff --git a/tester/call_tester.c b/tester/call_tester.c index ddea0e758..771a794da 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -163,10 +163,10 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana int max_time_to_wait; c1=linphone_core_get_current_call(caller->lc); c2=linphone_core_get_current_call(callee->lc); - + BC_ASSERT_PTR_NOT_NULL(c1); BC_ASSERT_PTR_NOT_NULL(c2); - + if (!c1 || !c2) return; linphone_call_ref(c1); linphone_call_ref(c2); @@ -175,18 +175,18 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana max_time_to_wait = 15000; else max_time_to_wait = 5000; - + do { if (linphone_call_get_audio_stats(c1)->round_trip_delay > 0.0 && linphone_call_get_audio_stats(c2)->round_trip_delay > 0.0 && (!linphone_call_log_video_enabled(linphone_call_get_call_log(c1)) || linphone_call_get_video_stats(c1)->round_trip_delay>0.0) && (!linphone_call_log_video_enabled(linphone_call_get_call_log(c2)) || linphone_call_get_video_stats(c2)->round_trip_delay>0.0)) { break; - + } wait_for_until(caller->lc,callee->lc,NULL,0,20); /*just to sleep while iterating*/ }while (!liblinphone_tester_clock_elapsed(&ts,max_time_to_wait)); - + if (linphone_core_rtcp_enabled(caller->lc) && linphone_core_rtcp_enabled(callee->lc)) { BC_ASSERT_GREATER(linphone_call_get_audio_stats(c1)->round_trip_delay,0.0,float,"%f"); BC_ASSERT_GREATER(linphone_call_get_audio_stats(c2)->round_trip_delay,0.0,float,"%f"); @@ -254,7 +254,7 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr }else{ BC_ASSERT_PTR_NOT_NULL((caller_call=linphone_core_invite_address_with_params(caller_mgr->lc,callee_mgr->identity,caller_params))); } - + BC_ASSERT_PTR_NULL(linphone_call_get_remote_params(caller_call)); /*assert that remote params are NULL when no response is received yet*/ did_receive_call = wait_for(callee_mgr->lc @@ -357,7 +357,7 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr /* check no ice re-invite received*/ BC_ASSERT_FALSE(wait_for_until(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallStreamsRunning,initial_caller.number_of_LinphoneCallStreamsRunning+2,2000)); BC_ASSERT_FALSE(wait_for_until(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallStreamsRunning,initial_callee.number_of_LinphoneCallStreamsRunning+2,2000)); - + } if (linphone_core_get_media_encryption(caller_mgr->lc) == LinphoneMediaEncryptionDTLS ) { if (linphone_core_get_current_call(caller_mgr->lc)->audiostream) @@ -366,7 +366,7 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr if (linphone_core_get_current_call(caller_mgr->lc)->videostream && video_stream_started(linphone_core_get_current_call(caller_mgr->lc)->videostream)) BC_ASSERT_TRUE(ms_media_stream_sessions_get_encryption_mandatory(&linphone_core_get_current_call(caller_mgr->lc)->videostream->ms.sessions)); #endif - + } return result; } @@ -747,7 +747,7 @@ end: static void disable_all_codecs(const MSList* elem, LinphoneCoreManager* call){ PayloadType *pt; - + for(;elem!=NULL;elem=elem->next){ pt=(PayloadType*)elem->data; linphone_core_enable_payload_type(call->lc,pt,FALSE); @@ -758,25 +758,25 @@ static void disable_all_codecs(const MSList* elem, LinphoneCoreManager* call){ Wait for SIP 488 unacceptable. ***/ static void call_with_no_audio_codec(void){ - + LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc"); LinphoneCall* out_call ; - + const MSList* elem =linphone_core_get_audio_codecs(caller->lc); - + disable_all_codecs(elem, caller); - - + + out_call = linphone_core_invite_address(caller->lc,callee->identity); linphone_call_ref(out_call); BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallOutgoingInit, 1)); - - + + BC_ASSERT_TRUE(wait_for_until(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallError, 1, 6000)); BC_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable, int, "%d"); BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived, 0, int, "%d"); - + linphone_call_unref(out_call); linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); @@ -784,56 +784,56 @@ static void call_with_no_audio_codec(void){ } static void video_call_with_no_audio_and_no_video_codec(void){ - + LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc"); LinphoneCall* out_call ; LinphoneVideoPolicy callee_policy, caller_policy; LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0}; - + const MSList* elem_video =linphone_core_get_video_codecs(caller->lc); - + const MSList* elem_audio =linphone_core_get_audio_codecs(caller->lc); - + disable_all_codecs(elem_audio, caller); disable_all_codecs(elem_video, caller); - + callee_policy.automatically_initiate=FALSE; callee_policy.automatically_accept=TRUE; caller_policy.automatically_initiate=TRUE; caller_policy.automatically_accept=FALSE; - + linphone_core_set_video_policy(callee->lc,&callee_policy); linphone_core_set_video_policy(caller->lc,&caller_policy); - - + + linphone_core_enable_video_display(callee->lc, TRUE); linphone_core_enable_video_capture(callee->lc, TRUE); - + linphone_core_enable_video_display(caller->lc, TRUE); linphone_core_enable_video_capture(caller->lc, TRUE); - + /* Create call params */ caller_test_params.base = linphone_core_create_call_params(caller->lc, NULL); - - + + out_call = linphone_core_invite_address_with_params(caller->lc, callee->identity,caller_test_params.base); linphone_call_ref(out_call); - + linphone_call_params_destroy(caller_test_params.base); if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base); - - + + BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallOutgoingInit, 1)); - + BC_ASSERT_TRUE(wait_for_until(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallError, 1, 6000)); BC_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable, int, "%d"); BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived, 0, int, "%d"); - + linphone_call_unref(out_call); linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); - + } static void simple_call_compatibility_mode(void) { @@ -1529,7 +1529,7 @@ static void call_paused_resumed_with_video_base(bool_t sdp_200_ack call_marie = linphone_core_get_current_call(marie->lc); wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000); - + linphone_core_pause_call(pauline->lc,call_pauline); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1)); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); @@ -1573,7 +1573,7 @@ static void call_paused_resumed_with_video_base(bool_t sdp_200_ack BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallResuming,1)); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); } - + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); if (use_video_policy_for_re_invite_sdp_200) { @@ -2196,14 +2196,14 @@ static void check_fir(LinphoneCoreManager* caller,LinphoneCoreManager* callee ){ LinphoneCall* caller_call; callee_call=linphone_core_get_current_call(callee->lc); caller_call=linphone_core_get_current_call(caller->lc); - + /*check video path*/ linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc); - + linphone_call_send_vfu_request(callee_call); BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1)); if (rtp_session_avpf_enabled(callee_call->sessions->rtp_session)){ - + BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&caller_call->videostream->ms_video_stat.counter_rcvd_fir, 1)); } else{ @@ -2211,13 +2211,13 @@ static void check_fir(LinphoneCoreManager* caller,LinphoneCoreManager* callee ){ } ms_message ("check_fir : [%p] received %d FIR ",&caller_call ,caller_call->videostream->ms_video_stat.counter_rcvd_fir); ms_message ("check_fir : [%p] stat number of iframe decoded %d ",&callee_call, callee->stat.number_of_IframeDecoded); - + linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc); linphone_call_send_vfu_request(caller_call); BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1)); - + if (rtp_session_avpf_enabled(caller_call->sessions->rtp_session)) { - + if (rtp_session_avpf_enabled(callee_call->sessions->rtp_session)){ BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&callee_call->videostream->ms_video_stat.counter_rcvd_fir, 1)); } @@ -2227,34 +2227,34 @@ static void check_fir(LinphoneCoreManager* caller,LinphoneCoreManager* callee ){ } ms_message ("check_fir : [%p] received %d FIR ",&callee_call ,callee_call->videostream->ms_video_stat.counter_rcvd_fir); ms_message ("check_fir : [%p] stat number of iframe decoded %d ",&caller_call, caller->stat.number_of_IframeDecoded); - - - + + + } void video_call_base_3(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) { LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0}; - + LinphoneCall* callee_call; LinphoneCall* caller_call; LinphoneVideoPolicy callee_policy, caller_policy; - + if (using_policy) { callee_policy.automatically_initiate=FALSE; callee_policy.automatically_accept=TRUE; caller_policy.automatically_initiate=TRUE; caller_policy.automatically_accept=FALSE; - + linphone_core_set_video_policy(callee->lc,&callee_policy); linphone_core_set_video_policy(caller->lc,&caller_policy); } - + linphone_core_enable_video_display(callee->lc, callee_video_enabled); linphone_core_enable_video_capture(callee->lc, callee_video_enabled); - + linphone_core_enable_video_display(caller->lc, caller_video_enabled); linphone_core_enable_video_capture(caller->lc, caller_video_enabled); - + if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */ char *path = bc_tester_file("certificates-marie"); callee->lc->user_certificates_path = ms_strdup(path); @@ -2265,29 +2265,29 @@ void video_call_base_3(LinphoneCoreManager* caller,LinphoneCoreManager* callee, belle_sip_mkdir(callee->lc->user_certificates_path); belle_sip_mkdir(caller->lc->user_certificates_path); } - + linphone_core_set_media_encryption(callee->lc,mode); linphone_core_set_media_encryption(caller->lc,mode); /* Create call params */ caller_test_params.base=linphone_core_create_call_params(caller->lc, NULL); - + if (!using_policy) linphone_call_params_enable_video(caller_test_params.base,TRUE); - + if (!using_policy){ callee_test_params.base=linphone_core_create_call_params(callee->lc, NULL); linphone_call_params_enable_video(callee_test_params.base,TRUE); - + } - + BC_ASSERT_TRUE(call_with_params2(caller,callee,&caller_test_params,&callee_test_params,using_policy)); callee_call=linphone_core_get_current_call(callee->lc); caller_call=linphone_core_get_current_call(caller->lc); - + linphone_call_params_destroy(caller_test_params.base); if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base); - + if (callee_call && caller_call ) { if (callee_video_enabled && caller_video_enabled) { check_fir(caller,callee); @@ -2318,13 +2318,13 @@ static void video_call_without_rtcp(void) { LpConfig *lp; LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - + lp = linphone_core_get_config(marie->lc); lp_config_set_int(lp,"rtp","rtcp_enabled",0); - + lp = linphone_core_get_config(pauline->lc); lp_config_set_int(lp,"rtp","rtcp_enabled",0); - + video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); @@ -2338,7 +2338,7 @@ static void video_call_disable_implicit_AVPF_on_callee(void) { callee_lp = linphone_core_get_config(callee->lc); lp_config_set_int(callee_lp,"rtp","rtcp_fb_implicit_rtcp_fb",0); - + video_call_base_3(caller,callee,TRUE,LinphoneMediaEncryptionNone,TRUE,TRUE); params = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)); BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), "RTP/AVP"); @@ -2356,10 +2356,10 @@ static void video_call_disable_implicit_AVPF_on_caller(void) { LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc"); LpConfig *caller_lp; const LinphoneCallParams *params, *params2; - + caller_lp = linphone_core_get_config(caller->lc); lp_config_set_int(caller_lp,"rtp","rtcp_fb_implicit_rtcp_fb",0); - + video_call_base_3(caller,callee,TRUE,LinphoneMediaEncryptionNone,TRUE,TRUE); params = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)); BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), "RTP/AVP"); @@ -2368,7 +2368,7 @@ static void video_call_disable_implicit_AVPF_on_caller(void) { end_call(caller, callee); linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); - + } static void video_call_AVPF_to_implicit_AVPF(void) @@ -2379,7 +2379,7 @@ static void video_call_AVPF_to_implicit_AVPF(void) linphone_core_set_avpf_mode(caller->lc,LinphoneAVPFEnabled); video_call_base_3(caller,callee,TRUE,LinphoneMediaEncryptionNone,TRUE,TRUE); end_call(caller,callee); - + linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); @@ -2389,14 +2389,14 @@ static void video_call_implicit_AVPF_to_AVPF(void) { LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc"); - + linphone_core_set_avpf_mode(callee->lc,LinphoneAVPFEnabled); video_call_base_3(caller,callee,TRUE,LinphoneMediaEncryptionNone,TRUE,TRUE); end_call(caller,callee); - + linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); - + } static void video_call_using_policy_AVPF_implicit_caller_and_callee(void) { @@ -3138,14 +3138,14 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video for (i=0;i<100;i++) { LinphoneCall *pauline_call = linphone_core_get_current_call(pauline->lc); LinphoneCall *marie_call = linphone_core_get_current_call(marie->lc); - + if (!pauline_call || !marie_call){ /*if one of the two calls was disapeering, don't crash, but report it*/ BC_ASSERT_PTR_NOT_NULL(pauline_call); BC_ASSERT_PTR_NOT_NULL(marie_call); break; } - + if (linphone_call_get_authentication_token(pauline_call) && linphone_call_get_authentication_token(marie_call)) { @@ -3604,7 +3604,7 @@ static void call_redirect(void){ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); LinphoneCoreManager* laure = linphone_core_manager_new("laure_rc"); MSList* lcs = NULL; - char *margaux_url = NULL; + char *laure_url = NULL; LinphoneCall* marie_call; lcs = ms_list_append(lcs,marie->lc); @@ -3619,9 +3619,9 @@ static void call_redirect(void){ BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,6000)); if (linphone_core_get_current_call(pauline->lc)){ - margaux_url = linphone_address_as_string(laure->identity); - linphone_core_redirect_call(pauline->lc, linphone_core_get_current_call(pauline->lc), margaux_url); - ms_free(margaux_url); + laure_url = linphone_address_as_string(laure->identity); + linphone_core_redirect_call(pauline->lc, linphone_core_get_current_call(pauline->lc), laure_url); + ms_free(laure_url); /* laure should be ringing now */ BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallIncomingReceived,1,6000)); @@ -4024,7 +4024,7 @@ static void record_call(const char *filename, bool_t enableVideo, const char *vi marie = linphone_core_manager_new("marie_h264_rc"); pauline = linphone_core_manager_new("pauline_h264_rc"); - + #if defined(HAVE_OPENH264) && defined(ANDROID) libmsopenh264_init(linphone_core_get_ms_factory(marie->lc)); linphone_core_reload_ms_plugins(marie->lc, NULL); @@ -4645,7 +4645,7 @@ static void video_call_with_re_invite_inactive_followed_by_re_invite_base(Linpho calls_ok = linphone_core_get_current_call(marie->lc) != NULL && linphone_core_get_current_call(pauline->lc) != NULL; BC_ASSERT_TRUE(calls_ok); - + if (calls_ok) { params=linphone_core_create_call_params(marie->lc,linphone_core_get_current_call(marie->lc)); linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionInactive); @@ -4726,18 +4726,18 @@ static void audio_call_with_video_policy_enabled(void){ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); LinphoneVideoPolicy vpol; - - + + linphone_core_enable_video(marie->lc, TRUE, TRUE); linphone_core_enable_video(pauline->lc, TRUE, TRUE); vpol.automatically_accept = vpol.automatically_initiate = TRUE; linphone_core_set_video_policy(marie->lc, &vpol); vpol.automatically_accept = vpol.automatically_initiate = FALSE; linphone_core_set_video_policy(pauline->lc, &vpol); - + linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce); linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce); - + linphone_core_invite_address(pauline->lc, marie->identity); if (!BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallIncomingReceived, 1))) goto end; linphone_core_accept_call(marie->lc, linphone_core_get_current_call(marie->lc)); @@ -4747,15 +4747,15 @@ static void audio_call_with_video_policy_enabled(void){ linphone_call_params_enable_video(params, TRUE); linphone_core_accept_call_with_params(marie->lc, linphone_core_get_current_call(marie->lc), params); linphone_call_params_destroy(params);*/ - + /*wait for call to be established and ICE reINVITEs to be done */ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2)); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); - + linphone_core_pause_call(marie->lc, linphone_core_get_current_call(marie->lc)); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallPausedByRemote, 1)); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallPaused, 1)); - + end_call(marie, pauline); end: linphone_core_manager_destroy(marie); @@ -4862,7 +4862,7 @@ static void simple_stereo_call(const char *codec_name, int clock_rate, int bitra char *stereo_file = bc_tester_res("sounds/vrroom.wav"); char *recordpath = bc_tester_file("stereo-record.wav"); bool_t audio_cmp_failed = FALSE; - + unlink(recordpath); marie = linphone_core_manager_new( "marie_rc"); @@ -5231,10 +5231,10 @@ static int rtptm_on_receive(RtpTransportModifier *rtptm, mblk_t *msg) { static void rtptm_on_schedule(RtpTransportModifier *rtptm) { RtpTransportModifierData *data = rtptm->data; mblk_t *msg = NULL; - + while ((msg = ms_queue_get(&data->to_send)) != NULL) { int size = 0; - unsigned char *src; + unsigned char *src; int i = 0; // Mediastream can create a mblk_t with only the RTP header and setting the b_cont pointer to the actual RTP content buffer @@ -5248,10 +5248,10 @@ static void rtptm_on_schedule(RtpTransportModifier *rtptm) { for (i = 0; i < size; i++) { src[i] ^= (unsigned char) XOR_KEY[i % strlen(XOR_KEY)]; } - + meta_rtp_transport_modifier_inject_packet_to_send(rtptm->transport, rtptm, msg, 0); } - + msg = NULL; while ((msg = ms_queue_get(&data->to_recv)) != NULL) { int size = 0; @@ -5266,7 +5266,7 @@ static void rtptm_on_schedule(RtpTransportModifier *rtptm) { for (i = 0; i < size; i++) { src[i] ^= (unsigned char) XOR_KEY[i % strlen(XOR_KEY)]; } - + meta_rtp_transport_modifier_inject_packet_to_recv(rtptm->transport, rtptm, msg, 0); } } @@ -5345,7 +5345,7 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) { v_table = linphone_core_v_table_new(); v_table->call_state_changed = call_state_changed_4; linphone_core_add_listener(marie->lc,v_table); - + if (recordTest) { // When we do the record test, we need a file player to play the content of a sound file /*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/ @@ -5500,7 +5500,7 @@ static void call_record_with_custom_rtp_modifier(void) { static void _call_with_network_switch_in_early_state(bool_t network_loosed_by_caller){ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - + linphone_core_invite_address(marie->lc, pauline->identity); if (!BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingReceived, 1))) goto end; if (!BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging, 1))) goto end; @@ -5537,7 +5537,7 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); MSList *lcs = NULL; bool_t call_ok; - + lcs = ms_list_append(lcs, marie->lc); lcs = ms_list_append(lcs, pauline->lc); @@ -5549,7 +5549,7 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh lp_config_set_int(linphone_core_get_config(marie->lc), "net", "recreate_sockets_when_network_is_up", 1); lp_config_set_int(linphone_core_get_config(pauline->lc), "net", "recreate_sockets_when_network_is_up", 1); } - + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (!call_ok) goto end; @@ -5618,7 +5618,7 @@ static void call_with_sip_and_rtp_independant_switches(void){ bool_t call_ok; bool_t use_ice = TRUE; bool_t with_socket_refresh = TRUE; - + lcs = ms_list_append(lcs, marie->lc); lcs = ms_list_append(lcs, pauline->lc); @@ -5630,9 +5630,9 @@ static void call_with_sip_and_rtp_independant_switches(void){ lp_config_set_int(linphone_core_get_config(marie->lc), "net", "recreate_sockets_when_network_is_up", 1); lp_config_set_int(linphone_core_get_config(pauline->lc), "net", "recreate_sockets_when_network_is_up", 1); } - + linphone_core_set_media_network_reachable(marie->lc, TRUE); - + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (!call_ok) goto end; @@ -5654,7 +5654,7 @@ static void call_with_sip_and_rtp_independant_switches(void){ wait_for_until(marie->lc, pauline->lc, NULL, 0, 5000); /*at this stage, no reINVITE is expected to be send*/ BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallUpdating, 0, int, "%i"); - + /*now we notify the a reconnection of media network*/ linphone_core_set_media_network_reachable(marie->lc, TRUE); @@ -5822,7 +5822,7 @@ static void call_logs_sqlite_storage(void) { call_id = linphone_call_log_get_call_id(call_log); BC_ASSERT_PTR_NOT_NULL(call_id); BC_ASSERT_PTR_NOT_NULL(linphone_core_find_call_log_from_call_id(marie->lc, call_id)); - + BC_ASSERT_TRUE(linphone_address_equal( linphone_call_log_get_remote_address(call_log), linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc)))); @@ -5831,7 +5831,7 @@ static void call_logs_sqlite_storage(void) { BC_ASSERT_EQUAL(linphone_call_log_get_start_date(call_log), start_time, int, "%d"); BC_ASSERT_EQUAL(linphone_call_log_get_status(call_log), LinphoneCallSuccess, int, "%d"); } - + linphone_core_delete_call_log(marie->lc, (LinphoneCallLog *)ms_list_nth_data(logs, 0)); ms_list_free_with_data(logs, (void (*)(void*))linphone_call_log_unref); BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 0); @@ -5914,10 +5914,10 @@ static void _call_with_rtcp_mux(bool_t caller_rtcp_mux, bool_t callee_rtcp_mux, LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); const LinphoneCallParams *params; MSList *lcs = NULL; - + lcs = ms_list_append(lcs, marie->lc); lcs = ms_list_append(lcs, pauline->lc); - + if (caller_rtcp_mux){ lp_config_set_int(linphone_core_get_config(marie->lc), "rtp", "rtcp_mux", 1); } @@ -5934,21 +5934,21 @@ static void _call_with_rtcp_mux(bool_t caller_rtcp_mux, bool_t callee_rtcp_mux, lp_config_set_int(linphone_core_get_config(pauline->lc), "sip", "update_call_when_ice_completed", 0); lp_config_set_int(linphone_core_get_config(marie->lc), "sip", "update_call_when_ice_completed", 0); } - + if (!BC_ASSERT_TRUE(call(marie,pauline))) goto end; - + params = linphone_call_get_remote_params(linphone_core_get_current_call(pauline->lc)); BC_ASSERT_TRUE(caller_rtcp_mux == (linphone_call_params_get_custom_sdp_media_attribute(params, LinphoneStreamTypeAudio, "rtcp-mux") != NULL)); if (caller_rtcp_mux){ params = linphone_call_get_remote_params(linphone_core_get_current_call(marie->lc)); BC_ASSERT_TRUE(callee_rtcp_mux == (linphone_call_params_get_custom_sdp_media_attribute(params, LinphoneStreamTypeAudio, "rtcp-mux") != NULL)); } - + if (with_ice){ check_ice(marie, pauline, LinphoneIceStateHostConnection); } liblinphone_tester_check_rtcp(marie,pauline); - + if (caller_rtcp_mux && callee_rtcp_mux){ BC_ASSERT_EQUAL(marie->stat.number_of_rtcp_received_via_mux, marie->stat.number_of_rtcp_received, int, "%i"); BC_ASSERT_GREATER(marie->stat.number_of_rtcp_received, 0, int, "%i"); @@ -5958,10 +5958,10 @@ static void _call_with_rtcp_mux(bool_t caller_rtcp_mux, bool_t callee_rtcp_mux, BC_ASSERT_TRUE(marie->stat.number_of_rtcp_received_via_mux == 0); BC_ASSERT_TRUE(pauline->stat.number_of_rtcp_received_via_mux == 0); } - + check_media_direction(pauline, linphone_core_get_current_call(pauline->lc), lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionInvalid); end_call(marie,pauline); - + end: ms_list_free(lcs); linphone_core_manager_destroy(pauline); @@ -5986,18 +5986,18 @@ static void call_with_ice_and_rtcp_mux_without_reinvite(void){ static void call_with_zrtp_configured_calling_base(LinphoneCoreManager *marie, LinphoneCoreManager *pauline) { bool_t call_ok; - + linphone_core_set_media_encryption(marie->lc, LinphoneMediaEncryptionZRTP); BC_ASSERT_TRUE((call_ok=call(pauline,marie))); - + liblinphone_tester_check_rtcp(marie,pauline); - + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))) , LinphoneMediaEncryptionNone, int, "%i"); BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))) , LinphoneMediaEncryptionNone, int, "%i"); end_call(pauline, marie); - + } static void call_with_zrtp_configured_calling_side(void) { LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); @@ -6012,11 +6012,11 @@ static void call_with_zrtp_configured_calling_side(void) { linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce); linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce); call_with_zrtp_configured_calling_base(marie,pauline); - + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); - + } test_t call_tests[] = { TEST_NO_TAG("Early declined call", early_declined_call), From 028afb264d5ad7cb4ad1befdb49a40b00c47eb1d Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 16 Feb 2016 14:00:59 +0100 Subject: [PATCH 21/27] linphonecore.c: release adress after usage --- coreapi/linphonecore.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b07cb11a6..f13d67a48 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3854,22 +3854,21 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){ } int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char *redirect_uri){ - char *real_url=NULL; - LinphoneAddress *real_parsed_url=linphone_core_interpret_url(lc,redirect_uri); - - - if (!real_parsed_url){ - /* bad url */ - ms_error("Bad redirect URI: %s", redirect_uri?:"NULL"); - return -1; - } if (call->state==LinphoneCallIncomingReceived){ + char *real_url=NULL; + LinphoneAddress *real_parsed_url=linphone_core_interpret_url(lc,redirect_uri); + if (!real_parsed_url){ + /* bad url */ + ms_error("Bad redirect URI: %s", redirect_uri?:"NULL"); + return -1; + } real_url=linphone_address_as_string (real_parsed_url); sal_call_decline(call->op,SalReasonRedirect,real_url); ms_free(real_url); sal_error_info_set(&call->non_op_error,SalReasonRedirect,603,"Call redirected",NULL); terminate_call(lc,call); + linphone_address_unref(real_parsed_url); }else{ ms_error("Bad state for call redirection."); return -1; From 523cbd2febdaaa8e6662a5bf1708ab7fba451a70 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 17 Feb 2016 11:19:14 +0100 Subject: [PATCH 22/27] update ms2 and ortp --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 622a95ddc..cd636702f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 622a95ddcb9216d7e4a8ddb34709f39e39f798df +Subproject commit cd636702fa7af17469af8373a2ae27cac18e353d diff --git a/oRTP b/oRTP index e7995bc78..45ae584ce 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit e7995bc78c801eac78aa1aec0ab8a5b565a3ad25 +Subproject commit 45ae584ce2493860056a74ae0f31417a5194be8c From 7fd9db22ac3e11ca464b8cda22c15aeb798bc0cc Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 17 Feb 2016 17:30:00 +0100 Subject: [PATCH 23/27] port linphone-android to bctoolbox --- build/android/Android.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/android/Android.mk b/build/android/Android.mk index 8fa4c5555..f3cd9bc0a 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -124,6 +124,7 @@ LOCAL_C_INCLUDES += \ $(LOCAL_PATH)/../oRTP/include \ $(LOCAL_PATH)/../mediastreamer2/include \ $(LOCAL_PATH)/../mediastreamer2/src/audiofilters/ \ + $(LOCAL_PATH)/../../bctoolbox/include \ $(LOCAL_PATH)/../../belle-sip/include \ $(LOCAL_PATH)/../../../gen \ $(LOCAL_PATH)/../../externals/libxml2/include \ @@ -137,6 +138,7 @@ LOCAL_STATIC_LIBRARIES := \ libmediastreamer2 \ libortp \ libbellesip \ + libbctoolbox \ libgsm \ liblpxml2 From e30b6b36451cc5fb6f83b43d0d215fc725d268ef Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 17 Feb 2016 17:31:01 +0100 Subject: [PATCH 24/27] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index cd636702f..a3ce2bb81 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit cd636702fa7af17469af8373a2ae27cac18e353d +Subproject commit a3ce2bb81a4d6da1e68537196da2c8e07addc010 From 1c06fe5f7700bb5c94433004d4862ab9d0a94a03 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 17 Feb 2016 22:53:12 +0100 Subject: [PATCH 25/27] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index a3ce2bb81..19e101d26 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a3ce2bb81a4d6da1e68537196da2c8e07addc010 +Subproject commit 19e101d26bb39b47e0dd75038e5c68bbff1fc364 From 2cab9fe9813755c03dbb9ec13540cf99552f838f Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 18 Feb 2016 11:54:18 +0100 Subject: [PATCH 26/27] Try to convert ISO to UTF8 before generating xml entry for LpConfig dump --- coreapi/lpc2xml.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/coreapi/lpc2xml.c b/coreapi/lpc2xml.c index edef1f764..605c65297 100644 --- a/coreapi/lpc2xml.c +++ b/coreapi/lpc2xml.c @@ -24,6 +24,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #define LPC2XML_BZ 2048 +#define ISO_ENCODING "ISO-8859-1" + +static xmlChar* convert_iso_to_utf8(const char *in) { + xmlChar *out = NULL; + int ret, size, out_size, temp; + xmlCharEncodingHandlerPtr handler; + + size = (int)strlen(in) + 1; + out_size = size * 2 - 1; + out = ms_malloc((size_t)out_size); + + if (out) { + handler = xmlFindCharEncodingHandler(ISO_ENCODING); + if (!handler) { + ms_free(out); + return NULL; + } + + temp = size-1; + ret = handler->input(out, &out_size, (const xmlChar *)in, &temp); + if (ret < 0 || temp - size + 1) { + ms_free(out); + return NULL; + } else { + out = ms_realloc(out, out_size + 1); + out[out_size] = '\0'; + } + } + return out; +} struct _lpc2xml_context { const LpConfig *lpc; @@ -94,15 +124,24 @@ static void lpc2xml_genericxml_warning(void *ctx, const char *fmt, ...) { static int processEntry(const char *section, const char *entry, xmlNode *node, lpc2xml_context *ctx) { const char *content = lp_config_get_string(ctx->lpc, section, entry, NULL); + xmlChar *converted_content = NULL; if (content == NULL) { lpc2xml_log(ctx, LPC2XML_ERROR, "Issue when reading the lpc"); return -1; } - lpc2xml_log(ctx, LPC2XML_MESSAGE, "Set %s|%s = %s", section, entry, content); - // xmlNodeSetContent expects special characters to be escaped, xmlNodeAddContent doesn't (and escapes what needs to be) - xmlNodeSetContent(node, (const xmlChar *) ""); - xmlNodeAddContent(node, (const xmlChar *) content); + converted_content = convert_iso_to_utf8(content); + + if (converted_content) { + // xmlNodeSetContent expects special characters to be escaped, xmlNodeAddContent doesn't (and escapes what needs to be) + xmlNodeSetContent(node, (const xmlChar *) ""); + xmlNodeAddContent(node, (const xmlChar *) converted_content); + ms_free(converted_content); + } else { + // xmlNodeSetContent expects special characters to be escaped, xmlNodeAddContent doesn't (and escapes what needs to be) + xmlNodeSetContent(node, (const xmlChar *) ""); + xmlNodeAddContent(node, (const xmlChar *) content); + } if (lp_config_get_overwrite_flag_for_entry(ctx->lpc, section, entry) || lp_config_get_overwrite_flag_for_section(ctx->lpc, section)) { xmlSetProp(node, (const xmlChar *)"overwrite", (const xmlChar *) "true"); From 4bef511e53499a32f129b4e4475a47bec627bd79 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 18 Feb 2016 12:31:23 +0100 Subject: [PATCH 27/27] linphonecore.c: fix log collection --- coreapi/linphonecore.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f13d67a48..15a6bf815 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -169,7 +169,7 @@ const LinphoneAddress *linphone_core_get_current_call_remote_address(struct _Lin static void linphone_core_log_collection_handler(const char *domain, OrtpLogLevel level, const char *fmt, va_list args); void linphone_core_set_log_handler(OrtpLogFunc logfunc) { - if (ortp_logv_out == linphone_core_log_collection_handler) { + if (ortp_get_log_handler() == linphone_core_log_collection_handler) { ms_message("There is already a log collection handler, keep it"); liblinphone_log_func = logfunc; } else @@ -389,7 +389,7 @@ void linphone_core_enable_log_collection(LinphoneLogCollectionState state) { /* at first call of this function, set liblinphone_log_func to the current * ortp log function */ if( liblinphone_log_func == NULL ){ - liblinphone_log_func = ortp_logv_out; + liblinphone_log_func = ortp_get_log_handler(); } liblinphone_log_collection_state = state; if (state != LinphoneLogCollectionDisabled) { @@ -397,7 +397,7 @@ void linphone_core_enable_log_collection(LinphoneLogCollectionState state) { if (state == LinphoneLogCollectionEnabledWithoutPreviousLogHandler) { liblinphone_log_func = NULL; } else { - liblinphone_log_func = ortp_logv_out; + liblinphone_log_func = ortp_get_log_handler(); } ortp_set_log_handler(linphone_core_log_collection_handler); } else {