From 74a5945acf833f985167e9d266deec9d2b027aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Tue, 5 Jul 2016 15:29:41 +0200 Subject: [PATCH 01/45] Fix auto answer delay setting on Windows --- gtk/linphone.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/linphone.h b/gtk/linphone.h index 865b0bc7a..764663508 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -364,6 +364,7 @@ LINPHONE_PUBLIC void linphone_gtk_reload_sound_devices(void); LINPHONE_PUBLIC void linphone_gtk_reload_video_devices(void); LINPHONE_PUBLIC bool_t linphone_gtk_is_friend(LinphoneCore *lc, const char *contact); LINPHONE_PUBLIC gboolean linphone_gtk_auto_answer_enabled(void); +LINPHONE_PUBLIC void linphone_gtk_auto_answer_delay_changed(GtkSpinButton *spinbutton, gpointer user_data); LINPHONE_PUBLIC void linphone_gtk_update_status_bar_icons(void); LINPHONE_PUBLIC void linphone_gtk_enable_auto_answer(GtkToggleButton *checkbox, gpointer user_data); From b3ed363618db38f69eb86922fca4740a56f9923e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 5 Jul 2016 18:35:44 +0200 Subject: [PATCH 02/45] fix crash on windows when moving the video window frequently --- gtk/videowindow.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/gtk/videowindow.c b/gtk/videowindow.c index 145ef084a..09938d444 100644 --- a/gtk/videowindow.c +++ b/gtk/videowindow.c @@ -121,7 +121,7 @@ static void _resize_video_window(GtkWidget *video_window, MSVideoSize vsize){ } } -static gint resize_video_window(LinphoneCall *call){ +static gboolean resize_video_window(LinphoneCall *call){ const LinphoneCallParams *params=linphone_call_get_current_params(call); if (params){ MSVideoSize vsize=linphone_call_params_get_received_video_size(params); @@ -232,6 +232,18 @@ static gboolean video_window_moved(GtkWidget *widget, GdkEvent *event, gpointer return FALSE; } +static gint do_gtk_widget_destroy(GtkWidget *w){ + gtk_widget_destroy(w); + return FALSE; +} + +static void schedule_video_controls_disapearance(GtkWidget *w){ + gint timeout=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"timeout")); + if (timeout != 0) g_source_remove(timeout); + timeout=g_timeout_add(3000,(GSourceFunc)do_gtk_widget_destroy,w); + g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout)); +} + static GtkWidget *show_video_controls(GtkWidget *video_window){ GtkWidget *w; w=(GtkWidget*)g_object_get_data(G_OBJECT(video_window),"controls"); @@ -240,7 +252,6 @@ static GtkWidget *show_video_controls(GtkWidget *video_window){ const char *stock_button=isfullscreen ? GTK_STOCK_LEAVE_FULLSCREEN : GTK_STOCK_FULLSCREEN; gint response_id=isfullscreen ? GTK_RESPONSE_NO : GTK_RESPONSE_YES ; GtkWidget *image = gtk_image_new_from_icon_name(linphone_gtk_get_ui_config("stop_call_icon_name","linphone-stop-call"), GTK_ICON_SIZE_BUTTON); - gint timeout; GtkWidget *button; w=gtk_dialog_new_with_buttons("",GTK_WINDOW(video_window),GTK_DIALOG_DESTROY_WITH_PARENT,stock_button,response_id,NULL); gtk_window_set_opacity(GTK_WINDOW(w),0.5); @@ -255,18 +266,14 @@ static GtkWidget *show_video_controls(GtkWidget *video_window){ gtk_widget_show(button); gtk_dialog_add_action_widget(GTK_DIALOG(w),button,GTK_RESPONSE_APPLY); g_signal_connect(w,"response",(GCallback)on_controls_response,video_window); - timeout=g_timeout_add(3000,(GSourceFunc)gtk_widget_destroy,w); - g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout)); + schedule_video_controls_disapearance(w); g_signal_connect(w,"destroy",(GCallback)on_controls_destroy,NULL); g_object_set_data(G_OBJECT(w),"video_window",video_window); g_object_set_data(G_OBJECT(video_window),"controls",w); set_video_controls_position(video_window); gtk_widget_show(w); }else{ - gint timeout=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"timeout")); - g_source_remove(timeout); - timeout=g_timeout_add(3000,(GSourceFunc)gtk_widget_destroy,w); - g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout)); + schedule_video_controls_disapearance(w); } return w; } From 46bfc7431a373b4c4843f14865ef75a240c41b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Wed, 6 Jul 2016 14:44:48 +0200 Subject: [PATCH 03/45] Replace non-ascii characters in COPYING --- COPYING | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/COPYING b/COPYING index 365b8c279..ce1d99769 100644 --- a/COPYING +++ b/COPYING @@ -349,7 +349,7 @@ About The Cisco-Provided Binary of OpenH264 Video Codec Cisco provides this program under the terms of the BSD license. -Additionally, this binary is licensed under Cisco’s AVC/H.264 Patent Portfolio +Additionally, this binary is licensed under Cisco's AVC/H.264 Patent Portfolio License from MPEG LA, at no cost to you, provided that the requirements and conditions shown below in the AVC/H.264 Patent Portfolio sections are met. @@ -367,7 +367,7 @@ BSD terms, which can be found at http://www.openh264.org BSD License ----------- -Copyright © 2014 Cisco Systems, Inc. +Copyright (C) 2014 Cisco Systems, Inc. All rights reserved. From b211fd7175585c084ed6b7f701e7afff5a49b39a Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 6 Jul 2016 16:39:33 +0200 Subject: [PATCH 04/45] Changing max auto answer delay to 30s instead of 60s. --- gtk/parameters.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/parameters.ui b/gtk/parameters.ui index 511066899..bb90ccefe 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -53,7 +53,7 @@ 10 - 60000 + 30000 2000 100 500 From ec2ff4e8fdbd3584dffeb9e836d3666ddba23072 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 6 Jul 2016 17:11:03 +0200 Subject: [PATCH 05/45] Another attempt to fix crash on windows when moving video window --- gtk/videowindow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gtk/videowindow.c b/gtk/videowindow.c index 09938d444..10c4a8173 100644 --- a/gtk/videowindow.c +++ b/gtk/videowindow.c @@ -196,14 +196,17 @@ static void on_controls_response(GtkWidget *dialog, int response_id, GtkWidget * } -static void on_controls_destroy(GtkWidget *w){ +static gboolean on_controls_destroy(GtkWidget *w){ GtkWidget *video_window=(GtkWidget*)g_object_get_data(G_OBJECT(w),"video_window"); gint timeout=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"timeout")); if (timeout!=0){ g_source_remove(timeout); g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(0)); } - g_object_set_data(G_OBJECT(video_window),"controls",NULL); + if (video_window) { + g_object_set_data(G_OBJECT(video_window),"controls",NULL); + } + return FALSE; } static gboolean _set_video_controls_position(GtkWidget *video_window){ From d6bccae005f0ffe55f1fc0687b74dfb91909c76e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 8 Jul 2016 13:41:57 +0200 Subject: [PATCH 06/45] Ask the user to restart Linphone after setting the remote provisioning URI on Windows --- gtk/config-fetching.c | 30 ++++++++++++++++++++++++------ gtk/config-uri.ui | 6 ++---- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/gtk/config-fetching.c b/gtk/config-fetching.c index b1794eea9..88f433da6 100644 --- a/gtk/config-fetching.c +++ b/gtk/config-fetching.c @@ -36,12 +36,30 @@ void linphone_gtk_config_uri_changed(GtkWidget *button){ if (uri && (strlen(uri)==0 || strcmp(uri,"https://")==0)) uri=NULL; - linphone_core_set_provisioning_uri(linphone_gtk_get_core(),uri); - gtk_widget_destroy(w); - - if (uri){ - linphone_gtk_schedule_restart(); - gtk_main_quit(); + if(linphone_core_set_provisioning_uri(linphone_gtk_get_core(),uri) == 0) { + gtk_widget_destroy(w); + if (uri){ +#ifndef _WIN32 + linphone_gtk_schedule_restart(); + gtk_main_quit(); +#else + GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(linphone_gtk_get_main_window()), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + _("Remote provisioning URI successfully set. Please restart Linphone in order to load the new remote settings")); + g_signal_connect_swapped(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), dialog); + gtk_widget_show(dialog); +#endif + } + } else { + GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(w), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + _("Invalid remote provisioning URI")); + g_signal_connect_swapped(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), dialog); + gtk_widget_show(dialog); } } diff --git a/gtk/config-uri.ui b/gtk/config-uri.ui index cc99c40db..26c1fef0e 100644 --- a/gtk/config-uri.ui +++ b/gtk/config-uri.ui @@ -19,11 +19,10 @@ end - gtk-undo + gtk-cancel True True True - False True @@ -39,7 +38,6 @@ True True True - False True @@ -77,7 +75,7 @@ Please enter or modify the configuration URI below. After clicking OK, Linphone True True - https:// + https:// False False True From bba243e32e657957f204e13f50afcc8c5dffa000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 8 Jul 2016 13:54:48 +0200 Subject: [PATCH 07/45] Change the type of the dialog that show when an invalid remote provisioning URI has been entered --- gtk/config-fetching.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/config-fetching.c b/gtk/config-fetching.c index 88f433da6..e8c7b0113 100644 --- a/gtk/config-fetching.c +++ b/gtk/config-fetching.c @@ -55,7 +55,7 @@ void linphone_gtk_config_uri_changed(GtkWidget *button){ } else { GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(w), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Invalid remote provisioning URI")); g_signal_connect_swapped(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), dialog); From 8539d068d2b3ed9c3af49ff2339cd4ac4ce05457 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 8 Jul 2016 11:50:51 +0200 Subject: [PATCH 08/45] Big AES patch --- coreapi/misc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index 6f713553c..f981e951f 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -1748,8 +1748,7 @@ void linphone_core_set_tone(LinphoneCore *lc, LinphoneToneID id, const char *aud } const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc){ - const char *config=lp_config_get_string(lc->config,"sip","srtp_crypto_suites","AES_CM_128_HMAC_SHA1_80, AES_CM_128_HMAC_SHA1_32, AES_CM_256_HMAC_SHA1_80, AES_CM_256_HMAC_SHA1_32"); - char *tmp=ms_strdup(config); + const char *config= lp_config_get_string(lc->config, "sip", "srtp_crypto_suites", "AES_CM_128_HMAC_SHA1_80, AES_CM_128_HMAC_SHA1_32, AES_256_CM_HMAC_SHA1_80, AES_256_CM_HMAC_SHA1_32"); char *sep; char *pos; char *nextpos; From bf149410eaf1a0d7e4b326816c4727aa0bd7425b Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 8 Jul 2016 15:04:54 +0200 Subject: [PATCH 09/45] Fix small error in AES patch. --- coreapi/misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coreapi/misc.c b/coreapi/misc.c index f981e951f..ec1986896 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -1749,6 +1749,8 @@ void linphone_core_set_tone(LinphoneCore *lc, LinphoneToneID id, const char *aud const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc){ const char *config= lp_config_get_string(lc->config, "sip", "srtp_crypto_suites", "AES_CM_128_HMAC_SHA1_80, AES_CM_128_HMAC_SHA1_32, AES_256_CM_HMAC_SHA1_80, AES_256_CM_HMAC_SHA1_32"); + char *tmp=ms_strdup(config); + char *sep; char *pos; char *nextpos; From aa595964110a5c04ed67211bc6bb943323afbc1d Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 8 Jul 2016 15:45:45 +0200 Subject: [PATCH 10/45] Bug fix for video window moving around on windows. --- gtk/videowindow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/videowindow.c b/gtk/videowindow.c index 10c4a8173..add0d4207 100644 --- a/gtk/videowindow.c +++ b/gtk/videowindow.c @@ -231,7 +231,8 @@ static void set_video_controls_position(GtkWidget *video_window){ } static gboolean video_window_moved(GtkWidget *widget, GdkEvent *event, gpointer user_data){ - set_video_controls_position(widget); + /*Workaround to Video window bug on Windows. */ + /* set_video_controls_position(widget); */ return FALSE; } From 916f1c6fafb16420f30afb1cadd3ef3c99e57c96 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 8 Jul 2016 16:04:52 +0200 Subject: [PATCH 11/45] Update to mediastreamer 2.14.x --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index ba0fd4218..72baa3cac 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ba0fd4218dada7c6f3e923e68c756dd2d333bbcc +Subproject commit 72baa3cacd593da76bbc8d2f701ee99a8b869d43 From 973591c7154b8f1893877390672e09deb2ca5c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Tue, 12 Jul 2016 10:12:59 +0200 Subject: [PATCH 12/45] [Regression fix] disable the conference butten when there is only one call --- gtk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/main.c b/gtk/main.c index 161aa9593..7f4bc4721 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -816,7 +816,7 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){ conf_frame=(GtkWidget *)g_object_get_data(G_OBJECT(mw),"conf_frame"); if(conf_frame==NULL){ linphone_gtk_enable_transfer_button(lc,call_list_size>1); - linphone_gtk_enable_conference_button(lc,call_list_size>0); + linphone_gtk_enable_conference_button(lc,call_list_size>1); } else { linphone_gtk_enable_transfer_button(lc,FALSE); linphone_gtk_enable_conference_button(lc,FALSE); From 16353f4e3c8f1318cd84bea28b5e5dce25f38354 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 21 Jul 2016 14:22:12 +0200 Subject: [PATCH 13/45] Remove default route when configuring already existing linphone account in the wizard. Forcing setting empty route. --- coreapi/account_creator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index 4469bc7d1..db7179336 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -455,7 +455,7 @@ LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCr linphone_address_set_transport(addr, LinphoneTransportTls); tmp = linphone_address_as_string(addr); linphone_proxy_config_set_server_addr(cfg, tmp); - linphone_proxy_config_set_route(cfg, tmp); + linphone_proxy_config_set_route(cfg, ""); ms_free(tmp); linphone_address_destroy(addr); } From 485fd4749543873b8d7cde17561050798ee9a78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 22 Jul 2016 12:12:47 +0200 Subject: [PATCH 14/45] Do not install liblinphone_tester on iOS --- tester/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index 75aee8e7b..addc18dc5 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -268,13 +268,13 @@ if (NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") endif() endif() - install(TARGETS liblinphone_tester - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) if(NOT IOS) + install(TARGETS liblinphone_tester + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) install(FILES ${OTHER_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester") install(FILES ${SOUND_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/sounds") install(FILES ${SIPP_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/sipp") From f54ae3285449f77e4a4ee916669ebed97887711d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 22 Jul 2016 13:51:08 +0200 Subject: [PATCH 15/45] Update mediastreamer2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 72baa3cac..b0dc4e259 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 72baa3cacd593da76bbc8d2f701ee99a8b869d43 +Subproject commit b0dc4e259f44a45a173e020794b2a75191afb4e9 From 834c52392f582faec6cbead78efbe5f53fe742c8 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 25 Jul 2016 11:49:01 +0200 Subject: [PATCH 16/45] Fix Mantis 3208 - MAC - using a valid remote uri in remote provisioning makes linphone crash --- gtk/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/main.c b/gtk/main.c index 7f4bc4721..c9fa4255f 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1938,6 +1938,7 @@ static void linphone_gtk_init_main_window(void){ G_CALLBACK (linphone_gtk_close), main_window); #ifdef HAVE_GTK_OSX { + gtk_widget_show(main_window); GtkWidget *menubar=linphone_gtk_get_widget(main_window,"menubar1"); GtkosxApplication *theMacApp = gtkosx_application_get(); gtkosx_application_set_menu_bar(theMacApp,GTK_MENU_SHELL(menubar)); From 8d9084ce8ef91ecccb4019cb0b102363f5be232d Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 25 Jul 2016 14:23:17 +0200 Subject: [PATCH 17/45] improve chat --- coreapi/message_storage.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/coreapi/message_storage.c b/coreapi/message_storage.c index 2fd76e053..43dd49862 100644 --- a/coreapi/message_storage.c +++ b/coreapi/message_storage.c @@ -85,7 +85,7 @@ int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) { * We workaround by asking that the open is made with no protection*/ flags |= SQLITE_OPEN_FILEPROTECTION_NONE; #endif - + /*since we plug our vfs into sqlite, we convert to UTF-8. * On Windows, the filename has to be converted back to windows native charset.*/ char *utf8_filename = utf8_convert(db_file); @@ -209,16 +209,15 @@ static int create_chat_message(void *data, int argc, char **argv, char **colName // check if the message exists in the transient list, in which case we should return that one. LinphoneChatMessage* new_message = get_transient_message(cr, storage_id); if( new_message == NULL ){ - LinphoneAddress *local_addr=linphone_address_new(argv[1]); new_message = linphone_chat_room_create_message(cr, argv[4]); if(atoi(argv[3])==LinphoneChatMessageIncoming){ new_message->dir=LinphoneChatMessageIncoming; linphone_chat_message_set_from(new_message,linphone_chat_room_get_peer_address(cr)); - new_message->to = local_addr; /*direct assignation to avoid a copy*/ + new_message->to = NULL; /*will be filled at the end */ } else { new_message->dir=LinphoneChatMessageOutgoing; - new_message->from = local_addr; /*direct assignation to avoid a copy*/ + new_message->from = NULL; /*will be filled at the end */ linphone_chat_message_set_to(new_message,linphone_chat_room_get_peer_address(cr)); } @@ -491,16 +490,33 @@ bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int sta ms_free(buf); buf = buf2; } - + begin=ortp_get_cur_time_ms(); linphone_sql_request_message(lc->db,buf,cr); end=ortp_get_cur_time_ms(); - + if (endm+1-startm > 1) { //display message only if at least 2 messages are loaded ms_message("%s(): completed in %i ms",__FUNCTION__, (int)(end-begin)); } ms_free(buf); + + if (cr->messages_hist) { + //fill local addr with core identity instead of per message + LinphoneAddress* local_addr = linphone_address_new(linphone_core_get_identity(cr->lc)); + bctbx_list_t* it = cr->messages_hist; + while (it) { + LinphoneChatMessage* msg = it->data; + if (msg->dir == LinphoneChatMessageOutgoing) { + msg->from = linphone_address_ref(local_addr); + } else { + msg->to = linphone_address_ref(local_addr); + } + it = it->next; + } + linphone_address_unref(local_addr); + } + ret=cr->messages_hist; cr->messages_hist=NULL; ms_free(peer); @@ -650,7 +666,7 @@ void linphone_update_table(sqlite3* db) { ms_debug("Table content successfully created."); } } - + // new fields for content key storage when using lime ret=sqlite3_exec(db,"ALTER TABLE content ADD COLUMN key_size INTEGER;",NULL,NULL,&errmsg); if(ret != SQLITE_OK) { From c5d86ae5ae06c9ba8ba597b56995f421e7aa49ee Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 26 Jul 2016 16:20:45 +0200 Subject: [PATCH 18/45] Fix: imported friend from Vcard not saved in DB. --- coreapi/friendlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index cf1b6a456..18f5c970a 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -793,6 +793,7 @@ int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *lis LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard); if (lf) { if (LinphoneFriendListOK == linphone_friend_list_import_friend(list, lf, TRUE)) { + linphone_friend_save(lf,lf->lc); count++; } linphone_friend_unref(lf); From 64829432e4d6cfa599568cc31daf8e02325d3e7d Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 27 Jul 2016 12:34:28 +0200 Subject: [PATCH 19/45] Update ORTP. --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 96f89c625..7de595181 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 96f89c62589f9fb84c78be2a092dc94a016ec775 +Subproject commit 7de595181e8e0f6cfd77db7054b0b7bf71d067d2 From 37a2fd43e6d3c4d89357d4b7ff89138b9ef84de3 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 19 Jul 2016 12:23:17 +0200 Subject: [PATCH 20/45] fix bc_vfs header --- console/linphonec.c | 2 +- coreapi/lpconfig.c | 2 +- coreapi/private.h | 2 +- coreapi/sqlite3_bctbx_vfs.h | 2 +- gtk/calllogs.c | 2 +- gtk/chat.c | 2 +- gtk/friendlist.c | 2 +- gtk/main.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/console/linphonec.c b/console/linphonec.c index 899ffe61c..a805aed7a 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -37,7 +37,7 @@ #include #include "linphonec.h" -#include +#include #ifdef _WIN32 #include diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index ace08362b..2f5353b39 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -25,7 +25,7 @@ #define MAX_LEN 16384 #include "linphonecore.h" -#include "bctoolbox/bc_vfs.h" +#include "bctoolbox/vfs.h" #include #include diff --git a/coreapi/private.h b/coreapi/private.h index 7caf85c0d..af1930480 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -38,7 +38,7 @@ #include "vcard.h" #include -#include +#include #include #include diff --git a/coreapi/sqlite3_bctbx_vfs.h b/coreapi/sqlite3_bctbx_vfs.h index 0b1fb9d8a..40a7a1790 100644 --- a/coreapi/sqlite3_bctbx_vfs.h +++ b/coreapi/sqlite3_bctbx_vfs.h @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#include +#include #include "sqlite3.h" diff --git a/gtk/calllogs.c b/gtk/calllogs.c index 6705b6cff..4ac70ef20 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "linphone.h" -#include +#include #define CONFIG_FILE ".linphone-call-history.db" diff --git a/gtk/chat.c b/gtk/chat.c index 0b8e8a36d..185117e06 100644 --- a/gtk/chat.c +++ b/gtk/chat.c @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "linphone.h" -#include +#include #ifdef HAVE_GTK_OSX #include diff --git a/gtk/friendlist.c b/gtk/friendlist.c index 2128ace66..3cb6827a5 100644 --- a/gtk/friendlist.c +++ b/gtk/friendlist.c @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "linphone.h" -#include +#include #include static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list); diff --git a/gtk/main.c b/gtk/main.c index c9fa4255f..6f55077c4 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphone.h" #include "lpconfig.h" #include "liblinphone_gitversion.h" -#include +#include #include #include From 69b99e2e4ed9ff6908230b06225f356cb9983295 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 8 Jul 2016 16:42:56 +0200 Subject: [PATCH 21/45] Use bctbx_list_t instead of MSList in JNI. --- coreapi/linphonecore_jni.cc | 130 ++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 664fb1df4..ef27f4966 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1431,7 +1431,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addListener(JNIEnv* env, } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeListener(JNIEnv* env, jobject thiz, jlong lc, jobject jlistener) { - MSList* iterator; + bctbx_list_t* iterator; LinphoneCore *core = (LinphoneCore*)lc; //jobject listener = env->NewGlobalRef(jlistener); for (iterator = core->vtable_refs; iterator != NULL; ) { @@ -1563,12 +1563,12 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getDefaultProxyConfig } extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getProxyConfigList(JNIEnv* env, jobject thiz, jlong lc) { - const MSList* proxies = linphone_core_get_proxy_config_list((LinphoneCore*)lc); - int proxyCount = ms_list_size(proxies); + const bctbx_list_t* proxies = linphone_core_get_proxy_config_list((LinphoneCore*)lc); + size_t proxyCount = bctbx_list_size(proxies); LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data((LinphoneCore *)lc); jobjectArray jProxies = env->NewObjectArray(proxyCount,ljb->proxyClass,NULL); - for (int i = 0; i < proxyCount; i++ ) { + for (size_t i = 0; i < proxyCount; i++ ) { LinphoneProxyConfig* proxy = (LinphoneProxyConfig*)proxies->data; jobject jproxy = getProxy(env,proxy,thiz); if(jproxy != NULL){ @@ -1598,12 +1598,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeAuthInfo(JNIEnv* e } extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getAuthInfosList(JNIEnv* env, jobject thiz,jlong lc) { - const MSList* authInfos = linphone_core_get_auth_info_list((LinphoneCore*)lc); - int listCount = ms_list_size(authInfos); + const bctbx_list_t* authInfos = linphone_core_get_auth_info_list((LinphoneCore*)lc); + size_t listCount = bctbx_list_size(authInfos); jlongArray jAuthInfos = env->NewLongArray(listCount); jlong *jInternalArray = env->GetLongArrayElements(jAuthInfos, NULL); - for (int i = 0; i < listCount; i++ ) { + for (size_t i = 0; i < listCount; i++ ) { jInternalArray[i] = (unsigned long) (authInfos->data); authInfos = authInfos->next; } @@ -1750,12 +1750,12 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCallLog( JNIEnv* en ,jobject thiz ,jlong lc ,jint position) { - return (jlong)ms_list_nth_data(linphone_core_get_call_logs((LinphoneCore*)lc),position); + return (jlong)bctbx_list_nth_data(linphone_core_get_call_logs((LinphoneCore*)lc),position); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getNumberOfCallLogs( JNIEnv* env ,jobject thiz ,jlong lc) { - return (jint)ms_list_size(linphone_core_get_call_logs((LinphoneCore*)lc)); + return (jint)bctbx_list_size(linphone_core_get_call_logs((LinphoneCore*)lc)); } extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getLastOutgoingCallLog( JNIEnv* env ,jobject thiz @@ -1901,12 +1901,12 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv* extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTypes(JNIEnv* env ,jobject thiz ,jlong lc) { - const MSList* codecs = linphone_core_get_video_codecs((LinphoneCore*)lc); - int codecsCount = ms_list_size(codecs); + const bctbx_list_t* codecs = linphone_core_get_video_codecs((LinphoneCore*)lc); + size_t codecsCount = bctbx_list_size(codecs); jlongArray jCodecs = env->NewLongArray(codecsCount); jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL); - for (int i = 0; i < codecsCount; i++ ) { + for (size_t i = 0; i < codecsCount; i++ ) { jInternalArray[i] = (unsigned long) (codecs->data); codecs = codecs->next; } @@ -1917,12 +1917,12 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTy } JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) { - MSList *pts = NULL; + bctbx_list_t *pts = NULL; int codecsCount = env->GetArrayLength(jCodecs); jlong *codecs = env->GetLongArrayElements(jCodecs, NULL); for (int i = 0; i < codecsCount; i++) { PayloadType *pt = (PayloadType *)codecs[i]; - ms_list_append(pts, pt); + bctbx_list_append(pts, pt); } linphone_core_set_video_codecs((LinphoneCore *)lc, pts); env->ReleaseLongArrayElements(jCodecs, codecs, 0); @@ -1931,12 +1931,12 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoCodecs(JN extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTypes(JNIEnv* env ,jobject thiz ,jlong lc) { - const MSList* codecs = linphone_core_get_audio_codecs((LinphoneCore*)lc); - int codecsCount = ms_list_size(codecs); + const bctbx_list_t* codecs = linphone_core_get_audio_codecs((LinphoneCore*)lc); + size_t codecsCount = bctbx_list_size(codecs); jlongArray jCodecs = env->NewLongArray(codecsCount); jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL); - for (int i = 0; i < codecsCount; i++ ) { + for (size_t i = 0; i < codecsCount; i++ ) { jInternalArray[i] = (unsigned long) (codecs->data); codecs = codecs->next; } @@ -1947,12 +1947,12 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTy } JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setAudioCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) { - MSList *pts = NULL; + bctbx_list_t *pts = NULL; int codecsCount = env->GetArrayLength(jCodecs); jlong *codecs = env->GetLongArrayElements(jCodecs, NULL); for (int i = 0; i < codecsCount; i++) { PayloadType *pt = (PayloadType *)codecs[i]; - pts = ms_list_append(pts, pt); + pts = bctbx_list_append(pts, pt); } linphone_core_set_audio_codecs((LinphoneCore *)lc, pts); env->ReleaseLongArrayElements(jCodecs, codecs, 0); @@ -2137,12 +2137,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeFriendList(JNIEnv* extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendList(JNIEnv* env ,jobject thiz ,jlong lc) { - const MSList* friends = linphone_core_get_friend_list((LinphoneCore*)lc); - int friendsSize = ms_list_size(friends); + const bctbx_list_t* friends = linphone_core_get_friend_list((LinphoneCore*)lc); + size_t friendsSize = bctbx_list_size(friends); LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data((LinphoneCore *)lc); jobjectArray jFriends = env->NewObjectArray(friendsSize,ljb->friendClass,NULL); - for (int i = 0; i < friendsSize; i++) { + for (size_t i = 0; i < friendsSize; i++) { LinphoneFriend* lfriend = (LinphoneFriend*)friends->data; jobject jfriend = getFriend(env,lfriend); if(jfriend != NULL){ @@ -2158,12 +2158,12 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendList(JN extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendLists(JNIEnv* env ,jobject thiz ,jlong lc) { - const MSList* friends = linphone_core_get_friends_lists((LinphoneCore*)lc); - int friendsSize = ms_list_size(friends); + const bctbx_list_t* friends = linphone_core_get_friends_lists((LinphoneCore*)lc); + size_t friendsSize = bctbx_list_size(friends); LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data((LinphoneCore *)lc); jobjectArray jFriends = env->NewObjectArray(friendsSize,ljb->friendListClass,NULL); - for (int i = 0; i < friendsSize; i++) { + for (size_t i = 0; i < friendsSize; i++) { LinphoneFriendList* lfriend = (LinphoneFriendList*)friends->data; jobject jfriend = getFriendList(env,lfriend); if(jfriend != NULL){ @@ -3117,12 +3117,12 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog( JNIEnv* en extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getCallLogs(JNIEnv* env ,jobject thiz ,jlong lc) { - const MSList *logs = linphone_core_get_call_logs((LinphoneCore *) lc); - int logsCount = ms_list_size(logs); + const bctbx_list_t *logs = linphone_core_get_call_logs((LinphoneCore *) lc); + size_t logsCount = bctbx_list_size(logs); jlongArray jLogs = env->NewLongArray(logsCount); jlong *jInternalArray = env->GetLongArrayElements(jLogs, NULL); - for (int i = 0; i < logsCount; i++) { + for (size_t i = 0; i < logsCount; i++) { jInternalArray[i] = (unsigned long) (logs->data); logs = logs->next; } @@ -3496,13 +3496,13 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_addLocalFriend(JNI } extern "C" jobjectArray Java_org_linphone_core_LinphoneFriendListImpl_getFriendList(JNIEnv* env, jobject thiz, jlong list) { - const MSList* friends = linphone_friend_list_get_friends((LinphoneFriendList *)list); - int friendsSize = ms_list_size(friends); + const bctbx_list_t* friends = linphone_friend_list_get_friends((LinphoneFriendList *)list); + size_t friendsSize = bctbx_list_size(friends); LinphoneCore *lc = linphone_friend_list_get_core((LinphoneFriendList *)list); LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc); jobjectArray jFriends = env->NewObjectArray(friendsSize,ljb->friendClass,NULL); - for (int i = 0; i < friendsSize; i++) { + for (size_t i = 0; i < friendsSize; i++) { LinphoneFriend* lfriend = (LinphoneFriend*)friends->data; jobject jfriend = getFriend(env,lfriend); if(jfriend != NULL){ @@ -3526,16 +3526,16 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_updateSubscription extern "C" jlongArray Java_org_linphone_core_LinphoneFriendImpl_getAddresses(JNIEnv* env ,jobject thiz ,jlong ptr) { - MSList *addresses = linphone_friend_get_addresses((LinphoneFriend*)ptr); - MSList *list = addresses; - int size = ms_list_size(addresses); + bctbx_list_t *addresses = linphone_friend_get_addresses((LinphoneFriend*)ptr); + bctbx_list_t *list = addresses; + size_t size = bctbx_list_size(addresses); jlongArray jaddresses = env->NewLongArray(size); jlong *jInternalArray = env->GetLongArrayElements(jaddresses, NULL); - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { jInternalArray[i] = (unsigned long) (addresses->data); - addresses = ms_list_next(addresses); + addresses = bctbx_list_next(addresses); } - ms_list_free(list); + bctbx_list_free(list); env->ReleaseLongArrayElements(jaddresses, jInternalArray, 0); return jaddresses; } @@ -3557,16 +3557,16 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_removeAddress(JNIEnv* extern "C" jobjectArray Java_org_linphone_core_LinphoneFriendImpl_getPhoneNumbers(JNIEnv* env ,jobject thiz ,jlong ptr) { - MSList *phone_numbers = linphone_friend_get_phone_numbers((LinphoneFriend*)ptr); - MSList *list = phone_numbers; - int size = ms_list_size(phone_numbers); + bctbx_list_t *phone_numbers = linphone_friend_get_phone_numbers((LinphoneFriend*)ptr); + bctbx_list_t *list = phone_numbers; + size_t size = bctbx_list_size(phone_numbers); jobjectArray jphonenumbers = env->NewObjectArray(size, env->FindClass("java/lang/String"), env->NewStringUTF("")); - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { const char *phone = (const char *)phone_numbers->data; env->SetObjectArrayElement(jphonenumbers, i, env->NewStringUTF(phone)); - phone_numbers = ms_list_next(phone_numbers); + phone_numbers = bctbx_list_next(phone_numbers); } - ms_list_free(list); + bctbx_list_free(list); return jphonenumbers; } @@ -3761,15 +3761,15 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getFriendByAddress(JN } } -extern "C" jobjectArray _LinphoneChatRoomImpl_getHistory(JNIEnv* env, jobject thiz, jlong ptr, MSList* history) { +extern "C" jobjectArray _LinphoneChatRoomImpl_getHistory(JNIEnv* env, jobject thiz, jlong ptr, bctbx_list_t* history) { LinphoneChatRoom *room = (LinphoneChatRoom *)ptr; LinphoneCore *lc = linphone_chat_room_get_core(room); LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc); - MSList *list = history; - int historySize = ms_list_size(history); + bctbx_list_t *list = history; + size_t historySize = bctbx_list_size(history); jobjectArray jHistory = env->NewObjectArray(historySize, ljb->chatMessageClass, NULL); - for (int i = 0; i < historySize; i++) { + for (size_t i = 0; i < historySize; i++) { LinphoneChatMessage *msg = (LinphoneChatMessage *)history->data; jobject jmsg = getChatMessage(env, msg); if (jmsg != NULL) { @@ -3781,7 +3781,7 @@ extern "C" jobjectArray _LinphoneChatRoomImpl_getHistory(JNIEnv* env, jobject th } /*getChatMessage() acquired a ref that is "transfered" to the java object. We must drop * the reference given by linphone_chat_room_get_history_range()*/ - ms_list_free_with_data(list, (void (*)(void*))linphone_chat_message_unref); + bctbx_list_free_with_data(list, (void (*)(void*))linphone_chat_message_unref); return jHistory; } extern "C" jobjectArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistoryRange(JNIEnv* env @@ -3789,14 +3789,14 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistoryRa ,jlong ptr ,jint start ,jint end) { - MSList* history = linphone_chat_room_get_history_range((LinphoneChatRoom*)ptr, start, end); + bctbx_list_t* history = linphone_chat_room_get_history_range((LinphoneChatRoom*)ptr, start, end); return _LinphoneChatRoomImpl_getHistory(env, thiz, ptr, history); } extern "C" jobjectArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistory(JNIEnv* env ,jobject thiz ,jlong ptr ,jint limit) { - MSList* history = linphone_chat_room_get_history((LinphoneChatRoom*)ptr, limit); + bctbx_list_t* history = linphone_chat_room_get_history((LinphoneChatRoom*)ptr, limit); return _LinphoneChatRoomImpl_getHistory(env, thiz, ptr, history); } extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env @@ -4191,12 +4191,12 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getChatRooms(JNI ,jobject thiz ,jlong ptr) { LinphoneCore *lc = (LinphoneCore*)ptr; - const MSList* chats = linphone_core_get_chat_rooms(lc); + const bctbx_list_t* chats = linphone_core_get_chat_rooms(lc); LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc); - int chatsSize = ms_list_size(chats); + size_t chatsSize = bctbx_list_size(chats); jobjectArray jChats = env->NewObjectArray(chatsSize, ljb->chatRoomClass, NULL); - for (int i = 0; i < chatsSize; i++) { + for (size_t i = 0; i < chatsSize; i++) { LinphoneChatRoom *room = (LinphoneChatRoom *)chats->data; jobject jroom = getChatRoom(env, room); if (jroom != NULL) { @@ -4901,11 +4901,11 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateAllCalls(JNIEnv linphone_core_terminate_all_calls((LinphoneCore *) pCore); } extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCall(JNIEnv *env,jobject thiz,jlong pCore,jint position) { - LinphoneCall* lCall = (LinphoneCall*) ms_list_nth_data(linphone_core_get_calls((LinphoneCore *) pCore),position); + LinphoneCall* lCall = (LinphoneCall*) bctbx_list_nth_data(linphone_core_get_calls((LinphoneCore *) pCore),position); return getCall(env,lCall); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getCallsNb(JNIEnv *env,jobject thiz,jlong pCore) { - return (jint)ms_list_size(linphone_core_get_calls((LinphoneCore *) pCore)); + return (jint)bctbx_list_size(linphone_core_get_calls((LinphoneCore *) pCore)); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_transferCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jstring jReferTo) { @@ -5088,11 +5088,11 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_tunnelGetServers jobjectArray tunnelConfigArray = NULL; if(tunnel != NULL) { - const MSList *servers = linphone_tunnel_get_servers(tunnel); - const MSList *it; + const bctbx_list_t *servers = linphone_tunnel_get_servers(tunnel); + const bctbx_list_t *it; int i; - tunnelConfigArray = env->NewObjectArray(ms_list_size(servers), tunnelConfigClass, NULL); + tunnelConfigArray = env->NewObjectArray(bctbx_list_size(servers), tunnelConfigClass, NULL); for(it = servers, i=0; it != NULL; it = it->next, i++) { LinphoneTunnelConfig *conf = (LinphoneTunnelConfig *)it->data; jobject elt = getTunnelConfig(env, conf); @@ -7029,7 +7029,7 @@ extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_videoMultica } JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setDnsServers(JNIEnv *env, jobject thiz, jlong lc, jobjectArray servers){ - MSList *l = NULL; + bctbx_list_t *l = NULL; if (servers != NULL){ int count = env->GetArrayLength(servers); @@ -7038,13 +7038,13 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setDnsServers(JNI jstring server = (jstring) env->GetObjectArrayElement(servers, i); const char *str = GetStringUTFChars(env, server); if (str){ - l = ms_list_append(l, ms_strdup(str)); + l = bctbx_list_append(l, ms_strdup(str)); ReleaseStringUTFChars(env, server, str); } } } linphone_core_set_dns_servers((LinphoneCore*)lc, l); - ms_list_free_with_data(l, ms_free); + bctbx_list_free_with_data(l, ms_free); } JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_enableDnsSrv(JNIEnv *env, jobject thiz, jlong lc, jboolean yesno) { @@ -7365,20 +7365,20 @@ extern "C" jboolean Java_org_linphone_core_LinphoneConferenceParamsImpl_isVideoR extern "C" jobjectArray Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) { - MSList *participants, *it; + bctbx_list_t *participants, *it; jclass addr_class = env->FindClass("org/linphone/core/LinphoneAddressImpl"); jmethodID addr_constructor = env->GetMethodID(addr_class, "", "(J)V"); jobjectArray jaddr_list; int i; participants = linphone_conference_get_participants((LinphoneConference *)pconference); - jaddr_list = env->NewObjectArray(ms_list_size(participants), addr_class, NULL); - for(it=participants, i=0; it; it=ms_list_next(it), i++) { + jaddr_list = env->NewObjectArray(bctbx_list_size(participants), addr_class, NULL); + for(it=participants, i=0; it; it=bctbx_list_next(it), i++) { LinphoneAddress *addr = (LinphoneAddress *)it->data; jobject jaddr = env->NewObject(addr_class, addr_constructor, (jlong)addr); env->SetObjectArrayElement(jaddr_list, i, jaddr); } - ms_list_free(participants); + bctbx_list_free(participants); return jaddr_list; } From 94695d47748cb667453bc7ffa943291127c8b140 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 8 Jul 2016 16:43:32 +0200 Subject: [PATCH 22/45] Add NAT policy JNI wrapper. --- coreapi/linphonecore_jni.cc | 126 +++++++++++++++++- coreapi/nat_policy.h | 2 +- java/CMakeLists.txt | 19 ++- .../org/linphone/core/LinphoneCore.java | 33 ++++- .../org/linphone/core/LinphoneNatPolicy.java | 113 ++++++++++++++++ .../org/linphone/core/LinphoneCoreImpl.java | 18 ++- .../linphone/core/LinphoneNatPolicyImpl.java | 125 +++++++++++++++++ 7 files changed, 421 insertions(+), 15 deletions(-) create mode 100644 java/common/org/linphone/core/LinphoneNatPolicy.java create mode 100644 java/impl/org/linphone/core/LinphoneNatPolicyImpl.java diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index ef27f4966..0d3a90472 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -282,16 +282,19 @@ public: chatRoomClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatRoomImpl")); chatRoomCtrId = env->GetMethodID(chatRoomClass,"", "(J)V"); - friendClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendImpl"));; + friendClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendImpl")); friendCtrId = env->GetMethodID(friendClass,"", "(J)V"); - friendListClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendListImpl"));; + friendListClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendListImpl")); friendListCtrId = env->GetMethodID(friendListClass,"", "(J)V"); friendListCreatedId = env->GetMethodID(listenerClass, "friendListCreated", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriendList;)V"); friendListRemovedId = env->GetMethodID(listenerClass, "friendListRemoved", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriendList;)V"); friendListSyncStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendList$State")); friendListSyncStateFromIntId = env->GetStaticMethodID(friendListSyncStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneFriendList$State;"); + natPolicyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneNatPolicyImpl")); + natPolicyCtrId = env->GetMethodID(natPolicyClass, "", "(J)V"); + addressClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAddressImpl")); addressCtrId = env->GetMethodID(addressClass,"", "(J)V"); @@ -412,6 +415,9 @@ public: jclass friendListSyncStateClass; jmethodID friendListSyncStateFromIntId; + jclass natPolicyClass; + jmethodID natPolicyCtrId; + jclass addressClass; jmethodID addressCtrId; @@ -599,6 +605,29 @@ jobject getFriendList(JNIEnv *env, LinphoneFriendList *lfriendList){ return jobj; } +jobject getNatPolicy(JNIEnv *env, LinphoneNatPolicy *lNatPolicy) { + jobject jobj = 0; + + if (lNatPolicy != NULL) { + LinphoneCore *lc = lNatPolicy->lc; + LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc); + + void *up = linphone_nat_policy_get_user_data(lNatPolicy); + if (up == NULL) { + jobj = env->NewObject(ljb->natPolicyClass, ljb->natPolicyCtrId, (jlong)lNatPolicy); + linphone_nat_policy_set_user_data(lNatPolicy, (void *)env->NewWeakGlobalRef(jobj)); + linphone_nat_policy_ref(lNatPolicy); + } else { + jobj = env->NewLocalRef((jobject)up); + if (jobj == NULL) { + jobj = env->NewObject(ljb->natPolicyClass, ljb->natPolicyCtrId, (jlong)lNatPolicy); + linphone_nat_policy_set_user_data(lNatPolicy, (void *)env->NewWeakGlobalRef(jobj)); + } + } + } + return jobj; +} + jobject getEvent(JNIEnv *env, LinphoneEvent *lev){ if (lev==NULL) return NULL; jobject jev=(jobject)linphone_event_get_user_data(lev); @@ -4340,6 +4369,21 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getFirewallPolicy(JNIEnv return (jint)linphone_core_get_firewall_policy((LinphoneCore*)lc); } +JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_createNatPolicy(JNIEnv *env, jobject thiz, jlong lc) { + LinphoneNatPolicy *nat_policy = linphone_core_create_nat_policy((LinphoneCore *)lc); + return (nat_policy != NULL) ? getNatPolicy(env, nat_policy) : NULL; +} + +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setNatPolicy(JNIEnv *env, jobject thiz, jlong lc, jlong jpolicy) { + linphone_core_set_nat_policy((LinphoneCore *)lc, (LinphoneNatPolicy *)jpolicy); +} + +JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_getNatPolicy(JNIEnv *env, jobject thiz, jlong lc) { + LinphoneNatPolicy *nat_policy = linphone_core_get_nat_policy((LinphoneCore *)lc); + return (nat_policy != NULL) ? getNatPolicy(env, nat_policy) : NULL; +} + + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStunServer(JNIEnv *env, jobject thiz, jlong lc, jstring jserver){ const char* server = GetStringUTFChars(env, jserver); linphone_core_set_stun_server((LinphoneCore*)lc,server); @@ -7417,3 +7461,81 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_reloadMsPlugins(J linphone_core_reload_ms_plugins((LinphoneCore*)pcore, path); ReleaseStringUTFChars(env, jpath, path); } + + +JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_getCore(JNIEnv *env, jobject thiz, jlong jNatPolicy) { + LinphoneCore *lc = ((LinphoneNatPolicy *)jNatPolicy)->lc; + LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc); + return ljb->getCore(); +} + +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_clear(JNIEnv *env, jobject thiz, jlong jNatPolicy) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + linphone_nat_policy_clear(nat_policy); +} + +JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_stunEnabled(JNIEnv *env, jobject thiz, jlong jNatPolicy) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + return (linphone_nat_policy_stun_enabled(nat_policy) == FALSE) ? JNI_FALSE : JNI_TRUE; +} + +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_enableStun(JNIEnv *env, jobject thiz, jlong jNatPolicy, jboolean jEnable) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + linphone_nat_policy_enable_stun(nat_policy, (jEnable == JNI_FALSE) ? FALSE : TRUE); +} + +JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_turnEnabled(JNIEnv *env, jobject thiz, jlong jNatPolicy) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + return (linphone_nat_policy_turn_enabled(nat_policy) == FALSE) ? JNI_FALSE : JNI_TRUE; +} + +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_enableTurn(JNIEnv *env, jobject thiz, jlong jNatPolicy, jboolean jEnable) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + linphone_nat_policy_enable_turn(nat_policy, (jEnable == JNI_FALSE) ? FALSE : TRUE); +} + +JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_iceEnabled(JNIEnv *env, jobject thiz, jlong jNatPolicy) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + return (linphone_nat_policy_ice_enabled(nat_policy) == FALSE) ? JNI_FALSE : JNI_TRUE; +} + +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_enableIce(JNIEnv *env, jobject thiz, jlong jNatPolicy, jboolean jEnable) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + linphone_nat_policy_enable_ice(nat_policy, (jEnable == JNI_FALSE) ? FALSE : TRUE); +} + +JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_upnpEnabled(JNIEnv *env, jobject thiz, jlong jNatPolicy) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + return (linphone_nat_policy_upnp_enabled(nat_policy) == FALSE) ? JNI_FALSE : JNI_TRUE; +} + +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_enableUpnp(JNIEnv *env, jobject thiz, jlong jNatPolicy, jboolean jEnable) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + linphone_nat_policy_enable_upnp(nat_policy, (jEnable == JNI_FALSE) ? FALSE : TRUE); +} + +JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_getStunServer(JNIEnv *env, jobject thiz, jlong jNatPolicy) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + const char *stun_server = linphone_nat_policy_get_stun_server(nat_policy); + return (stun_server != NULL) ? env->NewStringUTF(stun_server) : NULL; +} + +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_setStunServer(JNIEnv *env, jobject thiz, jlong jNatPolicy, jstring jStunServer) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + const char *stun_server = GetStringUTFChars(env, jStunServer); + linphone_nat_policy_set_stun_server(nat_policy, stun_server); + ReleaseStringUTFChars(env, jStunServer, stun_server); +} + +JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_getStunServerUsername(JNIEnv *env, jobject thiz, jlong jNatPolicy) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + const char *stun_server = linphone_nat_policy_get_stun_server_username(nat_policy); + return (stun_server != NULL) ? env->NewStringUTF(stun_server) : NULL; +} + +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_setStunServerUsername(JNIEnv *env, jobject thiz, jlong jNatPolicy, jstring jStunServerUsername) { + LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy; + const char *stun_server_username = GetStringUTFChars(env, jStunServerUsername); + linphone_nat_policy_set_stun_server_username(nat_policy, stun_server_username); + ReleaseStringUTFChars(env, jStunServerUsername, stun_server_username); +} diff --git a/coreapi/nat_policy.h b/coreapi/nat_policy.h index e122508aa..b80cd2c9e 100644 --- a/coreapi/nat_policy.h +++ b/coreapi/nat_policy.h @@ -156,7 +156,7 @@ LINPHONE_PUBLIC void linphone_nat_policy_set_stun_server(LinphoneNatPolicy *poli LINPHONE_PUBLIC const char * linphone_nat_policy_get_stun_server_username(const LinphoneNatPolicy *policy); /** - * Seth the username used to authenticate with the STUN/TURN server. + * Set the username used to authenticate with the STUN/TURN server. * The authentication will search for a LinphoneAuthInfo with this username. * If it is not set the username of the currently used LinphoneProxyConfig is used to search for a LinphoneAuthInfo. * @param[in] policy LinphoneNatPolicy object diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 69d7a265b..772e553d1 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -24,28 +24,35 @@ if(ANDROID) find_package(Java REQUIRED COMPONENTS Development) set(JNI_CLASSES + "org.linphone.core.ErrorInfoImpl" "org.linphone.core.LinphoneAddressImpl" "org.linphone.core.LinphoneAuthInfoImpl" + "org.linphone.core.LinphoneBufferImpl" "org.linphone.core.LinphoneCallImpl" "org.linphone.core.LinphoneCallLogImpl" "org.linphone.core.LinphoneCallParamsImpl" "org.linphone.core.LinphoneCallStatsImpl" "org.linphone.core.LinphoneChatMessageImpl" "org.linphone.core.LinphoneChatRoomImpl" + "org.linphone.core.LinphoneConferenceImpl" + "org.linphone.core.LinphoneConferenceParamsImpl" + "org.linphone.core.LinphoneContentImpl" "org.linphone.core.LinphoneCoreFactoryImpl" "org.linphone.core.LinphoneCoreImpl" - "org.linphone.core.LinphoneFriendImpl" - "org.linphone.core.LinphoneProxyConfigImpl" - "org.linphone.core.PayloadTypeImpl" - "org.linphone.core.LpConfigImpl" - "org.linphone.core.LinphoneInfoMessageImpl" "org.linphone.core.LinphoneEventImpl" + "org.linphone.core.LinphoneFriendImpl" + "org.linphone.core.LinphoneFriendListImpl" + "org.linphone.core.LinphoneInfoMessageImpl" + "org.linphone.core.LinphoneNatPolicyImpl" + "org.linphone.core.LinphonePlayerImpl" + "org.linphone.core.LinphoneProxyConfigImpl" + "org.linphone.core.LpConfigImpl" + "org.linphone.core.PayloadTypeImpl" "org.linphone.core.PresenceActivityImpl" "org.linphone.core.PresenceModelImpl" "org.linphone.core.PresenceNoteImpl" "org.linphone.core.PresencePersonImpl" "org.linphone.core.PresenceServiceImpl" - "org.linphone.core.ErrorInfoImpl" "org.linphone.core.TunnelConfigImpl" ) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index f75523317..f63c017ef 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -170,7 +170,7 @@ public interface LinphoneCore { } /** * Describes firewall policy. - * + * @deprecated */ static public class FirewallPolicy { @@ -1116,6 +1116,7 @@ public interface LinphoneCore { * **/ void enableVideo(boolean vcap_enabled, boolean display_enabled); + /** * Returns TRUE if video is enabled, FALSE otherwise. * @@ -1127,6 +1128,7 @@ public interface LinphoneCore { * @param stun_server Stun server address and port, such as stun.linphone.org or stun.linphone.org:3478 */ void setStunServer(String stun_server); + /** * Get STUN server * @return stun server address if previously set. @@ -1136,24 +1138,49 @@ public interface LinphoneCore { /** * Sets policy regarding workarounding NATs * @param pol one of the FirewallPolicy members. + * @deprecated **/ void setFirewallPolicy(FirewallPolicy pol); + /** * @return previously set firewall policy. + * @deprecated */ FirewallPolicy getFirewallPolicy(); + + /** + * Create a new LinphoneNatPolicy object with every policies being disabled. + * @return A new LinphoneNatPolicy object. + */ + LinphoneNatPolicy createNatPolicy(); + + /** + * Set the policy to use to pass through NATs/firewalls. + * It may be overridden by a NAT policy for a specific proxy config. + * @param policy LinphoneNatPolicy object + */ + void setNatPolicy(LinphoneNatPolicy policy); + + /** + * Get The policy that is used to pass through NATs/firewalls. + * It may be overridden by a NAT policy for a specific proxy config. + * @return LinphoneNatPolicy object in use. + */ + LinphoneNatPolicy getNatPolicy(); + /** * Initiates an outgoing call given a destination LinphoneAddress * * @param addr the destination of the call {@link #LinphoneAddress }. * @param params call parameters {@link #LinphoneCallParams } * - *
The LinphoneAddress can be constructed directly using {@link LinphoneCoreFactory#createLinphoneAddress} , or created {@link LinphoneCore#interpretUrl(String)}. . + *
The LinphoneAddress can be constructed directly using {@link LinphoneCoreFactory#createLinphoneAddress} , or created {@link LinphoneCore#interpretUrl(String)}. * * @return a {@link #LinphoneCall LinphoneCall} object * @throws LinphoneCoreException in case of failure **/ - LinphoneCall inviteAddressWithParams(LinphoneAddress destination, LinphoneCallParams params) throws LinphoneCoreException ; + LinphoneCall inviteAddressWithParams(LinphoneAddress destination, LinphoneCallParams params) throws LinphoneCoreException; + /** * Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore. * diff --git a/java/common/org/linphone/core/LinphoneNatPolicy.java b/java/common/org/linphone/core/LinphoneNatPolicy.java new file mode 100644 index 000000000..82bfce0c5 --- /dev/null +++ b/java/common/org/linphone/core/LinphoneNatPolicy.java @@ -0,0 +1,113 @@ +/* +LinphoneNatPolicy.java +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. +*/ + +package org.linphone.core; + +/** + * Policy to use to pass through NATs/firewalls. + * + */ +public interface LinphoneNatPolicy { + /** + * Clear a NAT policy (deactivate all protocols and unset the STUN server). + */ + void clear(); + + /** + * Tell whether STUN is enabled. + * @return Boolean value telling whether STUN is enabled. + */ + boolean stunEnabled(); + + /** + * Enable STUN. + * If TURN is also enabled, TURN will be used instead of STUN. + * @param enable Boolean value telling whether to enable STUN. + */ + void enableStun(boolean enable); + + /** + * Tell whether TURN is enabled. + * @return Boolean value telling whether TURN is enabled. + */ + boolean turnEnabled(); + + /** + * Enable TURN. + * If STUN is also enabled, it is ignored and TURN is used. + * @param enable Boolean value telling whether to enable TURN. + */ + void enableTurn(boolean enable); + + /** + * Tell whether ICE is enabled. + * @return Boolean value telling whether ICE is enabled. + */ + boolean iceEnabled(); + + /** + * Enable ICE. + * ICE can be enabled without STUN/TURN, in which case only the local candidates will be used. + * @param enable Boolean value telling whether to enable ICE. + */ + void enableIce(boolean enable); + + /** + * Tell whether uPnP is enabled. + * @return Boolean value telling whether uPnP is enabled. + */ + boolean upnpEnabled(); + + /** + * Enable uPnP. + * This has the effect to disable every other policies (ICE, STUN and TURN). + * @param enable Boolean value telling whether to enable uPnP. + */ + void enableUpnp(boolean enable); + + /** + * Get the STUN/TURN server to use with this NAT policy. + * Used when STUN or TURN are enabled. + * @return The STUN server used by this NAT policy. + */ + String getStunServer(); + + /** + * Set the STUN/TURN server to use with this NAT policy. + * Used when STUN or TURN are enabled. + * @param stun_server The STUN server to use with this NAT policy. + */ + void setStunServer(String stun_server); + + /** + * Get the username used to authenticate with the STUN/TURN server. + * The authentication will search for a LinphoneAuthInfo with this username. + * If it is not set the username of the currently used LinphoneProxyConfig is used to search for a LinphoneAuthInfo. + * @return The username used to authenticate with the STUN/TURN server. + */ + String getStunServerUsername(); + + /** + * Set the username used to authenticate with the STUN/TURN server. + * The authentication will search for a LinphoneAuthInfo with this username. + * If it is not set the username of the currently used LinphoneProxyConfig is used to search for a LinphoneAuthInfo. + * @param username The username used to authenticate with the STUN/TURN server. + */ + void setStunServerUsername(String username); +} diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index c2df92a72..267f0b7b8 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -111,6 +111,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native boolean isVideoSupported(long nativePtr); private native void setFirewallPolicy(long nativePtr, int enum_value); private native int getFirewallPolicy(long nativePtr); + private native Object createNatPolicy(long nativePtr); + private native void setNatPolicy(long nativePtr, long policyPtr); + private native Object getNatPolicy(long nativePtr); private native void setStunServer(long nativePtr, String stun_server); private native String getStunServer(long nativePtr); private native int updateCall(long ptrLc, long ptrCall, long ptrParams); @@ -524,12 +527,21 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized FirewallPolicy getFirewallPolicy() { return FirewallPolicy.fromInt(getFirewallPolicy(nativePtr)); } - public synchronized String getStunServer() { - return getStunServer(nativePtr); - } public synchronized void setFirewallPolicy(FirewallPolicy pol) { setFirewallPolicy(nativePtr,pol.value()); } + public synchronized LinphoneNatPolicy createNatPolicy() { + return (LinphoneNatPolicy)createNatPolicy(nativePtr); + } + public synchronized void setNatPolicy(LinphoneNatPolicy policy) { + setNatPolicy(nativePtr, ((LinphoneNatPolicyImpl)policy).mNativePtr); + } + public synchronized LinphoneNatPolicy getNatPolicy() { + return (LinphoneNatPolicy)getNatPolicy(nativePtr); + } + public synchronized String getStunServer() { + return getStunServer(nativePtr); + } public synchronized void setStunServer(String stunServer) { setStunServer(nativePtr, stunServer); } diff --git a/java/impl/org/linphone/core/LinphoneNatPolicyImpl.java b/java/impl/org/linphone/core/LinphoneNatPolicyImpl.java new file mode 100644 index 000000000..302bda306 --- /dev/null +++ b/java/impl/org/linphone/core/LinphoneNatPolicyImpl.java @@ -0,0 +1,125 @@ +/* +LinphoneNatPolicyImpl.java +Copyright (C) 2015 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. +*/ + +package org.linphone.core; + +public class LinphoneNatPolicyImpl implements LinphoneNatPolicy { + protected final long mNativePtr; + + private native Object getCore(long nativePtr); + private native void clear(long nativePtr); + private native boolean stunEnabled(long nativePtr); + private native void enableStun(long nativePtr, boolean enable); + private native boolean turnEnabled(long nativePtr); + private native void enableTurn(long nativePtr, boolean enable); + private native boolean iceEnabled(long nativePtr); + private native void enableIce(long nativePtr, boolean enable); + private native boolean upnpEnabled(long nativePtr); + private native void enableUpnp(long nativePtr, boolean enable); + private native String getStunServer(long nativePtr); + private native void setStunServer(long nativePtr, String stun_server); + private native String getStunServerUsername(long nativePtr); + private native void setStunServerUsername(long nativePtr, String username); + + protected LinphoneNatPolicyImpl(long nativePtr) { + mNativePtr = nativePtr; + } + + private synchronized LinphoneCore getCore() { + return (LinphoneCore)getCore(mNativePtr); + } + + public void clear() { + synchronized(getCore()) { + clear(mNativePtr); + } + } + + public boolean stunEnabled() { + synchronized(getCore()) { + return stunEnabled(mNativePtr); + } + } + + public void enableStun(boolean enable) { + synchronized(getCore()) { + enableStun(mNativePtr, enable); + } + } + + public boolean turnEnabled() { + synchronized(getCore()) { + return turnEnabled(mNativePtr); + } + } + + public void enableTurn(boolean enable) { + synchronized(getCore()) { + enableTurn(mNativePtr, enable); + } + } + + public boolean iceEnabled() { + synchronized(getCore()) { + return iceEnabled(mNativePtr); + } + } + + public void enableIce(boolean enable) { + synchronized(getCore()) { + enableIce(mNativePtr, enable); + } + } + + public boolean upnpEnabled() { + synchronized(getCore()) { + return upnpEnabled(mNativePtr); + } + } + + public void enableUpnp(boolean enable) { + synchronized(getCore()) { + enableUpnp(mNativePtr, enable); + } + } + + public String getStunServer() { + synchronized(getCore()) { + return getStunServer(mNativePtr); + } + } + + public void setStunServer(String stun_server) { + synchronized(getCore()) { + setStunServer(mNativePtr, stun_server); + } + } + + public String getStunServerUsername() { + synchronized(getCore()) { + return getStunServerUsername(mNativePtr); + } + } + + public void setStunServerUsername(String username) { + synchronized(getCore()) { + setStunServerUsername(mNativePtr, username); + } + } +} From 159488da141b15f5520b4b8c835164b17823c321 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 20 Jul 2016 14:38:08 +0200 Subject: [PATCH 23/45] Handle IPv6 for ICE and TURN. --- coreapi/misc.c | 121 ++++++++++++++++++++++++------------ coreapi/nat_policy.c | 12 ++-- tester/call_single_tester.c | 64 +++++++++++-------- tester/call_video_tester.c | 2 +- tester/stun_tester.c | 35 ++++++++--- tester/tester.c | 35 +++++++---- 6 files changed, 174 insertions(+), 95 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index ec1986896..b9040045e 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -587,16 +587,17 @@ void linphone_core_resolve_stun_server(LinphoneCore *lc){ if (lc->nat_policy != NULL) { linphone_nat_policy_resolve_stun_server(lc->nat_policy); } else { - /* - * WARNING: stun server resolution only done in IPv4. - * TODO: use IPv6 resolution if linphone_core_ipv6_enabled()==TRUE and use V4Mapped addresses for ICE gathering. - */ const char *server=linphone_core_get_stun_server(lc); - if (lc->sal && server && !lc->net_conf.stun_res){ + LinphoneFirewallPolicy firewall_policy = linphone_core_get_firewall_policy(lc); + if (lc->sal && server && !lc->net_conf.stun_res + && ((firewall_policy == LinphonePolicyUseStun) || (firewall_policy == LinphonePolicyUseIce))) { char host[NI_MAXHOST]; + const char *service = "stun"; int port=3478; + int family = AF_INET; linphone_parse_host_port(server,host,sizeof(host),&port); - lc->net_conf.stun_res=sal_resolve_a(lc->sal,host,port,AF_INET,(SalResolverCallback)stun_server_resolved,lc); + if (linphone_core_ipv6_enabled(lc) == TRUE) family = AF_INET6; + lc->net_conf.stun_res = sal_resolve(lc->sal, service, "udp", host, port, family, (SalResolverCallback)stun_server_resolved, lc); } } } @@ -682,12 +683,55 @@ static void stun_auth_requested_cb(LinphoneCall *call, const char *realm, const } } +static void linphone_core_add_local_ice_candidates(LinphoneCall *call, int family, const char *addr, IceCheckList *audio_cl, IceCheckList *video_cl, IceCheckList *text_cl) { + if ((ice_check_list_state(audio_cl) != ICL_Completed) && (ice_check_list_candidates_gathered(audio_cl) == FALSE)) { + ice_add_local_candidate(audio_cl, "host", family, addr, call->media_ports[call->main_audio_stream_index].rtp_port, 1, NULL); + ice_add_local_candidate(audio_cl, "host", family, addr, call->media_ports[call->main_audio_stream_index].rtcp_port, 2, NULL); + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; + } + if (linphone_core_video_enabled(call->core) && (video_cl != NULL) + && (ice_check_list_state(video_cl) != ICL_Completed) && (ice_check_list_candidates_gathered(video_cl) == FALSE)) { + ice_add_local_candidate(video_cl, "host", family, addr, call->media_ports[call->main_video_stream_index].rtp_port, 1, NULL); + ice_add_local_candidate(video_cl, "host", family, addr, call->media_ports[call->main_video_stream_index].rtcp_port, 2, NULL); + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress; + } + if (call->params->realtimetext_enabled && (text_cl != NULL) + && (ice_check_list_state(text_cl) != ICL_Completed) && (ice_check_list_candidates_gathered(text_cl) == FALSE)) { + ice_add_local_candidate(text_cl, "host", family, addr, call->media_ports[call->main_text_stream_index].rtp_port, 1, NULL); + ice_add_local_candidate(text_cl, "host", family, addr, call->media_ports[call->main_text_stream_index].rtcp_port, 2, NULL); + call->stats[LINPHONE_CALL_STATS_TEXT].ice_state = LinphoneIceStateInProgress; + } +} + +static const struct addrinfo * get_preferred_stun_server_addrinfo(const struct addrinfo *ai) { + char ip[NI_MAXHOST]; + const struct addrinfo *preferred_ai = NULL; + + while (ai != NULL) { + bctbx_addrinfo_to_printable_ip_address(ai, ip, sizeof(ip)); + if (ai->ai_family == AF_INET) { + preferred_ai = ai; + break; + } + else if (ai->ai_family == AF_INET6) { + struct sockaddr_storage ss; + socklen_t sslen = sizeof(ss); + bctbx_sockaddr_ipv6_to_ipv4(ai->ai_addr, (struct sockaddr *)&ss, &sslen); + if ((ss.ss_family == AF_INET) && (preferred_ai == NULL)) preferred_ai = ai; + } + ai = ai->ai_next; + } + + bctbx_addrinfo_to_printable_ip_address(preferred_ai, ip, sizeof(ip)); + return preferred_ai; +} + int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){ char local_addr[64]; const struct addrinfo *ai = NULL; - IceCheckList *audio_check_list; - IceCheckList *video_check_list; - IceCheckList *text_check_list; + IceCheckList *audio_cl; + IceCheckList *video_cl; + IceCheckList *text_cl; LinphoneNatPolicy *nat_policy = NULL; const char *server = NULL; @@ -696,19 +740,17 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){ if (nat_policy != NULL) server = linphone_nat_policy_get_stun_server(nat_policy); if (call->ice_session == NULL) return -1; - audio_check_list = ice_session_check_list(call->ice_session, call->main_audio_stream_index); - video_check_list = ice_session_check_list(call->ice_session, call->main_video_stream_index); - text_check_list = ice_session_check_list(call->ice_session, call->main_text_stream_index); - if (audio_check_list == NULL) return -1; + audio_cl = ice_session_check_list(call->ice_session, call->main_audio_stream_index); + video_cl = ice_session_check_list(call->ice_session, call->main_video_stream_index); + text_cl = ice_session_check_list(call->ice_session, call->main_text_stream_index); + if (audio_cl == NULL) return -1; - if (call->af==AF_INET6){ - ms_warning("Ice gathering is not implemented for ipv6"); - return -1; - } if ((nat_policy != NULL) && (server != NULL) && (server[0] != '\0')) { ai=linphone_nat_policy_get_stun_server_addrinfo(nat_policy); if (ai==NULL){ ms_warning("Fail to resolve STUN server for ICE gathering, continuing without stun."); + } else { + ai = get_preferred_stun_server_addrinfo(ai); } }else{ ms_warning("Ice is used without stun server."); @@ -718,28 +760,22 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){ ice_session_enable_forced_relay(call->ice_session, lc->forced_ice_relay); ice_session_enable_short_turn_refresh(call->ice_session, lc->short_turn_refresh); - // TODO: Handle IPv6 /* Gather local host candidates. */ + if (call->af == AF_INET6) { + if (linphone_core_get_local_ip_for(AF_INET6, NULL, local_addr) < 0) { + ms_error("Fail to get local IPv6"); + return -1; + } else { + linphone_core_add_local_ice_candidates(call, AF_INET6, local_addr, audio_cl, video_cl, text_cl); + } + } if (linphone_core_get_local_ip_for(AF_INET, NULL, local_addr) < 0) { - ms_error("Fail to get local ip"); - return -1; - } - if ((ice_check_list_state(audio_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(audio_check_list) == FALSE)) { - ice_add_local_candidate(audio_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_audio_stream_index].rtp_port, 1, NULL); - ice_add_local_candidate(audio_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_audio_stream_index].rtcp_port, 2, NULL); - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; - } - if (linphone_core_video_enabled(lc) && (video_check_list != NULL) - && (ice_check_list_state(video_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(video_check_list) == FALSE)) { - ice_add_local_candidate(video_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_video_stream_index].rtp_port, 1, NULL); - ice_add_local_candidate(video_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_video_stream_index].rtcp_port, 2, NULL); - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress; - } - if (call->params->realtimetext_enabled && (text_check_list != NULL) - && (ice_check_list_state(text_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(text_check_list) == FALSE)) { - ice_add_local_candidate(text_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_text_stream_index].rtp_port, 1, NULL); - ice_add_local_candidate(text_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_text_stream_index].rtcp_port, 2, NULL); - call->stats[LINPHONE_CALL_STATS_TEXT].ice_state = LinphoneIceStateInProgress; + if (call->af != AF_INET6) { + ms_error("Fail to get local IPv4"); + return -1; + } + } else { + linphone_core_add_local_ice_candidates(call, AF_INET, local_addr, audio_cl, video_cl, text_cl); } if ((ai != NULL) && (nat_policy != NULL) && (linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy))) { @@ -1123,6 +1159,7 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, ice_session_remove_check_list(call->ice_session, cl); clear_ice_check_list(call,cl); } else { + int family; if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES; j++) { @@ -1135,8 +1172,9 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, get_default_addr_and_port(candidate->componentID, md, stream, &addr, &port); if (addr && (candidate->port == port) && (strlen(candidate->addr) == strlen(addr)) && (strcmp(candidate->addr, addr) == 0)) default_candidate = TRUE; - // TODO: Handle IPv6 - ice_add_remote_candidate(cl, candidate->type, AF_INET, candidate->addr, candidate->port, candidate->componentID, + if (strchr(candidate->addr, ':') != NULL) family = AF_INET6; + else family = AF_INET; + ice_add_remote_candidate(cl, candidate->type, family, candidate->addr, candidate->port, candidate->componentID, candidate->priority, candidate->foundation, default_candidate); } if (ice_restarted == FALSE) { @@ -1152,8 +1190,9 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, /* If we receive a re-invite and we finished ICE processing on our side, use the candidates given by the remote. */ ice_check_list_unselect_valid_pairs(cl); } - // TODO: Handle IPv6 - ice_add_losing_pair(cl, j + 1, AF_INET, remote_candidate->addr, remote_candidate->port, addr, port); + if (strchr(remote_candidate->addr, ':') != NULL) family = AF_INET6; + else family = AF_INET; + ice_add_losing_pair(cl, j + 1, family, remote_candidate->addr, remote_candidate->port, addr, port); losing_pairs_added = TRUE; } if (losing_pairs_added == TRUE) ice_check_list_check_completed(cl); diff --git a/coreapi/nat_policy.c b/coreapi/nat_policy.c index cf3e11b9d..801a993b8 100644 --- a/coreapi/nat_policy.c +++ b/coreapi/nat_policy.c @@ -220,20 +220,16 @@ static void stun_server_resolved(LinphoneNatPolicy *policy, const char *name, st void linphone_nat_policy_resolve_stun_server(LinphoneNatPolicy *policy) { const char *service = NULL; - /* - * WARNING: stun server resolution only done in IPv4. - * TODO: use IPv6 resolution if linphone_core_ipv6_enabled()==TRUE and use V4Mapped addresses for ICE gathering. - */ - if (linphone_nat_policy_stun_server_activated(policy) - && (policy->lc->sal != NULL) - && !policy->stun_resolver_context) { + if (linphone_nat_policy_stun_server_activated(policy) && (policy->lc->sal != NULL) && !policy->stun_resolver_context) { char host[NI_MAXHOST]; int port = 3478; linphone_parse_host_port(policy->stun_server, host, sizeof(host), &port); if (linphone_nat_policy_turn_enabled(policy)) service = "turn"; else if (linphone_nat_policy_stun_enabled(policy)) service = "stun"; if (service != NULL) { - policy->stun_resolver_context = sal_resolve(policy->lc->sal, service, "udp", host, port, AF_INET, (SalResolverCallback)stun_server_resolved, policy); + int family = AF_INET; + if (linphone_core_ipv6_enabled(policy->lc) == TRUE) family = AF_INET6; + policy->stun_resolver_context = sal_resolve(policy->lc->sal, service, "udp", host, port, family, (SalResolverCallback)stun_server_resolved, policy); } } } diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index 6fcc548ff..189bdee93 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -1232,15 +1232,30 @@ void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie end_call(pauline, marie); } -static void _call_with_ice(bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay) { - LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); - LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); +static void _call_with_ice(bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay, bool_t ipv6) { + LinphoneCoreManager* marie = linphone_core_manager_new2("marie_rc", FALSE); + LinphoneCoreManager* pauline = linphone_core_manager_new2(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc", FALSE); + if (ipv6) { + linphone_core_enable_ipv6(marie->lc, TRUE); + linphone_core_enable_ipv6(pauline->lc, TRUE); + } + linphone_core_manager_start(marie, TRUE); + linphone_core_manager_start(pauline, TRUE); _call_with_ice_base(pauline,marie,caller_with_ice,callee_with_ice,random_ports,forced_relay); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } + static void call_with_ice(void){ - _call_with_ice(TRUE,TRUE,FALSE,FALSE); + _call_with_ice(TRUE,TRUE,FALSE,FALSE,FALSE); +} + +static void call_with_ice_ipv6(void) { + if (liblinphone_tester_ipv6_available()) { + _call_with_ice(TRUE, TRUE, FALSE, FALSE, TRUE); + } else { + ms_warning("Test skipped, no ipv6 available"); + } } /*ICE is not expected to work in this case, however this should not crash*/ @@ -1264,19 +1279,19 @@ static void call_with_ice_no_sdp(void){ } static void call_with_ice_random_ports(void){ - _call_with_ice(TRUE,TRUE,TRUE,FALSE); + _call_with_ice(TRUE,TRUE,TRUE,FALSE,FALSE); } static void call_with_ice_forced_relay(void) { - _call_with_ice(TRUE, TRUE, TRUE, TRUE); + _call_with_ice(TRUE, TRUE, TRUE, TRUE, FALSE); } static void ice_to_not_ice(void){ - _call_with_ice(TRUE,FALSE,FALSE,FALSE); + _call_with_ice(TRUE,FALSE,FALSE,FALSE,FALSE); } static void not_ice_to_ice(void){ - _call_with_ice(FALSE,TRUE,FALSE,FALSE); + _call_with_ice(FALSE,TRUE,FALSE,FALSE,FALSE); } static void ice_added_by_reinvite(void){ @@ -1311,15 +1326,11 @@ static void ice_added_by_reinvite(void){ linphone_call_params_destroy(params); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,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)); - - BC_ASSERT_TRUE(check_ice(marie, pauline, LinphoneIceStateHostConnection)); - + /*wait for the ICE reINVITE*/ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,3)); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,3)); - + BC_ASSERT_TRUE(check_ice(marie, pauline, LinphoneIceStateHostConnection)); end_call(pauline, marie); @@ -4189,10 +4200,10 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh wait_for_until(marie->lc, pauline->lc, NULL, 0, 2000); if (use_ice) { - BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); /*wait for ICE reINVITE to complete*/ 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)); + BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); } /*marie looses the network and reconnects*/ @@ -4279,10 +4290,10 @@ static void call_with_sip_and_rtp_independant_switches(void){ wait_for_until(marie->lc, pauline->lc, NULL, 0, 2000); if (use_ice) { - BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); /*wait for ICE reINVITE to complete*/ 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)); + BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); } /*marie looses the SIP network and reconnects*/ linphone_core_set_sip_network_reachable(marie->lc, FALSE); @@ -4799,17 +4810,19 @@ static void v6_call_over_nat_64(void){ } static void call_with_ice_in_ipv4_with_v6_enabled(void) { - if (liblinphone_tester_ipv4_available() && liblinphone_tester_ipv6_available()){ - bool_t liblinphonetester_ipv6_save=liblinphonetester_ipv6; /*this test nee v6*/ - LinphoneCoreManager* marie = linphone_core_manager_new("marie_v4proxy_rc"); - LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_v4proxy_rc"); + LinphoneCoreManager* marie; + LinphoneCoreManager* pauline; - liblinphonetester_ipv6=TRUE; - _call_with_ice_base(pauline,marie,TRUE,TRUE,TRUE,FALSE); - linphone_core_manager_destroy(marie); - linphone_core_manager_destroy(pauline); - liblinphonetester_ipv6=liblinphonetester_ipv6_save; /*this test nee v6*/ + if (liblinphone_tester_ipv4_available() && liblinphone_tester_ipv6_available()){ + bool_t liblinphonetester_ipv6_save=liblinphonetester_ipv6; /*this test nee v6*/ + liblinphonetester_ipv6=TRUE; + marie = linphone_core_manager_new("marie_v4proxy_rc"); + pauline = linphone_core_manager_new("pauline_v4proxy_rc"); + _call_with_ice_base(pauline,marie,TRUE,TRUE,TRUE,FALSE); + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); + liblinphonetester_ipv6=liblinphonetester_ipv6_save; /*this test nee v6*/ } else ms_warning("Test skipped, need both ipv6 and v4 available"); } @@ -4873,6 +4886,7 @@ test_t call_tests[] = { TEST_NO_TAG("Call rejected without 403 because of wrong credential", call_rejected_without_403_because_wrong_credentials), TEST_NO_TAG("Call rejected without 403 because of wrong credential and no auth req cb", call_rejected_without_403_because_wrong_credentials_no_auth_req_cb), TEST_ONE_TAG("Call with ICE", call_with_ice, "ICE"), + TEST_ONE_TAG("Call with ICE IPv6", call_with_ice_ipv6, "ICE"), TEST_ONE_TAG("Call with ICE without SDP", call_with_ice_no_sdp, "ICE"), TEST_ONE_TAG("Call with ICE (random ports)", call_with_ice_random_ports, "ICE"), TEST_ONE_TAG("Call with ICE (forced relay)", call_with_ice_forced_relay, "ICE"), diff --git a/tester/call_video_tester.c b/tester/call_video_tester.c index 2f8abfaaf..2c5e7bc06 100644 --- a/tester/call_video_tester.c +++ b/tester/call_video_tester.c @@ -886,11 +886,11 @@ static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVide BC_ASSERT_TRUE(call_ok = call(pauline, marie)); if (!call_ok) goto end; - BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); /* Wait for ICE reINVITEs to complete. */ BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2) && wait_for(pauline->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); + BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts); nb_media_starts++; diff --git a/tester/stun_tester.c b/tester/stun_tester.c index 3967ebb44..69003fd2c 100644 --- a/tester/stun_tester.c +++ b/tester/stun_tester.c @@ -121,7 +121,7 @@ static void check_turn_context_statistics(MSTurnContext *turn_context, bool_t fo } } -static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t caller_turn_enabled, bool_t callee_turn_enabled, bool_t rtcp_mux_enabled) { +static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t caller_turn_enabled, bool_t callee_turn_enabled, bool_t rtcp_mux_enabled, bool_t ipv6) { LinphoneCoreManager *marie; LinphoneCoreManager *pauline; LinphoneCall *lcall; @@ -129,11 +129,16 @@ static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t LinphoneMediaDirection expected_video_dir = LinphoneMediaDirectionInactive; bctbx_list_t *lcs = NULL; - marie = linphone_core_manager_new("marie_rc"); + marie = linphone_core_manager_new2("marie_rc", FALSE); lcs = bctbx_list_append(lcs, marie->lc); - pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); + pauline = linphone_core_manager_new2(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc", FALSE); lcs = bctbx_list_append(lcs, pauline->lc); + if (ipv6) { + linphone_core_enable_ipv6(marie->lc, TRUE); + linphone_core_enable_ipv6(pauline->lc, TRUE); + } + configure_nat_policy(marie->lc, caller_turn_enabled); configure_nat_policy(pauline->lc, callee_turn_enabled); if (forced_relay == TRUE) { @@ -148,6 +153,9 @@ static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t lp_config_set_int(linphone_core_get_config(pauline->lc), "rtp", "rtcp_mux", 1); } + linphone_core_manager_start(marie, TRUE); + linphone_core_manager_start(pauline, TRUE); + if (video_enabled) { #ifdef VIDEO_ENABLED video_call_base_2(marie, pauline, FALSE, LinphoneMediaEncryptionNone, TRUE, TRUE); @@ -184,31 +192,39 @@ static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t } static void basic_ice_turn_call(void) { - ice_turn_call_base(FALSE, FALSE, TRUE, TRUE, FALSE); + ice_turn_call_base(FALSE, FALSE, TRUE, TRUE, FALSE, FALSE); +} + +static void basic_ipv6_ice_turn_call(void) { + if (liblinphone_tester_ipv6_available()) { + ice_turn_call_base(FALSE, FALSE, TRUE, TRUE, FALSE, TRUE); + } else { + ms_warning("Test skipped, no ipv6 available"); + } } #ifdef VIDEO_ENABLED static void video_ice_turn_call(void) { - ice_turn_call_base(TRUE, FALSE, TRUE, TRUE, FALSE); + ice_turn_call_base(TRUE, FALSE, TRUE, TRUE, FALSE, FALSE); } #endif static void relayed_ice_turn_call(void) { - ice_turn_call_base(FALSE, TRUE, TRUE, TRUE, FALSE); + ice_turn_call_base(FALSE, TRUE, TRUE, TRUE, FALSE, FALSE); } #ifdef VIDEO_ENABLED static void relayed_video_ice_turn_call(void) { - ice_turn_call_base(TRUE, TRUE, TRUE, TRUE, FALSE); + ice_turn_call_base(TRUE, TRUE, TRUE, TRUE, FALSE, FALSE); } #endif static void relayed_ice_turn_call_with_rtcp_mux(void) { - ice_turn_call_base(FALSE, TRUE, TRUE, TRUE, TRUE); + ice_turn_call_base(FALSE, TRUE, TRUE, TRUE, TRUE, FALSE); } static void relayed_ice_turn_to_ice_stun_call(void) { - ice_turn_call_base(FALSE, TRUE, TRUE, FALSE, FALSE); + ice_turn_call_base(FALSE, TRUE, TRUE, FALSE, FALSE, FALSE); } @@ -216,6 +232,7 @@ test_t stun_tests[] = { TEST_ONE_TAG("Basic Stun test (Ping/public IP)", linphone_stun_test_grab_ip, "STUN"), TEST_ONE_TAG("STUN encode", linphone_stun_test_encode, "STUN"), TEST_TWO_TAGS("Basic ICE+TURN call", basic_ice_turn_call, "ICE", "TURN"), + TEST_TWO_TAGS("Basic IPv6 ICE+TURN call", basic_ipv6_ice_turn_call, "ICE", "TURN"), #ifdef VIDEO_ENABLED TEST_TWO_TAGS("Video ICE+TURN call", video_ice_turn_call, "ICE", "TURN"), TEST_TWO_TAGS("Relayed video ICE+TURN call", relayed_video_ice_turn_call, "ICE", "TURN"), diff --git a/tester/tester.c b/tester/tester.c index 0c865fce5..86e2b233a 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -656,20 +656,33 @@ static void check_ice_from_rtp(LinphoneCall *c1, LinphoneCall *c2, LinphoneStrea return; } - if (linphone_call_get_audio_stats(c1)->ice_state == LinphoneIceStateHostConnection && media_stream_started(ms)) { - char ip[16]; - char port[8]; - getnameinfo((const struct sockaddr *)&c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addr - , c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addrlen - , ip - , sizeof(ip) - , port - , sizeof(port) - , NI_NUMERICHOST|NI_NUMERICSERV); - BC_ASSERT_STRING_EQUAL(ip, c2->media_localip); + struct sockaddr_storage remaddr; + socklen_t remaddrlen = sizeof(remaddr); + char ip[NI_MAXHOST] = { 0 }; + int port = 0; + SalMediaDescription *result_desc; + char *expected_addr = NULL; + + const LinphoneCallParams *cp1 = linphone_call_get_current_params(c1); + const LinphoneCallParams *cp2 = linphone_call_get_current_params(c2); + if (cp1->update_call_when_ice_completed && cp2->update_call_when_ice_completed) { + memset(&remaddr, 0, remaddrlen); + result_desc = sal_call_get_final_media_description(c2->op); + expected_addr = result_desc->streams[0].rtp_addr; + if (expected_addr[0] == '\0') expected_addr = result_desc->addr; + if ((strchr(expected_addr, ':') == NULL) && (c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addr.ss_family == AF_INET6)) { + bctbx_sockaddr_ipv6_to_ipv4((struct sockaddr *)&c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addr, (struct sockaddr *)&remaddr, &remaddrlen); + } else { + memcpy(&remaddr, &c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addr, c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addrlen); + } + bctbx_sockaddr_to_ip_address((struct sockaddr *)&remaddr, remaddrlen, ip, sizeof(ip), &port); + + BC_ASSERT_STRING_EQUAL(ip, expected_addr); + } } } + bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, LinphoneIceState state) { LinphoneCall *c1,*c2; bool_t audio_success=FALSE; From eeec3d41f8cb16a759bd56ce9f5b1da2e8bbfb84 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 21 Jul 2016 17:52:35 +0200 Subject: [PATCH 24/45] Fix build with Visual Studio. --- include/sal/sal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sal/sal.h b/include/sal/sal.h index b885cf6a1..a815bf64b 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -714,7 +714,7 @@ int sal_call_accept(SalOp*h); int sal_call_decline(SalOp *h, SalReason reason, const char *redirection /*optional*/); int sal_call_update(SalOp *h, const char *subject, bool_t no_user_consent); SalMediaDescription * sal_call_get_remote_media_description(SalOp *h); -SalMediaDescription * sal_call_get_final_media_description(SalOp *h); +LINPHONE_PUBLIC SalMediaDescription * sal_call_get_final_media_description(SalOp *h); int sal_call_refer(SalOp *h, const char *refer_to); int sal_call_refer_with_replaces(SalOp *h, SalOp *other_call_h); int sal_call_accept_refer(SalOp *h); From b03a9b25f8125fa40bbc44dc76bb73299dd3bb36 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 13 Jul 2016 13:45:05 +0200 Subject: [PATCH 25/45] Add API and config parameter to enable/disable DNS search. --- coreapi/bellesip_sal/sal_impl.c | 8 ++++++++ coreapi/linphonecore.c | 12 ++++++++++++ coreapi/linphonecore.h | 16 ++++++++++++++++ include/sal/sal.h | 2 ++ 4 files changed, 38 insertions(+) diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index aabee27f7..e9f0a7b23 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -877,6 +877,14 @@ bool_t sal_dns_srv_enabled(const Sal *sal) { return (bool_t)belle_sip_stack_dns_srv_enabled(sal->stack); } +void sal_enable_dns_search(Sal *sal, bool_t enable) { + belle_sip_stack_enable_dns_search(sal->stack, (unsigned char)enable); +} + +bool_t sal_dns_search_enabled(const Sal *sal) { + return (bool_t)belle_sip_stack_dns_search_enabled(sal->stack); +} + void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file) { belle_sip_stack_set_dns_user_hosts_file(sal->stack, hosts_file); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 317a87a16..bea0fff1b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -790,6 +790,8 @@ static void net_config_read (LinphoneCore *lc) } tmp = lp_config_get_int(lc->config, "net", "dns_srv_enabled", 1); linphone_core_enable_dns_srv(lc, tmp); + tmp = lp_config_get_int(lc->config, "net", "dns_search_enabled", 1); + linphone_core_enable_dns_search(lc, tmp); /* This is to filter out unsupported firewall policies */ if (nat_policy_ref == NULL) @@ -1523,6 +1525,16 @@ bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc) { return sal_dns_srv_enabled(lc->sal); } +void linphone_core_enable_dns_search(LinphoneCore *lc, bool_t enable) { + sal_enable_dns_search(lc->sal, enable); + if (linphone_core_ready(lc)) + lp_config_set_int(lc->config, "net", "dns_search_enabled", enable ? 1 : 0); +} + +bool_t linphone_core_dns_search_enabled(const LinphoneCore *lc) { + return sal_dns_search_enabled(lc->sal); +} + int linphone_core_get_download_bandwidth(const LinphoneCore *lc){ return lc->net_conf.download_bw; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index eafc3512d..8adc07c7e 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -2754,6 +2754,22 @@ LINPHONE_PUBLIC void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enabl */ LINPHONE_PUBLIC bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc); +/** + * Enable or disable DNS search (use of local domain if the fully qualified name did return results). + * @param[in] lc #LinphoneCore object. + * @param[in] enable TRUE to enable DNS search, FALSE to disable it. + * @ingroup media_parameters + */ +LINPHONE_PUBLIC void linphone_core_enable_dns_search(LinphoneCore *lc, bool_t enable); + +/** + * Tells whether DNS search (use of local domain if the fully qualified name did return results) is enabled. + * @param[in] lc #LinphoneCore object. + * @return TRUE if DNS search is enabled, FALSE if disabled. + * @ingroup media_parameters + */ +LINPHONE_PUBLIC bool_t linphone_core_dns_search_enabled(const LinphoneCore *lc); + /** * Forces liblinphone to use the supplied list of dns servers, instead of system's ones. * @param[in] lc #LinphoneCore object. diff --git a/include/sal/sal.h b/include/sal/sal.h index a815bf64b..629569744 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -870,6 +870,8 @@ LINPHONE_PUBLIC int sal_get_transport_timeout(const Sal* sal); void sal_set_dns_servers(Sal *sal, const MSList *servers); LINPHONE_PUBLIC void sal_enable_dns_srv(Sal *sal, bool_t enable); LINPHONE_PUBLIC bool_t sal_dns_srv_enabled(const Sal *sal); +LINPHONE_PUBLIC void sal_enable_dns_search(Sal *sal, bool_t enable); +LINPHONE_PUBLIC bool_t sal_dns_search_enabled(const Sal *sal); LINPHONE_PUBLIC void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file); LINPHONE_PUBLIC const char *sal_get_dns_user_hosts_file(const Sal *sal); unsigned int sal_get_random(void); From ead444f3f0ea864e86a49e79c88e334da91e85f9 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 22 Jul 2016 11:24:28 +0200 Subject: [PATCH 26/45] Enable IPv6 by default on all platforms (it was only enabled on iOS). --- coreapi/linphonecore.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index bea0fff1b..33eedc3dd 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -953,10 +953,7 @@ static void sip_config_read(LinphoneCore *lc) const char *tmpstr; LCSipTransports tr; int i,tmp; - int ipv6_default = FALSE; -#if TARGET_OS_IPHONE - ipv6_default=TRUE; -#endif + int ipv6_default = TRUE; if (lp_config_get_int(lc->config,"sip","use_session_timers",0)==1){ sal_use_session_timers(lc->sal,200); @@ -965,13 +962,11 @@ static void sip_config_read(LinphoneCore *lc) sal_use_no_initial_route(lc->sal,lp_config_get_int(lc->config,"sip","use_no_initial_route",0)); sal_use_rport(lc->sal,lp_config_get_int(lc->config,"sip","use_rport",1)); -#if TARGET_OS_IPHONE if (!lp_config_get_int(lc->config,"sip","ipv6_migration_done",FALSE) && lp_config_has_entry(lc->config,"sip","use_ipv6")) { lp_config_clean_entry(lc->config,"sip","use_ipv6"); lp_config_set_int(lc->config, "sip", "ipv6_migration_done", TRUE); ms_message("IPV6 settings migration done."); } -#endif lc->sip_conf.ipv6_enabled=lp_config_get_int(lc->config,"sip","use_ipv6",ipv6_default); From 6ea23562ac632c4f5f7b092c52d8bd6144900b03 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 27 Jul 2016 15:15:03 +0200 Subject: [PATCH 27/45] Prevent crash in ICE+TURN tests. --- tester/stun_tester.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tester/stun_tester.c b/tester/stun_tester.c index 69003fd2c..7285c20d4 100644 --- a/tester/stun_tester.c +++ b/tester/stun_tester.c @@ -174,13 +174,16 @@ static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t check_media_direction(pauline, linphone_core_get_current_call(pauline->lc), lcs, LinphoneMediaDirectionSendRecv, expected_video_dir); liblinphone_tester_check_rtcp(marie, pauline); lcall = linphone_core_get_current_call(marie->lc); - BC_ASSERT_PTR_NOT_NULL(lcall->ice_session); - if (lcall->ice_session != NULL) { - IceCheckList *cl = ice_session_check_list(lcall->ice_session, 0); - BC_ASSERT_PTR_NOT_NULL(cl); - if (cl != NULL) { - check_turn_context_statistics(cl->rtp_turn_context, forced_relay); - if (!rtcp_mux_enabled) check_turn_context_statistics(cl->rtcp_turn_context, forced_relay); + BC_ASSERT_PTR_NOT_NULL(lcall); + if (lcall != NULL) { + BC_ASSERT_PTR_NOT_NULL(lcall->ice_session); + if (lcall->ice_session != NULL) { + IceCheckList *cl = ice_session_check_list(lcall->ice_session, 0); + BC_ASSERT_PTR_NOT_NULL(cl); + if (cl != NULL) { + check_turn_context_statistics(cl->rtp_turn_context, forced_relay); + if (!rtcp_mux_enabled) check_turn_context_statistics(cl->rtcp_turn_context, forced_relay); + } } } From 710567252ed07572270203749a3badfc34af7888 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 19 Jul 2016 13:16:19 +0200 Subject: [PATCH 28/45] Do not access the fd field of the bctbx_file_t as it may not be set by some vfs implementation. Furthermore if the file fails to open bctbx_file_open returns NULL and so accessing the fd field will result in a crash. --- coreapi/lpconfig.c | 51 ++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index 2f5353b39..41dd9d2e7 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -397,10 +397,6 @@ LpConfig * lp_config_new_from_buffer(const char *buffer){ } LpConfig *lp_config_new_with_factory(const char *config_filename, const char *factory_config_filename) { - - int fd; - bctbx_vfs_file_t* pFile = NULL; - LpConfig *lpconfig=lp_new0(LpConfig,1); lpconfig->g_bctbx_vfs = bctbx_vfs_get_default(); @@ -430,23 +426,20 @@ LpConfig *lp_config_new_with_factory(const char *config_filename, const char *fa } } #endif /*_WIN32*/ - /*open with r+ to check if we can write on it later*/ - pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,lpconfig->filename, "r+"); - fd = pFile->fd; - lpconfig->pFile = pFile; - + /*open with r+ to check if we can write on it later*/ + lpconfig->pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,lpconfig->filename, "r+"); #ifdef RENAME_REQUIRES_NONEXISTENT_NEW_PATH - if (fd == -1){ - pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,lpconfig->tmpfilename, "r+"); - if (fd){ + if (lpconfig->pFile == NULL){ + lpconfig->pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,lpconfig->tmpfilename, "r+"); + if (lpconfig->pFile == NULL){ ms_warning("Could not open %s but %s works, app may have crashed during last sync.",lpconfig->filename,lpconfig->tmpfilename); } } #endif - if (fd != -1){ - lp_config_parse(lpconfig, pFile); - bctbx_file_close(pFile); + if (lpconfig->pFile != NULL){ + lp_config_parse(lpconfig, lpconfig->pFile); + bctbx_file_close(lpconfig->pFile); lpconfig->pFile = NULL; lpconfig->modified=0; } @@ -463,10 +456,8 @@ fail: int lp_config_read_file(LpConfig *lpconfig, const char *filename){ char* path = lp_realpath(filename, NULL); - int fd=-1; bctbx_vfs_file_t* pFile = bctbx_file_open(lpconfig->g_bctbx_vfs, path, "r"); - fd = pFile->fd; - if (fd != -1){ + if (pFile != NULL){ ms_message("Reading config information from %s", path); lp_config_parse(lpconfig, pFile); bctbx_file_close(pFile); @@ -927,7 +918,7 @@ static const char *_lp_config_dirname(char *path) { } bool_t lp_config_relative_file_exists(const LpConfig *lpconfig, const char *filename) { - bctbx_vfs_file_t *pFile = lpconfig->pFile; + bctbx_vfs_file_t *pFile; if (lpconfig->filename == NULL) { return FALSE; } else { @@ -943,10 +934,10 @@ bool_t lp_config_relative_file_exists(const LpConfig *lpconfig, const char *file pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,realfilepath, "r"); ms_free(realfilepath); - if (pFile->fd != -1) { + if (pFile != NULL) { bctbx_file_close(pFile); } - return pFile->fd > 0; + return pFile != NULL; } } @@ -955,9 +946,8 @@ void lp_config_write_relative_file(const LpConfig *lpconfig, const char *filenam const char *dir = NULL; char *filepath = NULL; char *realfilepath = NULL; - int fd = 0; + bctbx_vfs_file_t *pFile; - bctbx_vfs_file_t *pFile = lpconfig->pFile; if (lpconfig->filename == NULL) return; if(strlen(data) == 0) { @@ -974,10 +964,8 @@ void lp_config_write_relative_file(const LpConfig *lpconfig, const char *filenam goto end; } - pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,realfilepath, "w"); - fd = pFile->fd; - - if(fd == -1) { + pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,realfilepath, "w"); + if(pFile == NULL) { ms_error("Could not open %s for write", realfilepath); goto end; } @@ -994,7 +982,6 @@ int lp_config_read_relative_file(const LpConfig *lpconfig, const char *filename, char *dup_config_file = NULL; const char *dir = NULL; char *filepath = NULL; - int fd = 0; bctbx_vfs_file_t* pFile = NULL; char* realfilepath = NULL; @@ -1011,16 +998,12 @@ int lp_config_read_relative_file(const LpConfig *lpconfig, const char *filename, } pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,realfilepath,"r"); - if (pFile !=NULL) - fd = pFile->fd; - - if(fd == -1 ) { + if (pFile == NULL) { ms_error("Could not open %s for read.", realfilepath); goto err; } - - if(bctbx_file_read(pFile, data, 1, max_length) < 0){ + if(bctbx_file_read(pFile, data, 1, (off_t)max_length) < 0){ ms_error("%s could not be loaded.", realfilepath); goto err; From d53a690a11aeee02cee27ab9f74530d8011b0844 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Aug 2016 15:42:50 +0200 Subject: [PATCH 29/45] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index b0dc4e259..6e8471005 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b0dc4e259f44a45a173e020794b2a75191afb4e9 +Subproject commit 6e84710057279bb2054196fe31e55a706053e911 From afbf2577499beda23a420a4ddb63927098371c03 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Aug 2016 15:46:28 +0200 Subject: [PATCH 30/45] Fix crash in linphone_call_update_ice_from_remote_media_description() when building with GCC >= 4.9 and -O2. --- CMakeLists.txt | 3 + configure.ac | 3 + coreapi/misc.c | 320 +++++++++++++++++++++++++++---------------------- 3 files changed, 182 insertions(+), 144 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79f9cdc19..83180627a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,6 +247,9 @@ if(MSVC) else() list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized" "-Wno-error=deprecated-declarations") list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement" "-Wstrict-prototypes" "-Wno-error=strict-prototypes") + if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + list(APPEND STRICT_OPTIONS_C "-fno-inline-small-functions") + endif() if(CMAKE_C_COMPILER_ID STREQUAL "Clang") list(APPEND STRICT_OPTIONS_CPP "-Qunused-arguments" "-Wno-array-bounds") endif() diff --git a/configure.ac b/configure.ac index ed258184a..377fb30a3 100644 --- a/configure.ac +++ b/configure.ac @@ -777,6 +777,9 @@ STRICT_OPTIONS_CXX="" #for clang case $CC in + *gcc*) + STRICT_OPTIONS="$STRICT_OPTIONS -fno-inline-small-functions" + ;; *clang*) STRICT_OPTIONS="$STRICT_OPTIONS -Qunused-arguments " #disabled due to wrong optimization false positive with small string diff --git a/coreapi/misc.c b/coreapi/misc.c index b9040045e..eda06fcda 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -1077,150 +1077,6 @@ void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMedi } } -void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer){ - const SalStreamDescription *stream; - IceCheckList *cl = NULL; - bool_t default_candidate = FALSE; - const char *addr = NULL; - int port = 0; - int componentID = 0; - bool_t ice_restarted = FALSE; - bool_t ice_params_found=FALSE; - int i, j; - - if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) { - ice_params_found=TRUE; - } else { - for (i = 0; i < md->nb_streams; i++) { - stream = &md->streams[i]; - cl = ice_session_check_list(call->ice_session, i); - if (cl) { - if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) { - ice_params_found=TRUE; - } else { - ice_params_found=FALSE; - break; - } - } - } - } - if (ice_params_found) { - /* Check for ICE restart and set remote credentials. */ - if ((strcmp(md->addr, "0.0.0.0") == 0) || (strcmp(md->addr, "::0") == 0)) { - ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); - ice_restarted = TRUE; - } else { - for (i = 0; i < md->nb_streams; i++) { - stream = &md->streams[i]; - cl = ice_session_check_list(call->ice_session, i); - if (cl && (strcmp(stream->rtp_addr, "0.0.0.0") == 0)) { - ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); - ice_restarted = TRUE; - break; - } - } - } - if ((ice_session_remote_ufrag(call->ice_session) == NULL) && (ice_session_remote_pwd(call->ice_session) == NULL)) { - ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); - } else if (ice_session_remote_credentials_changed(call->ice_session, md->ice_ufrag, md->ice_pwd)) { - if (ice_restarted == FALSE) { - ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); - ice_restarted = TRUE; - } - ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); - } - for (i = 0; i < md->nb_streams; i++) { - stream = &md->streams[i]; - cl = ice_session_check_list(call->ice_session, i); - if (cl && (stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) { - if (ice_check_list_remote_credentials_changed(cl, stream->ice_ufrag, stream->ice_pwd)) { - if (ice_restarted == FALSE - && ice_check_list_get_remote_ufrag(cl) - && ice_check_list_get_remote_pwd(cl)) { - /* restart only if remote ufrag/paswd was already set*/ - ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); - ice_restarted = TRUE; - } - ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); - break; - } - } - } - - /* Create ICE check lists if needed and parse ICE attributes. */ - for (i = 0; i < md->nb_streams; i++) { - stream = &md->streams[i]; - cl = ice_session_check_list(call->ice_session, i); - - if (cl==NULL) continue; - if (stream->ice_mismatch == TRUE) { - ice_check_list_set_state(cl, ICL_Failed); - } else if (stream->rtp_port == 0) { - ice_session_remove_check_list(call->ice_session, cl); - clear_ice_check_list(call,cl); - } else { - int family; - if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) - ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); - for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES; j++) { - const SalIceCandidate *candidate = &stream->ice_candidates[j]; - default_candidate = FALSE; - addr = NULL; - port = 0; - if (candidate->addr[0] == '\0') break; - if ((candidate->componentID == 0) || (candidate->componentID > 2)) continue; - get_default_addr_and_port(candidate->componentID, md, stream, &addr, &port); - if (addr && (candidate->port == port) && (strlen(candidate->addr) == strlen(addr)) && (strcmp(candidate->addr, addr) == 0)) - default_candidate = TRUE; - if (strchr(candidate->addr, ':') != NULL) family = AF_INET6; - else family = AF_INET; - ice_add_remote_candidate(cl, candidate->type, family, candidate->addr, candidate->port, candidate->componentID, - candidate->priority, candidate->foundation, default_candidate); - } - if (ice_restarted == FALSE) { - bool_t losing_pairs_added = FALSE; - for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES; j++) { - const SalIceRemoteCandidate *remote_candidate = &stream->ice_remote_candidates[j]; - addr = NULL; - port = 0; - componentID = j + 1; - if (remote_candidate->addr[0] == '\0') break; - get_default_addr_and_port(componentID, md, stream, &addr, &port); - if (j == 0) { - /* If we receive a re-invite and we finished ICE processing on our side, use the candidates given by the remote. */ - ice_check_list_unselect_valid_pairs(cl); - } - if (strchr(remote_candidate->addr, ':') != NULL) family = AF_INET6; - else family = AF_INET; - ice_add_losing_pair(cl, j + 1, family, remote_candidate->addr, remote_candidate->port, addr, port); - losing_pairs_added = TRUE; - } - if (losing_pairs_added == TRUE) ice_check_list_check_completed(cl); - } - } - } - for (i = 0; i < md->nb_streams; i++) { - stream = &md->streams[i]; - cl = ice_session_check_list(call->ice_session, i); - if (!cl) continue; - - if (!sal_stream_description_active(stream)) { - ice_session_remove_check_list_from_idx(call->ice_session, i); - clear_ice_check_list(call, cl); - } - } - linphone_call_clear_unused_ice_candidates(call, md); - ice_session_check_mismatch(call->ice_session); - } else { - /* Response from remote does not contain mandatory ICE attributes, delete the session. */ - linphone_call_delete_ice_session(call); - return; - } - if (ice_session_nb_check_lists(call->ice_session) == 0) { - linphone_call_delete_ice_session(call); - } -} - bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md){ int i; @@ -2074,3 +1930,179 @@ void linphone_task_list_run(LinphoneTaskList *t){ void linphone_task_list_free(LinphoneTaskList *t){ t->hooks = bctbx_list_free_with_data(t->hooks, (void (*)(void*))ms_free); } + +static bool_t _ice_params_found_in_remote_media_description(IceSession *ice_session, const SalMediaDescription *md) { + const SalStreamDescription *stream; + IceCheckList *cl = NULL; + int i; + bool_t ice_params_found = FALSE; + if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) { + ice_params_found=TRUE; + } else { + for (i = 0; i < md->nb_streams; i++) { + stream = &md->streams[i]; + cl = ice_session_check_list(ice_session, i); + if (cl) { + if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) { + ice_params_found=TRUE; + } else { + ice_params_found=FALSE; + break; + } + } + } + } + return ice_params_found; +} + +static bool_t _check_for_ice_restart_and_set_remote_credentials(IceSession *ice_session, const SalMediaDescription *md, bool_t is_offer) { + const SalStreamDescription *stream; + IceCheckList *cl = NULL; + bool_t ice_restarted = FALSE; + int i; + + if ((strcmp(md->addr, "0.0.0.0") == 0) || (strcmp(md->addr, "::0") == 0)) { + ice_session_restart(ice_session, is_offer ? IR_Controlled : IR_Controlling); + ice_restarted = TRUE; + } else { + for (i = 0; i < md->nb_streams; i++) { + stream = &md->streams[i]; + cl = ice_session_check_list(ice_session, i); + if (cl && (strcmp(stream->rtp_addr, "0.0.0.0") == 0)) { + ice_session_restart(ice_session, is_offer ? IR_Controlled : IR_Controlling); + ice_restarted = TRUE; + break; + } + } + } + if ((ice_session_remote_ufrag(ice_session) == NULL) && (ice_session_remote_pwd(ice_session) == NULL)) { + ice_session_set_remote_credentials(ice_session, md->ice_ufrag, md->ice_pwd); + } else if (ice_session_remote_credentials_changed(ice_session, md->ice_ufrag, md->ice_pwd)) { + if (ice_restarted == FALSE) { + ice_session_restart(ice_session, is_offer ? IR_Controlled : IR_Controlling); + ice_restarted = TRUE; + } + ice_session_set_remote_credentials(ice_session, md->ice_ufrag, md->ice_pwd); + } + for (i = 0; i < md->nb_streams; i++) { + stream = &md->streams[i]; + cl = ice_session_check_list(ice_session, i); + if (cl && (stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) { + if (ice_check_list_remote_credentials_changed(cl, stream->ice_ufrag, stream->ice_pwd)) { + if (ice_restarted == FALSE + && ice_check_list_get_remote_ufrag(cl) + && ice_check_list_get_remote_pwd(cl)) { + /* restart only if remote ufrag/paswd was already set*/ + ice_session_restart(ice_session, is_offer ? IR_Controlled : IR_Controlling); + ice_restarted = TRUE; + } + ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); + break; + } + } + } + return ice_restarted; +} + +static void _create_ice_check_lists_and_parse_ice_attributes(LinphoneCall *call, const SalMediaDescription *md, bool_t ice_restarted) { + const SalStreamDescription *stream; + IceCheckList *cl = NULL; + bool_t default_candidate = FALSE; + const char *addr = NULL; + int port = 0; + int componentID = 0; + int family; + int i, j; + + for (i = 0; i < md->nb_streams; i++) { + stream = &md->streams[i]; + cl = ice_session_check_list(call->ice_session, i); + + if (cl==NULL) continue; + if (stream->ice_mismatch == TRUE) { + ice_check_list_set_state(cl, ICL_Failed); + continue; + } + if (stream->rtp_port == 0) { + ice_session_remove_check_list(call->ice_session, cl); + clear_ice_check_list(call,cl); + continue; + } + + if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) + ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); + for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES; j++) { + const SalIceCandidate *candidate = &stream->ice_candidates[j]; + default_candidate = FALSE; + addr = NULL; + port = 0; + if (candidate->addr[0] == '\0') break; + if ((candidate->componentID == 0) || (candidate->componentID > 2)) continue; + get_default_addr_and_port(candidate->componentID, md, stream, &addr, &port); + if (addr && (candidate->port == port) && (strlen(candidate->addr) == strlen(addr)) && (strcmp(candidate->addr, addr) == 0)) + default_candidate = TRUE; + if (strchr(candidate->addr, ':') != NULL) family = AF_INET6; + else family = AF_INET; + ice_add_remote_candidate(cl, candidate->type, family, candidate->addr, candidate->port, candidate->componentID, + candidate->priority, candidate->foundation, default_candidate); + } + if (ice_restarted == FALSE) { + bool_t losing_pairs_added = FALSE; + for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES; j++) { + const SalIceRemoteCandidate *remote_candidate = &stream->ice_remote_candidates[j]; + addr = NULL; + port = 0; + componentID = j + 1; + if (remote_candidate->addr[0] == '\0') break; + get_default_addr_and_port(componentID, md, stream, &addr, &port); + if (j == 0) { + /* If we receive a re-invite and we finished ICE processing on our side, use the candidates given by the remote. */ + ice_check_list_unselect_valid_pairs(cl); + } + if (strchr(remote_candidate->addr, ':') != NULL) family = AF_INET6; + else family = AF_INET; + ice_add_losing_pair(cl, j + 1, family, remote_candidate->addr, remote_candidate->port, addr, port); + losing_pairs_added = TRUE; + } + if (losing_pairs_added == TRUE) ice_check_list_check_completed(cl); + } + } +} + +static void _update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer) { + const SalStreamDescription *stream; + IceCheckList *cl = NULL; + bool_t ice_restarted = FALSE; + int i; + + /* Check for ICE restart and set remote credentials. */ + ice_restarted = _check_for_ice_restart_and_set_remote_credentials(call->ice_session, md, is_offer); + + /* Create ICE check lists if needed and parse ICE attributes. */ + _create_ice_check_lists_and_parse_ice_attributes(call, md, ice_restarted); + for (i = 0; i < md->nb_streams; i++) { + stream = &md->streams[i]; + cl = ice_session_check_list(call->ice_session, i); + if (!cl) continue; + + if (!sal_stream_description_active(stream)) { + ice_session_remove_check_list_from_idx(call->ice_session, i); + clear_ice_check_list(call, cl); + } + } + linphone_call_clear_unused_ice_candidates(call, md); + ice_session_check_mismatch(call->ice_session); +} + +void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer){ + if (_ice_params_found_in_remote_media_description(call->ice_session, md) == TRUE) { + _update_ice_from_remote_media_description(call, md, is_offer); + } else { + /* Response from remote does not contain mandatory ICE attributes, delete the session. */ + linphone_call_delete_ice_session(call); + return; + } + if (ice_session_nb_check_lists(call->ice_session) == 0) { + linphone_call_delete_ice_session(call); + } +} From 36d95999b57bb81b375a9b8261def957a1acab36 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 4 Aug 2016 11:17:01 +0200 Subject: [PATCH 31/45] Revert "Enable IPv6 by default on all platforms (it was only enabled on iOS)." This reverts commit ead444f3f0ea864e86a49e79c88e334da91e85f9. --- coreapi/linphonecore.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 33eedc3dd..bea0fff1b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -953,7 +953,10 @@ static void sip_config_read(LinphoneCore *lc) const char *tmpstr; LCSipTransports tr; int i,tmp; - int ipv6_default = TRUE; + int ipv6_default = FALSE; +#if TARGET_OS_IPHONE + ipv6_default=TRUE; +#endif if (lp_config_get_int(lc->config,"sip","use_session_timers",0)==1){ sal_use_session_timers(lc->sal,200); @@ -962,11 +965,13 @@ static void sip_config_read(LinphoneCore *lc) sal_use_no_initial_route(lc->sal,lp_config_get_int(lc->config,"sip","use_no_initial_route",0)); sal_use_rport(lc->sal,lp_config_get_int(lc->config,"sip","use_rport",1)); +#if TARGET_OS_IPHONE if (!lp_config_get_int(lc->config,"sip","ipv6_migration_done",FALSE) && lp_config_has_entry(lc->config,"sip","use_ipv6")) { lp_config_clean_entry(lc->config,"sip","use_ipv6"); lp_config_set_int(lc->config, "sip", "ipv6_migration_done", TRUE); ms_message("IPV6 settings migration done."); } +#endif lc->sip_conf.ipv6_enabled=lp_config_get_int(lc->config,"sip","use_ipv6",ipv6_default); From 4904fec941ab42f846f59367fb4a3d95261be6d5 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 4 Aug 2016 13:50:11 +0200 Subject: [PATCH 32/45] Revert "Handle IPv6 for ICE and TURN --- coreapi/misc.c | 111 ++++++++++++------------------------ coreapi/nat_policy.c | 12 ++-- tester/call_single_tester.c | 64 ++++++++------------- tester/call_video_tester.c | 2 +- tester/stun_tester.c | 35 +++--------- tester/tester.c | 35 ++++-------- 6 files changed, 92 insertions(+), 167 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index eda06fcda..086aefc05 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -587,17 +587,16 @@ void linphone_core_resolve_stun_server(LinphoneCore *lc){ if (lc->nat_policy != NULL) { linphone_nat_policy_resolve_stun_server(lc->nat_policy); } else { + /* + * WARNING: stun server resolution only done in IPv4. + * TODO: use IPv6 resolution if linphone_core_ipv6_enabled()==TRUE and use V4Mapped addresses for ICE gathering. + */ const char *server=linphone_core_get_stun_server(lc); - LinphoneFirewallPolicy firewall_policy = linphone_core_get_firewall_policy(lc); - if (lc->sal && server && !lc->net_conf.stun_res - && ((firewall_policy == LinphonePolicyUseStun) || (firewall_policy == LinphonePolicyUseIce))) { + if (lc->sal && server && !lc->net_conf.stun_res){ char host[NI_MAXHOST]; - const char *service = "stun"; int port=3478; - int family = AF_INET; linphone_parse_host_port(server,host,sizeof(host),&port); - if (linphone_core_ipv6_enabled(lc) == TRUE) family = AF_INET6; - lc->net_conf.stun_res = sal_resolve(lc->sal, service, "udp", host, port, family, (SalResolverCallback)stun_server_resolved, lc); + lc->net_conf.stun_res=sal_resolve_a(lc->sal,host,port,AF_INET,(SalResolverCallback)stun_server_resolved,lc); } } } @@ -683,55 +682,12 @@ static void stun_auth_requested_cb(LinphoneCall *call, const char *realm, const } } -static void linphone_core_add_local_ice_candidates(LinphoneCall *call, int family, const char *addr, IceCheckList *audio_cl, IceCheckList *video_cl, IceCheckList *text_cl) { - if ((ice_check_list_state(audio_cl) != ICL_Completed) && (ice_check_list_candidates_gathered(audio_cl) == FALSE)) { - ice_add_local_candidate(audio_cl, "host", family, addr, call->media_ports[call->main_audio_stream_index].rtp_port, 1, NULL); - ice_add_local_candidate(audio_cl, "host", family, addr, call->media_ports[call->main_audio_stream_index].rtcp_port, 2, NULL); - call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; - } - if (linphone_core_video_enabled(call->core) && (video_cl != NULL) - && (ice_check_list_state(video_cl) != ICL_Completed) && (ice_check_list_candidates_gathered(video_cl) == FALSE)) { - ice_add_local_candidate(video_cl, "host", family, addr, call->media_ports[call->main_video_stream_index].rtp_port, 1, NULL); - ice_add_local_candidate(video_cl, "host", family, addr, call->media_ports[call->main_video_stream_index].rtcp_port, 2, NULL); - call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress; - } - if (call->params->realtimetext_enabled && (text_cl != NULL) - && (ice_check_list_state(text_cl) != ICL_Completed) && (ice_check_list_candidates_gathered(text_cl) == FALSE)) { - ice_add_local_candidate(text_cl, "host", family, addr, call->media_ports[call->main_text_stream_index].rtp_port, 1, NULL); - ice_add_local_candidate(text_cl, "host", family, addr, call->media_ports[call->main_text_stream_index].rtcp_port, 2, NULL); - call->stats[LINPHONE_CALL_STATS_TEXT].ice_state = LinphoneIceStateInProgress; - } -} - -static const struct addrinfo * get_preferred_stun_server_addrinfo(const struct addrinfo *ai) { - char ip[NI_MAXHOST]; - const struct addrinfo *preferred_ai = NULL; - - while (ai != NULL) { - bctbx_addrinfo_to_printable_ip_address(ai, ip, sizeof(ip)); - if (ai->ai_family == AF_INET) { - preferred_ai = ai; - break; - } - else if (ai->ai_family == AF_INET6) { - struct sockaddr_storage ss; - socklen_t sslen = sizeof(ss); - bctbx_sockaddr_ipv6_to_ipv4(ai->ai_addr, (struct sockaddr *)&ss, &sslen); - if ((ss.ss_family == AF_INET) && (preferred_ai == NULL)) preferred_ai = ai; - } - ai = ai->ai_next; - } - - bctbx_addrinfo_to_printable_ip_address(preferred_ai, ip, sizeof(ip)); - return preferred_ai; -} - int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){ char local_addr[64]; const struct addrinfo *ai = NULL; - IceCheckList *audio_cl; - IceCheckList *video_cl; - IceCheckList *text_cl; + IceCheckList *audio_check_list; + IceCheckList *video_check_list; + IceCheckList *text_check_list; LinphoneNatPolicy *nat_policy = NULL; const char *server = NULL; @@ -740,17 +696,19 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){ if (nat_policy != NULL) server = linphone_nat_policy_get_stun_server(nat_policy); if (call->ice_session == NULL) return -1; - audio_cl = ice_session_check_list(call->ice_session, call->main_audio_stream_index); - video_cl = ice_session_check_list(call->ice_session, call->main_video_stream_index); - text_cl = ice_session_check_list(call->ice_session, call->main_text_stream_index); - if (audio_cl == NULL) return -1; + audio_check_list = ice_session_check_list(call->ice_session, call->main_audio_stream_index); + video_check_list = ice_session_check_list(call->ice_session, call->main_video_stream_index); + text_check_list = ice_session_check_list(call->ice_session, call->main_text_stream_index); + if (audio_check_list == NULL) return -1; + if (call->af==AF_INET6){ + ms_warning("Ice gathering is not implemented for ipv6"); + return -1; + } if ((nat_policy != NULL) && (server != NULL) && (server[0] != '\0')) { ai=linphone_nat_policy_get_stun_server_addrinfo(nat_policy); if (ai==NULL){ ms_warning("Fail to resolve STUN server for ICE gathering, continuing without stun."); - } else { - ai = get_preferred_stun_server_addrinfo(ai); } }else{ ms_warning("Ice is used without stun server."); @@ -760,22 +718,28 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){ ice_session_enable_forced_relay(call->ice_session, lc->forced_ice_relay); ice_session_enable_short_turn_refresh(call->ice_session, lc->short_turn_refresh); + // TODO: Handle IPv6 /* Gather local host candidates. */ - if (call->af == AF_INET6) { - if (linphone_core_get_local_ip_for(AF_INET6, NULL, local_addr) < 0) { - ms_error("Fail to get local IPv6"); - return -1; - } else { - linphone_core_add_local_ice_candidates(call, AF_INET6, local_addr, audio_cl, video_cl, text_cl); - } - } if (linphone_core_get_local_ip_for(AF_INET, NULL, local_addr) < 0) { - if (call->af != AF_INET6) { - ms_error("Fail to get local IPv4"); - return -1; - } - } else { - linphone_core_add_local_ice_candidates(call, AF_INET, local_addr, audio_cl, video_cl, text_cl); + ms_error("Fail to get local ip"); + return -1; + } + if ((ice_check_list_state(audio_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(audio_check_list) == FALSE)) { + ice_add_local_candidate(audio_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_audio_stream_index].rtp_port, 1, NULL); + ice_add_local_candidate(audio_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_audio_stream_index].rtcp_port, 2, NULL); + call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress; + } + if (linphone_core_video_enabled(lc) && (video_check_list != NULL) + && (ice_check_list_state(video_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(video_check_list) == FALSE)) { + ice_add_local_candidate(video_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_video_stream_index].rtp_port, 1, NULL); + ice_add_local_candidate(video_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_video_stream_index].rtcp_port, 2, NULL); + call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress; + } + if (call->params->realtimetext_enabled && (text_check_list != NULL) + && (ice_check_list_state(text_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(text_check_list) == FALSE)) { + ice_add_local_candidate(text_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_text_stream_index].rtp_port, 1, NULL); + ice_add_local_candidate(text_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_text_stream_index].rtcp_port, 2, NULL); + call->stats[LINPHONE_CALL_STATS_TEXT].ice_state = LinphoneIceStateInProgress; } if ((ai != NULL) && (nat_policy != NULL) && (linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy))) { @@ -1077,6 +1041,7 @@ void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMedi } } + bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md){ int i; diff --git a/coreapi/nat_policy.c b/coreapi/nat_policy.c index 801a993b8..cf3e11b9d 100644 --- a/coreapi/nat_policy.c +++ b/coreapi/nat_policy.c @@ -220,16 +220,20 @@ static void stun_server_resolved(LinphoneNatPolicy *policy, const char *name, st void linphone_nat_policy_resolve_stun_server(LinphoneNatPolicy *policy) { const char *service = NULL; - if (linphone_nat_policy_stun_server_activated(policy) && (policy->lc->sal != NULL) && !policy->stun_resolver_context) { + /* + * WARNING: stun server resolution only done in IPv4. + * TODO: use IPv6 resolution if linphone_core_ipv6_enabled()==TRUE and use V4Mapped addresses for ICE gathering. + */ + if (linphone_nat_policy_stun_server_activated(policy) + && (policy->lc->sal != NULL) + && !policy->stun_resolver_context) { char host[NI_MAXHOST]; int port = 3478; linphone_parse_host_port(policy->stun_server, host, sizeof(host), &port); if (linphone_nat_policy_turn_enabled(policy)) service = "turn"; else if (linphone_nat_policy_stun_enabled(policy)) service = "stun"; if (service != NULL) { - int family = AF_INET; - if (linphone_core_ipv6_enabled(policy->lc) == TRUE) family = AF_INET6; - policy->stun_resolver_context = sal_resolve(policy->lc->sal, service, "udp", host, port, family, (SalResolverCallback)stun_server_resolved, policy); + policy->stun_resolver_context = sal_resolve(policy->lc->sal, service, "udp", host, port, AF_INET, (SalResolverCallback)stun_server_resolved, policy); } } } diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index 189bdee93..6fcc548ff 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -1232,30 +1232,15 @@ void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie end_call(pauline, marie); } -static void _call_with_ice(bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay, bool_t ipv6) { - LinphoneCoreManager* marie = linphone_core_manager_new2("marie_rc", FALSE); - LinphoneCoreManager* pauline = linphone_core_manager_new2(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc", FALSE); - if (ipv6) { - linphone_core_enable_ipv6(marie->lc, TRUE); - linphone_core_enable_ipv6(pauline->lc, TRUE); - } - linphone_core_manager_start(marie, TRUE); - linphone_core_manager_start(pauline, TRUE); +static void _call_with_ice(bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay) { + LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); + LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); _call_with_ice_base(pauline,marie,caller_with_ice,callee_with_ice,random_ports,forced_relay); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } - static void call_with_ice(void){ - _call_with_ice(TRUE,TRUE,FALSE,FALSE,FALSE); -} - -static void call_with_ice_ipv6(void) { - if (liblinphone_tester_ipv6_available()) { - _call_with_ice(TRUE, TRUE, FALSE, FALSE, TRUE); - } else { - ms_warning("Test skipped, no ipv6 available"); - } + _call_with_ice(TRUE,TRUE,FALSE,FALSE); } /*ICE is not expected to work in this case, however this should not crash*/ @@ -1279,19 +1264,19 @@ static void call_with_ice_no_sdp(void){ } static void call_with_ice_random_ports(void){ - _call_with_ice(TRUE,TRUE,TRUE,FALSE,FALSE); + _call_with_ice(TRUE,TRUE,TRUE,FALSE); } static void call_with_ice_forced_relay(void) { - _call_with_ice(TRUE, TRUE, TRUE, TRUE, FALSE); + _call_with_ice(TRUE, TRUE, TRUE, TRUE); } static void ice_to_not_ice(void){ - _call_with_ice(TRUE,FALSE,FALSE,FALSE,FALSE); + _call_with_ice(TRUE,FALSE,FALSE,FALSE); } static void not_ice_to_ice(void){ - _call_with_ice(FALSE,TRUE,FALSE,FALSE,FALSE); + _call_with_ice(FALSE,TRUE,FALSE,FALSE); } static void ice_added_by_reinvite(void){ @@ -1326,11 +1311,15 @@ static void ice_added_by_reinvite(void){ linphone_call_params_destroy(params); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,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)); + + BC_ASSERT_TRUE(check_ice(marie, pauline, LinphoneIceStateHostConnection)); + /*wait for the ICE reINVITE*/ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,3)); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,3)); - BC_ASSERT_TRUE(check_ice(marie, pauline, LinphoneIceStateHostConnection)); + end_call(pauline, marie); @@ -4200,10 +4189,10 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh wait_for_until(marie->lc, pauline->lc, NULL, 0, 2000); if (use_ice) { + BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); /*wait for ICE reINVITE to complete*/ 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)); - BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); } /*marie looses the network and reconnects*/ @@ -4290,10 +4279,10 @@ static void call_with_sip_and_rtp_independant_switches(void){ wait_for_until(marie->lc, pauline->lc, NULL, 0, 2000); if (use_ice) { + BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); /*wait for ICE reINVITE to complete*/ 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)); - BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection)); } /*marie looses the SIP network and reconnects*/ linphone_core_set_sip_network_reachable(marie->lc, FALSE); @@ -4810,19 +4799,17 @@ static void v6_call_over_nat_64(void){ } static void call_with_ice_in_ipv4_with_v6_enabled(void) { - LinphoneCoreManager* marie; - LinphoneCoreManager* pauline; + if (liblinphone_tester_ipv4_available() && liblinphone_tester_ipv6_available()){ + bool_t liblinphonetester_ipv6_save=liblinphonetester_ipv6; /*this test nee v6*/ + LinphoneCoreManager* marie = linphone_core_manager_new("marie_v4proxy_rc"); + LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_v4proxy_rc"); - if (liblinphone_tester_ipv4_available() && liblinphone_tester_ipv6_available()){ - bool_t liblinphonetester_ipv6_save=liblinphonetester_ipv6; /*this test nee v6*/ - liblinphonetester_ipv6=TRUE; - marie = linphone_core_manager_new("marie_v4proxy_rc"); - pauline = linphone_core_manager_new("pauline_v4proxy_rc"); + liblinphonetester_ipv6=TRUE; + _call_with_ice_base(pauline,marie,TRUE,TRUE,TRUE,FALSE); + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); + liblinphonetester_ipv6=liblinphonetester_ipv6_save; /*this test nee v6*/ - _call_with_ice_base(pauline,marie,TRUE,TRUE,TRUE,FALSE); - linphone_core_manager_destroy(marie); - linphone_core_manager_destroy(pauline); - liblinphonetester_ipv6=liblinphonetester_ipv6_save; /*this test nee v6*/ } else ms_warning("Test skipped, need both ipv6 and v4 available"); } @@ -4886,7 +4873,6 @@ test_t call_tests[] = { TEST_NO_TAG("Call rejected without 403 because of wrong credential", call_rejected_without_403_because_wrong_credentials), TEST_NO_TAG("Call rejected without 403 because of wrong credential and no auth req cb", call_rejected_without_403_because_wrong_credentials_no_auth_req_cb), TEST_ONE_TAG("Call with ICE", call_with_ice, "ICE"), - TEST_ONE_TAG("Call with ICE IPv6", call_with_ice_ipv6, "ICE"), TEST_ONE_TAG("Call with ICE without SDP", call_with_ice_no_sdp, "ICE"), TEST_ONE_TAG("Call with ICE (random ports)", call_with_ice_random_ports, "ICE"), TEST_ONE_TAG("Call with ICE (forced relay)", call_with_ice_forced_relay, "ICE"), diff --git a/tester/call_video_tester.c b/tester/call_video_tester.c index 2c5e7bc06..2f8abfaaf 100644 --- a/tester/call_video_tester.c +++ b/tester/call_video_tester.c @@ -886,11 +886,11 @@ static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVide BC_ASSERT_TRUE(call_ok = call(pauline, marie)); if (!call_ok) goto end; + BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); /* Wait for ICE reINVITEs to complete. */ BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2) && wait_for(pauline->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); - BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection)); check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts); nb_media_starts++; diff --git a/tester/stun_tester.c b/tester/stun_tester.c index 7285c20d4..5564d289e 100644 --- a/tester/stun_tester.c +++ b/tester/stun_tester.c @@ -121,7 +121,7 @@ static void check_turn_context_statistics(MSTurnContext *turn_context, bool_t fo } } -static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t caller_turn_enabled, bool_t callee_turn_enabled, bool_t rtcp_mux_enabled, bool_t ipv6) { +static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t caller_turn_enabled, bool_t callee_turn_enabled, bool_t rtcp_mux_enabled) { LinphoneCoreManager *marie; LinphoneCoreManager *pauline; LinphoneCall *lcall; @@ -129,16 +129,11 @@ static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t LinphoneMediaDirection expected_video_dir = LinphoneMediaDirectionInactive; bctbx_list_t *lcs = NULL; - marie = linphone_core_manager_new2("marie_rc", FALSE); + marie = linphone_core_manager_new("marie_rc"); lcs = bctbx_list_append(lcs, marie->lc); - pauline = linphone_core_manager_new2(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc", FALSE); + pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); lcs = bctbx_list_append(lcs, pauline->lc); - if (ipv6) { - linphone_core_enable_ipv6(marie->lc, TRUE); - linphone_core_enable_ipv6(pauline->lc, TRUE); - } - configure_nat_policy(marie->lc, caller_turn_enabled); configure_nat_policy(pauline->lc, callee_turn_enabled); if (forced_relay == TRUE) { @@ -153,9 +148,6 @@ static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t lp_config_set_int(linphone_core_get_config(pauline->lc), "rtp", "rtcp_mux", 1); } - linphone_core_manager_start(marie, TRUE); - linphone_core_manager_start(pauline, TRUE); - if (video_enabled) { #ifdef VIDEO_ENABLED video_call_base_2(marie, pauline, FALSE, LinphoneMediaEncryptionNone, TRUE, TRUE); @@ -195,39 +187,31 @@ static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t } static void basic_ice_turn_call(void) { - ice_turn_call_base(FALSE, FALSE, TRUE, TRUE, FALSE, FALSE); -} - -static void basic_ipv6_ice_turn_call(void) { - if (liblinphone_tester_ipv6_available()) { - ice_turn_call_base(FALSE, FALSE, TRUE, TRUE, FALSE, TRUE); - } else { - ms_warning("Test skipped, no ipv6 available"); - } + ice_turn_call_base(FALSE, FALSE, TRUE, TRUE, FALSE); } #ifdef VIDEO_ENABLED static void video_ice_turn_call(void) { - ice_turn_call_base(TRUE, FALSE, TRUE, TRUE, FALSE, FALSE); + ice_turn_call_base(TRUE, FALSE, TRUE, TRUE, FALSE); } #endif static void relayed_ice_turn_call(void) { - ice_turn_call_base(FALSE, TRUE, TRUE, TRUE, FALSE, FALSE); + ice_turn_call_base(FALSE, TRUE, TRUE, TRUE, FALSE); } #ifdef VIDEO_ENABLED static void relayed_video_ice_turn_call(void) { - ice_turn_call_base(TRUE, TRUE, TRUE, TRUE, FALSE, FALSE); + ice_turn_call_base(TRUE, TRUE, TRUE, TRUE, FALSE); } #endif static void relayed_ice_turn_call_with_rtcp_mux(void) { - ice_turn_call_base(FALSE, TRUE, TRUE, TRUE, TRUE, FALSE); + ice_turn_call_base(FALSE, TRUE, TRUE, TRUE, TRUE); } static void relayed_ice_turn_to_ice_stun_call(void) { - ice_turn_call_base(FALSE, TRUE, TRUE, FALSE, FALSE, FALSE); + ice_turn_call_base(FALSE, TRUE, TRUE, FALSE, FALSE); } @@ -235,7 +219,6 @@ test_t stun_tests[] = { TEST_ONE_TAG("Basic Stun test (Ping/public IP)", linphone_stun_test_grab_ip, "STUN"), TEST_ONE_TAG("STUN encode", linphone_stun_test_encode, "STUN"), TEST_TWO_TAGS("Basic ICE+TURN call", basic_ice_turn_call, "ICE", "TURN"), - TEST_TWO_TAGS("Basic IPv6 ICE+TURN call", basic_ipv6_ice_turn_call, "ICE", "TURN"), #ifdef VIDEO_ENABLED TEST_TWO_TAGS("Video ICE+TURN call", video_ice_turn_call, "ICE", "TURN"), TEST_TWO_TAGS("Relayed video ICE+TURN call", relayed_video_ice_turn_call, "ICE", "TURN"), diff --git a/tester/tester.c b/tester/tester.c index 86e2b233a..0c865fce5 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -656,33 +656,20 @@ static void check_ice_from_rtp(LinphoneCall *c1, LinphoneCall *c2, LinphoneStrea return; } + if (linphone_call_get_audio_stats(c1)->ice_state == LinphoneIceStateHostConnection && media_stream_started(ms)) { - struct sockaddr_storage remaddr; - socklen_t remaddrlen = sizeof(remaddr); - char ip[NI_MAXHOST] = { 0 }; - int port = 0; - SalMediaDescription *result_desc; - char *expected_addr = NULL; - - const LinphoneCallParams *cp1 = linphone_call_get_current_params(c1); - const LinphoneCallParams *cp2 = linphone_call_get_current_params(c2); - if (cp1->update_call_when_ice_completed && cp2->update_call_when_ice_completed) { - memset(&remaddr, 0, remaddrlen); - result_desc = sal_call_get_final_media_description(c2->op); - expected_addr = result_desc->streams[0].rtp_addr; - if (expected_addr[0] == '\0') expected_addr = result_desc->addr; - if ((strchr(expected_addr, ':') == NULL) && (c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addr.ss_family == AF_INET6)) { - bctbx_sockaddr_ipv6_to_ipv4((struct sockaddr *)&c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addr, (struct sockaddr *)&remaddr, &remaddrlen); - } else { - memcpy(&remaddr, &c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addr, c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addrlen); - } - bctbx_sockaddr_to_ip_address((struct sockaddr *)&remaddr, remaddrlen, ip, sizeof(ip), &port); - - BC_ASSERT_STRING_EQUAL(ip, expected_addr); - } + char ip[16]; + char port[8]; + getnameinfo((const struct sockaddr *)&c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addr + , c1->audiostream->ms.sessions.rtp_session->rtp.gs.rem_addrlen + , ip + , sizeof(ip) + , port + , sizeof(port) + , NI_NUMERICHOST|NI_NUMERICSERV); + BC_ASSERT_STRING_EQUAL(ip, c2->media_localip); } } - bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, LinphoneIceState state) { LinphoneCall *c1,*c2; bool_t audio_success=FALSE; From 40c435c104f8c4370a15b16dab071d7a3484fd99 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 4 Aug 2016 16:06:37 +0200 Subject: [PATCH 33/45] Fix DTLS encryption mandatory property box --- gtk/propertybox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 58871da0a..c2510ffc8 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1294,7 +1294,7 @@ static void linphone_gtk_media_encryption_changed(GtkWidget *combo){ gtk_widget_set_sensitive(mandatory_box,TRUE); }else if (strcasecmp(selected,"DTLS")==0){ linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionDTLS); - gtk_widget_set_sensitive(mandatory_box,FALSE); + gtk_widget_set_sensitive(mandatory_box,TRUE); }else if (strcasecmp(selected,"ZRTP")==0){ linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionZRTP); gtk_widget_set_sensitive(mandatory_box,FALSE); From 837b94df2dc753fe032ced4c87e9f4b1cc8435dc Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 8 Aug 2016 11:17:27 +0200 Subject: [PATCH 34/45] Experimental feature lime Adding lime_experimental_feature in linphonerc [GtkUi] section. Setting it to 1 shows the options related to lime in the GUI. Setting it to 0 hides the options. Default:set to 0. Note: enabling lime in the [sip] section does work too, the GUI will just not show the option has been changed. --- gtk/propertybox.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gtk/propertybox.c b/gtk/propertybox.c index c2510ffc8..2b1e12caa 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1397,9 +1397,16 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){ } gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"media_encryption_mandatory_checkbox")), linphone_core_is_media_encryption_mandatory(lc)); - - gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"chat_lime_combo")), linphone_core_lime_enabled(lc)); - gtk_widget_set_sensitive(linphone_gtk_get_widget(pb,"chat_lime_combo"), linphone_core_lime_available(lc)); + + gtk_widget_set_visible (linphone_gtk_get_widget(pb,"chat_lime_label"), 0); + gtk_widget_set_visible (linphone_gtk_get_widget(pb,"chat_lime_combo"), 0); + + if (linphone_gtk_get_ui_config_int("lime_experimental_feature", 0)){ + gtk_widget_set_visible (linphone_gtk_get_widget(pb,"chat_lime_label"), 1); + gtk_widget_set_visible (linphone_gtk_get_widget(pb,"chat_lime_combo"), 1); + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"chat_lime_combo")), linphone_core_lime_enabled(lc)); + gtk_widget_set_sensitive(linphone_gtk_get_widget(pb,"chat_lime_combo"), linphone_core_lime_available(lc)); + } g_object_unref(G_OBJECT(model)); } From 90efce68494f1310003d7a531763a4128bc4c905 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 8 Aug 2016 11:50:23 +0200 Subject: [PATCH 35/45] Update NEWS. --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 67738b71e..8865e1034 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ -linphone-3.10.0 -- May xxth, 2016 +linphone-3.10.0 -- August 8th, 2016 + * Adding lime_experimental_feature : set to 1 in .linphonerc [GtkUi] to + show the Lime menu in the graphical user interface. Caution : Experimental. * Video conference support through a conference server (SDK only) * Disable dummy STUN packets sending when ICE is activated. * Signal AVPF support as AVP : Enable rtcp feedback on RTP/AVP by default From 602f480dd8136e2fa316fc96437561d42592a815 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 8 Aug 2016 12:18:34 +0200 Subject: [PATCH 36/45] Version 3.10.0 --- CMakeLists.txt | 4 ++-- configure.ac | 2 +- tools/python/doc/source/conf.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83180627a..d14d0b700 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,14 +21,14 @@ ############################################################################ cmake_minimum_required(VERSION 3.0) -project(linphone VERSION 3.9.1 LANGUAGES C CXX) +project(linphone VERSION 3.10.0 LANGUAGES C CXX) set(LINPHONE_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) set(LINPHONE_MINOR_VERSION ${PROJECT_VERSION_MINOR}) set(LINPHONE_MICRO_VERSION ${PROJECT_VERSION_PATCH}) set(LINPHONE_VERSION ${PROJECT_VERSION}) -set(LINPHONE_SO_VERSION "8") +set(LINPHONE_SO_VERSION "9") file(GLOB LINPHONE_PO_FILES RELATIVE "${CMAKE_CURRENT_LIST_DIR}/po" "${CMAKE_CURRENT_LIST_DIR}/po/*.po") string(REGEX REPLACE "([a-zA-Z_]+)\\.po" "\\1" LINPHONE_ALL_LANGS_LIST "${LINPHONE_PO_FILES}") diff --git a/configure.ac b/configure.ac index 377fb30a3..dbf08f1c4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([linphone],[3.9.1],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.10.0],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) diff --git a/tools/python/doc/source/conf.py b/tools/python/doc/source/conf.py index f3ecde103..eb9ba43bb 100644 --- a/tools/python/doc/source/conf.py +++ b/tools/python/doc/source/conf.py @@ -53,9 +53,9 @@ copyright = u'2014, Belledonne Communications' # built documents. # # The short X.Y version. -version = '3.9' +version = '3.10' # The full version, including alpha/beta/rc tags. -release = '3.9.1' +release = '3.10.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 6256cf1636fa5a5b8abb50f10a6aafe1d2f3b80a Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 1 Jul 2016 10:34:16 +0200 Subject: [PATCH 37/45] Moved and renamed some vcard methods for python wrapper Cherry pick c8ae29742aee37727658df310f3be603d216c499 from master --- coreapi/carddav.c | 2 +- coreapi/friend.c | 2 +- coreapi/friendlist.c | 4 ++-- coreapi/private.h | 5 ----- coreapi/vcard.cc | 26 ++++++++++++++++---------- coreapi/vcard.h | 38 ++++++++++++++++++++++++++++++++++---- coreapi/vcard_stubs.c | 11 ++++++----- tester/vcard_tester.c | 20 ++++++++++---------- 8 files changed, 70 insertions(+), 38 deletions(-) diff --git a/coreapi/carddav.c b/coreapi/carddav.c index d63b20861..63b22c6bd 100644 --- a/coreapi/carddav.c +++ b/coreapi/carddav.c @@ -115,7 +115,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, bctbx_li while (vCards) { LinphoneCardDavResponse *vCard = (LinphoneCardDavResponse *)vCards->data; if (vCard) { - LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(cdc->friend_list->lc->vcard_context, vCard->vcard); + LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(cdc->friend_list->lc->vcard_context, vCard->vcard); LinphoneFriend *lf = NULL; bctbx_list_t *local_friend = NULL; diff --git a/coreapi/friend.c b/coreapi/friend.c index af6b511d8..896e4cab5 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -1256,7 +1256,7 @@ static int create_friend(void *data, int argc, char **argv, char **colName) { LinphoneVcard *vcard = NULL; unsigned int storage_id = (unsigned int)atoi(argv[0]); - vcard = linphone_vcard_new_from_vcard4_buffer(context, argv[6]); + vcard = linphone_vcard_context_get_vcard_from_buffer(context, argv[6]); if (vcard) { linphone_vcard_set_etag(vcard, argv[7]); linphone_vcard_set_url(vcard, argv[8]); diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 18f5c970a..fb36aec67 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -781,7 +781,7 @@ int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *lis return -1; } - vcards = linphone_vcard_list_from_vcard4_file(list->lc->vcard_context, vcard_file); + vcards = linphone_vcard_context_get_vcard_list_from_file(list->lc->vcard_context, vcard_file); vcards_iterator = vcards; if (!vcards) { ms_error("Failed to parse the file %s", vcard_file); @@ -821,7 +821,7 @@ int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *l return -1; } - vcards = linphone_vcard_list_from_vcard4_buffer(list->lc->vcard_context, vcard_buffer); + vcards = linphone_vcard_context_get_vcard_list_from_buffer(list->lc->vcard_context, vcard_buffer); vcards_iterator = vcards; if (!vcards) { ms_error("Failed to parse the buffer"); diff --git a/coreapi/private.h b/coreapi/private.h index af1930480..094737be1 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1555,11 +1555,6 @@ char *linphone_presence_model_to_xml(LinphonePresenceModel *model) ; void linphone_call_check_ice_session(LinphoneCall *call, IceRole role, bool_t is_reinvite); -LinphoneVcardContext* linphone_vcard_context_new(void); -void linphone_vcard_context_destroy(LinphoneVcardContext *context); -void* linphone_vcard_context_get_user_data(LinphoneVcardContext *context); -void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *data); - #ifdef __cplusplus } #endif diff --git a/coreapi/vcard.cc b/coreapi/vcard.cc index 388422915..f944ad07c 100644 --- a/coreapi/vcard.cc +++ b/coreapi/vcard.cc @@ -53,7 +53,7 @@ void linphone_vcard_context_destroy(LinphoneVcardContext *context) { } } -void* linphone_vcard_context_get_user_data(LinphoneVcardContext *context) { +void* linphone_vcard_context_get_user_data(const LinphoneVcardContext *context) { return context ? context->user_data : NULL; } @@ -82,11 +82,13 @@ void linphone_vcard_free(LinphoneVcard *vCard) { ms_free(vCard); } -bctbx_list_t* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context, const char *filename) { +bctbx_list_t* linphone_vcard_context_get_vcard_list_from_file(LinphoneVcardContext *context, const char *filename) { bctbx_list_t *result = NULL; if (context && filename) { - belcard::BelCardParser *parser = context->parser; - shared_ptr belCards = parser->parseFile(filename); + if (!context->parser) { + context->parser = new belcard::BelCardParser(); + } + shared_ptr belCards = context->parser->parseFile(filename); if (belCards) { for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) { shared_ptr belCard = (*it); @@ -98,11 +100,13 @@ bctbx_list_t* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context return result; } -bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) { +bctbx_list_t* linphone_vcard_context_get_vcard_list_from_buffer(LinphoneVcardContext *context, const char *buffer) { bctbx_list_t *result = NULL; if (context && buffer) { - belcard::BelCardParser *parser = context->parser; - shared_ptr belCards = parser->parse(buffer); + if (!context->parser) { + context->parser = new belcard::BelCardParser(); + } + shared_ptr belCards = context->parser->parse(buffer); if (belCards) { for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) { shared_ptr belCard = (*it); @@ -114,11 +118,13 @@ bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *conte return result; } -LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) { +LinphoneVcard* linphone_vcard_context_get_vcard_from_buffer(LinphoneVcardContext *context, const char *buffer) { LinphoneVcard *vCard = NULL; if (context && buffer) { - belcard::BelCardParser *parser = context->parser; - shared_ptr belCard = parser->parseOne(buffer); + if (!context->parser) { + context->parser = new belcard::BelCardParser(); + } + shared_ptr belCard = context->parser->parseOne(buffer); if (belCard) { vCard = linphone_vcard_new_from_belcard(belCard); } else { diff --git a/coreapi/vcard.h b/coreapi/vcard.h index 62674a33d..550fa8d81 100644 --- a/coreapi/vcard.h +++ b/coreapi/vcard.h @@ -37,10 +37,36 @@ extern "C" */ /** - * Linphone vCard context object. + * The LinphoneVcardContext object. */ typedef struct _LinphoneVcardContext LinphoneVcardContext; +/** + * Creates a vCard context to reuse the same BelCardParser object + * @return a new LinphoneVcardContext object + */ +LINPHONE_PUBLIC LinphoneVcardContext* linphone_vcard_context_new(void); + +/** + * Destroys the vCard context + * @param[in] context a LinphoneVcardContext object + */ +LINPHONE_PUBLIC void linphone_vcard_context_destroy(LinphoneVcardContext *context); + +/** + * Gets the user data set in the LinphoneVcardContext + * @param[in] context a LinphoneVcardContext object + * @return the user data pointer + */ +LINPHONE_PUBLIC void* linphone_vcard_context_get_user_data(const LinphoneVcardContext *context); + +/** + * Sets the user data in the LinphoneVcardContext + * @param[in] context a LinphoneVcardContext object + * @param[in] data the user data pointer + */ +LINPHONE_PUBLIC void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *data); + /** * The LinphoneVcard object. */ @@ -48,6 +74,7 @@ typedef struct _LinphoneVcard LinphoneVcard; /** * Creates a LinphoneVcard object that has a pointer to an empty vCard + * @return a new LinphoneVcard object */ LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_new(void); @@ -59,24 +86,27 @@ LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard); /** * Uses belcard to parse the content of a file and returns all the vcards it contains as LinphoneVcards, or NULL if it contains none. + * @param[in] context the vCard context to use (speed up the process by not creating a Belcard parser each time) * @param[in] file the path to the file to parse * @return \mslist{LinphoneVcard} */ -LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context, const char *file); +LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_context_get_vcard_list_from_file(LinphoneVcardContext *context, const char *file); /** * Uses belcard to parse the content of a buffer and returns all the vcards it contains as LinphoneVcards, or NULL if it contains none. + * @param[in] context the vCard context to use (speed up the process by not creating a Belcard parser each time) * @param[in] buffer the buffer to parse * @return \mslist{LinphoneVcard} */ -LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer); +LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_context_get_vcard_list_from_buffer(LinphoneVcardContext *context, const char *buffer); /** * Uses belcard to parse the content of a buffer and returns one vCard if possible, or NULL otherwise. + * @param[in] context the vCard context to use (speed up the process by not creating a Belcard parser each time) * @param[in] buffer the buffer to parse * @return a LinphoneVcard if one could be parsed, or NULL otherwise */ -LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer); +LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_context_get_vcard_from_buffer(LinphoneVcardContext *context, const char *buffer); /** * Returns the vCard4 representation of the LinphoneVcard. diff --git a/coreapi/vcard_stubs.c b/coreapi/vcard_stubs.c index 50a8fc2e9..916cd541a 100644 --- a/coreapi/vcard_stubs.c +++ b/coreapi/vcard_stubs.c @@ -31,8 +31,9 @@ void linphone_vcard_context_destroy(LinphoneVcardContext *context) { } -void* linphone_vcard_context_get_user_data(LinphoneVcardContext *context) { - return NULL; + +void* linphone_vcard_context_get_user_data(const LinphoneVcardContext *context) { + return context ? context->user_data : NULL; } void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *data) { @@ -51,15 +52,15 @@ void linphone_vcard_free(LinphoneVcard *vCard) { } -MSList* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context, const char *filename) { +MSList* linphone_vcard_context_get_vcard_list_from_file(LinphoneVcardContext *context, const char *filename) { return NULL; } -MSList* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) { +MSList* linphone_vcard_context_get_vcard_list_from_buffer(LinphoneVcardContext *context, const char *buffer) { return NULL; } -LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) { +LinphoneVcard* linphone_vcard_context_get_vcard_from_buffer(LinphoneVcardContext *context, const char *buffer) { return NULL; } diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c index 28631db1f..790244f19 100644 --- a/tester/vcard_tester.c +++ b/tester/vcard_tester.c @@ -138,7 +138,7 @@ static void linphone_vcard_update_existing_friends_test(void) { static void linphone_vcard_phone_numbers_and_sip_addresses(void) { LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE); - LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nIMPP;TYPE=home:sip:sylvain@sip.linphone.org\r\nTEL;TYPE=work:0952636505\r\nEND:VCARD\r\n"); + LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nIMPP;TYPE=home:sip:sylvain@sip.linphone.org\r\nTEL;TYPE=work:0952636505\r\nEND:VCARD\r\n"); LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc); bctbx_list_t *sip_addresses = linphone_friend_get_addresses(lf); bctbx_list_t *phone_numbers = linphone_friend_get_phone_numbers(lf); @@ -150,7 +150,7 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) { if (phone_numbers) bctbx_list_free(phone_numbers); linphone_friend_unref(lf); - lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nTEL;TYPE=work:0952636505\r\nTEL:0476010203\r\nEND:VCARD\r\n"); + lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nTEL;TYPE=work:0952636505\r\nTEL:0476010203\r\nEND:VCARD\r\n"); lf = linphone_friend_new_from_vcard(lvc); sip_addresses = linphone_friend_get_addresses(lf); phone_numbers = linphone_friend_get_phone_numbers(lf); @@ -473,7 +473,7 @@ static void carddav_sync_2(void) { static void carddav_sync_3(void) { LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE); LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1); - LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nFN:Sylvain Berfini\r\nIMPP;TYPE=work:sip:sylvain@sip.linphone.org\r\nEND:VCARD\r\n"); + LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nFN:Sylvain Berfini\r\nIMPP;TYPE=work:sip:sylvain@sip.linphone.org\r\nEND:VCARD\r\n"); LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc); char *friends_db = bc_tester_file("friends.db"); LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc); @@ -514,7 +514,7 @@ static void carddav_sync_3(void) { static void carddav_sync_4(void) { LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE); LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1); - LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n"); + LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n"); LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc); LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc); LinphoneCardDavContext *c = NULL; @@ -575,7 +575,7 @@ static void carddav_sync_status_changed(LinphoneFriendList *list, LinphoneFriend static void carddav_integration(void) { LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE); LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc); - LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n"); + LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n"); LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc); LinphoneVcard *lvc2 = NULL; LinphoneFriend *lf2 = NULL; @@ -608,12 +608,12 @@ static void carddav_integration(void) { linphone_friend_unref(lf); lf = NULL; - lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n"); + lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n"); lf = linphone_friend_new_from_vcard(lvc); BC_ASSERT_EQUAL(linphone_friend_list_add_local_friend(lfl, lf), LinphoneFriendListOK, int, "%d"); linphone_friend_unref(lf); - lvc2 = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n"); + lvc2 = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n"); linphone_vcard_set_url(lvc2, "/card.php/addressbooks/tester/default/me.vcf"); lf2 = linphone_friend_new_from_vcard(lvc2); linphone_friend_set_ref_key(lf2, refkey); @@ -691,7 +691,7 @@ static void carddav_clean(void) { // This is to ensure the content of the test } bctbx_list_free(friends); - lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sylvain@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n"); + lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sylvain@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n"); linphone_vcard_set_url(lvc, "http://dav.linphone.org/card.php/addressbooks/tester/default/me.vcf"); lf = linphone_friend_new_from_vcard(lvc); linphone_friend_list_add_friend(lfl, lf); @@ -739,9 +739,9 @@ static void carddav_server_to_client_and_client_to_sever_sync(void) { LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc); LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(lfl); LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1); - LinphoneVcard *lvc1 = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n"); + LinphoneVcard *lvc1 = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n"); LinphoneFriend *lf1 = linphone_friend_new_from_vcard(lvc1); - LinphoneVcard *lvc2 = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n"); + LinphoneVcard *lvc2 = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n"); LinphoneFriend *lf2 = linphone_friend_new_from_vcard(lvc2); bctbx_list_t *friends = NULL, *friends_iterator = NULL; From 2f928c41b810d6f744c606fb263ef21a0af2cb79 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 29 Jun 2016 16:45:42 +0200 Subject: [PATCH 38/45] Card context has to work even without vCard support for fetching friend from db... Cherry pick from master ae708bdd8cabe0efa5afc102ee7a06e324594847 --- coreapi/vcard_stubs.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/coreapi/vcard_stubs.c b/coreapi/vcard_stubs.c index 916cd541a..26583c455 100644 --- a/coreapi/vcard_stubs.c +++ b/coreapi/vcard_stubs.c @@ -20,15 +20,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "vcard.h" struct _LinphoneVcardContext { - void *dummy; + void *user_data; }; LinphoneVcardContext* linphone_vcard_context_new(void) { - return NULL; + LinphoneVcardContext* context = ms_new0(LinphoneVcardContext, 1); + context->user_data = NULL; + return context; } void linphone_vcard_context_destroy(LinphoneVcardContext *context) { - + if (context) { + ms_free(context); + } } @@ -37,7 +41,7 @@ void* linphone_vcard_context_get_user_data(const LinphoneVcardContext *context) } void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *data) { - + if (context) context->user_data = data; } struct _LinphoneVcard { From 6bbad729db9f6ab459e218a561128f8189dcd25f Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 10 Aug 2016 14:24:21 +0200 Subject: [PATCH 39/45] Revert "Version 3.10.0" This reverts commit 602f480dd8136e2fa316fc96437561d42592a815. --- CMakeLists.txt | 4 ++-- configure.ac | 2 +- tools/python/doc/source/conf.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d14d0b700..83180627a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,14 +21,14 @@ ############################################################################ cmake_minimum_required(VERSION 3.0) -project(linphone VERSION 3.10.0 LANGUAGES C CXX) +project(linphone VERSION 3.9.1 LANGUAGES C CXX) set(LINPHONE_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) set(LINPHONE_MINOR_VERSION ${PROJECT_VERSION_MINOR}) set(LINPHONE_MICRO_VERSION ${PROJECT_VERSION_PATCH}) set(LINPHONE_VERSION ${PROJECT_VERSION}) -set(LINPHONE_SO_VERSION "9") +set(LINPHONE_SO_VERSION "8") file(GLOB LINPHONE_PO_FILES RELATIVE "${CMAKE_CURRENT_LIST_DIR}/po" "${CMAKE_CURRENT_LIST_DIR}/po/*.po") string(REGEX REPLACE "([a-zA-Z_]+)\\.po" "\\1" LINPHONE_ALL_LANGS_LIST "${LINPHONE_PO_FILES}") diff --git a/configure.ac b/configure.ac index dbf08f1c4..377fb30a3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([linphone],[3.10.0],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.9.1],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) diff --git a/tools/python/doc/source/conf.py b/tools/python/doc/source/conf.py index eb9ba43bb..f3ecde103 100644 --- a/tools/python/doc/source/conf.py +++ b/tools/python/doc/source/conf.py @@ -53,9 +53,9 @@ copyright = u'2014, Belledonne Communications' # built documents. # # The short X.Y version. -version = '3.10' +version = '3.9' # The full version, including alpha/beta/rc tags. -release = '3.10.0' +release = '3.9.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 6771f2f60a24ccba65b317cc7a27f65dc784c378 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 11 Aug 2016 11:37:18 +0200 Subject: [PATCH 40/45] Revert "Revert "Version 3.10.0"" This reverts commit 6bbad729db9f6ab459e218a561128f8189dcd25f. --- CMakeLists.txt | 4 ++-- configure.ac | 2 +- tools/python/doc/source/conf.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83180627a..d14d0b700 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,14 +21,14 @@ ############################################################################ cmake_minimum_required(VERSION 3.0) -project(linphone VERSION 3.9.1 LANGUAGES C CXX) +project(linphone VERSION 3.10.0 LANGUAGES C CXX) set(LINPHONE_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) set(LINPHONE_MINOR_VERSION ${PROJECT_VERSION_MINOR}) set(LINPHONE_MICRO_VERSION ${PROJECT_VERSION_PATCH}) set(LINPHONE_VERSION ${PROJECT_VERSION}) -set(LINPHONE_SO_VERSION "8") +set(LINPHONE_SO_VERSION "9") file(GLOB LINPHONE_PO_FILES RELATIVE "${CMAKE_CURRENT_LIST_DIR}/po" "${CMAKE_CURRENT_LIST_DIR}/po/*.po") string(REGEX REPLACE "([a-zA-Z_]+)\\.po" "\\1" LINPHONE_ALL_LANGS_LIST "${LINPHONE_PO_FILES}") diff --git a/configure.ac b/configure.ac index 377fb30a3..dbf08f1c4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([linphone],[3.9.1],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.10.0],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) diff --git a/tools/python/doc/source/conf.py b/tools/python/doc/source/conf.py index f3ecde103..eb9ba43bb 100644 --- a/tools/python/doc/source/conf.py +++ b/tools/python/doc/source/conf.py @@ -53,9 +53,9 @@ copyright = u'2014, Belledonne Communications' # built documents. # # The short X.Y version. -version = '3.9' +version = '3.10' # The full version, including alpha/beta/rc tags. -release = '3.9.1' +release = '3.10.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 937ff462944b5db586662113ad21fa7ea345ac8d Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 18 Aug 2016 15:25:01 +0200 Subject: [PATCH 41/45] Fixing warnings for the javadoc. --- .../linphone/core/LinphoneChatMessage.java | 2 +- .../org/linphone/core/LinphoneCore.java | 10 +-- .../org/linphone/core/LinphoneFriend.java | 6 +- .../org/linphone/core/PresenceActivity.java | 16 ++--- .../org/linphone/core/PresenceModel.java | 66 +++++++++---------- .../org/linphone/core/PresenceNote.java | 14 ++-- .../org/linphone/core/PresencePerson.java | 44 ++++++------- .../org/linphone/core/PresenceService.java | 32 ++++----- 8 files changed, 95 insertions(+), 95 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index fab2bab28..972a39d1d 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -230,7 +230,7 @@ public interface LinphoneChatMessage { /** * Fulfill a chat message char by char. Message linked to a Real Time Text Call send char in realtime following RFC 4103/T.140 * To commit a message, use #linphone_chat_room_send_message - * @param[in] character T.140 char + * @param character T.140 char * @throw LinphoneCoreExeption . */ void putChar(long character) throws LinphoneCoreException; diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index f63c017ef..08e8a47cf 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -1027,7 +1027,7 @@ public interface LinphoneCore { LinphoneFriendList[] getFriendLists(); /** - * @brief Set my presence status + * Set my presence status * @param minutes_away how long in away * @param alternative_contact sip uri used to redirect call in state LinphoneStatusMoved * @param status OnlineStatus @@ -1035,18 +1035,18 @@ public interface LinphoneCore { */ void setPresenceInfo(int minutes_away, String alternative_contact, OnlineStatus status); /** - * @brief Get my presence status + * Get my presence status * @return OnlineStatus * @deprecated Use getPresenceModel() instead */ OnlineStatus getPresenceInfo(); /** - * @brief Set my presence status + * Set my presence status * @param presence #LinphonePresenceModel */ void setPresenceModel(PresenceModel presence); /** - * @brief Get my presence status + * Get my presence status * @return A #PresenceModel object, or null if no presence model has been set. */ PresenceModel getPresenceModel(); @@ -1555,7 +1555,7 @@ public interface LinphoneCore { * which could result in an active call. * Eg: don't start a new call if one is in outgoing ringing. * Eg: don't merge to conference either as it could result - * in two active calls (conference and accepted call). + * in two active calls (conference and accepted call). * @return */ boolean soundResourcesLocked(); diff --git a/java/common/org/linphone/core/LinphoneFriend.java b/java/common/org/linphone/core/LinphoneFriend.java index d210833eb..a6f159864 100644 --- a/java/common/org/linphone/core/LinphoneFriend.java +++ b/java/common/org/linphone/core/LinphoneFriend.java @@ -109,18 +109,18 @@ public interface LinphoneFriend { */ boolean isPresenceReceived(); /** - * @brief Get the status of a friend + * Get the status of a friend * @return OnlineStatus * @deprecated Use getPresenceModel() instead */ OnlineStatus getStatus(); /** - * @brief Get the presence information of a friend + * Get the presence information of a friend * @return A #PresenceModel object, or null if the friend do not have presence information (in which case he is considered offline) */ PresenceModel getPresenceModel(); /** - * @brief Set the presence information of a friend + * Set the presence information of a friend * @param presenceModel A #PresenceModel object */ void setPresenceModel(PresenceModel presenceModel); diff --git a/java/common/org/linphone/core/PresenceActivity.java b/java/common/org/linphone/core/PresenceActivity.java index b965b526b..286184ece 100644 --- a/java/common/org/linphone/core/PresenceActivity.java +++ b/java/common/org/linphone/core/PresenceActivity.java @@ -22,39 +22,39 @@ package org.linphone.core; public interface PresenceActivity { /** - * @brief Gets the string representation of a presence activity. + * Gets the string representation of a presence activity. * @return A String representing the given activity. */ String toString(); /** - * @brief Gets the activity type of a presence activity. + * Gets the activity type of a presence activity. * @return The #PresenceActivityType of the activity. */ PresenceActivityType getType(); /** - * @brief Sets the type of activity of a presence activity. - * @param[in] acttype The activity type to set for the activity. + * Sets the type of activity of a presence activity. + * @param acttype The activity type to set for the activity. * @return 0 if successful, a value < 0 in case of error. */ int setType(PresenceActivityType type); /** - * @brief Gets the description of a presence activity. + * Gets the description of a presence activity. * @return A String containing the description of the presence activity, or null if no description is specified. */ String getDescription(); /** - * @brief Sets the description of a presence activity. - * @param[in] description An additional description of the activity. Can be null if no additional description is to be added. + * Sets the description of a presence activity. + * @param description An additional description of the activity. Can be null if no additional description is to be added. * @return 0 if successful, a value < 0 in case of error. */ int setDescription(String description); /** - * @brief Gets the native pointer for this object. + * Gets the native pointer for this object. */ long getNativePtr(); diff --git a/java/common/org/linphone/core/PresenceModel.java b/java/common/org/linphone/core/PresenceModel.java index 78bc264c2..277b4466c 100644 --- a/java/common/org/linphone/core/PresenceModel.java +++ b/java/common/org/linphone/core/PresenceModel.java @@ -22,46 +22,46 @@ package org.linphone.core; public interface PresenceModel { /** - * @brief Gets the basic status of a presence model. + * Gets the basic status of a presence model. * @return The #BasicStatus of the #PresenceModel object. */ PresenceBasicStatus getBasicStatus(); /** - * @brief Sets the basic status of a presence model. - * @param[in] basic_status The #BasicStatus to set for the #PresenceModel object. + * Sets the basic status of a presence model. + * @param basic_status The #BasicStatus to set for the #PresenceModel object. * @return 0 if successful, a value < 0 in case of error. */ int setBasicStatus(PresenceBasicStatus basic_status); /** - * @brief Gets the timestamp of a presence model. + * Gets the timestamp of a presence model. * @return The timestamp of the #LinphonePresenceModel object or -1 on error. */ long getTimestamp(); /** - * @brief Gets the contact of a presence model. + * Gets the contact of a presence model. * @return A string containing the contact, or null if no contact is found. */ String getContact(); /** - * @brief Sets the contact of a presence model. + * Sets the contact of a presence model. * @param contact The contact string to set. */ void setContact(String contact); /** - * @brief Gets the first activity of a presence model (there is usually only one). + * Gets the first activity of a presence model (there is usually only one). * @return A #PresenceActivity object if successful, null otherwise. */ PresenceActivity getActivity(); /** - * @brief Sets the activity of a presence model (limits to only one activity). - * @param[in] activity The #PresenceActivityType to set for the model. - * @param[in] description An additional description of the activity to set for the model. Can be null if no additional description is to be added. + * Sets the activity of a presence model (limits to only one activity). + * @param activity The #PresenceActivityType to set for the model. + * @param description An additional description of the activity to set for the model. Can be null if no additional description is to be added. * @return 0 if successful, a value < 0 in case of error. * * WARNING: This method will modify the basic status of the model according to the activity being set. @@ -70,42 +70,42 @@ public interface PresenceModel { int setActivity(PresenceActivityType activity, String description); /** - * @brief Gets the number of activities included in the presence model. + * Gets the number of activities included in the presence model. * @return The number of activities included in the #PresenceModel object. */ long getNbActivities(); /** - * @brief Gets the nth activity of a presence model. + * Gets the nth activity of a presence model. * @param idx The index of the activity to get (the first activity having the index 0). * @return A #PresenceActivity object if successful, null otherwise. */ PresenceActivity getNthActivity(long idx); /** - * @brief Adds an activity to a presence model. - * @param[in] activity The #PresenceActivity to add to the model. + * Adds an activity to a presence model. + * @param activity The #PresenceActivity to add to the model. * @return 0 if successful, a value < 0 in case of error. */ int addActivity(PresenceActivity activity); /** - * @brief Clears the activities of a presence model. + * Clears the activities of a presence model. * @return 0 if successful, a value < 0 in case of error. */ int clearActivities(); /** - * @brief Gets the first note of a presence model (there is usually only one). - * @param[in] lang The language of the note to get. Can be null to get a note that has no language specified or to get the first note whatever language it is written into. + * Gets the first note of a presence model (there is usually only one). + * @param lang The language of the note to get. Can be null to get a note that has no language specified or to get the first note whatever language it is written into. * @return A #PresenceNote object if successful, null otherwise. */ PresenceNote getNote(String lang); /** - * @brief Adds a note to a presence model. - * @param[in] note_content The note to be added to the presence model. - * @param[in] lang The language of the note to be added. Can be null if no language is to be specified for the note. + * Adds a note to a presence model. + * @param note_content The note to be added to the presence model. + * @param lang The language of the note to be added. Can be null if no language is to be specified for the note. * @return 0 if successful, a value < 0 in case of error. * * Only one note for each language can be set, so e.g. setting a note for the 'fr' language if there is only one will replace the existing one. @@ -113,59 +113,59 @@ public interface PresenceModel { int addNote(String note_content, String lang); /** - * @brief Clears all the notes of a presence model. + * Clears all the notes of a presence model. * @return 0 if successful, a value < 0 in case of error. */ int clearNotes(); /** - * @brief Gets the number of services included in the presence model. + * Gets the number of services included in the presence model. * @return The number of services included in the #PresenceModel object. */ long getNbServices(); /** - * @brief Gets the nth service of a presence model. - * @param[in] idx The index of the service to get (the first service having the index 0). + * Gets the nth service of a presence model. + * @param idx The index of the service to get (the first service having the index 0). * @return A #PresenceService object if successful, null otherwise. */ PresenceService getNthService(long idx); /** - * @brief Adds a service to a presence model. - * @param[in] service The #PresenceService object to add to the model. + * Adds a service to a presence model. + * @param service The #PresenceService object to add to the model. * @return 0 if successful, a value < 0 in case of error. */ int addService(PresenceService service); /** - * @brief Clears the services of a presence model. + * Clears the services of a presence model. * @return 0 if successful, a value < 0 in case of error. */ int clearServices(); /** - * @brief Gets the number of persons included in the presence model. + * Gets the number of persons included in the presence model. * @return The number of persons included in the #PresenceModel object. */ long getNbPersons(); /** - * @brief Gets the nth person of a presence model. - * @param[in] idx The index of the person to get (the first person having the index 0). + * Gets the nth person of a presence model. + * @param idx The index of the person to get (the first person having the index 0). * @return A pointer to a #PresencePerson object if successful, null otherwise. */ PresencePerson getNthPerson(long idx); /** - * @brief Adds a person to a presence model. - * @param[in] person The #PresencePerson object to add to the model. + * Adds a person to a presence model. + * @param person The #PresencePerson object to add to the model. * @return 0 if successful, a value < 0 in case of error. */ int addPerson(PresencePerson person); /** - * @brief Clears the persons of a presence model. + * Clears the persons of a presence model. * @return 0 if successful, a value < 0 in case of error. */ int clearPersons(); diff --git a/java/common/org/linphone/core/PresenceNote.java b/java/common/org/linphone/core/PresenceNote.java index 9353d9de4..fbfb36332 100644 --- a/java/common/org/linphone/core/PresenceNote.java +++ b/java/common/org/linphone/core/PresenceNote.java @@ -22,33 +22,33 @@ package org.linphone.core; public interface PresenceNote { /** - * @brief Gets the content of a presence note. + * Gets the content of a presence note. * @return A String with the content of the presence note. */ String getContent(); /** - * @brief Sets the content of a presence note. - * @param[in] content The content of the note. + * Sets the content of a presence note. + * @param content The content of the note. * @return 0 if successful, a value < 0 in case of error. */ int setContent(String content); /** - * @brief Gets the language of a presence note. + * Gets the language of a presence note. * @return A String containing the language of the presence note, or null if no language is specified. */ String getLang(); /** - * @brief Sets the language of a presence note. - * @param[in] lang The language of the note. + * Sets the language of a presence note. + * @param lang The language of the note. * @return 0 if successful, a value < 0 in case of error. */ int setLang(String lang); /** - * @brief Gets the native pointer for this object. + * Gets the native pointer for this object. */ long getNativePtr(); diff --git a/java/common/org/linphone/core/PresencePerson.java b/java/common/org/linphone/core/PresencePerson.java index 730aafe77..11eb6bfd3 100644 --- a/java/common/org/linphone/core/PresencePerson.java +++ b/java/common/org/linphone/core/PresencePerson.java @@ -22,98 +22,98 @@ package org.linphone.core; public interface PresencePerson { /** - * @brief Gets the id of a presence person. + * Gets the id of a presence person. * @return A string containing the id. */ String getId(); /** - * @brief Sets the id of a presence person. - * @param[in] id The id string to set. Can be null to generate it automatically. + * Sets the id of a presence person. + * @param id The id string to set. Can be null to generate it automatically. * @return 0 if successful, a value < 0 in case of error. */ int setId(String id); /** - * @brief Gets the number of activities included in the presence person. + * Gets the number of activities included in the presence person. * @return The number of activities included in the #PresencePerson object. */ long getNbActivities(); /** - * @brief Gets the nth activity of a presence person. - * @param[in] idx The index of the activity to get (the first activity having the index 0). + * Gets the nth activity of a presence person. + * @param idx The index of the activity to get (the first activity having the index 0). * @return A #PresenceActivity object if successful, null otherwise. */ PresenceActivity getNthActivity(long idx); /** - * @brief Adds an activity to a presence person. - * @param[in] activity The #PresenceActivity object to add to the person. + * Adds an activity to a presence person. + * @param activity The #PresenceActivity object to add to the person. * @return 0 if successful, a value < 0 in case of error. */ int addActivity(PresenceActivity activity); /** - * @brief Clears the activities of a presence person. + * Clears the activities of a presence person. * @return 0 if successful, a value < 0 in case of error. */ int clearActivities(); /** - * @brief Gets the number of notes included in the presence person. + * Gets the number of notes included in the presence person. * @return The number of notes included in the #PresencePerson object. */ long getNbNotes(); /** - * @brief Gets the nth note of a presence person. - * @param[in] idx The index of the note to get (the first note having the index 0). + * Gets the nth note of a presence person. + * @param idx The index of the note to get (the first note having the index 0). * @return A pointer to a #PresenceNote object if successful, null otherwise. */ PresenceNote getNthNote(long idx); /** - * @brief Adds a note to a presence person. - * @param[in] note The #PresenceNote object to add to the person. + * Adds a note to a presence person. + * @param note The #PresenceNote object to add to the person. * @return 0 if successful, a value < 0 in case of error. */ int addNote(PresenceNote note); /** - * @brief Clears the notes of a presence person. + * Clears the notes of a presence person. * @return 0 if successful, a value < 0 in case of error. */ int clearNotes(); /** - * @brief Gets the number of activities notes included in the presence person. + * Gets the number of activities notes included in the presence person. * @return The number of activities notes included in the #PresencePerson object. */ long getNbActivitiesNotes(); /** - * @brief Gets the nth activities note of a presence person. - * @param[in] idx The index of the activities note to get (the first note having the index 0). + * Gets the nth activities note of a presence person. + * @param idx The index of the activities note to get (the first note having the index 0). * @return A pointer to a #PresenceNote object if successful, null otherwise. */ PresenceNote getNthActivitiesNote(long idx); /** - * @brief Adds an activities note to a presence person. - * @param[in] note The #PresenceNote object to add to the person. + * Adds an activities note to a presence person. + * @param note The #PresenceNote object to add to the person. * @return 0 if successful, a value < 0 in case of error. */ int addActivitiesNote(PresenceNote note); /** - * @brief Clears the activities notes of a presence person. + * Clears the activities notes of a presence person. * @return 0 if successful, a value < 0 in case of error. */ int clearActivitesNotes(); /** - * @brief Gets the native pointer for this object. + * Gets the native pointer for this object. */ long getNativePtr(); diff --git a/java/common/org/linphone/core/PresenceService.java b/java/common/org/linphone/core/PresenceService.java index 3e06b6774..18d8004ca 100644 --- a/java/common/org/linphone/core/PresenceService.java +++ b/java/common/org/linphone/core/PresenceService.java @@ -22,72 +22,72 @@ package org.linphone.core; public interface PresenceService { /** - * @brief Gets the id of a presence service. + * Gets the id of a presence service. * @return A string containing the id. */ String getId(); /** - * @brief Sets the id of a presence service. - * @param[in] id The id string to set. Can be null to generate it automatically. + * Sets the id of a presence service. + * @param id The id string to set. Can be null to generate it automatically. * @return 0 if successful, a value < 0 in case of error. */ int setId(String id); /** - * @brief Gets the basic status of a presence service. + * Gets the basic status of a presence service. * @return The #PresenceBasicStatus of the #PresenceService object. */ PresenceBasicStatus getBasicStatus(); /** - * @brief Sets the basic status of a presence service. - * @param[in] status The #PresenceBasicStatus to set for the #PresenceService object. + * Sets the basic status of a presence service. + * @param status The #PresenceBasicStatus to set for the #PresenceService object. * @return 0 if successful, a value < 0 in case of error. */ int setBasicStatus(PresenceBasicStatus status); /** - * @brief Gets the contact of a presence service. + * Gets the contact of a presence service. * @return A string containing the contact, or null if no contact is found. */ String getContact(); /** - * @brief Sets the contact of a presence service. - * @param[in] contact The contact string to set. + * Sets the contact of a presence service. + * @param contact The contact string to set. * @return 0 if successful, a value < 0 in case of error. */ int setContact(String contact); /** - * @brief Gets the number of notes included in the presence service. + * Gets the number of notes included in the presence service. * @return The number of notes included in the #PresenceService object. */ long getNbNotes(); /** - * @brief Gets the nth note of a presence service. - * @param[in] idx The index of the note to get (the first note having the index 0). + * Gets the nth note of a presence service. + * @param idx The index of the note to get (the first note having the index 0). * @return A pointer to a #PresenceNote object if successful, null otherwise. */ PresenceNote getNthNote(long idx); /** - * @brief Adds a note to a presence service. - * @param[in] note The #PresenceNote object to add to the service. + * Adds a note to a presence service. + * @param note The #PresenceNote object to add to the service. * @return 0 if successful, a value < 0 in case of error. */ int addNote(PresenceNote note); /** - * @brief Clears the notes of a presence service. + * Clears the notes of a presence service. * @return 0 if successful, a value < 0 in case of error. */ int clearNotes(); /** - * @brief Gets the native pointer for this object. + * Gets the native pointer for this object. */ long getNativePtr(); From dd99267ba6e3773a5edf6b8391a379cfaa2b4e41 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 18 Aug 2016 16:51:07 +0200 Subject: [PATCH 42/45] Update mediastreamer2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 6e8471005..c8f02b327 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6e84710057279bb2054196fe31e55a706053e911 +Subproject commit c8f02b327e9c13c5f6b7aca2dc7c7d074ccddb29 From 7442397cdfa6379baa8acae0d035ead2f98a2289 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 19 Aug 2016 12:06:49 +0200 Subject: [PATCH 43/45] Update media streamer --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 6e8471005..c8f02b327 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6e84710057279bb2054196fe31e55a706053e911 +Subproject commit c8f02b327e9c13c5f6b7aca2dc7c7d074ccddb29 From 28ced75b42257e864071359be4cb3e1b9babda4a Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 23 Aug 2016 11:05:50 +0200 Subject: [PATCH 44/45] version python 3.10.1 --- CMakeLists.txt | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d14d0b700..c4de9d22b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ ############################################################################ cmake_minimum_required(VERSION 3.0) -project(linphone VERSION 3.10.0 LANGUAGES C CXX) +project(linphone VERSION 3.10.1 LANGUAGES C CXX) set(LINPHONE_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) diff --git a/configure.ac b/configure.ac index dbf08f1c4..d017b078d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([linphone],[3.10.0],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.10.1],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) From 9ccb8e078b0240bf100965a350b6980479d735ca Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 25 Aug 2016 10:02:03 +0200 Subject: [PATCH 45/45] Revert "version python 3.10.1" This reverts commit 28ced75b42257e864071359be4cb3e1b9babda4a. --- CMakeLists.txt | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4de9d22b..d14d0b700 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ ############################################################################ cmake_minimum_required(VERSION 3.0) -project(linphone VERSION 3.10.1 LANGUAGES C CXX) +project(linphone VERSION 3.10.0 LANGUAGES C CXX) set(LINPHONE_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) diff --git a/configure.ac b/configure.ac index d017b078d..dbf08f1c4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([linphone],[3.10.1],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.10.0],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c])