Merge branch 'master' into dev_vcard

Conflicts:
	coreapi/friendlist.c
	java/common/org/linphone/core/LinphoneCore.java
This commit is contained in:
Sylvain Berfini 2016-02-18 14:25:06 +01:00
commit 1ed3fccf3a
21 changed files with 290 additions and 222 deletions

View file

@ -93,9 +93,11 @@ 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_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake")
else()
find_package(BelleSIP REQUIRED)
find_package(Mediastreamer2 REQUIRED)
find_package(BcToolBox REQUIRED)
endif()
find_package(XML2 REQUIRED)
find_package(Zlib)
@ -199,6 +201,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})

View file

@ -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

View file

@ -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);
@ -1243,12 +1245,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;
}
@ -1261,6 +1267,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 +1284,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);

View file

@ -148,6 +148,7 @@ add_definitions(
)
set(LIBS
${BCTOOLBOX_LIBRARIES}
${BELLESIP_LIBRARIES}
${MEDIASTREAMER2_LIBRARIES}
${XML2_LIBRARIES}

View file

@ -1039,7 +1039,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);

View file

@ -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*/

View file

@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphonecore.h"
#include "private.h"
#include <polarssl/md5.h>
#include <bctoolbox/crypto.h>
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneFriendListCbs);
@ -605,7 +605,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);

View file

@ -4,19 +4,8 @@
#endif
#ifdef HAVE_LIME
#include "linphonecore.h"
#include "ortp/b64.h"
#include "polarssl/gcm.h"
/* check polarssl version */
#include <polarssl/version.h>
#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;

View file

@ -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);

View file

@ -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 {
@ -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);
@ -1716,14 +1716,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));
@ -3900,10 +3900,21 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){
}
int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char *redirect_uri){
if (call->state==LinphoneCallIncomingReceived){
sal_call_decline(call->op,SalReasonRedirect,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;
}
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;
@ -4566,10 +4577,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;
}
/**
@ -4580,10 +4588,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;
}
/**
@ -5936,6 +5941,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;
}
@ -6529,7 +6538,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);
}

View file

@ -3703,6 +3703,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()).

View file

@ -7174,3 +7174,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);
}

View file

@ -24,6 +24,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <libxml/xmlversion.h>
#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");

View file

@ -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

View file

@ -2297,4 +2297,9 @@ public interface LinphoneCore {
* Passing null restores the default behaviour, which is to use the dns server list provided by the system.
**/
public void setDnsServers(String servers[]);
/**
* Set user certificates directory path (used by SRTP-DTLS).
*/
public void setUserCertificatesPath(String path);
}

View file

@ -1647,4 +1647,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);
}
}

@ -1 +1 @@
Subproject commit 43de256e523896f35387b4fa286c80e054591d78
Subproject commit 19e101d26bb39b47e0dd75038e5c68bbff1fc364

2
oRTP

@ -1 +1 @@
Subproject commit 1d533c7490475b26a29f3fce300ac7004ab74a88
Subproject commit 45ae584ce2493860056a74ae0f31417a5194be8c

View file

@ -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

View file

@ -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),

View file

@ -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