Merge branch 'master' of git.linphone.org:linphone into bc_vfs

This commit is contained in:
Sandrine Avakian 2016-05-06 15:46:07 +02:00
commit 01d2634738
7 changed files with 129 additions and 19 deletions

View file

@ -27,7 +27,7 @@
# ICONV_LIBRARIES - The libraries needed to use libiconv
if(APPLE AND NOT IOS)
set(ICONV_HINTS "/usr")
set(ICONV_HINTS "${CMAKE_OSX_SYSROOT}/usr" "/usr")
endif()
if(ICONV_HINTS)
set(ICONV_LIBRARIES_HINTS "${ICONV_HINTS}/lib")

View file

@ -329,7 +329,6 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage
if (cr->call && linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(cr->call))) {
uint32_t new_line = 0x2028;
linphone_chat_message_put_char(msg, new_line); // New Line
linphone_chat_message_set_state(msg, LinphoneChatMessageStateDelivered);
linphone_chat_message_unref(msg);
return;
}
@ -867,7 +866,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
if (character == new_line || character == crlf || character == lf) {
// End of message
LinphoneChatMessage *msg = cr->pending_message;
ms_message("New line received, forge a message with content %s", cr->pending_message->message);
ms_debug("New line received, forge a message with content %s", cr->pending_message->message);
linphone_chat_message_set_from(msg, cr->peer_url);
if (msg->to)
@ -878,7 +877,10 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
msg->state = LinphoneChatMessageStateDelivered;
msg->is_read = FALSE;
msg->dir = LinphoneChatMessageIncoming;
msg->storage_id = linphone_chat_message_store(msg);
if (lp_config_get_int(lc->config, "misc", "store_rtt_messages", 1) == 1) {
msg->storage_id = linphone_chat_message_store(msg);
}
if (cr->unread_count < 0) cr->unread_count = 1;
else cr->unread_count++;
@ -890,7 +892,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
} else {
char *value = utf8_to_char(character);
cr->pending_message->message = ms_strcat_printf(cr->pending_message->message, value);
ms_message("Received RTT character: %s (%lu), pending text is %s", value, (unsigned long)character, cr->pending_message->message);
ms_debug("Received RTT character: %s (%lu), pending text is %s", value, (unsigned long)character, cr->pending_message->message);
ms_free(value);
}
}
@ -911,15 +913,39 @@ uint32_t linphone_chat_room_get_char(const LinphoneChatRoom *cr) {
return 0;
}
int linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t charater) {
int linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t character) {
LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg);
LinphoneCall *call = cr->call;
LinphoneCore *lc = cr->lc;
uint32_t new_line = 0x2028;
uint32_t crlf = 0x0D0A;
uint32_t lf = 0x0A;
if (!call || !call->textstream) {
return -1;
}
text_stream_putchar32(call->textstream, charater);
if (character == new_line || character == crlf || character == lf) {
if (lc && lp_config_get_int(lc->config, "misc", "store_rtt_messages", 1) == 1) {
ms_debug("New line sent, forge a message with content %s", msg->message);
msg->time = ms_time(0);
msg->state = LinphoneChatMessageStateDelivered;
msg->is_read = TRUE;
msg->dir = LinphoneChatMessageOutgoing;
if (msg->from) linphone_address_destroy(msg->from);
msg->from = linphone_address_new(linphone_core_get_identity(lc));
msg->storage_id = linphone_chat_message_store(msg);
ms_free(msg->message);
msg->message = NULL;
}
} else {
char *value = utf8_to_char(character);
msg->message = ms_strcat_printf(msg->message, value);
ms_debug("Sent RTT character: %s (%lu), pending text is %s", value, (unsigned long)character, msg->message);
ms_free(value);
}
text_stream_putchar32(call->textstream, character);
return 0;
}

View file

