diff --git a/build/android/liblinphone_tester.mk b/build/android/liblinphone_tester.mk
index cada1aba4..a6a2ab5f5 100644
--- a/build/android/liblinphone_tester.mk
+++ b/build/android/liblinphone_tester.mk
@@ -13,7 +13,8 @@ common_SRC_FILES := \
flexisip_tester.c \
tester.c \
remote_provisioning_tester.c \
- quality_reporting_tester.c
+ quality_reporting_tester.c \
+ transport_tester.c
common_C_INCLUDES += \
$(LOCAL_PATH) \
diff --git a/build/wp8/LibLinphoneTester-native/LibLinphoneTester-native.vcxproj b/build/wp8/LibLinphoneTester-native/LibLinphoneTester-native.vcxproj
index 424044515..0512be517 100644
--- a/build/wp8/LibLinphoneTester-native/LibLinphoneTester-native.vcxproj
+++ b/build/wp8/LibLinphoneTester-native/LibLinphoneTester-native.vcxproj
@@ -105,6 +105,7 @@
+
true
@@ -153,4 +154,4 @@
-
\ No newline at end of file
+
diff --git a/coreapi/help/buddy_status.c b/coreapi/help/buddy_status.c
index 40db6458e..34c6fcda3 100644
--- a/coreapi/help/buddy_status.c
+++ b/coreapi/help/buddy_status.c
@@ -1,7 +1,7 @@
/*
buddy_status
-Copyright (C) 2010 Belledonne Communications SARL
+Copyright (C) 2010 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -73,7 +73,7 @@ static void new_subscription_requested (LinphoneCore *lc, LinphoneFriend *frien
* Registration state notification callback
*/
static void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message){
- printf("New registration state %s for user id [%s] at proxy [%s]\n"
+ printf("New registration state %s for user id [%s] at proxy [%s]"
,linphone_registration_state_to_string(cstate)
,linphone_proxy_config_get_identity(cfg)
,linphone_proxy_config_get_addr(cfg));
@@ -104,7 +104,7 @@ int main(int argc, char *argv[]){
#ifdef DEBUG
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
#endif
- /*
+ /*
Fill the LinphoneCoreVTable with application callbacks.
All are optional. Here we only use the both notify_presence_received and new_subscription_requested callbacks
in order to get notifications about friend status.
diff --git a/coreapi/linphone_tunnel.cc b/coreapi/linphone_tunnel.cc
index 2e77bbd95..e7968d8d7 100644
--- a/coreapi/linphone_tunnel.cc
+++ b/coreapi/linphone_tunnel.cc
@@ -55,6 +55,9 @@ static inline _LpConfig *config(LinphoneTunnel *tunnel){
void linphone_tunnel_destroy(LinphoneTunnel *tunnel){
delete tunnel->manager;
+
+ ms_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
+
ms_free(tunnel);
}
@@ -100,12 +103,12 @@ static LinphoneTunnelConfig *linphone_tunnel_config_from_string(const char *str)
break;
case 3:
delay = atoi(pch);
- break;
+ break;
default:
// Abort
pos = 0;
break;
-
+
}
++pos;
pch = strtok(NULL, ":");
@@ -121,7 +124,7 @@ static LinphoneTunnelConfig *linphone_tunnel_config_from_string(const char *str)
if(pos == 4) {
linphone_tunnel_config_set_delay(tunnel_config, delay);
}
- ms_free(dstr);
+ ms_free(dstr);
return tunnel_config;
}
@@ -152,12 +155,12 @@ static void linphone_tunnel_save_config(LinphoneTunnel *tunnel) {
static void linphone_tunnel_add_server_intern(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config) {
if(linphone_tunnel_config_get_remote_udp_mirror_port(tunnel_config) == -1) {
- bcTunnel(tunnel)->addServer(linphone_tunnel_config_get_host(tunnel_config),
+ bcTunnel(tunnel)->addServer(linphone_tunnel_config_get_host(tunnel_config),
linphone_tunnel_config_get_port(tunnel_config));
} else {
- bcTunnel(tunnel)->addServer(linphone_tunnel_config_get_host(tunnel_config),
- linphone_tunnel_config_get_port(tunnel_config),
- linphone_tunnel_config_get_remote_udp_mirror_port(tunnel_config),
+ bcTunnel(tunnel)->addServer(linphone_tunnel_config_get_host(tunnel_config),
+ linphone_tunnel_config_get_port(tunnel_config),
+ linphone_tunnel_config_get_remote_udp_mirror_port(tunnel_config),
linphone_tunnel_config_get_delay(tunnel_config));
}
tunnel->config_list = ms_list_append(tunnel->config_list, tunnel_config);
@@ -209,10 +212,10 @@ void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig
MSList *elem = ms_list_find(tunnel->config_list, tunnel_config);
if(elem != NULL) {
tunnel->config_list = ms_list_remove(tunnel->config_list, tunnel_config);
- linphone_tunnel_config_destroy(tunnel_config);
+ linphone_tunnel_config_destroy(tunnel_config);
linphone_tunnel_refresh_config(tunnel);
linphone_tunnel_save_config(tunnel);
- }
+ }
}
const MSList *linphone_tunnel_get_servers(LinphoneTunnel *tunnel){
@@ -221,11 +224,11 @@ const MSList *linphone_tunnel_get_servers(LinphoneTunnel *tunnel){
void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel){
bcTunnel(tunnel)->cleanServers();
-
+
/* Free the list */
- ms_list_for_each(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
- tunnel->config_list = ms_list_free(tunnel->config_list);
-
+ ms_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
+ tunnel->config_list = NULL;
+
linphone_tunnel_save_config(tunnel);
}
diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c
index d39f0ba74..04373a681 100644
--- a/coreapi/linphonecall.c
+++ b/coreapi/linphonecall.c
@@ -1563,7 +1563,11 @@ void linphone_call_init_audio_stream(LinphoneCall *call){
if (lc->rtptf){
RtpTransport *artp=lc->rtptf->audio_rtp_func(lc->rtptf->audio_rtp_func_data, call->media_ports[0].rtp_port);
RtpTransport *artcp=lc->rtptf->audio_rtcp_func(lc->rtptf->audio_rtcp_func_data, call->media_ports[0].rtcp_port);
- rtp_session_set_transports(audiostream->ms.sessions.rtp_session,artp,artcp);
+ RtpTransport *meta_rtp;
+ RtpTransport *meta_rtcp;
+ meta_rtp_transport_new(&meta_rtp,TRUE,artp, 0);
+ meta_rtp_transport_new(&meta_rtcp,FALSE,artcp, 0);
+ rtp_session_set_transports(audiostream->ms.sessions.rtp_session,meta_rtp,meta_rtcp);
}
call->audiostream_app_evq = ortp_ev_queue_new();
diff --git a/mediastreamer2 b/mediastreamer2
index a8c099577..4d43eeedb 160000
--- a/mediastreamer2
+++ b/mediastreamer2
@@ -1 +1 @@
-Subproject commit a8c09957733d1504744ac5388ecedddd9f5575ac
+Subproject commit 4d43eeedbcf715182325c27438106735593f4e8e
diff --git a/oRTP b/oRTP
index 7ad100e9f..509e86632 160000
--- a/oRTP
+++ b/oRTP
@@ -1 +1 @@
-Subproject commit 7ad100e9f3b28e6a37f5472f70c49500ec15f49e
+Subproject commit 509e86632b4a9544ff5d7ce57b66c89e3e384933
diff --git a/tester/Makefile.am b/tester/Makefile.am
index 348306bca..0306ea7a4 100644
--- a/tester/Makefile.am
+++ b/tester/Makefile.am
@@ -21,7 +21,8 @@ liblinphonetester_la_SOURCES = tester.c \
flexisip_tester.c \
stun_tester.c \
remote_provisioning_tester.c \
- quality_reporting_tester.c
+ quality_reporting_tester.c \
+ transport_tester.c
liblinphonetester_la_LDFLAGS= -no-undefined
liblinphonetester_la_LIBADD= ../coreapi/liblinphone.la $(CUNIT_LIBS)
diff --git a/tester/call_tester.c b/tester/call_tester.c
index 55286937b..9313c6f74 100644
--- a/tester/call_tester.c
+++ b/tester/call_tester.c
@@ -266,7 +266,7 @@ bool_t call(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr){
return call_with_params(caller_mgr,callee_mgr,NULL,NULL);
}
-static void end_call(LinphoneCoreManager *m1, LinphoneCoreManager *m2){
+void end_call(LinphoneCoreManager *m1, LinphoneCoreManager *m2){
linphone_core_terminate_all_calls(m1->lc);
CU_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m1->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(m1->lc,m2->lc,&m2->stat.number_of_LinphoneCallEnd,1));
diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h
index 9b2eeeb60..38aeafa4d 100644
--- a/tester/liblinphone_tester.h
+++ b/tester/liblinphone_tester.h
@@ -58,6 +58,7 @@ extern test_suite_t flexisip_test_suite;
extern test_suite_t stun_test_suite;
extern test_suite_t remote_provisioning_test_suite;
extern test_suite_t quality_reporting_test_suite;
+extern test_suite_t transport_test_suite;
extern int liblinphone_tester_nb_test_suites(void);
@@ -239,6 +240,7 @@ bool_t call_with_params(LinphoneCoreManager* caller_mgr
, const LinphoneCallParams *caller_params
, const LinphoneCallParams *callee_params);
bool_t call(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr);
+void end_call(LinphoneCoreManager *m1, LinphoneCoreManager *m2);
stats * get_stats(LinphoneCore *lc);
LinphoneCoreManager *get_manager(LinphoneCore *lc);
const char *liblinphone_tester_get_subscribe_content(void);
diff --git a/tester/tester.c b/tester/tester.c
index 5387983ad..07ace6956 100644
--- a/tester/tester.c
+++ b/tester/tester.c
@@ -370,6 +370,7 @@ void liblinphone_tester_init(void) {
add_test_suite(&flexisip_test_suite);
add_test_suite(&remote_provisioning_test_suite);
add_test_suite(&quality_reporting_test_suite);
+ add_test_suite(&transport_test_suite);
}
void liblinphone_tester_uninit(void) {
diff --git a/tester/transport_tester.c b/tester/transport_tester.c
new file mode 100644
index 000000000..5d4b9ffaa
--- /dev/null
+++ b/tester/transport_tester.c
@@ -0,0 +1,105 @@
+/*
+ liblinphone_tester - liblinphone test suite
+ Copyright (C) 2013 Belledonne Communications SARL
+
+ 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, see .
+*/
+
+
+#include
+#include
+#include
+#include "CUnit/Basic.h"
+#include "linphonecore.h"
+#include "lpconfig.h"
+#include "private.h"
+#include "liblinphone_tester.h"
+
+static void call_with_transport_base(bool_t use_tunnel, LinphoneMediaEncryption encryption) {
+ if (linphone_core_tunnel_available()){
+ /*enabling the tunnel cause another REGISTER to be made*/
+ int pauline_register_count_expected = use_tunnel ? 2 : 1;
+ char *tmp_char;
+ LinphoneCoreManager *pauline = linphone_core_manager_new( "pauline_rc");
+ LinphoneCoreManager *marie = linphone_core_manager_new( "marie_rc");
+ LinphoneCall *pauline_call;
+
+ /*tunnel works only in UDP mode*/
+ LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(pauline->lc);
+ LinphoneAddress *server_addr = linphone_address_new(linphone_proxy_config_get_server_addr(proxy));
+ LinphoneAddress *route = linphone_address_new(linphone_proxy_config_get_route(proxy));
+ linphone_proxy_config_edit(proxy);
+ linphone_address_set_transport(server_addr, LinphoneTransportUdp);
+ linphone_address_set_transport(route, LinphoneTransportUdp);
+ tmp_char = linphone_address_as_string(server_addr);
+ linphone_proxy_config_set_server_addr(proxy, tmp_char);
+ ms_free(tmp_char);
+ tmp_char = linphone_address_as_string(route);
+ linphone_proxy_config_set_route(proxy, tmp_char);
+ ms_free(tmp_char);
+
+ linphone_core_set_media_encryption(pauline->lc, encryption);
+
+ if (use_tunnel){
+ LinphoneTunnel *tunnel = linphone_core_get_tunnel(pauline->lc);
+ LinphoneTunnelConfig *config = linphone_tunnel_config_new();
+
+ linphone_tunnel_enable(tunnel, TRUE);
+ linphone_tunnel_config_set_host(config, "tunnel.linphone.org");
+ linphone_tunnel_config_set_port(config, 443);
+ linphone_tunnel_add_server(tunnel, config);
+ }
+ linphone_proxy_config_done(proxy);
+
+ CU_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,pauline_register_count_expected));
+ CU_ASSERT_TRUE(wait_for(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk, 1));
+
+ CU_ASSERT_TRUE(call(pauline,marie));
+ pauline_call=linphone_core_get_current_call(pauline->lc);
+ CU_ASSERT_PTR_NOT_NULL(pauline_call);
+ if (pauline_call!=NULL){
+ CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(pauline_call)),
+ encryption);
+ }
+ end_call(pauline,marie);
+
+ linphone_address_destroy(server_addr);
+ linphone_address_destroy(route);
+ linphone_core_manager_destroy(pauline);
+ linphone_core_manager_destroy(marie);
+ }else{
+ ms_warning("Could not test %s because tunnel functionality is not available",__FUNCTION__);
+ }
+}
+
+static void call_with_tunnel(void) {
+ call_with_transport_base(TRUE,LinphoneMediaEncryptionNone);
+}
+
+static void call_with_tunnel_srtp(void) {
+ call_with_transport_base(TRUE,LinphoneMediaEncryptionSRTP);
+}
+
+test_t transport_tests[] = {
+ { "Tunnel only", call_with_tunnel },
+ { "Tunnel with SRTP", call_with_tunnel_srtp },
+};
+
+test_suite_t transport_test_suite = {
+ "Transport",
+ NULL,
+ NULL,
+ sizeof(transport_tests) / sizeof(transport_tests[0]),
+ transport_tests
+};