@ -4367,7 +4367,8 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
case IS_Failed:
/* At least one ICE session has succeeded, so perform a call update. */
if (ice_session_has_completed_check_list(call->ice_session) == TRUE) {
if (ice_session_role(call->ice_session) == IR_Controlling && call->params->update_call_when_ice_completed ) {
const LinphoneCallParams *current_param = linphone_call_get_current_params(call);
if (ice_session_role(call->ice_session) == IR_Controlling && current_param->update_call_when_ice_completed ) {
LinphoneCallParams *params = linphone_core_create_call_params(call->core, call);
params->internal_call_update = TRUE;
linphone_core_update_call(call->core, call, params);

View file

@ -161,8 +161,10 @@ void linphone_core_register_offer_answer_providers(LinphoneCore *lc){
static PayloadType * find_payload_type_best_match(MSFactory *factory, const MSList *local_payloads, const PayloadType *refpt,
const MSList *remote_payloads, bool_t reading_response){
PayloadType *ret = NULL;
MSOfferAnswerContext *ctx = ms_factory_create_offer_answer_context(factory, refpt->mime_type);
if (ctx){
MSOfferAnswerContext *ctx = NULL;
// When a stream is inactive, refpt->mime_type might be null
if (refpt->mime_type && (ctx = ms_factory_create_offer_answer_context(factory, refpt->mime_type))) {
ms_message("Doing offer/answer processing with specific provider for codec [%s]", refpt->mime_type);
ret = ms_offer_answer_context_match_payload(ctx, local_payloads, refpt, remote_payloads, reading_response);
ms_offer_answer_context_destroy(ctx);
@ -223,6 +225,7 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL
*/
matched=payload_type_clone(matched);
payload_type_set_number(matched,local_number);
payload_type_set_flag(matched, PAYLOAD_TYPE_FLAG_CAN_RECV);
payload_type_set_flag(matched, PAYLOAD_TYPE_FROZEN_NUMBER);
res=ms_list_append(res,matched);
}

@ -1 +1 @@
Subproject commit 066b148a7648fcb93c0e97523854a3b629c59092
Subproject commit 72de22a29e2f6d7330ee3ed6854437692f178a8f

View file

@ -4266,6 +4266,41 @@ end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void call_with_very_early_call_update(void) {
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
LinphoneCallParams *params;
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
linphone_core_invite_address(marie->lc,pauline->identity);
BC_ASSERT_TRUE (wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallIncomingReceived,1));
BC_ASSERT_TRUE(linphone_core_inc_invite_pending(pauline->lc));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingProgress,1, int, "%d");
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallOutgoingRinging,1));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(pauline->lc));
if (linphone_core_get_current_call_remote_address(pauline->lc)) {
linphone_core_accept_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,1));
}
params=linphone_core_create_call_params(pauline->lc,linphone_core_get_current_call(pauline->lc));
linphone_core_update_call(pauline->lc,linphone_core_get_current_call(pauline->lc),params);
linphone_call_params_destroy(params);
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallUpdating,1));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdatedByRemote,1));
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));
end_call(marie,pauline);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void call_with_in_dialog_codec_change_base(bool_t no_sdp) {
int dummy=0;
LinphoneCoreManager* marie;
@ -6392,6 +6427,7 @@ test_t call_tests[] = {
TEST_NO_TAG("Call with no audio codec", call_with_no_audio_codec),
TEST_NO_TAG("Video call with no audio and no video codec", video_call_with_no_audio_and_no_video_codec),
TEST_NO_TAG("Call with in-dialog UPDATE request", call_with_in_dialog_update),
TEST_NO_TAG("Call with in-dialog very early call request", call_with_very_early_call_update),
TEST_NO_TAG("Call with in-dialog codec change", call_with_in_dialog_codec_change),
TEST_NO_TAG("Call with in-dialog codec change no sdp", call_with_in_dialog_codec_change_no_sdp),
TEST_NO_TAG("Call with pause no SDP on resume", call_with_paused_no_sdp_on_resume),

View file

@ -1333,12 +1333,24 @@ static void file_transfer_io_error_after_destroying_chatroom(void) {
file_transfer_io_error_base("https://www.linphone.org:444/lft.php", TRUE);
}
static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, bool_t mess_with_marie_payload_number, bool_t mess_with_pauline_payload_number, bool_t ice_enabled) {
static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, bool_t mess_with_marie_payload_number, bool_t mess_with_pauline_payload_number,
bool_t ice_enabled, bool_t sql_storage, bool_t do_not_store_rtt_messages_in_sql_storage) {
LinphoneChatRoom *pauline_chat_room;
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCallParams *marie_params = NULL;
LinphoneCall *pauline_call, *marie_call;
char *marie_db = bc_tester_file("marie.db");
char *pauline_db = bc_tester_file("pauline.db");
if (sql_storage) {
linphone_core_set_chat_database_path(marie->lc, marie_db);
linphone_core_set_chat_database_path(pauline->lc, pauline_db);
if (do_not_store_rtt_messages_in_sql_storage) {
lp_config_set_int(marie->lc->config, "misc", "store_rtt_messages", 0);
lp_config_set_int(pauline->lc->config, "misc", "store_rtt_messages", 0);
}
}
if (mess_with_marie_payload_number) {
MSList *elem;
@ -1405,6 +1417,24 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
}
linphone_chat_room_send_chat_message(pauline_chat_room, rtt_message);
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
if (sql_storage) {
MSList *marie_messages = linphone_chat_room_get_history(marie_chat_room, 0);
MSList *pauline_messages = linphone_chat_room_get_history(pauline_chat_room, 0);
if (do_not_store_rtt_messages_in_sql_storage) {
BC_ASSERT_EQUAL(ms_list_size(marie_messages), 0, int , "%i");
BC_ASSERT_EQUAL(ms_list_size(pauline_messages), 0, int , "%i");
} else {
LinphoneChatMessage *marie_msg = (LinphoneChatMessage *)marie_messages->data;
LinphoneChatMessage *pauline_msg = (LinphoneChatMessage *)pauline_messages->data;
BC_ASSERT_EQUAL(ms_list_size(marie_messages), 1, int , "%i");
BC_ASSERT_EQUAL(ms_list_size(pauline_messages), 1, int , "%i");
BC_ASSERT_STRING_EQUAL(marie_msg->message, message);
BC_ASSERT_STRING_EQUAL(pauline_msg->message, message);
ms_list_free_with_data(marie_messages, (void (*)(void *))linphone_chat_message_unref);
ms_list_free_with_data(pauline_messages, (void (*)(void *))linphone_chat_message_unref);
}
}
}
if (!audio_stream_enabled) {
@ -1423,10 +1453,22 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
linphone_call_params_destroy(marie_params);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
remove(marie_db);
bc_free(marie_db);
remove(pauline_db);
bc_free(pauline_db);
}
static void real_time_text_message(void) {
real_time_text(TRUE, FALSE, FALSE, FALSE, FALSE);
real_time_text(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
}
static void real_time_text_sql_storage(void) {
real_time_text(TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE);
}
static void real_time_text_sql_storage_rtt_disabled(void) {
real_time_text(TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
}
static void real_time_text_conversation(void) {
@ -1529,15 +1571,15 @@ static void real_time_text_conversation(void) {
}
static void real_time_text_without_audio(void) {
real_time_text(FALSE, FALSE, FALSE, FALSE, FALSE);
real_time_text(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
}
static void real_time_text_srtp(void) {
real_time_text(TRUE, TRUE, FALSE, FALSE, FALSE);
real_time_text(TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
}
static void real_time_text_ice(void) {
real_time_text(TRUE, FALSE, FALSE, FALSE, TRUE);
real_time_text(TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE);
}
static void real_time_text_message_compat(bool_t end_with_crlf, bool_t end_with_lf) {
@ -1646,11 +1688,11 @@ static void real_time_text_message_accented_chars(void) {
}
static void real_time_text_message_different_text_codecs_payload_numbers_sender_side(void) {
real_time_text(FALSE, FALSE, TRUE, FALSE, FALSE);
real_time_text(FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE);
}
static void real_time_text_message_different_text_codecs_payload_numbers_receiver_side(void) {
real_time_text(FALSE, FALSE, FALSE, TRUE, FALSE);
real_time_text(FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE);
}
static void real_time_text_copy_paste(void) {
@ -1748,6 +1790,8 @@ test_t message_tests[] = {
TEST_ONE_TAG("Transfer not sent if url moved permanently", file_transfer_not_sent_if_url_moved_permanently, "LeaksMemory"),
TEST_ONE_TAG("Transfer io error after destroying chatroom", file_transfer_io_error_after_destroying_chatroom, "LeaksMemory"),
TEST_NO_TAG("Real Time Text message", real_time_text_message),
TEST_NO_TAG("Real Time Text SQL storage", real_time_text_sql_storage),
TEST_NO_TAG("Real Time Text SQL storage with RTT messages not stored", real_time_text_sql_storage_rtt_disabled),
TEST_NO_TAG("Real Time Text conversation", real_time_text_conversation),
TEST_NO_TAG("Real Time Text without audio", real_time_text_without_audio),
TEST_NO_TAG("Real Time Text with srtp", real_time_text_srtp),