diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6144be09..99860bbb0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,6 +40,7 @@ option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES)
option(ENABLE_DATE "Use build date in internal version number." NO)
+cmake_dependent_option(ENABLE_DAEMON "Enable the linphone daemon interface." YES "NOT WIN32" NO)
option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." YES)
option(ENABLE_LDAP "Enable LDAP support." NO)
@@ -75,6 +76,11 @@ macro(apply_compile_flags SOURCE_FILES)
endif()
endmacro()
+if(ENABLE_STATIC)
+ set(LINPHONE_LIBS_FOR_TOOLS linphone-static)
+else()
+ set(LINPHONE_LIBS_FOR_TOOLS linphone)
+endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@@ -228,7 +234,12 @@ set(STRICT_OPTIONS_CPP )
set(STRICT_OPTIONS_C )
set(STRICT_OPTIONS_CXX )
set(STRICT_OPTIONS_OBJC )
-if(NOT MSVC)
+if(MSVC)
+ list(APPEND STRICT_OPTIONS_CPP "/wd4995") # Disable "name was marked as #pragma deprecated" warnings
+ if(ENABLE_STRICT)
+ list(APPEND STRICT_OPTIONS_CPP "/WX")
+ endif()
+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 "Clang")
@@ -290,6 +301,9 @@ add_subdirectory(share)
if(ENABLE_CONSOLE_UI)
add_subdirectory(console)
endif()
+if(ENABLE_DAEMON)
+ add_subdirectory(daemon)
+endif()
if(ENABLE_GTK_UI)
add_subdirectory(gtk)
add_subdirectory(pixmaps)
diff --git a/build/wince/liblinphone.sln b/build/wince/liblinphone.sln
deleted file mode 100644
index fe4efff27..000000000
--- a/build/wince/liblinphone.sln
+++ /dev/null
@@ -1,48 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblinphone", "liblinphone.vcproj", "{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "linphonec", "linphonec\linphonec.vcproj", "{92574924-BF59-4DAA-994B-9978B80E5797}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|Windows Mobile 6 Professional SDK (ARMV4I) = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
- Debug|Windows Mobile 6 Standard SDK (ARMV4I) = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
- Release|Win32 = Release|Win32
- Release|Windows Mobile 6 Professional SDK (ARMV4I) = Release|Windows Mobile 6 Professional SDK (ARMV4I)
- Release|Windows Mobile 6 Standard SDK (ARMV4I) = Release|Windows Mobile 6 Standard SDK (ARMV4I)
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Win32.ActiveCfg = Debug|Win32
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Win32.Build.0 = Debug|Win32
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Win32.ActiveCfg = Release|Win32
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Win32.Build.0 = Release|Win32
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
- {290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Win32.ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Release|Win32.ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
- {92574924-BF59-4DAA-994B-9978B80E5797}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/build/wince/liblinphone.vcproj b/build/wince/liblinphone.vcproj
deleted file mode 100644
index 9909c8a1f..000000000
--- a/build/wince/liblinphone.vcproj
+++ /dev/null
@@ -1,585 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/wince/linphonec/linphonec.vcproj b/build/wince/linphonec/linphonec.vcproj
deleted file mode 100644
index 058ce425c..000000000
--- a/build/wince/linphonec/linphonec.vcproj
+++ /dev/null
@@ -1,240 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/cmake/LinphoneConfig.cmake.in b/cmake/LinphoneConfig.cmake.in
index 8c9ef3944..89e2c87dd 100644
--- a/cmake/LinphoneConfig.cmake.in
+++ b/cmake/LinphoneConfig.cmake.in
@@ -57,7 +57,6 @@ if(@ENABLE_SHARED@)
else()
set(LINPHONE_LIBRARIES linphone-static)
endif()
-set(LINPHONE_LDFLAGS @LINK_FLAGS@)
list(APPEND LINPHONE_INCLUDE_DIRS ${MEDIASTREAMER2_INCLUDE_DIRS} ${BELLESIP_INCLUDE_DIRS})
list(APPEND LINPHONE_LIBRARIES ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES})
set(LINPHONE_CPPFLAGS "${MEDIASTREAMER2_CPPFLAGS}")
diff --git a/console/CMakeLists.txt b/console/CMakeLists.txt
index 3ec2b9e44..92016c04a 100644
--- a/console/CMakeLists.txt
+++ b/console/CMakeLists.txt
@@ -30,16 +30,28 @@ set(LINPHONECSH_SOURCE_FILES
)
apply_compile_flags(LINPHONEC_SOURCE_FILES "CPP" "C")
+if(MSVC)
+ get_source_file_property(COMMANDS_C_COMPILE_FLAGS commands.c COMPILE_FLAGS)
+ set(COMMANDS_C_COMPILE_FLAGS "${COMMANDS_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings
+ set_source_files_properties(commands.c PROPERTY COMPILE_FLAGS "${COMMANDS_C_COMPILE_FLAGS}")
+endif()
+
add_executable(linphonec ${LINPHONEC_SOURCE_FILES})
-target_link_libraries(linphonec linphone)
+target_link_libraries(linphonec linphone ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
+if(INTL_FOUND)
+ target_link_libraries(linphonec ${INTL_LIBRARIES})
+endif()
if(WIN32)
add_executable(linphoned WIN32 ${LINPHONEC_SOURCE_FILES})
- target_link_libraries(linphoned linphone)
+ target_link_libraries(linphoned linphone ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
+ if(INTL_FOUND)
+ target_link_libraries(linphoned ${INTL_LIBRARIES})
+ endif()
endif()
add_executable(linphonecsh ${LINPHONECSH_SOURCE_FILES})
-target_link_libraries(linphonecsh linphone)
+target_link_libraries(linphonecsh linphone ${ORTP_LIBRARIES})
set(INSTALL_TARGETS linphonec linphonecsh)
if(WIN32)
diff --git a/console/commands.c b/console/commands.c
index 095ab3f18..264dc3a35 100644
--- a/console/commands.c
+++ b/console/commands.c
@@ -600,7 +600,7 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
static int
lpc_cmd_calls(LinphoneCore *lc, char *args){
- const MSList *calls = linphone_core_get_calls(lc);
+ const bctbx_list_t *calls = linphone_core_get_calls(lc);
if(calls)
{
lpc_display_call_states(lc);
@@ -665,7 +665,7 @@ lpc_cmd_transfer(LinphoneCore *lc, char *args)
int n=sscanf(args,"%255s %265s %li",arg1,arg2,&id2);
if (n==1 || isalpha(*arg1)){
call=linphone_core_get_current_call(lc);
- if (call==NULL && ms_list_size(linphone_core_get_calls(lc))==1){
+ if (call==NULL && bctbx_list_size(linphone_core_get_calls(lc))==1){
call=(LinphoneCall*)linphone_core_get_calls(lc)->data;
}
refer_to=args;
@@ -734,7 +734,7 @@ lpc_cmd_terminate(LinphoneCore *lc, char *args)
static int
lpc_cmd_redirect(LinphoneCore *lc, char *args){
- const MSList *elem;
+ const bctbx_list_t *elem;
int didit=0;
if (!args) return 0;
if ((elem=linphone_core_get_calls(lc))==NULL){
@@ -780,7 +780,7 @@ static int
lpc_cmd_answer(LinphoneCore *lc, char *args){
if (!args)
{
- int nb=ms_list_size(linphone_core_get_calls(lc));
+ int nb=bctbx_list_size(linphone_core_get_calls(lc));
if (nb==1){
//if just one call is present answer the only one in passing NULL to the linphone_core_accept_call ...
if ( -1 == linphone_core_accept_call(lc, NULL) )
@@ -1176,8 +1176,8 @@ lpc_cmd_proxy(LinphoneCore *lc, char *args)
static int
lpc_cmd_call_logs(LinphoneCore *lc, char *args)
{
- const MSList *elem=linphone_core_get_call_logs(lc);
- for (;elem!=NULL;elem=ms_list_next(elem))
+ const bctbx_list_t *elem=linphone_core_get_call_logs(lc);
+ for (;elem!=NULL;elem=bctbx_list_next(elem))
{
LinphoneCallLog *cl=(LinphoneCallLog*)elem->data;
char *str=linphone_call_log_to_str(cl);
@@ -1432,7 +1432,7 @@ lpc_cmd_staticpic(LinphoneCore *lc, char *args)
if (strcmp(arg1, "fps")==0) {
if (arg2) {
- float fps = atof(arg2); /* FIXME: Handle not-a-float */
+ float fps = (float)atof(arg2); /* FIXME: Handle not-a-float */
linphone_core_set_static_picture_fps(lc, fps);
return 1;
} else {
@@ -1480,8 +1480,8 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
}
else
{
- const MSList *calls = linphone_core_get_calls(lc);
- int nbcalls=ms_list_size(calls);
+ const bctbx_list_t *calls = linphone_core_get_calls(lc);
+ int nbcalls=bctbx_list_size(calls);
if( nbcalls == 1)
{
if(linphone_core_resume_call(lc,calls->data) < 0)
@@ -1766,7 +1766,7 @@ linphonec_proxy_display(LinphoneProxyConfig *cfg)
static void linphonec_proxy_show(LinphoneCore *lc, int index)
{
- const MSList *elem;
+ const bctbx_list_t *elem;
int i;
for(elem=linphone_core_get_proxy_config_list(lc),i=0;elem!=NULL;elem=elem->next,++i){
if (index==i){
@@ -1781,12 +1781,12 @@ static void linphonec_proxy_show(LinphoneCore *lc, int index)
static void
linphonec_proxy_list(LinphoneCore *lc)
{
- const MSList *proxies;
+ const bctbx_list_t *proxies;
int n;
int def=linphone_core_get_default_proxy(lc,NULL);
proxies=linphone_core_get_proxy_config_list(lc);
- for(n=0;proxies!=NULL;proxies=ms_list_next(proxies),n++){
+ for(n=0;proxies!=NULL;proxies=bctbx_list_next(proxies),n++){
if (n==def)
linphonec_out("****** Proxy %i - this is the default one - *******\n",n);
else
@@ -1799,10 +1799,10 @@ linphonec_proxy_list(LinphoneCore *lc)
static void
linphonec_proxy_remove(LinphoneCore *lc, int index)
{
- const MSList *proxies;
+ const bctbx_list_t *proxies;
LinphoneProxyConfig *cfg;
proxies=linphone_core_get_proxy_config_list(lc);
- cfg=(LinphoneProxyConfig*)ms_list_nth_data(proxies,index);
+ cfg=(LinphoneProxyConfig*)bctbx_list_nth_data(proxies,index);
if (cfg==NULL){
linphonec_out("No such proxy.\n");
return;
@@ -1814,10 +1814,10 @@ linphonec_proxy_remove(LinphoneCore *lc, int index)
static int
linphonec_proxy_use(LinphoneCore *lc, int index)
{
- const MSList *proxies;
+ const bctbx_list_t *proxies;
LinphoneProxyConfig *cfg;
proxies=linphone_core_get_proxy_config_list(lc);
- cfg=(LinphoneProxyConfig*)ms_list_nth_data(proxies,index);
+ cfg=(LinphoneProxyConfig*)bctbx_list_nth_data(proxies,index);
if (cfg==NULL){
linphonec_out("No such proxy (try 'proxy list').");
return 0;
@@ -1841,7 +1841,7 @@ linphonec_friend_display(LinphoneFriend *fr)
static int
linphonec_friend_list(LinphoneCore *lc, char *pat)
{
- const MSList *friend;
+ const bctbx_list_t *friend;
int n;
if (pat) {
@@ -1850,7 +1850,7 @@ linphonec_friend_list(LinphoneCore *lc, char *pat)
}
friend = linphone_core_get_friend_list(lc);
- for(n=0; friend!=NULL; friend=ms_list_next(friend), ++n )
+ for(n=0; friend!=NULL; friend=bctbx_list_next(friend), ++n )
{
if ( pat ) {
const char *name = linphone_address_get_display_name(
@@ -1867,11 +1867,11 @@ linphonec_friend_list(LinphoneCore *lc, char *pat)
static int
linphonec_friend_call(LinphoneCore *lc, unsigned int num)
{
- const MSList *friend = linphone_core_get_friend_list(lc);
+ const bctbx_list_t *friend = linphone_core_get_friend_list(lc);
unsigned int n;
char *addr;
- for(n=0; friend!=NULL; friend=ms_list_next(friend), ++n )
+ for(n=0; friend!=NULL; friend=bctbx_list_next(friend), ++n )
{
if ( n == num )
{
@@ -1904,10 +1904,10 @@ linphonec_friend_add(LinphoneCore *lc, const char *name, const char *addr)
static int
linphonec_friend_delete(LinphoneCore *lc, int num)
{
- const MSList *friend = linphone_core_get_friend_list(lc);
+ const bctbx_list_t *friend = linphone_core_get_friend_list(lc);
unsigned int n;
- for(n=0; friend!=NULL; friend=ms_list_next(friend), ++n )
+ for(n=0; friend!=NULL; friend=bctbx_list_next(friend), ++n )
{
if ( n == num )
{
@@ -1941,7 +1941,7 @@ static int lpc_cmd_register(LinphoneCore *lc, char *args){
char proxy[512];
char passwd[512];
LinphoneProxyConfig *cfg;
- const MSList *elem;
+ const bctbx_list_t *elem;
if (!args)
{
@@ -2006,7 +2006,7 @@ static int lpc_cmd_unregister(LinphoneCore *lc, char *args){
static int lpc_cmd_duration(LinphoneCore *lc, char *args){
LinphoneCallLog *cl;
- const MSList *elem=linphone_core_get_call_logs(lc);
+ const bctbx_list_t *elem=linphone_core_get_call_logs(lc);
for(;elem!=NULL;elem=elem->next){
if (elem->next==NULL){
cl=(LinphoneCallLog*)elem->data;
@@ -2234,7 +2234,7 @@ static int lpc_cmd_codec(int type, LinphoneCore *lc, char *args){
static void linphonec_codec_list(int type, LinphoneCore *lc){
PayloadType *pt;
int index=0;
- const MSList *node=NULL;
+ const bctbx_list_t *node=NULL;
if (type == AUDIO) {
node=linphone_core_get_audio_codecs(lc);
@@ -2242,7 +2242,7 @@ static void linphonec_codec_list(int type, LinphoneCore *lc){
node=linphone_core_get_video_codecs(lc);
}
- for(;node!=NULL;node=ms_list_next(node)){
+ for(;node!=NULL;node=bctbx_list_next(node)){
pt=(PayloadType*)(node->data);
linphonec_out("%2d: %s (%d) %s\n", index, pt->mime_type, pt->clock_rate,
linphone_core_payload_type_enabled(lc,pt) ? "enabled" : "disabled");
@@ -2253,7 +2253,7 @@ static void linphonec_codec_list(int type, LinphoneCore *lc){
static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){
PayloadType *pt;
int index=0;
- const MSList *node=NULL;
+ const bctbx_list_t *node=NULL;
if (type == AUDIO) {
node=linphone_core_get_audio_codecs(lc);
@@ -2261,7 +2261,7 @@ static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){
node=linphone_core_get_video_codecs(lc);
}
- for(;node!=NULL;node=ms_list_next(node)){
+ for(;node!=NULL;node=bctbx_list_next(node)){
if (index == sel_index || sel_index == -1) {
pt=(PayloadType*)(node->data);
linphone_core_enable_payload_type (lc,pt,TRUE);
@@ -2274,7 +2274,7 @@ static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){
static void linphonec_codec_disable(int type, LinphoneCore *lc, int sel_index){
PayloadType *pt;
int index=0;
- const MSList *node=NULL;
+ const bctbx_list_t *node=NULL;
if (type == AUDIO) {
node=linphone_core_get_audio_codecs(lc);
@@ -2282,7 +2282,7 @@ static void linphonec_codec_disable(int type, LinphoneCore *lc, int sel_index){
node=linphone_core_get_video_codecs(lc);
}
- for(;node!=NULL;node=ms_list_next(node)){
+ for(;node!=NULL;node=bctbx_list_next(node)){
if (index == sel_index || sel_index == -1) {
pt=(PayloadType*)(node->data);
linphone_core_enable_payload_type (lc,pt,FALSE);
@@ -2375,7 +2375,7 @@ static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args){
static int lpc_cmd_playback_gain(LinphoneCore *lc, char *args)
{
if (args){
- linphone_core_set_playback_gain_db(lc, atof(args));
+ linphone_core_set_playback_gain_db(lc, (float)atof(args));
return 1;
}
return 0;
@@ -2466,7 +2466,7 @@ static void lpc_display_global_state(LinphoneCore *lc){
static void lpc_display_call_states(LinphoneCore *lc){
LinphoneCall *call;
- const MSList *elem;
+ const bctbx_list_t *elem;
char *tmp;
linphonec_out("Call states\n"
"Id | Destination | State | Flags |\n"
@@ -2491,7 +2491,7 @@ static void lpc_display_call_states(LinphoneCore *lc){
}
static void lpc_display_proxy_states(LinphoneCore *lc){
- const MSList *elem;
+ const bctbx_list_t *elem;
linphonec_out("Proxy registration states\n"
" Identity | State\n"
"------------------------------------------------------------\n");
diff --git a/console/linphonec.c b/console/linphonec.c
index 07ac95729..899ffe61c 100644
--- a/console/linphonec.c
+++ b/console/linphonec.c
@@ -37,6 +37,7 @@
#include
#include "linphonec.h"
+#include
#ifdef _WIN32
#include
@@ -1206,7 +1207,7 @@ linphonec_parse_cmdline(int argc, char **argv)
if (strcmp(argv[arg_num], "NUL") != 0) {
#endif
#if !defined(_WIN32_WCE)
- if (access(argv[arg_num], F_OK) != 0)
+ if (bctbx_file_exist(argv[arg_num]) != 0)
{
fprintf(stderr,
"Cannot open config file %s.\n",
@@ -1223,7 +1224,7 @@ linphonec_parse_cmdline(int argc, char **argv)
{
if ( ++arg_num >= argc ) print_usage(EXIT_FAILURE);
#if !defined(_WIN32_WCE)
- if (access(argv[arg_num],F_OK)!=0 )
+ if (bctbx_file_exist(argv[arg_num])!=0 )
{
fprintf (stderr,
"Cannot open config file %s.\n",
@@ -1331,7 +1332,7 @@ handle_configfile_migration()
* If the *NEW* configuration already exists
* do nothing.
*/
- if (access(new_cfg,F_OK)==0)
+ if (bctbx_file_exist(new_cfg)==0)
{
free(new_cfg);
return 0;
@@ -1343,7 +1344,7 @@ handle_configfile_migration()
* If the *OLD* CLI configurations exist copy it to
* the new file and make it a symlink.
*/
- if (access(old_cfg_cli, F_OK)==0)
+ if (bctbx_file_exist(old_cfg_cli)==0)
{
if ( ! copy_file(old_cfg_cli, new_cfg) )
{
@@ -1364,7 +1365,7 @@ handle_configfile_migration()
* If the *OLD* GUI configurations exist copy it to
* the new file and make it a symlink.
*/
- if (access(old_cfg_gui, F_OK)==0)
+ if (bctbx_file_exist(old_cfg_gui)==0)
{
if ( ! copy_file(old_cfg_gui, new_cfg) )
{
diff --git a/console/shell.c b/console/shell.c
index 850446ab7..3427fa601 100644
--- a/console/shell.c
+++ b/console/shell.c
@@ -39,6 +39,7 @@
#endif
#include "ortp/ortp.h"
+#include
#define DEFAULT_REPLY_SIZE 4096
diff --git a/console/sipomatic.c b/console/sipomatic.c
index 92f4fe572..25afdbdb8 100644
--- a/console/sipomatic.c
+++ b/console/sipomatic.c
@@ -271,8 +271,8 @@ void sipomatic_uninit(Sipomatic *obj)
void sipomatic_iterate(Sipomatic *obj)
{
- MSList *elem;
- MSList *to_be_destroyed=NULL;
+ bctbx_list_t *elem;
+ bctbx_list_t *to_be_destroyed=NULL;
Call *call;
double elapsed;
eXosip_event_t *ev;
@@ -293,13 +293,13 @@ void sipomatic_iterate(Sipomatic *obj)
case CALL_STATE_RUNNING:
if (elapsed>obj->max_call_time || call->eof){
call_release(call);
- to_be_destroyed=ms_list_append(to_be_destroyed,call);
+ to_be_destroyed=bctbx_list_append(to_be_destroyed,call);
}
break;
}
- elem=ms_list_next(elem);
+ elem=bctbx_list_next(elem);
}
- for(;to_be_destroyed!=NULL; to_be_destroyed=ms_list_next(to_be_destroyed)){
+ for(;to_be_destroyed!=NULL; to_be_destroyed=bctbx_list_next(to_be_destroyed)){
call_destroy((Call*)to_be_destroyed->data);
}
}
@@ -307,9 +307,9 @@ void sipomatic_iterate(Sipomatic *obj)
Call* sipomatic_find_call(Sipomatic *obj,int did)
{
- MSList *it;
+ bctbx_list_t *it;
Call *call=NULL;
- for (it=obj->calls;it!=NULL;it=ms_list_next(it)){
+ for (it=obj->calls;it!=NULL;it=bctbx_list_next(it)){
call=(Call*)it->data;
if ( call->did==did) return call;
}
@@ -351,7 +351,7 @@ Call * call_new(Sipomatic *root, eXosip_event_t *ev)
obj->state=CALL_STATE_INIT;
obj->eof=0;
obj->root=root;
- root->calls=ms_list_append(root->calls,obj);
+ root->calls=bctbx_list_append(root->calls,obj);
return obj;
}
@@ -367,7 +367,7 @@ void call_release(Call *call)
void call_destroy(Call *obj)
{
- obj->root->calls=ms_list_remove(obj->root->calls,obj);
+ obj->root->calls=bctbx_list_remove(obj->root->calls,obj);
rtp_profile_destroy(obj->profile);
sdp_context_free(obj->sdpc);
ms_free(obj);
diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt
index 564d80d51..de85a6fe6 100644
--- a/coreapi/CMakeLists.txt
+++ b/coreapi/CMakeLists.txt
@@ -48,6 +48,7 @@ set(LINPHONE_HEADER_FILES
linphone_tunnel.h
lpc2xml.h
lpconfig.h
+ nat_policy.h
ringtoneplayer.h
sipsetup.h
sqlite3_bctbx_vfs.h
@@ -102,6 +103,7 @@ set(LINPHONE_SOURCE_FILES_C
lsd.c
message_storage.c
misc.c
+ nat_policy.c
offeranswer.c
offeranswer.h
player.c
@@ -228,7 +230,7 @@ if(ENABLE_SHARED)
set_target_properties(linphone PROPERTIES SOVERSION ${LINPHONE_SO_VERSION})
endif()
add_dependencies(linphone liblinphone-git-version)
- target_link_libraries(linphone ${LIBS})
+ target_link_libraries(linphone PRIVATE ${LIBS})
if(WIN32 AND CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set_target_properties(linphone PROPERTIES PREFIX "lib")
elseif(ANDROID)
@@ -236,8 +238,8 @@ if(ENABLE_SHARED)
add_dependencies(linphone linphonecore-jni-header)
endif()
if(MSVC)
- if(CMAKE_BUILD_TYPE STREQUAL "Debug")
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/linphone.pdb
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/linphone.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am
index ae407244b..97ba75460 100644
--- a/coreapi/Makefile.am
+++ b/coreapi/Makefile.am
@@ -42,6 +42,7 @@ linphone_include_HEADERS=\
linphone_tunnel.h \
lpc2xml.h \
lpconfig.h \
+ nat_policy.h \
sipsetup.h \
sqlite3_bctbx_vfs.h \
xml2lpc.h \
@@ -81,6 +82,7 @@ liblinphone_la_SOURCES=\
lsd.c \
message_storage.c \
misc.c \
+ nat_policy.c \
offeranswer.c offeranswer.h\
player.c \
presence.c \
diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc
index 02fd650f1..2a5bfcde7 100644
--- a/coreapi/TunnelManager.cc
+++ b/coreapi/TunnelManager.cc
@@ -136,6 +136,8 @@ int TunnelManager::customRecvfrom(struct _RtpTransport *t, mblk_t *msg, int flag
int err=((TunnelSocket*)t->data)->recvfrom(msg->b_wptr,msg->b_datap->db_lim-msg->b_datap->db_base,from,*fromlen);
//to make ice happy
inet_aton(((TunnelManager*)((TunnelSocket*)t->data)->getUserPointer())->mLocalAddr,&msg->recv_addr.addr.ipi_addr);
+ msg->recv_addr.family = AF_INET;
+ msg->recv_addr.port = htons((unsigned short)((TunnelSocket*)t->data)->getPort());
if (err>0) return err;
return 0;
}
diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c
index 1ea4aabb5..4469bc7d1 100644
--- a/coreapi/account_creator.c
+++ b/coreapi/account_creator.c
@@ -210,11 +210,11 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_username(LinphoneAccou
bool_t use_phone_number = lp_config_get_int(creator->core->config, "assistant", "use_phone_number", 0);
const char* regex = lp_config_get_string(creator->core->config, "assistant", "username_regex", 0);
LinphoneAccountCreatorStatus status;
- if (min_length > 0 && strlen(username) < min_length) {
+ if (min_length > 0 && strlen(username) < (size_t)min_length) {
return LinphoneAccountCreatorUsernameTooShort;
- } else if (max_length > 0 && strlen(username) > max_length) {
+ } else if (max_length > 0 && strlen(username) > (size_t)max_length) {
return LinphoneAccountCreatorUsernameTooLong;
- } else if (fixed_length > 0 && strlen(username) != fixed_length) {
+ } else if (fixed_length > 0 && strlen(username) != (size_t)fixed_length) {
return LinphoneAccountCreatorUsernameInvalidSize;
} else if (use_phone_number && !linphone_proxy_config_is_phone_number(NULL, username)) {
return LinphoneAccountCreatorUsernameInvalid;
@@ -236,9 +236,9 @@ const char * linphone_account_creator_get_username(const LinphoneAccountCreator
LinphoneAccountCreatorStatus linphone_account_creator_set_password(LinphoneAccountCreator *creator, const char *password){
int min_length = lp_config_get_int(creator->core->config, "assistant", "password_min_length", -1);
int max_length = lp_config_get_int(creator->core->config, "assistant", "password_max_length", -1);
- if (min_length > 0 && strlen(password) < min_length) {
+ if (min_length > 0 && strlen(password) < (size_t)min_length) {
return LinphoneAccountCreatorPasswordTooShort;
- } else if (max_length > 0 && strlen(password) > max_length) {
+ } else if (max_length > 0 && strlen(password) > (size_t)max_length) {
return LinphoneAccountCreatorPasswordTooLong;
}
set_string(&creator->password, password, FALSE);
diff --git a/coreapi/authentication.c b/coreapi/authentication.c
index 5382347ad..b1bfc09cc 100644
--- a/coreapi/authentication.c
+++ b/coreapi/authentication.c
@@ -231,7 +231,7 @@ static bool_t realm_match(const char *realm1, const char *realm2){
}
static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *username, const char *realm, const char *domain, bool_t ignore_realm){
- MSList *elem;
+ bctbx_list_t *elem;
const LinphoneAuthInfo *ret=NULL;
for (elem=lc->auth_info;elem!=NULL;elem=elem->next) {
@@ -286,7 +286,7 @@ const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const cha
/*the auth info is expected to be in the core's list*/
void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai){
int i;
- MSList *elem = lc->auth_info;
+ bctbx_list_t *elem = lc->auth_info;
if (!lc->sip_conf.save_auth_info) return;
@@ -298,12 +298,12 @@ void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai){
}
static void write_auth_infos(LinphoneCore *lc){
- MSList *elem;
+ bctbx_list_t *elem;
int i;
if (!linphone_core_ready(lc)) return;
if (!lc->sip_conf.save_auth_info) return;
- for(elem=lc->auth_info,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
+ for(elem=lc->auth_info,i=0;elem!=NULL;elem=bctbx_list_next(elem),i++){
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)(elem->data);
linphone_auth_info_write_config(lc->config,ai,i);
}
@@ -321,8 +321,8 @@ LinphoneAuthInfo * linphone_core_create_auth_info(LinphoneCore *lc, const char *
**/
void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info){
LinphoneAuthInfo *ai;
- MSList *elem;
- MSList *l;
+ bctbx_list_t *elem;
+ bctbx_list_t *l;
int restarted_op_count=0;
bool_t updating=FALSE;
@@ -333,11 +333,11 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
/* find if we are attempting to modify an existing auth info */
ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
if (ai!=NULL && ai->domain && info->domain && strcmp(ai->domain, info->domain)==0){
- lc->auth_info=ms_list_remove(lc->auth_info,ai);
+ lc->auth_info=bctbx_list_remove(lc->auth_info,ai);
linphone_auth_info_destroy(ai);
updating=TRUE;
}
- lc->auth_info=ms_list_append(lc->auth_info,linphone_auth_info_clone(info));
+ lc->auth_info=bctbx_list_append(lc->auth_info,linphone_auth_info_clone(info));
/* retry pending authentication operations */
for(l=elem=sal_get_pending_auths(lc->sal);elem!=NULL;elem=elem->next){
@@ -347,14 +347,14 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
ai=(LinphoneAuthInfo*)_linphone_core_find_auth_info(lc,req_sai->realm,req_sai->username,req_sai->domain, FALSE);
if (ai){
SalAuthInfo sai;
- MSList* proxy;
+ bctbx_list_t* proxy;
sai.username=ai->username;
sai.userid=ai->userid;
sai.realm=ai->realm;
sai.password=ai->passwd;
sai.ha1=ai->ha1;
/*proxy case*/
- for (proxy=(MSList*)linphone_core_get_proxy_config_list(lc);proxy!=NULL;proxy=proxy->next) {
+ for (proxy=(bctbx_list_t*)linphone_core_get_proxy_config_list(lc);proxy!=NULL;proxy=proxy->next) {
if (proxy->data == sal_op_get_user_pointer(op)) {
linphone_proxy_config_set_state((LinphoneProxyConfig*)(proxy->data),LinphoneRegistrationProgress,"Authentication...");
break;
@@ -375,7 +375,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
info->realm ? info->realm : "",
info->domain ? info->domain : "");
}
- ms_list_free(l);
+ bctbx_list_free(l);
write_auth_infos(lc);
}
@@ -394,7 +394,7 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *in
LinphoneAuthInfo *r;
r=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
if (r){
- lc->auth_info=ms_list_remove(lc->auth_info,r);
+ lc->auth_info=bctbx_list_remove(lc->auth_info,r);
linphone_auth_info_destroy(r);
write_auth_infos(lc);
}
@@ -405,7 +405,7 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *in
* @param[in] lc The LinphoneCore object
* @return \mslist{LinphoneAuthInfo}
**/
-const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc){
+const bctbx_list_t *linphone_core_get_auth_info_list(const LinphoneCore *lc){
return lc->auth_info;
}
@@ -413,14 +413,14 @@ const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc){
* Clear all authentication information.
**/
void linphone_core_clear_all_auth_info(LinphoneCore *lc){
- MSList *elem;
+ bctbx_list_t *elem;
int i;
- for(i=0,elem=lc->auth_info;elem!=NULL;elem=ms_list_next(elem),i++){
+ for(i=0,elem=lc->auth_info;elem!=NULL;elem=bctbx_list_next(elem),i++){
LinphoneAuthInfo *info=(LinphoneAuthInfo*)elem->data;
linphone_auth_info_destroy(info);
linphone_auth_info_write_config(lc->config,NULL,i);
}
- ms_list_free(lc->auth_info);
+ bctbx_list_free(lc->auth_info);
lc->auth_info=NULL;
}
diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c
index 75071f1bc..aabee27f7 100644
--- a/coreapi/bellesip_sal/sal_impl.c
+++ b/coreapi/bellesip_sal/sal_impl.c
@@ -115,8 +115,8 @@ void sal_set_log_level(OrtpLogLevel level) {
}
void sal_add_pending_auth(Sal *sal, SalOp *op){
- if (ms_list_find(sal->pending_auths,op)==NULL){
- sal->pending_auths=ms_list_append(sal->pending_auths,op);
+ if (bctbx_list_find(sal->pending_auths,op)==NULL){
+ sal->pending_auths=bctbx_list_append(sal->pending_auths,op);
op->has_auth_pending=TRUE;
}
}
@@ -124,8 +124,8 @@ void sal_add_pending_auth(Sal *sal, SalOp *op){
void sal_remove_pending_auth(Sal *sal, SalOp *op){
if (op->has_auth_pending){
op->has_auth_pending=FALSE;
- if (ms_list_find(sal->pending_auths,op)){
- sal->pending_auths=ms_list_remove(sal->pending_auths,op);
+ if (bctbx_list_find(sal->pending_auths,op)){
+ sal->pending_auths=bctbx_list_remove(sal->pending_auths,op);
}
}
}
@@ -593,7 +593,7 @@ void sal_uninit(Sal* sal){
belle_sip_object_unref(sal->stack);
belle_sip_object_unref(sal->listener);
if (sal->supported) belle_sip_object_unref(sal->supported);
- ms_list_free_with_data(sal->supported_tags,ms_free);
+ bctbx_list_free_with_data(sal->supported_tags,ms_free);
if (sal->uuid) ms_free(sal->uuid);
if (sal->root_ca) ms_free(sal->root_ca);
ms_free(sal);
@@ -804,8 +804,8 @@ int sal_iterate(Sal *sal){
belle_sip_stack_sleep(sal->stack,0);
return 0;
}
-MSList * sal_get_pending_auths(Sal *sal){
- return ms_list_copy(sal->pending_auths);
+bctbx_list_t * sal_get_pending_auths(Sal *sal){
+ return bctbx_list_copy(sal->pending_auths);
}
/*misc*/
@@ -858,10 +858,10 @@ int sal_get_transport_timeout(const Sal* sal) {
return belle_sip_stack_get_transport_timeout(sal->stack);
}
-void sal_set_dns_servers(Sal *sal, const MSList *servers){
+void sal_set_dns_servers(Sal *sal, const bctbx_list_t *servers){
belle_sip_list_t *l = NULL;
- /*we have to convert the MSList into a belle_sip_list_t first*/
+ /*we have to convert the bctbx_list_t into a belle_sip_list_t first*/
for (; servers != NULL; servers = servers->next){
l = belle_sip_list_append(l, servers->data);
}
@@ -1036,7 +1036,7 @@ int sal_generate_uuid(char *uuid, size_t len) {
written=snprintf(uuid,len,"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", uuid_struct.time_low, uuid_struct.time_mid,
uuid_struct.time_hi_and_version, uuid_struct.clock_seq_hi_and_reserved,
uuid_struct.clock_seq_low);
- if (written>len+13){
+ if ((written < 0) || ((size_t)written > (len +13))) {
ms_error("sal_create_uuid(): buffer is too short !");
return -1;
}
@@ -1055,7 +1055,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len) {
}
static void make_supported_header(Sal *sal){
- MSList *it;
+ bctbx_list_t *it;
char *alltags=NULL;
size_t buflen=64;
size_t written=0;
@@ -1080,7 +1080,7 @@ static void make_supported_header(Sal *sal){
}
void sal_set_supported_tags(Sal *ctx, const char* tags){
- ctx->supported_tags=ms_list_free_with_data(ctx->supported_tags,ms_free);
+ ctx->supported_tags=bctbx_list_free_with_data(ctx->supported_tags,ms_free);
if (tags){
char *iter;
char *buffer=ms_strdup(tags);
@@ -1089,7 +1089,7 @@ void sal_set_supported_tags(Sal *ctx, const char* tags){
iter=buffer;
while((tag=strtok_r(iter,", ",&context))!=NULL){
iter=NULL;
- ctx->supported_tags=ms_list_append(ctx->supported_tags,ms_strdup(tag));
+ ctx->supported_tags=bctbx_list_append(ctx->supported_tags,ms_strdup(tag));
}
ms_free(buffer);
}
@@ -1104,19 +1104,19 @@ const char *sal_get_supported_tags(Sal *ctx){
}
void sal_add_supported_tag(Sal *ctx, const char* tag){
- MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,tag);
+ bctbx_list_t *elem=bctbx_list_find_custom(ctx->supported_tags,(bctbx_compare_func)strcasecmp,tag);
if (!elem){
- ctx->supported_tags=ms_list_append(ctx->supported_tags,ms_strdup(tag));
+ ctx->supported_tags=bctbx_list_append(ctx->supported_tags,ms_strdup(tag));
make_supported_header(ctx);
}
}
void sal_remove_supported_tag(Sal *ctx, const char* tag){
- MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,tag);
+ bctbx_list_t *elem=bctbx_list_find_custom(ctx->supported_tags,(bctbx_compare_func)strcasecmp,tag);
if (elem){
ms_free(elem->data);
- ctx->supported_tags=ms_list_remove_link(ctx->supported_tags,elem);
+ ctx->supported_tags=bctbx_list_remove_link(ctx->supported_tags,elem);
make_supported_header(ctx);
}
}
@@ -1154,6 +1154,10 @@ SalResolverContext * sal_resolve_a(Sal* sal, const char *name, int port, int fam
return (SalResolverContext*)belle_sip_stack_resolve_a(sal->stack,name,port,family,(belle_sip_resolver_callback_t)cb,data);
}
+SalResolverContext * sal_resolve(Sal *sal, const char *service, const char *transport, const char *name, int port, int family, SalResolverCallback cb, void *data) {
+ return (SalResolverContext *)belle_sip_stack_resolve(sal->stack, service, transport, name, port, family, (belle_sip_resolver_callback_t)cb, data);
+}
+
/*
void sal_resolve_cancel(Sal *sal, SalResolverContext* ctx){
belle_sip_stack_resolve_cancel(sal->stack,ctx);
diff --git a/coreapi/bellesip_sal/sal_sdp.c b/coreapi/bellesip_sal/sal_sdp.c
index 177c813ab..896c6004b 100644
--- a/coreapi/bellesip_sal/sal_sdp.c
+++ b/coreapi/bellesip_sal/sal_sdp.c
@@ -70,7 +70,7 @@ static void add_ice_remote_candidates(belle_sdp_media_description_t *md, const S
}
static bool_t is_rtcp_fb_trr_int_the_same_for_all_payloads(const SalStreamDescription *stream, uint16_t *trr_int) {
- MSList *pt_it;
+ bctbx_list_t *pt_it;
bool_t first = TRUE;
for (pt_it = stream->payloads; pt_it != NULL; pt_it = pt_it->next) {
PayloadType *pt = (PayloadType *)pt_it->data;
@@ -119,7 +119,7 @@ static void add_rtcp_fb_ccm_attribute(belle_sdp_media_description_t *media_desc,
}
static void add_rtcp_fb_attributes(belle_sdp_media_description_t *media_desc, const SalMediaDescription *md, const SalStreamDescription *stream) {
- MSList *pt_it;
+ bctbx_list_t *pt_it;
PayloadType *pt;
PayloadTypeAvpfParams avpf_params;
bool_t general_trr_int;
@@ -191,7 +191,7 @@ static void stream_description_to_sdp ( belle_sdp_session_description_t *session
belle_sdp_mime_parameter_t* mime_param;
belle_sdp_media_description_t* media_desc;
int j;
- MSList* pt_it;
+ bctbx_list_t* pt_it;
PayloadType* pt;
char buffer[1024];
char* dir=NULL;
@@ -470,7 +470,7 @@ static void sdp_parse_payload_types(belle_sdp_media_description_t *media_desc, S
pt->channels=belle_sdp_mime_parameter_get_channel_count ( mime_param );
payload_type_set_send_fmtp ( pt,belle_sdp_mime_parameter_get_parameters ( mime_param ) );
payload_type_set_avpf_params(pt, avpf_params);
- stream->payloads=ms_list_append ( stream->payloads,pt );
+ stream->payloads=bctbx_list_append ( stream->payloads,pt );
stream->ptime=belle_sdp_mime_parameter_get_ptime ( mime_param );
ms_message ( "Found payload %s/%i fmtp=%s",pt->mime_type,pt->clock_rate,
pt->send_fmtp ? pt->send_fmtp : "" );
@@ -577,7 +577,7 @@ static void sdp_parse_media_ice_parameters(belle_sdp_media_description_t *media_
}
static void enable_avpf_for_stream(SalStreamDescription *stream) {
- MSList *pt_it;
+ bctbx_list_t *pt_it;
for (pt_it = stream->payloads; pt_it != NULL; pt_it = pt_it->next) {
PayloadType *pt = (PayloadType *)pt_it->data;
payload_type_set_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
@@ -639,7 +639,7 @@ static bool_t sdp_parse_rtcp_fb_parameters(belle_sdp_media_description_t *media_
belle_sip_list_t *it;
belle_sdp_attribute_t *attribute;
belle_sdp_rtcp_fb_attribute_t *fb_attribute;
- MSList *pt_it;
+ bctbx_list_t *pt_it;
PayloadType *pt;
int8_t pt_num;
bool_t retval = FALSE;
diff --git a/coreapi/call_log.c b/coreapi/call_log.c
index 1e8a3786c..2c9572c40 100644
--- a/coreapi/call_log.c
+++ b/coreapi/call_log.c
@@ -74,9 +74,9 @@ static void set_call_log_date(LinphoneCallLog *cl, time_t start_time){
******************************************************************************/
void call_logs_write_to_config_file(LinphoneCore *lc){
- MSList *elem;
+ bctbx_list_t *elem;
char logsection[32];
- int i;
+ unsigned int i;
char *tmp;
LpConfig *cfg=lc->config;
@@ -147,7 +147,7 @@ void call_logs_read_from_config_file(LinphoneCore *lc){
cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0);
tmp=lp_config_get_string(cfg,logsection,"call_id",NULL);
if (tmp) cl->call_id=ms_strdup(tmp);
- lc->call_logs=ms_list_append(lc->call_logs,cl);
+ lc->call_logs=bctbx_list_append(lc->call_logs,cl);
}else break;
}
}
@@ -414,13 +414,13 @@ void linphone_core_call_log_storage_close(LinphoneCore *lc) {
* | 11 | refkey
*/
static int create_call_log(void *data, int argc, char **argv, char **colName) {
- MSList **list = (MSList **)data;
+ bctbx_list_t **list = (bctbx_list_t **)data;
LinphoneAddress *from;
LinphoneAddress *to;
LinphoneCallDir dir;
LinphoneCallLog *log;
- unsigned int storage_id = atoi(argv[0]);
+ unsigned int storage_id = (unsigned int)atoi(argv[0]);
from = linphone_address_new(argv[1]);
to = linphone_address_new(argv[2]);
@@ -436,7 +436,7 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) {
log->connected_date_time = (time_t)atol(argv[6]);
log->status = (LinphoneCallStatus) atoi(argv[7]);
log->video_enabled = atoi(argv[8]) == 1;
- log->quality = atof(argv[9]);
+ log->quality = (float)atof(argv[9]);
if (argc > 10) {
if (argv[10] != NULL) {
@@ -447,7 +447,7 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) {
}
}
- *list = ms_list_append(*list, log);
+ *list = bctbx_list_append(*list, log);
return 0;
error:
@@ -461,7 +461,7 @@ error:
return 0;
}
-static void linphone_sql_request_call_log(sqlite3 *db, const char *stmt, MSList **list) {
+static void linphone_sql_request_call_log(sqlite3 *db, const char *stmt, bctbx_list_t **list) {
char* errmsg = NULL;
int ret;
ret = sqlite3_exec(db, stmt, create_call_log, list, &errmsg);
@@ -507,41 +507,41 @@ void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
ms_free(from);
ms_free(to);
- log->storage_id = sqlite3_last_insert_rowid(lc->logs_db);
+ log->storage_id = (unsigned int)sqlite3_last_insert_rowid(lc->logs_db);
}
if (lc) {
- lc->call_logs = ms_list_prepend(lc->call_logs, linphone_call_log_ref(log));
+ lc->call_logs = bctbx_list_prepend(lc->call_logs, linphone_call_log_ref(log));
}
}
-static void copy_user_data_from_existing_log(MSList *existing_logs, LinphoneCallLog *log) {
+static void copy_user_data_from_existing_log(bctbx_list_t *existing_logs, LinphoneCallLog *log) {
while (existing_logs) {
LinphoneCallLog *existing_log = (LinphoneCallLog *)existing_logs->data;
if (existing_log->storage_id == log->storage_id) {
log->user_data = existing_log->user_data;
break;
}
- existing_logs = ms_list_next(existing_logs);
+ existing_logs = bctbx_list_next(existing_logs);
}
}
-static void copy_user_data_from_existing_logs(MSList *existing_logs, MSList *new_logs) {
+static void copy_user_data_from_existing_logs(bctbx_list_t *existing_logs, bctbx_list_t *new_logs) {
while (new_logs) {
LinphoneCallLog *new_log = (LinphoneCallLog *)new_logs->data;
copy_user_data_from_existing_log(existing_logs, new_log);
- new_logs = ms_list_next(new_logs);
+ new_logs = bctbx_list_next(new_logs);
}
}
-const MSList *linphone_core_get_call_history(LinphoneCore *lc) {
+const bctbx_list_t *linphone_core_get_call_history(LinphoneCore *lc) {
char *buf;
uint64_t begin,end;
- MSList *result = NULL;
+ bctbx_list_t *result = NULL;
if (!lc || lc->logs_db == NULL) return NULL;
- buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %i", lc->max_call_logs);
+ buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %u", lc->max_call_logs);
begin = ortp_get_cur_time_ms();
linphone_sql_request_call_log(lc->logs_db, buf, &result);
@@ -553,7 +553,7 @@ const MSList *linphone_core_get_call_history(LinphoneCore *lc) {
copy_user_data_from_existing_logs(lc->call_logs, result);
}
- lc->call_logs = ms_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
+ lc->call_logs = bctbx_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
lc->call_logs = result;
return lc->call_logs;
@@ -574,7 +574,7 @@ void linphone_core_delete_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
if (!lc || lc->logs_db == NULL) return ;
- buf = sqlite3_mprintf("DELETE FROM call_history WHERE id = %i", log->storage_id);
+ buf = sqlite3_mprintf("DELETE FROM call_history WHERE id = %u", log->storage_id);
linphone_sql_request_generic(lc->logs_db, buf);
sqlite3_free(buf);
}
@@ -600,11 +600,11 @@ int linphone_core_get_call_history_size(LinphoneCore *lc) {
return numrows;
}
-MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
+bctbx_list_t * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
char *buf;
char *sipAddress;
uint64_t begin,end;
- MSList *result = NULL;
+ bctbx_list_t *result = NULL;
if (!lc || lc->logs_db == NULL || addr == NULL) return NULL;
@@ -629,7 +629,7 @@ MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const Linp
LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc) {
char *buf;
uint64_t begin,end;
- MSList *list = NULL;
+ bctbx_list_t *list = NULL;
LinphoneCallLog* result = NULL;
if (!lc || lc->logs_db == NULL) return NULL;
@@ -657,7 +657,7 @@ LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc) {
LinphoneCallLog * linphone_core_find_call_log_from_call_id(LinphoneCore *lc, const char *call_id) {
char *buf;
uint64_t begin,end;
- MSList *list = NULL;
+ bctbx_list_t *list = NULL;
LinphoneCallLog* result = NULL;
if (!lc || lc->logs_db == NULL) return NULL;
@@ -693,7 +693,7 @@ void linphone_core_call_log_storage_close(LinphoneCore *lc) {
void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
}
-const MSList *linphone_core_get_call_history(LinphoneCore *lc) {
+const bctbx_list_t *linphone_core_get_call_history(LinphoneCore *lc) {
return NULL;
}
@@ -707,7 +707,7 @@ int linphone_core_get_call_history_size(LinphoneCore *lc) {
return 0;
}
-MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
+bctbx_list_t * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
return NULL;
}
diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c
index 9cb4572e6..c2d1ae557 100644
--- a/coreapi/callbacks.c
+++ b/coreapi/callbacks.c
@@ -111,12 +111,12 @@ void linphone_call_update_frozen_payloads(LinphoneCall *call, SalMediaDescriptio
SalMediaDescription *local=call->localdesc;
int i;
for(i=0;inb_streams;++i){
- MSList *elem;
+ bctbx_list_t *elem;
for (elem=result_desc->streams[i].payloads;elem!=NULL;elem=elem->next){
PayloadType *pt=(PayloadType*)elem->data;
if (is_payload_type_number_available(local->streams[i].already_assigned_payloads, payload_type_get_number(pt), NULL)){
/*new codec, needs to be added to the list*/
- local->streams[i].already_assigned_payloads=ms_list_append(local->streams[i].already_assigned_payloads, payload_type_clone(pt));
+ local->streams[i].already_assigned_payloads=bctbx_list_append(local->streams[i].already_assigned_payloads, payload_type_clone(pt));
ms_message("LinphoneCall[%p] : payload type %i %s/%i fmtp=%s added to frozen list.",
call, payload_type_get_number(pt), pt->mime_type, pt->clock_rate, pt->recv_fmtp ? pt->recv_fmtp : "");
}
@@ -201,7 +201,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
prepare_early_media_forking(call);
}
linphone_call_start_media_streams(call, target_state);
- if (call->state==LinphoneCallPausing && call->paused_by_app && ms_list_size(lc->calls)==1){
+ if (call->state==LinphoneCallPausing && call->paused_by_app && bctbx_list_size(lc->calls)==1){
linphone_core_play_named_tone(lc,LinphoneToneCallOnHold);
}
linphone_call_update_frozen_payloads(call, new_md);
@@ -212,7 +212,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
}
#if 0
static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to){
- MSList *elem;
+ bctbx_list_t *elem;
for(elem=lc->calls;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall*)elem->data;
if (linphone_address_weak_equal(call->log->from,from) &&
@@ -225,7 +225,7 @@ static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, c
#endif
static bool_t already_a_call_with_remote_address(const LinphoneCore *lc, const LinphoneAddress *remote) {
- MSList *elem;
+ bctbx_list_t *elem;
ms_message("Searching for already_a_call_with_remote_address.");
for(elem=lc->calls;elem!=NULL;elem=elem->next){
@@ -786,7 +786,7 @@ static void call_terminated(SalOp *op, const char *from){
linphone_core_start_refered_call(lc,call,NULL);
}
//we stop the call only if we have this current call or if we are in call
- if ((ms_list_size(lc->calls) == 1) || linphone_core_in_call(lc)) {
+ if ((bctbx_list_size(lc->calls) == 1) || linphone_core_in_call(lc)) {
linphone_core_stop_ringing(lc);
}
linphone_call_stop_media_streams(call);
@@ -1088,8 +1088,8 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){
}
static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){
- MSList *elem=lc->last_recv_msg_ids;
- MSList *tail=NULL;
+ bctbx_list_t *elem=lc->last_recv_msg_ids;
+ bctbx_list_t *tail=NULL;
int i;
bool_t is_duplicate=FALSE;
for(i=0;elem!=NULL;elem=elem->next,i++){
@@ -1099,11 +1099,11 @@ static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){
tail=elem;
}
if (!is_duplicate){
- lc->last_recv_msg_ids=ms_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id));
+ lc->last_recv_msg_ids=bctbx_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id));
}
if (i>=10){
ms_free(tail->data);
- lc->last_recv_msg_ids=ms_list_remove_link(lc->last_recv_msg_ids,tail);
+ lc->last_recv_msg_ids=bctbx_list_remove_link(lc->last_recv_msg_ids,tail);
}
return is_duplicate;
}
diff --git a/coreapi/carddav.c b/coreapi/carddav.c
index 60ac8ed69..cac882fc5 100644
--- a/coreapi/carddav.c
+++ b/coreapi/carddav.c
@@ -105,15 +105,15 @@ static void linphone_carddav_response_free(LinphoneCardDavResponse *response) {
ms_free(response);
}
-static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, MSList *vCards) {
- if (vCards != NULL && ms_list_size(vCards) > 0) {
- MSList *friends = cdc->friend_list->friends;
+static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, bctbx_list_t *vCards) {
+ if (vCards != NULL && bctbx_list_size(vCards) > 0) {
+ bctbx_list_t *friends = cdc->friend_list->friends;
while (vCards) {
LinphoneCardDavResponse *vCard = (LinphoneCardDavResponse *)vCards->data;
if (vCard) {
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(vCard->vcard);
LinphoneFriend *lf = NULL;
- MSList *local_friend = NULL;
+ bctbx_list_t *local_friend = NULL;
if (lvc) {
// Compute downloaded vCards' URL and save it (+ eTag)
@@ -126,7 +126,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, MSList *
lf = linphone_friend_new_from_vcard(lvc);
if (lf) {
- local_friend = ms_list_find_custom(friends, (int (*)(const void*, const void*))find_matching_friend, lf);
+ local_friend = bctbx_list_find_custom(friends, (int (*)(const void*, const void*))find_matching_friend, lf);
if (local_friend) {
LinphoneFriend *lf2 = (LinphoneFriend *)local_friend->data;
@@ -156,15 +156,15 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, MSList *
ms_error("[carddav] Couldn't parse vCard %s", vCard->vcard);
}
}
- vCards = ms_list_next(vCards);
+ vCards = bctbx_list_next(vCards);
}
- ms_list_free_with_data(vCards, (void (*)(void *))linphone_carddav_response_free);
+ bctbx_list_free_with_data(vCards, (void (*)(void *))linphone_carddav_response_free);
}
linphone_carddav_server_to_client_sync_done(cdc, TRUE, NULL);
}
-static MSList* parse_vcards_from_xml_response(const char *body) {
- MSList *result = NULL;
+static bctbx_list_t* parse_vcards_from_xml_response(const char *body) {
+ bctbx_list_t *result = NULL;
xmlparsing_context_t *xml_ctx = linphone_xmlparsing_context_new();
xmlSetGenericErrorFunc(xml_ctx, linphone_xmlparsing_genericxml_error);
xml_ctx->doc = xmlReadDoc((const unsigned char*)body, 0, NULL, 0);
@@ -188,7 +188,7 @@ static MSList* parse_vcards_from_xml_response(const char *body) {
response->etag = ms_strdup(etag);
response->url = ms_strdup(url);
response->vcard = ms_strdup(vcard);
- result = ms_list_append(result, response);
+ result = bctbx_list_append(result, response);
ms_debug("Added vCard object with eTag %s, URL %s and vCard %s", etag, url, vcard);
}
}
@@ -209,19 +209,19 @@ static int find_matching_vcard(LinphoneCardDavResponse *response, LinphoneFriend
return strcmp(response->url, linphone_vcard_get_url(lf->vcard));
}
-static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, MSList *vCards) {
- if (vCards != NULL && ms_list_size(vCards) > 0) {
- MSList *friends = cdc->friend_list->friends;
- MSList *friends_to_remove = NULL;
- MSList *temp_list = NULL;
+static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, bctbx_list_t *vCards) {
+ if (vCards != NULL && bctbx_list_size(vCards) > 0) {
+ bctbx_list_t *friends = cdc->friend_list->friends;
+ bctbx_list_t *friends_to_remove = NULL;
+ bctbx_list_t *temp_list = NULL;
while (friends) {
LinphoneFriend *lf = (LinphoneFriend *)friends->data;
if (lf) {
- MSList *vCard = ms_list_find_custom(vCards, (int (*)(const void*, const void*))find_matching_vcard, lf);
+ bctbx_list_t *vCard = bctbx_list_find_custom(vCards, (int (*)(const void*, const void*))find_matching_vcard, lf);
if (!vCard) {
ms_debug("Local friend %s isn't in the remote vCard list, delete it", linphone_friend_get_name(lf));
- temp_list = ms_list_append(temp_list, linphone_friend_ref(lf));
+ temp_list = bctbx_list_append(temp_list, linphone_friend_ref(lf));
} else {
LinphoneCardDavResponse *response = (LinphoneCardDavResponse *)vCard->data;
ms_debug("Local friend %s is in the remote vCard list, check eTag", linphone_friend_get_name(lf));
@@ -230,13 +230,13 @@ static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, MSList
const char *etag = linphone_vcard_get_etag(lvc);
ms_debug("Local friend eTag is %s, remote vCard eTag is %s", etag, response->etag);
if (lvc && etag && strcmp(etag, response->etag) == 0) {
- ms_list_remove(vCards, vCard);
+ bctbx_list_remove(vCards, vCard);
linphone_carddav_response_free(response);
}
}
}
}
- friends = ms_list_next(friends);
+ friends = bctbx_list_next(friends);
}
friends_to_remove = temp_list;
while(friends_to_remove) {
@@ -247,17 +247,17 @@ static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, MSList
cdc->contact_removed_cb(cdc, lf);
}
}
- friends_to_remove = ms_list_next(friends_to_remove);
+ friends_to_remove = bctbx_list_next(friends_to_remove);
}
- temp_list = ms_list_free_with_data(temp_list, (void (*)(void *))linphone_friend_unref);
+ temp_list = bctbx_list_free_with_data(temp_list, (void (*)(void *))linphone_friend_unref);
linphone_carddav_pull_vcards(cdc, vCards);
- ms_list_free_with_data(vCards, (void (*)(void *))linphone_carddav_response_free);
+ bctbx_list_free_with_data(vCards, (void (*)(void *))linphone_carddav_response_free);
}
}
-static MSList* parse_vcards_etags_from_xml_response(const char *body) {
- MSList *result = NULL;
+static bctbx_list_t* parse_vcards_etags_from_xml_response(const char *body) {
+ bctbx_list_t *result = NULL;
xmlparsing_context_t *xml_ctx = linphone_xmlparsing_context_new();
xmlSetGenericErrorFunc(xml_ctx, linphone_xmlparsing_genericxml_error);
xml_ctx->doc = xmlReadDoc((const unsigned char*)body, 0, NULL, 0);
@@ -279,7 +279,7 @@ static MSList* parse_vcards_etags_from_xml_response(const char *body) {
LinphoneCardDavResponse *response = ms_new0(LinphoneCardDavResponse, 1);
response->etag = ms_strdup(etag);
response->url = ms_strdup(url);
- result = ms_list_append(result, response);
+ result = bctbx_list_append(result, response);
ms_debug("Added vCard object with eTag %s and URL %s", etag, url);
}
}
@@ -396,12 +396,12 @@ static void process_response_from_carddav_request(void *data, const belle_http_r
} else {
// For some reason, server didn't return the eTag of the updated/created vCard
// We need to do a GET on the vCard to get the correct one
- MSList *vcard = NULL;
+ bctbx_list_t *vcard = NULL;
LinphoneCardDavResponse *response = (LinphoneCardDavResponse *)ms_new0(LinphoneCardDavResponse, 1);
response->url = linphone_vcard_get_url(lvc);
- vcard = ms_list_append(vcard, response);
+ vcard = bctbx_list_append(vcard, response);
linphone_carddav_pull_vcards(query->context, vcard);
- ms_list_free_with_data(vcard, (void (*)(void *))linphone_carddav_response_free);
+ bctbx_list_free_with_data(vcard, (void (*)(void *))linphone_carddav_response_free);
}
}
else {
@@ -459,7 +459,7 @@ static void process_auth_requested_from_carddav_request(void *data, belle_sip_au
belle_sip_auth_event_set_ha1(event, cdc->auth_info->ha1);
} else {
LinphoneCore *lc = cdc->friend_list->lc;
- const MSList *auth_infos = linphone_core_get_auth_info_list(lc);
+ const bctbx_list_t *auth_infos = linphone_core_get_auth_info_list(lc);
ms_debug("Looking for auth info for domain %s and realm %s", domain, realm);
while (auth_infos) {
@@ -473,7 +473,7 @@ static void process_auth_requested_from_carddav_request(void *data, belle_sip_au
break;
}
}
- auth_infos = ms_list_next(auth_infos);
+ auth_infos = bctbx_list_next(auth_infos);
}
if (!auth_infos) {
@@ -716,10 +716,10 @@ void linphone_carddav_fetch_vcards(LinphoneCardDavContext *cdc) {
linphone_carddav_send_query(query);
}
-static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(LinphoneCardDavContext *cdc, MSList *vcards) {
+static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(LinphoneCardDavContext *cdc, bctbx_list_t *vcards) {
LinphoneCardDavQuery *query = (LinphoneCardDavQuery *)ms_new0(LinphoneCardDavQuery, 1);
- char *body = (char *)ms_malloc((ms_list_size(vcards) + 1) * 300 * sizeof(char));
- MSList *iterator = vcards;
+ char *body = (char *)ms_malloc((bctbx_list_size(vcards) + 1) * 300 * sizeof(char));
+ bctbx_list_t *iterator = vcards;
query->context = cdc;
query->depth = "1";
@@ -735,7 +735,7 @@ static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(
char temp_body[300];
snprintf(temp_body, sizeof(temp_body), "%s", response->url);
sprintf(body, "%s%s", body, temp_body);
- iterator = ms_list_next(iterator);
+ iterator = bctbx_list_next(iterator);
}
}
sprintf(body, "%s%s", body, "");
@@ -745,7 +745,7 @@ static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(
return query;
}
-void linphone_carddav_pull_vcards(LinphoneCardDavContext *cdc, MSList *vcards_to_pull) {
+void linphone_carddav_pull_vcards(LinphoneCardDavContext *cdc, bctbx_list_t *vcards_to_pull) {
LinphoneCardDavQuery *query = linphone_carddav_create_addressbook_multiget_query(cdc, vcards_to_pull);
linphone_carddav_send_query(query);
}
\ No newline at end of file
diff --git a/coreapi/chat.c b/coreapi/chat.c
index 0279db9f5..645b0683d 100644
--- a/coreapi/chat.c
+++ b/coreapi/chat.c
@@ -114,18 +114,18 @@ void linphone_chat_message_cbs_set_file_transfer_progress_indication(
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatMessage);
static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) {
- ms_list_free_with_data(cr->transient_messages, (void (*)(void *))linphone_chat_message_release);
+ bctbx_list_free_with_data(cr->transient_messages, (void (*)(void *))linphone_chat_message_release);
linphone_chat_room_delete_composing_idle_timer(cr);
linphone_chat_room_delete_composing_refresh_timer(cr);
linphone_chat_room_delete_remote_composing_refresh_timer(cr);
if (cr->lc != NULL) {
- if (ms_list_find(cr->lc->chatrooms, cr)) {
+ if (bctbx_list_find(cr->lc->chatrooms, cr)) {
ms_error("LinphoneChatRoom[%p] is destroyed while still being used by the LinphoneCore. This is abnormal."
" linphone_core_get_chat_room() doesn't give a reference, there is no need to call "
"linphone_chat_room_unref(). "
"In order to remove a chat room from the core, use linphone_core_delete_chat_room().",
cr);
- cr->lc->chatrooms = ms_list_remove(cr->lc->chatrooms, cr);
+ cr->lc->chatrooms = bctbx_list_remove(cr->lc->chatrooms, cr);
}
}
linphone_address_destroy(cr->peer_url);
@@ -167,7 +167,7 @@ bool_t linphone_core_chat_enabled(const LinphoneCore *lc) {
return lc->chat_deny_code != LinphoneReasonNone;
}
-const MSList *linphone_core_get_chat_rooms(LinphoneCore *lc) {
+const bctbx_list_t *linphone_core_get_chat_rooms(LinphoneCore *lc) {
return lc->chatrooms;
}
@@ -195,7 +195,7 @@ static LinphoneChatRoom *_linphone_core_create_chat_room_base(LinphoneCore *lc,
static LinphoneChatRoom *_linphone_core_create_chat_room(LinphoneCore *lc, LinphoneAddress *addr) {
LinphoneChatRoom *cr = _linphone_core_create_chat_room_base(lc, addr);
- lc->chatrooms = ms_list_append(lc->chatrooms, (void *)cr);
+ lc->chatrooms = bctbx_list_append(lc->chatrooms, (void *)cr);
return cr;
}
@@ -216,8 +216,8 @@ static LinphoneChatRoom *_linphone_core_create_chat_room_from_url(LinphoneCore *
LinphoneChatRoom *_linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAddress *addr) {
LinphoneChatRoom *cr = NULL;
- MSList *elem;
- for (elem = lc->chatrooms; elem != NULL; elem = ms_list_next(elem)) {
+ bctbx_list_t *elem;
+ for (elem = lc->chatrooms; elem != NULL; elem = bctbx_list_next(elem)) {
cr = (LinphoneChatRoom *)elem->data;
if (linphone_chat_room_matches(cr, addr)) {
break;
@@ -252,8 +252,8 @@ LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAd
}
void linphone_core_delete_chat_room(LinphoneCore *lc, LinphoneChatRoom *cr) {
- if (ms_list_find(lc->chatrooms, cr)) {
- lc->chatrooms = ms_list_remove(cr->lc->chatrooms, cr);
+ if (bctbx_list_find(lc->chatrooms, cr)) {
+ lc->chatrooms = bctbx_list_remove(cr->lc->chatrooms, cr);
linphone_chat_room_delete_history(cr);
linphone_chat_room_unref(cr);
} else {
@@ -338,7 +338,7 @@ static void linphone_chat_room_delete_remote_composing_refresh_timer(LinphoneCha
void linphone_chat_room_destroy(LinphoneChatRoom *cr) {
if (cr->received_rtt_characters) {
- cr->received_rtt_characters = ms_list_free(cr->received_rtt_characters);
+ cr->received_rtt_characters = bctbx_list_free(cr->received_rtt_characters);
}
linphone_chat_room_unref(cr);
}
@@ -376,18 +376,24 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage
msg->dir = LinphoneChatMessageOutgoing;
- // add to transient list
- cr->transient_messages = ms_list_append(cr->transient_messages, linphone_chat_message_ref(msg));
/* Check if we shall upload a file to a server */
if (msg->file_transfer_information != NULL && msg->content_type == NULL) {
/* open a transaction with the server and send an empty request(RCS5.1 section 3.5.4.8.3.1) */
- linphone_chat_room_upload_file(msg);
+ if (linphone_chat_room_upload_file(msg) == 0) {
+ // add to transient list only if message is going out
+ cr->transient_messages = bctbx_list_append(cr->transient_messages, linphone_chat_message_ref(msg));
+ } else {
+ linphone_chat_message_unref(msg);
+ return;
+ }
} else {
SalOp *op = NULL;
LinphoneCall *call=NULL;
char *content_type;
const char *identity = NULL;
+ // add to transient list
+ cr->transient_messages = bctbx_list_append(cr->transient_messages, linphone_chat_message_ref(msg));
msg->time = ms_time(0);
if (lp_config_get_int(cr->lc->config, "sip", "chat_use_call_dialogs", 0) != 0) {
if ((call = linphone_core_get_call_by_remote_address(cr->lc, cr->peer)) != NULL) {
@@ -484,7 +490,7 @@ void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMe
if (msg->state == LinphoneChatMessageStateDelivered || msg->state == LinphoneChatMessageStateNotDelivered) {
// msg is not transient anymore, we can remove it from our transient list and unref it
- msg->chat_room->transient_messages = ms_list_remove(msg->chat_room->transient_messages, msg);
+ msg->chat_room->transient_messages = bctbx_list_remove(msg->chat_room->transient_messages, msg);
linphone_chat_message_unref(msg);
}
}
@@ -909,7 +915,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
cmc->value = character;
cmc->has_been_read = FALSE;
- cr->received_rtt_characters = ms_list_append(cr->received_rtt_characters, (void *)cmc);
+ cr->received_rtt_characters = bctbx_list_append(cr->received_rtt_characters, (void *)cmc);
cr->remote_is_composing = LinphoneIsComposingActive;
linphone_core_notify_is_composing_received(cr->lc, cr);
@@ -939,7 +945,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
linphone_chat_room_message_received(cr, lc, msg);
linphone_chat_message_unref(msg);
cr->pending_message = NULL;
- cr->received_rtt_characters = ms_list_free(cr->received_rtt_characters);
+ cr->received_rtt_characters = bctbx_list_free(cr->received_rtt_characters);
} else {
char *value = utf8_to_char(character);
cr->pending_message->message = ms_strcat_printf(cr->pending_message->message, value);
@@ -951,14 +957,14 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
uint32_t linphone_chat_room_get_char(const LinphoneChatRoom *cr) {
if (cr && cr->received_rtt_characters) {
- MSList *characters = cr->received_rtt_characters;
+ bctbx_list_t *characters = cr->received_rtt_characters;
while (characters != NULL) {
LinphoneChatMessageCharacter *cmc = (LinphoneChatMessageCharacter *)characters->data;
if (!cmc->has_been_read) {
cmc->has_been_read = TRUE;
return cmc->value;
}
- characters = ms_list_next(characters);
+ characters = bctbx_list_next(characters);
}
}
return 0;
diff --git a/coreapi/chat_file_transfer.c b/coreapi/chat_file_transfer.c
index 21d003450..1d6eade51 100644
--- a/coreapi/chat_file_transfer.c
+++ b/coreapi/chat_file_transfer.c
@@ -291,20 +291,22 @@ static void linphone_chat_message_process_response_from_post_file(void *data,
msg->message = ms_strdup(body);
}
msg->content_type = ms_strdup("application/vnd.gsma.rcs-ft-http+xml");
- linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferDone);
linphone_chat_message_ref(msg);
+ linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferDone);
_release_http_request(msg);
_linphone_chat_room_send_message(msg->chat_room, msg);
linphone_chat_message_unref(msg);
} else {
ms_warning("Received empty response from server, file transfer failed");
- linphone_chat_message_set_state(msg, LinphoneChatMessageStateNotDelivered);
+ linphone_chat_message_update_state(msg, LinphoneChatMessageStateNotDelivered);
_release_http_request(msg);
+ linphone_chat_message_unref(msg);
}
} else {
ms_warning("Unhandled HTTP code response %d for file transfer", code);
- linphone_chat_message_set_state(msg, LinphoneChatMessageStateNotDelivered);
+ linphone_chat_message_update_state(msg, LinphoneChatMessageStateNotDelivered);
_release_http_request(msg);
+ linphone_chat_message_unref(msg);
}
}
}
diff --git a/coreapi/conference.cc b/coreapi/conference.cc
index a3401f758..db5930713 100644
--- a/coreapi/conference.cc
+++ b/coreapi/conference.cc
@@ -458,7 +458,7 @@ int LocalConference::remoteParticipantsCount() {
int LocalConference::convertConferenceToCall(){
int err=0;
- MSList *calls=m_core->calls;
+ bctbx_list_t *calls=m_core->calls;
if (remoteParticipantsCount()!=1){
ms_error("No unique call remaining in conference.");
@@ -506,7 +506,7 @@ int LocalConference::removeParticipant(const LinphoneAddress *uri) {
}
int LocalConference::terminate() {
- MSList *calls=m_core->calls;
+ bctbx_list_t *calls=m_core->calls;
m_terminating =TRUE;
while (calls) {
@@ -924,7 +924,7 @@ LinphoneConferenceParams *linphone_conference_params_clone(const LinphoneConfere
}
void linphone_conference_params_enable_video(LinphoneConferenceParams *params, bool_t enable) {
- ((Conference::Params *)params)->enableVideo(enable);
+ ((Conference::Params *)params)->enableVideo((enable == TRUE) ? true : false);
}
bool_t linphone_conference_params_video_requested(const LinphoneConferenceParams *params) {
@@ -994,7 +994,7 @@ AudioStream *linphone_conference_get_audio_stream(const LinphoneConference *obj)
}
int linphone_conference_mute_microphone(LinphoneConference *obj, bool_t val) {
- return ((Conference *)obj)->muteMicrophone(val);
+ return ((Conference *)obj)->muteMicrophone((val == TRUE) ? true : false);
}
bool_t linphone_conference_microphone_is_muted(const LinphoneConference *obj) {
@@ -1009,12 +1009,12 @@ int linphone_conference_get_size(const LinphoneConference *obj) {
return ((Conference *)obj)->getSize();
}
-MSList *linphone_conference_get_participants(const LinphoneConference *obj) {
+bctbx_list_t *linphone_conference_get_participants(const LinphoneConference *obj) {
const list &participants = ((Conference *)obj)->getParticipants();
- MSList *participants_list = NULL;
+ bctbx_list_t *participants_list = NULL;
for(list::const_iterator it=participants.begin();it!=participants.end();it++) {
LinphoneAddress *uri = linphone_address_clone((*it)->getUri());
- participants_list = ms_list_append(participants_list, uri);
+ participants_list = bctbx_list_append(participants_list, uri);
}
return participants_list;
}
@@ -1028,7 +1028,7 @@ int linphone_conference_stop_recording(LinphoneConference *obj) {
}
void linphone_conference_on_call_stream_starting(LinphoneConference *obj, LinphoneCall *call, bool_t is_paused_by_remote) {
- ((Conference *)obj)->onCallStreamStarting(call, is_paused_by_remote);
+ ((Conference *)obj)->onCallStreamStarting(call, (is_paused_by_remote == TRUE) ? true : false);
}
void linphone_conference_on_call_stream_stopping(LinphoneConference *obj, LinphoneCall *call) {
diff --git a/coreapi/conference.h b/coreapi/conference.h
index 0de492b7e..b1867adee 100644
--- a/coreapi/conference.h
+++ b/coreapi/conference.h
@@ -97,12 +97,12 @@ LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *o
/**
* Get URIs of all participants of one conference
- * The returned MSList contains URIs of all participant. That list must be
+ * The returned bctbx_list_t contains URIs of all participant. That list must be
* freed after use and each URI must be unref with linphone_address_unref()
* @param obj A #LinphoneConference
* @return \mslist{LinphoneAddress}
*/
-LINPHONE_PUBLIC MSList *linphone_conference_get_participants(const LinphoneConference *obj);
+LINPHONE_PUBLIC bctbx_list_t *linphone_conference_get_participants(const LinphoneConference *obj);
/**
* @}
diff --git a/coreapi/friend.c b/coreapi/friend.c
index 2251b370c..f08ef3b6f 100644
--- a/coreapi/friend.c
+++ b/coreapi/friend.c
@@ -93,12 +93,12 @@ static int friend_compare(const void * a, const void * b){
}
-MSList *linphone_find_friend_by_address(MSList *fl, const LinphoneAddress *addr, LinphoneFriend **lf){
- MSList *res=NULL;
+bctbx_list_t *linphone_find_friend_by_address(bctbx_list_t *fl, const LinphoneAddress *addr, LinphoneFriend **lf){
+ bctbx_list_t *res=NULL;
LinphoneFriend dummy;
if (lf!=NULL) *lf=NULL;
dummy.uri=(LinphoneAddress*)addr;
- res=ms_list_find_custom(fl,friend_compare,&dummy);
+ res=bctbx_list_find_custom(fl,friend_compare,&dummy);
if (lf!=NULL && res!=NULL) *lf=(LinphoneFriend*)res->data;
return res;
}
@@ -133,6 +133,14 @@ LinphoneFriend * linphone_friend_new(void){
return obj;
}
+#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
+#pragma GCC diagnostic push
+#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
LinphoneFriend *linphone_friend_new_with_address(const char *addr){
LinphoneAddress* linphone_address = linphone_address_new(addr);
LinphoneFriend *fr;
@@ -146,6 +154,9 @@ LinphoneFriend *linphone_friend_new_with_address(const char *addr){
linphone_address_unref(linphone_address);
return fr;
}
+#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
+#pragma GCC diagnostic pop
+#endif
void linphone_friend_set_user_data(LinphoneFriend *lf, void *data){
lf->user_data=data;
@@ -234,11 +245,11 @@ void linphone_friend_add_address(LinphoneFriend *lf, const LinphoneAddress *addr
linphone_vcard_add_sip_address(vcard, linphone_address_as_string_uri_only(addr));
}
-MSList* linphone_friend_get_addresses(LinphoneFriend *lf) {
+bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf) {
LinphoneVcard *vcard = NULL;
- MSList *sipAddresses = NULL;
- MSList *addresses = NULL;
- MSList *iterator = NULL;
+ bctbx_list_t *sipAddresses = NULL;
+ bctbx_list_t *addresses = NULL;
+ bctbx_list_t *iterator = NULL;
if (!lf) {
return NULL;
@@ -246,7 +257,7 @@ MSList* linphone_friend_get_addresses(LinphoneFriend *lf) {
vcard = linphone_friend_get_vcard(lf);
if (!vcard) {
- return lf->uri ? ms_list_append(addresses, lf->uri) : NULL;
+ return lf->uri ? bctbx_list_append(addresses, lf->uri) : NULL;
}
sipAddresses = linphone_vcard_get_sip_addresses(vcard);
@@ -255,11 +266,11 @@ MSList* linphone_friend_get_addresses(LinphoneFriend *lf) {
const char *sipAddress = (const char *)iterator->data;
LinphoneAddress *addr = linphone_address_new(sipAddress);
if (addr) {
- addresses = ms_list_append(addresses, addr);
+ addresses = bctbx_list_append(addresses, addr);
}
- iterator = ms_list_next(iterator);
+ iterator = bctbx_list_next(iterator);
}
- if (sipAddresses) ms_list_free(sipAddresses);
+ if (sipAddresses) bctbx_list_free(sipAddresses);
return addresses;
}
@@ -291,7 +302,7 @@ void linphone_friend_add_phone_number(LinphoneFriend *lf, const char *phone) {
linphone_vcard_add_phone_number(vcard, phone);
}
-MSList* linphone_friend_get_phone_numbers(LinphoneFriend *lf) {
+bctbx_list_t* linphone_friend_get_phone_numbers(LinphoneFriend *lf) {
LinphoneVcard *vcard = NULL;
if (!lf) {
@@ -359,7 +370,7 @@ int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscri
}
void linphone_friend_notify(LinphoneFriend *lf, LinphonePresenceModel *presence){
- MSList *elem;
+ bctbx_list_t *elem;
if (lf->insubs){
char *addr=linphone_address_as_string(linphone_friend_get_address(lf));
ms_message("Want to notify %s",addr);
@@ -373,13 +384,13 @@ void linphone_friend_notify(LinphoneFriend *lf, LinphonePresenceModel *presence)
void linphone_friend_add_incoming_subscription(LinphoneFriend *lf, SalOp *op){
/*ownership of the op is transfered from sal to the LinphoneFriend*/
- lf->insubs = ms_list_append(lf->insubs, op);
+ lf->insubs = bctbx_list_append(lf->insubs, op);
}
void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, SalOp *op){
- if (ms_list_find(lf->insubs, op)){
+ if (bctbx_list_find(lf->insubs, op)){
sal_op_release(op);
- lf->insubs = ms_list_remove(lf->insubs, op);
+ lf->insubs = bctbx_list_remove(lf->insubs, op);
}
}
@@ -413,12 +424,12 @@ void linphone_friend_invalidate_subscription(LinphoneFriend *lf){
void linphone_friend_close_subscriptions(LinphoneFriend *lf){
linphone_friend_unsubscribe(lf);
- ms_list_for_each(lf->insubs, (MSIterateFunc) sal_notify_presence_close);
- lf->insubs = ms_list_free_with_data(lf->insubs, (MSIterateFunc)sal_op_release);
+ bctbx_list_for_each(lf->insubs, (MSIterateFunc) sal_notify_presence_close);
+ lf->insubs = bctbx_list_free_with_data(lf->insubs, (MSIterateFunc)sal_op_release);
}
static void _linphone_friend_release_ops(LinphoneFriend *lf){
- lf->insubs = ms_list_free_with_data(lf->insubs, (MSIterateFunc) sal_op_release);
+ lf->insubs = bctbx_list_free_with_data(lf->insubs, (MSIterateFunc) sal_op_release);
if (lf->outsub){
sal_op_release(lf->outsub);
lf->outsub=NULL;
@@ -666,7 +677,7 @@ void linphone_friend_done(LinphoneFriend *fr) {
if (fr && fr->vcard) {
if (linphone_vcard_compare_md5_hash(fr->vcard) != 0) {
ms_debug("vCard's md5 has changed, mark friend as dirty");
- fr->friend_list->dirty_friends_to_update = ms_list_append(fr->friend_list->dirty_friends_to_update, linphone_friend_ref(fr));
+ fr->friend_list->dirty_friends_to_update = bctbx_list_append(fr->friend_list->dirty_friends_to_update, linphone_friend_ref(fr));
}
}
}
@@ -674,7 +685,11 @@ void linphone_friend_done(LinphoneFriend *fr) {
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
LinphoneFriend * linphone_core_create_friend(LinphoneCore *lc) {
LinphoneFriend * lf = linphone_friend_new();
lf->lc = lc;
@@ -693,9 +708,9 @@ LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, cons
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
if (linphone_friend_list_add_friend(linphone_core_get_default_friend_list(lc), lf) != LinphoneFriendListOK) return;
- if (ms_list_find(lc->subscribers, lf)) {
+ if (bctbx_list_find(lc->subscribers, lf)) {
/*if this friend was in the pending subscriber list, now remove it from this list*/
- lc->subscribers = ms_list_remove(lc->subscribers, lf);
+ lc->subscribers = bctbx_list_remove(lc->subscribers, lf);
linphone_friend_unref(lf);
}
}
@@ -709,11 +724,11 @@ void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *lf) {
}
void linphone_core_update_friends_subscriptions(LinphoneCore *lc, LinphoneProxyConfig *cfg, bool_t only_when_registered) {
- MSList *lists = lc->friends_lists;
+ bctbx_list_t *lists = lc->friends_lists;
while (lists) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
linphone_friend_list_update_subscriptions(list, cfg, only_when_registered);
- lists = ms_list_next(lists);
+ lists = bctbx_list_next(lists);
}
}
@@ -722,10 +737,10 @@ bool_t linphone_core_should_subscribe_friends_only_when_registered(const Linphon
}
void linphone_core_send_initial_subscribes(LinphoneCore *lc) {
- MSList *lists = lc->friends_lists;
+ bctbx_list_t *lists = lc->friends_lists;
bool_t proxy_config_for_rls_presence_uri_domain = FALSE;
LinphoneAddress *rls_address = NULL;
- const MSList *elem;
+ const bctbx_list_t *elem;
if (lc->initial_subscribes_sent) return;
lc->initial_subscribes_sent=TRUE;
@@ -753,16 +768,16 @@ void linphone_core_send_initial_subscribes(LinphoneCore *lc) {
} else {
linphone_core_update_friends_subscriptions(lc,NULL,linphone_core_should_subscribe_friends_only_when_registered(lc));
}
- lists = ms_list_next(lists);
+ lists = bctbx_list_next(lists);
}
}
void linphone_core_invalidate_friend_subscriptions(LinphoneCore *lc) {
- MSList *lists = lc->friends_lists;
+ bctbx_list_t *lists = lc->friends_lists;
while (lists) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
linphone_friend_list_invalidate_subscriptions(list);
- lists = ms_list_next(lists);
+ lists = bctbx_list_next(lists);
}
lc->initial_subscribes_sent=FALSE;
}
@@ -785,56 +800,56 @@ const char *linphone_friend_get_ref_key(const LinphoneFriend *lf){
}
LinphoneFriend *linphone_core_find_friend(const LinphoneCore *lc, const LinphoneAddress *addr) {
- MSList *lists = lc->friends_lists;
+ bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_address(list, addr);
- lists = ms_list_next(lists);
+ lists = bctbx_list_next(lists);
}
return lf;
}
LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *uri) {
- MSList *lists = lc->friends_lists;
+ bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_uri(list, uri);
- lists = ms_list_next(lists);
+ lists = bctbx_list_next(lists);
}
return lf;
}
LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key) {
- MSList *lists = lc->friends_lists;
+ bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_ref_key(list, key);
- lists = ms_list_next(lists);
+ lists = bctbx_list_next(lists);
}
return lf;
}
LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *lc, SalOp *op) {
- MSList *lists = lc->friends_lists;
+ bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_out_subscribe(list, op);
- lists = ms_list_next(lists);
+ lists = bctbx_list_next(lists);
}
return lf;
}
LinphoneFriend *linphone_core_find_friend_by_inc_subscribe(const LinphoneCore *lc, SalOp *op) {
- MSList *lists = lc->friends_lists;
+ bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_inc_subscribe(list, op);
- lists = ms_list_next(lists);
+ lists = bctbx_list_next(lists);
}
return lf;
}
@@ -856,7 +871,7 @@ LinphoneSubscribePolicy __policy_str_to_enum(const char* pol){
}
LinphoneProxyConfig *__index_to_proxy(LinphoneCore *lc, int index){
- if (index>=0) return (LinphoneProxyConfig*)ms_list_nth_data(lc->sip_conf.proxies,index);
+ if (index>=0) return (LinphoneProxyConfig*)bctbx_list_nth_data(lc->sip_conf.proxies,index);
else return NULL;
}
@@ -941,14 +956,14 @@ void linphone_friend_write_to_config_file(LpConfig *config, LinphoneFriend *lf,
}
void linphone_core_write_friends_config(LinphoneCore* lc) {
- MSList *elem;
+ bctbx_list_t *elem;
int i;
int store_friends;
if (! linphone_core_ready(lc)) return; /*dont write config when reading it !*/
store_friends = lp_config_get_int(lc->config, "misc", "store_friends", 1);
if (store_friends) {
- for (elem=linphone_core_get_default_friend_list(lc)->friends,i=0; elem!=NULL; elem=ms_list_next(elem),i++){
+ for (elem=linphone_core_get_default_friend_list(lc)->friends,i=0; elem!=NULL; elem=bctbx_list_next(elem),i++){
linphone_friend_write_to_config_file(lc->config,(LinphoneFriend*)elem->data,i);
}
linphone_friend_write_to_config_file(lc->config,NULL,i); /* set the end */
@@ -1033,12 +1048,16 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) {
LinphoneAddress* linphone_address = NULL;
LinphoneFriend *fr;
const char *name = NULL;
- MSList *sipAddresses = NULL;
+ bctbx_list_t *sipAddresses = NULL;
if (vcard == NULL) {
ms_error("Cannot create friend from null vcard");
@@ -1137,7 +1156,7 @@ void linphone_core_friends_storage_init(LinphoneCore *lc) {
int ret;
const char *errmsg;
sqlite3 *db;
- const MSList *friends_lists = NULL;
+ const bctbx_list_t *friends_lists = NULL;
linphone_core_friends_storage_close(lc);
@@ -1156,13 +1175,13 @@ void linphone_core_friends_storage_init(LinphoneCore *lc) {
friends_lists = linphone_core_fetch_friends_lists_from_db(lc);
if (friends_lists) {
ms_warning("Replacing current default friend list by the one(s) from the database");
- lc->friends_lists = ms_list_free_with_data(lc->friends_lists, (void (*)(void*))linphone_friend_list_unref);
+ lc->friends_lists = bctbx_list_free_with_data(lc->friends_lists, (void (*)(void*))linphone_friend_list_unref);
lc->friends_lists = NULL;
while (friends_lists) {
LinphoneFriendList *list = (LinphoneFriendList *)friends_lists->data;
linphone_core_add_friend_list(lc, list);
- friends_lists = ms_list_next(friends_lists);
+ friends_lists = bctbx_list_next(friends_lists);
}
}
}
@@ -1182,8 +1201,8 @@ void linphone_core_friends_storage_close(LinphoneCore *lc) {
* | 4 | revision
*/
static int create_friend_list(void *data, int argc, char **argv, char **colName) {
- MSList **list = (MSList **)data;
- unsigned int storage_id = atoi(argv[0]);
+ bctbx_list_t **list = (bctbx_list_t **)data;
+ unsigned int storage_id = (unsigned int)atoi(argv[0]);
LinphoneFriendList *lfl = linphone_core_create_friend_list(NULL);
lfl->storage_id = storage_id;
@@ -1192,7 +1211,7 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName)
linphone_friend_list_set_uri(lfl, argv[3]);
lfl->revision = atoi(argv[4]);
- *list = ms_list_append(*list, linphone_friend_list_ref(lfl));
+ *list = bctbx_list_append(*list, linphone_friend_list_ref(lfl));
linphone_friend_list_unref(lfl);
return 0;
}
@@ -1200,7 +1219,11 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName)
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
/* DB layout:
* | 0 | storage_id
* | 1 | friend_list_id
@@ -1214,10 +1237,10 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName)
* | 9 | presence_received
*/
static int create_friend(void *data, int argc, char **argv, char **colName) {
- MSList **list = (MSList **)data;
+ bctbx_list_t **list = (bctbx_list_t **)data;
LinphoneFriend *lf = NULL;
LinphoneVcard *vcard = NULL;
- unsigned int storage_id = atoi(argv[0]);
+ unsigned int storage_id = (unsigned int)atoi(argv[0]);
vcard = linphone_vcard_new_from_vcard4_buffer(argv[6]);
if (vcard) {
@@ -1237,7 +1260,7 @@ static int create_friend(void *data, int argc, char **argv, char **colName) {
lf->presence_received = atoi(argv[9]);
lf->storage_id = storage_id;
- *list = ms_list_append(*list, linphone_friend_ref(lf));
+ *list = bctbx_list_append(*list, linphone_friend_ref(lf));
linphone_friend_unref(lf);
return 0;
}
@@ -1245,7 +1268,7 @@ static int create_friend(void *data, int argc, char **argv, char **colName) {
#pragma GCC diagnostic pop
#endif
-static int linphone_sql_request_friend(sqlite3* db, const char *stmt, MSList **list) {
+static int linphone_sql_request_friend(sqlite3* db, const char *stmt, bctbx_list_t **list) {
char* errmsg = NULL;
int ret;
ret = sqlite3_exec(db, stmt, create_friend, list, &errmsg);
@@ -1256,7 +1279,7 @@ static int linphone_sql_request_friend(sqlite3* db, const char *stmt, MSList **l
return ret;
}
-static int linphone_sql_request_friends_list(sqlite3* db, const char *stmt, MSList **list) {
+static int linphone_sql_request_friends_list(sqlite3* db, const char *stmt, bctbx_list_t **list) {
char* errmsg = NULL;
int ret;
ret = sqlite3_exec(db, stmt, create_friend_list, list, &errmsg);
@@ -1299,7 +1322,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
}
if (lf->storage_id > 0) {
- buf = sqlite3_mprintf("UPDATE friends SET friend_list_id=%i,sip_uri=%Q,subscribe_policy=%i,send_subscribe=%i,ref_key=%Q,vCard=%Q,vCard_etag=%Q,vCard_url=%Q,presence_received=%i WHERE (id = %i);",
+ buf = sqlite3_mprintf("UPDATE friends SET friend_list_id=%u,sip_uri=%Q,subscribe_policy=%i,send_subscribe=%i,ref_key=%Q,vCard=%Q,vCard_etag=%Q,vCard_url=%Q,presence_received=%i WHERE (id = %u);",
lf->friend_list->storage_id,
linphone_address_as_string(linphone_friend_get_address(lf)),
lf->pol,
@@ -1312,7 +1335,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
lf->storage_id
);
} else {
- buf = sqlite3_mprintf("INSERT INTO friends VALUES(NULL,%i,%Q,%i,%i,%Q,%Q,%Q,%Q,%i);",
+ buf = sqlite3_mprintf("INSERT INTO friends VALUES(NULL,%u,%Q,%i,%i,%Q,%Q,%Q,%Q,%i);",
lf->friend_list->storage_id,
linphone_address_as_string(linphone_friend_get_address(lf)),
lf->pol,
@@ -1328,7 +1351,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
sqlite3_free(buf);
if (lf->storage_id == 0) {
- lf->storage_id = sqlite3_last_insert_rowid(lc->friends_db);
+ lf->storage_id = (unsigned int)sqlite3_last_insert_rowid(lc->friends_db);
}
}
}
@@ -1343,7 +1366,7 @@ void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList
}
if (list->storage_id > 0) {
- buf = sqlite3_mprintf("UPDATE friends_lists SET display_name=%Q,rls_uri=%Q,uri=%Q,revision=%i WHERE (id = %i);",
+ buf = sqlite3_mprintf("UPDATE friends_lists SET display_name=%Q,rls_uri=%Q,uri=%Q,revision=%i WHERE (id = %u);",
list->display_name,
list->rls_uri,
list->uri,
@@ -1362,7 +1385,7 @@ void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList
sqlite3_free(buf);
if (list->storage_id == 0) {
- list->storage_id = sqlite3_last_insert_rowid(lc->friends_db);
+ list->storage_id = (unsigned int)sqlite3_last_insert_rowid(lc->friends_db);
}
}
}
@@ -1375,7 +1398,7 @@ void linphone_core_remove_friend_from_db(LinphoneCore *lc, LinphoneFriend *lf) {
return;
}
- buf = sqlite3_mprintf("DELETE FROM friends WHERE id = %i", lf->storage_id);
+ buf = sqlite3_mprintf("DELETE FROM friends WHERE id = %u", lf->storage_id);
linphone_sql_request_generic(lc->friends_db, buf);
sqlite3_free(buf);
@@ -1391,7 +1414,7 @@ void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendL
return;
}
- buf = sqlite3_mprintf("DELETE FROM friends_lists WHERE id = %i", list->storage_id);
+ buf = sqlite3_mprintf("DELETE FROM friends_lists WHERE id = %u", list->storage_id);
linphone_sql_request_generic(lc->friends_db, buf);
sqlite3_free(buf);
@@ -1399,23 +1422,23 @@ void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendL
}
}
-MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
+bctbx_list_t* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
char *buf;
uint64_t begin,end;
- MSList *result = NULL;
- MSList *elem = NULL;
+ bctbx_list_t *result = NULL;
+ bctbx_list_t *elem = NULL;
if (!lc || lc->friends_db == NULL || list == NULL) {
ms_warning("Either lc (or list) is NULL or friends database wasn't initialized with linphone_core_friends_storage_init() yet");
return NULL;
}
- buf = sqlite3_mprintf("SELECT * FROM friends WHERE friend_list_id = %i ORDER BY id", list->storage_id);
+ buf = sqlite3_mprintf("SELECT * FROM friends WHERE friend_list_id = %u ORDER BY id", list->storage_id);
begin = ortp_get_cur_time_ms();
linphone_sql_request_friend(lc->friends_db, buf, &result);
end = ortp_get_cur_time_ms();
- ms_message("%s(): %i results fetched, completed in %i ms",__FUNCTION__, ms_list_size(result), (int)(end-begin));
+ ms_message("%s(): %u results fetched, completed in %i ms",__FUNCTION__, (unsigned int)bctbx_list_size(result), (int)(end-begin));
sqlite3_free(buf);
for(elem = result; elem != NULL; elem = elem->next) {
@@ -1427,11 +1450,11 @@ MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList
return result;
}
-MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
+bctbx_list_t* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
char *buf;
uint64_t begin,end;
- MSList *result = NULL;
- MSList *elem = NULL;
+ bctbx_list_t *result = NULL;
+ bctbx_list_t *elem = NULL;
if (!lc || lc->friends_db == NULL) {
ms_warning("Either lc is NULL or friends database wasn't initialized with linphone_core_friends_storage_init() yet");
@@ -1443,7 +1466,7 @@ MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
begin = ortp_get_cur_time_ms();
linphone_sql_request_friends_list(lc->friends_db, buf, &result);
end = ortp_get_cur_time_ms();
- ms_message("%s(): %i results fetched, completed in %i ms",__FUNCTION__, ms_list_size(result), (int)(end-begin));
+ ms_message("%s(): %u results fetched, completed in %i ms",__FUNCTION__, (unsigned int)bctbx_list_size(result), (int)(end-begin));
sqlite3_free(buf);
for(elem = result; elem != NULL; elem = elem->next) {
@@ -1475,11 +1498,11 @@ void linphone_core_remove_friend_from_db(LinphoneCore *lc, LinphoneFriend *lf) {
void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
}
-MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
+bctbx_list_t* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
return NULL;
}
-MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
+bctbx_list_t* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
return NULL;
}
@@ -1521,7 +1544,7 @@ void linphone_core_migrate_friends_from_rc_to_db(LinphoneCore *lc) {
return;
}
- if (ms_list_size(linphone_friend_list_get_friends(lfl)) > 0 && lfl->storage_id == 0) {
+ if (bctbx_list_size(linphone_friend_list_get_friends(lfl)) > 0 && lfl->storage_id == 0) {
linphone_core_remove_friend_list(lc, lfl);
lfl = linphone_core_create_friend_list(lc);
linphone_core_add_friend_list(lc, lfl);
diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c
index d48283d9b..b28af36de 100644
--- a/coreapi/friendlist.c
+++ b/coreapi/friendlist.c
@@ -90,12 +90,12 @@ void linphone_friend_list_cbs_set_sync_status_changed(LinphoneFriendListCbs *cbs
static char * create_resource_list_xml(const LinphoneFriendList *list) {
char *xml_content = NULL;
- MSList *elem;
+ bctbx_list_t *elem;
xmlBufferPtr buf;
xmlTextWriterPtr writer;
int err;
- if (ms_list_size(list->friends) <= 0) return NULL;
+ if (bctbx_list_size(list->friends) <= 0) return NULL;
buf = xmlBufferCreate();
if (buf == NULL) {
@@ -196,7 +196,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
goto end;
}
if ((strcmp(full_state_str, "true") == 0) || (strcmp(full_state_str, "1") == 0)) {
- MSList *l = list->friends;
+ bctbx_list_t *l = list->friends;
for (; l != NULL; l = l->next) {
lf = (LinphoneFriend *)l->data;
linphone_friend_set_presence_model(lf, NULL);
@@ -253,7 +253,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
if (resource_object != NULL) xmlXPathFreeObject(resource_object);
if (full_state == TRUE) {
- MSList *l = list->friends;
+ bctbx_list_t *l = list->friends;
for (; l != NULL; l = l->next) {
lf = (LinphoneFriend *)l->data;
if (linphone_friend_is_presence_received(lf) == TRUE) {
@@ -270,7 +270,7 @@ end:
}
static bool_t linphone_friend_list_has_subscribe_inactive(const LinphoneFriendList *list) {
- MSList *l = list->friends;
+ bctbx_list_t *l = list->friends;
bool_t has_subscribe_inactive = FALSE;
for (; l != NULL; l = l->next) {
LinphoneFriend *lf = (LinphoneFriend *)l->data;
@@ -301,8 +301,8 @@ static void linphone_friend_list_destroy(LinphoneFriendList *list) {
}
if (list->uri != NULL) ms_free(list->uri);
if (list->cbs) linphone_friend_list_cbs_unref(list->cbs);
- if (list->dirty_friends_to_update) list->dirty_friends_to_update = ms_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
- if (list->friends) list->friends = ms_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
+ if (list->dirty_friends_to_update) list->dirty_friends_to_update = bctbx_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
+ if (list->friends) list->friends = bctbx_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneFriendList);
@@ -338,10 +338,10 @@ void _linphone_friend_list_release(LinphoneFriendList *list){
list->cbs = NULL;
}
if (list->dirty_friends_to_update) {
- list->dirty_friends_to_update = ms_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
+ list->dirty_friends_to_update = bctbx_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
}
if (list->friends) {
- list->friends = ms_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
+ list->friends = bctbx_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
}
linphone_friend_list_unref(list);
}
@@ -400,7 +400,7 @@ static LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendL
ms_error("linphone_friend_list_add_friend(): invalid friend, already in list");
return status;
}
- if (ms_list_find(list->friends, lf) != NULL) {
+ if (bctbx_list_find(list->friends, lf) != NULL) {
char *tmp = NULL;
const LinphoneAddress *addr = linphone_friend_get_address(lf);
if (addr) tmp = linphone_address_as_string(addr);
@@ -435,9 +435,9 @@ LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *
}
lf->friend_list = list;
lf->lc = list->lc;
- list->friends = ms_list_append(list->friends, linphone_friend_ref(lf));
+ list->friends = bctbx_list_append(list->friends, linphone_friend_ref(lf));
if (synchronize) {
- list->dirty_friends_to_update = ms_list_append(list->dirty_friends_to_update, linphone_friend_ref(lf));
+ list->dirty_friends_to_update = bctbx_list_append(list->dirty_friends_to_update, linphone_friend_ref(lf));
}
return LinphoneFriendListOK;
}
@@ -450,7 +450,7 @@ static void carddav_done(LinphoneCardDavContext *cdc, bool_t success, const char
}
static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t remove_from_server) {
- MSList *elem = ms_list_find(list->friends, lf);
+ bctbx_list_t *elem = bctbx_list_find(list->friends, lf);
if (elem == NULL) return LinphoneFriendListNonExistentFriend;
#ifdef SQLITE_STORAGE_ENABLED
@@ -477,7 +477,7 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
lf->friend_list = NULL;
linphone_friend_unref(lf);
- list->friends = ms_list_remove_link(list->friends, elem);
+ list->friends = bctbx_list_remove_link(list->friends, elem);
return LinphoneFriendListOK;
}
@@ -485,12 +485,12 @@ LinphoneFriendListStatus linphone_friend_list_remove_friend(LinphoneFriendList *
return _linphone_friend_list_remove_friend(list, lf, TRUE);
}
-const MSList * linphone_friend_list_get_friends(const LinphoneFriendList *list) {
+const bctbx_list_t * linphone_friend_list_get_friends(const LinphoneFriendList *list) {
return list->friends;
}
void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list) {
- MSList *dirty_friends = list->dirty_friends_to_update;
+ bctbx_list_t *dirty_friends = list->dirty_friends_to_update;
while (dirty_friends) {
LinphoneCardDavContext *cdc = linphone_carddav_context_new(list);
@@ -504,9 +504,9 @@ void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list) {
linphone_carddav_put_vcard(cdc, lf);
}
}
- dirty_friends = ms_list_next(dirty_friends);
+ dirty_friends = bctbx_list_next(dirty_friends);
}
- list->dirty_friends_to_update = ms_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
+ list->dirty_friends_to_update = bctbx_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
}
static void carddav_created(LinphoneCardDavContext *cdc, LinphoneFriend *lf) {
@@ -532,7 +532,7 @@ static void carddav_removed(LinphoneCardDavContext *cdc, LinphoneFriend *lf) {
static void carddav_updated(LinphoneCardDavContext *cdc, LinphoneFriend *lf_new, LinphoneFriend *lf_old) {
if (cdc) {
LinphoneFriendList *lfl = cdc->friend_list;
- MSList *elem = ms_list_find(lfl->friends, lf_old);
+ bctbx_list_t *elem = bctbx_list_find(lfl->friends, lf_old);
if (elem) {
elem->data = linphone_friend_ref(lf_new);
}
@@ -568,7 +568,7 @@ void linphone_friend_list_synchronize_friends_from_server(LinphoneFriendList *li
LinphoneFriend * linphone_friend_list_find_friend_by_address(const LinphoneFriendList *list, const LinphoneAddress *address) {
LinphoneFriend *lf = NULL;
- const MSList *elem;
+ const bctbx_list_t *elem;
for (elem = list->friends; elem != NULL; elem = elem->next) {
lf = (LinphoneFriend *)elem->data;
if (linphone_address_weak_equal(lf->uri, address))
@@ -585,7 +585,7 @@ LinphoneFriend * linphone_friend_list_find_friend_by_uri(const LinphoneFriendLis
}
LinphoneFriend * linphone_friend_list_find_friend_by_ref_key(const LinphoneFriendList *list, const char *ref_key) {
- const MSList *elem;
+ const bctbx_list_t *elem;
if (ref_key == NULL) return NULL;
for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
@@ -595,16 +595,16 @@ LinphoneFriend * linphone_friend_list_find_friend_by_ref_key(const LinphoneFrien
}
LinphoneFriend * linphone_friend_list_find_friend_by_inc_subscribe(const LinphoneFriendList *list, SalOp *op) {
- const MSList *elem;
+ const bctbx_list_t *elem;
for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
- if (ms_list_find(lf->insubs, op)) return lf;
+ if (bctbx_list_find(lf->insubs, op)) return lf;
}
return NULL;
}
LinphoneFriend * linphone_friend_list_find_friend_by_out_subscribe(const LinphoneFriendList *list, SalOp *op) {
- const MSList *elem;
+ const bctbx_list_t *elem;
for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
if (lf->outsub && ((lf->outsub == op) || sal_op_is_forked_of(lf->outsub, op))) return lf;
@@ -619,11 +619,11 @@ static void linphone_friend_list_close_subscriptions(LinphoneFriendList *list) {
linphone_event_unref(list->event);
list->event = NULL;
}
- ms_list_for_each(list->friends, (void (*)(void *))linphone_friend_close_subscriptions);
+ bctbx_list_for_each(list->friends, (void (*)(void *))linphone_friend_close_subscriptions);
}
void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, LinphoneProxyConfig *cfg, bool_t only_when_registered) {
- const MSList *elem;
+ const bctbx_list_t *elem;
if (list->rls_uri != NULL) {
if (list->enable_subscriptions) {
LinphoneAddress *address = linphone_address_new(list->rls_uri);
@@ -679,7 +679,7 @@ void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, Linphon
}
void linphone_friend_list_invalidate_subscriptions(LinphoneFriendList *list) {
- const MSList *elem;
+ const bctbx_list_t *elem;
for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
linphone_friend_invalidate_subscription(lf);
@@ -687,7 +687,7 @@ void linphone_friend_list_invalidate_subscriptions(LinphoneFriendList *list) {
}
void linphone_friend_list_notify_presence(LinphoneFriendList *list, LinphonePresenceModel *presence) {
- const MSList *elem;
+ const bctbx_list_t *elem;
for(elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
linphone_friend_notify(lf, presence);
@@ -768,24 +768,28 @@ LinphoneCore* linphone_friend_list_get_core(LinphoneFriendList *list) {
}
int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *list, const char *vcard_file) {
- MSList *vcards = linphone_vcard_list_from_vcard4_file(vcard_file);
+ bctbx_list_t *vcards = NULL;
+ bctbx_list_t *vcards_iterator = NULL;
int count = 0;
#ifndef VCARD_ENABLED
ms_error("vCard support wasn't enabled at compilation time");
return -1;
#endif
- if (!vcards) {
- ms_error("Failed to parse the file %s", vcard_file);
- return -1;
- }
if (!list) {
ms_error("Can't import into a NULL list");
return -1;
}
+
+ vcards = linphone_vcard_list_from_vcard4_file(vcard_file);
+ vcards_iterator = vcards;
+ if (!vcards) {
+ ms_error("Failed to parse the file %s", vcard_file);
+ return -1;
+ }
- while (vcards != NULL && vcards->data != NULL) {
- LinphoneVcard *vcard = (LinphoneVcard *)vcards->data;
+ while (vcards_iterator != NULL && vcards_iterator->data != NULL) {
+ LinphoneVcard *vcard = (LinphoneVcard *)vcards_iterator->data;
LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard);
if (lf) {
if (LinphoneFriendListOK == linphone_friend_list_import_friend(list, lf, TRUE)) {
@@ -795,31 +799,36 @@ int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *lis
} else {
linphone_vcard_free(vcard);
}
- vcards = ms_list_next(vcards);
+ vcards_iterator = bctbx_list_next(vcards_iterator);
}
+ bctbx_list_free(vcards);
linphone_core_store_friends_list_in_db(list->lc, list);
return count;
}
int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *list, const char *vcard_buffer) {
- MSList *vcards = linphone_vcard_list_from_vcard4_buffer(vcard_buffer);
+ bctbx_list_t *vcards = NULL;
+ bctbx_list_t *vcards_iterator = NULL;
int count = 0;
#ifndef VCARD_ENABLED
ms_error("vCard support wasn't enabled at compilation time");
return -1;
#endif
- if (!vcards) {
- ms_error("Failed to parse the buffer");
- return -1;
- }
if (!list) {
ms_error("Can't import into a NULL list");
return -1;
}
+
+ vcards = linphone_vcard_list_from_vcard4_buffer(vcard_buffer);
+ vcards_iterator = vcards;
+ if (!vcards) {
+ ms_error("Failed to parse the buffer");
+ return -1;
+ }
- while (vcards != NULL && vcards->data != NULL) {
- LinphoneVcard *vcard = (LinphoneVcard *)vcards->data;
+ while (vcards_iterator != NULL && vcards_iterator->data != NULL) {
+ LinphoneVcard *vcard = (LinphoneVcard *)vcards_iterator->data;
LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard);
if (lf) {
if (LinphoneFriendListOK == linphone_friend_list_import_friend(list, lf, TRUE)) {
@@ -829,15 +838,16 @@ int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *l
} else {
linphone_vcard_free(vcard);
}
- vcards = ms_list_next(vcards);
+ vcards_iterator = bctbx_list_next(vcards_iterator);
}
+ bctbx_list_free(vcards);
linphone_core_store_friends_list_in_db(list->lc, list);
return count;
}
void linphone_friend_list_export_friends_as_vcard4_file(LinphoneFriendList *list, const char *vcard_file) {
FILE *file = NULL;
- const MSList *friends = linphone_friend_list_get_friends(list);
+ const bctbx_list_t *friends = linphone_friend_list_get_friends(list);
file = fopen(vcard_file, "wb");
if (file == NULL) {
@@ -857,7 +867,7 @@ void linphone_friend_list_export_friends_as_vcard4_file(LinphoneFriendList *list
} else {
ms_warning("Couldn't export friend %s because it doesn't have a vCard attached", linphone_address_as_string(linphone_friend_get_address(lf)));
}
- friends = ms_list_next(friends);
+ friends = bctbx_list_next(friends);
}
fclose(file);
diff --git a/coreapi/friendlist.h b/coreapi/friendlist.h
index 46bc711cd..1036acfbd 100644
--- a/coreapi/friendlist.h
+++ b/coreapi/friendlist.h
@@ -89,7 +89,7 @@ LINPHONE_PUBLIC void linphone_core_remove_friend_list(LinphoneCore *lc, Linphone
* @param[in] lc LinphoneCore object
* @return \mslist{LinphoneFriendList} a list of LinphoneFriendList
*/
-LINPHONE_PUBLIC const MSList * linphone_core_get_friends_lists(const LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_friends_lists(const LinphoneCore *lc);
/**
* Retrieves the first list of LinphoneFriend from the core.
@@ -183,7 +183,7 @@ LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_remove_friend(Linp
* @param[in] list LinphoneFriendList object
* @return \mslist{LinphoneFriend} a list of LinphoneFriend
*/
-LINPHONE_PUBLIC const MSList * linphone_friend_list_get_friends(const LinphoneFriendList *list);
+LINPHONE_PUBLIC const bctbx_list_t * linphone_friend_list_get_friends(const LinphoneFriendList *list);
/**
* Find a friend in the friend list using a LinphoneAddress.
diff --git a/coreapi/ldap/ldapprovider.c b/coreapi/ldap/ldapprovider.c
index 75b6b19a1..34460e1f4 100644
--- a/coreapi/ldap/ldapprovider.c
+++ b/coreapi/ldap/ldapprovider.c
@@ -40,7 +40,7 @@ struct _LinphoneLDAPContactProvider
LinphoneDictionary* config;
LDAP* ld;
- MSList* requests;
+ bctbx_list_t* requests;
unsigned int req_count;
// bind transaction
@@ -78,7 +78,7 @@ struct _LinphoneLDAPContactSearch
int msgid;
char* filter;
bool_t complete;
- MSList* found_entries;
+ bctbx_list_t* found_entries;
unsigned int found_count;
};
@@ -116,8 +116,8 @@ unsigned int linphone_ldap_contact_search_result_count(LinphoneLDAPContactSearch
static void linphone_ldap_contact_search_destroy( LinphoneLDAPContactSearch* obj )
{
//ms_message("~LinphoneLDAPContactSearch(%p)", obj);
- ms_list_for_each(obj->found_entries, linphone_ldap_contact_search_destroy_friend);
- obj->found_entries = ms_list_free(obj->found_entries);
+ bctbx_list_for_each(obj->found_entries, linphone_ldap_contact_search_destroy_friend);
+ obj->found_entries = bctbx_list_free(obj->found_entries);
if( obj->filter ) ms_free(obj->filter);
}
@@ -152,7 +152,7 @@ static void linphone_ldap_contact_provider_destroy( LinphoneLDAPContactProvider*
linphone_core_remove_iterate_hook(LINPHONE_CONTACT_PROVIDER(obj)->lc, linphone_ldap_contact_provider_iterate,obj);
// clean pending requests
- ms_list_for_each(obj->requests, linphone_ldap_contact_provider_destroy_request_cb);
+ bctbx_list_for_each(obj->requests, linphone_ldap_contact_provider_destroy_request_cb);
if (obj->ld) ldap_unbind_ext(obj->ld, NULL, NULL);
obj->ld = NULL;
@@ -223,7 +223,7 @@ static void linphone_ldap_contact_provider_handle_search_result( LinphoneLDAPCon
LinphoneFriend* lf = linphone_core_create_friend(lc);
linphone_friend_set_address(lf, la);
linphone_friend_set_name(lf, ldap_data.name);
- req->found_entries = ms_list_append(req->found_entries, lf);
+ req->found_entries = bctbx_list_append(req->found_entries, lf);
req->found_count++;
//ms_message("Added friend %s / %s", ldap_data.name, ldap_data.sip);
ms_free(ldap_data.sip);
@@ -313,7 +313,7 @@ static bool_t linphone_ldap_contact_provider_iterate(void *data)
unsigned int i;
for( i=0; ireq_count; i++){
- LinphoneLDAPContactSearch* search = (LinphoneLDAPContactSearch*)ms_list_nth_data( obj->requests, i );
+ LinphoneLDAPContactSearch* search = (LinphoneLDAPContactSearch*)bctbx_list_nth_data( obj->requests, i );
if( search && search->msgid == 0){
int ret;
ms_message("Found pending search %p (for %s), launching...", search, search->filter);
@@ -618,10 +618,10 @@ static int linphone_ldap_request_entry_compare_strong(const void*a, const void*
static inline LinphoneLDAPContactSearch* linphone_ldap_contact_provider_request_search( LinphoneLDAPContactProvider* obj, int msgid )
{
LinphoneLDAPContactSearch dummy = {};
- MSList* list_entry;
+ bctbx_list_t* list_entry;
dummy.msgid = msgid;
- list_entry = ms_list_find_custom(obj->requests, linphone_ldap_request_entry_compare_weak, &dummy);
+ list_entry = bctbx_list_find_custom(obj->requests, linphone_ldap_request_entry_compare_weak, &dummy);
if( list_entry ) return list_entry->data;
else return NULL;
}
@@ -632,10 +632,10 @@ static unsigned int linphone_ldap_contact_provider_cancel_search(LinphoneContact
LinphoneLDAPContactProvider* ldap_cp = LINPHONE_LDAP_CONTACT_PROVIDER(obj);
int ret = 1;
- MSList* list_entry = ms_list_find_custom(ldap_cp->requests, linphone_ldap_request_entry_compare_strong, req);
+ bctbx_list_t* list_entry = bctbx_list_find_custom(ldap_cp->requests, linphone_ldap_request_entry_compare_strong, req);
if( list_entry ) {
ms_message("Delete search %p", req);
- ldap_cp->requests = ms_list_remove_link(ldap_cp->requests, list_entry);
+ ldap_cp->requests = bctbx_list_remove_link(ldap_cp->requests, list_entry);
ldap_cp->req_count--;
ret = 0; // return OK if we found it in the monitored requests
} else {
@@ -703,7 +703,7 @@ static LinphoneLDAPContactSearch* linphone_ldap_contact_provider_begin_search (
}
if( request != NULL ) {
- obj->requests = ms_list_append ( obj->requests, request );
+ obj->requests = bctbx_list_append ( obj->requests, request );
obj->req_count++;
}
diff --git a/coreapi/lime.c b/coreapi/lime.c
index 0ce71921d..7d4e1ab93 100644
--- a/coreapi/lime.c
+++ b/coreapi/lime.c
@@ -713,7 +713,7 @@ int lime_decryptMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_
if ((!xmlStrcmp(cur->name, (const xmlChar *)"ZID"))){ /* sender ZID found, extract it */
peerZidHex = xmlNodeListGetString(xmlEncryptedMessage, cur->xmlChildrenNode, 1);
/* convert it from hexa string to bytes string and set the result in the associatedKey structure */
- lime_strToUint8(associatedKey.peerZID, peerZidHex, strlen((char *)peerZidHex));
+ lime_strToUint8(associatedKey.peerZID, peerZidHex, (uint16_t)strlen((char *)peerZidHex));
cur = cur->next;
}
}
@@ -825,8 +825,18 @@ void lime_freeKeys(limeURIKeys_t *associatedKeys){
int lime_getCachedSndKeysByURI(xmlDocPtr cacheBuffer, limeURIKeys_t *associatedKeys){
return LIME_NOT_ENABLED;
}
-
-
+int lime_encryptMessage(limeKey_t *key, uint8_t *plainMessage, uint32_t messageLength, uint8_t selfZID[12], uint8_t *encryptedMessage) {
+ return LIME_NOT_ENABLED;
+}
+int lime_setCachedKey(xmlDocPtr cacheBuffer, limeKey_t *associatedKey, uint8_t role) {
+ return LIME_NOT_ENABLED;
+}
+int lime_getCachedRcvKeyByZid(xmlDocPtr cacheBuffer, limeKey_t *associatedKey) {
+ return LIME_NOT_ENABLED;
+}
+int lime_decryptMessage(limeKey_t *key, uint8_t *encryptedMessage, uint32_t messageLength, uint8_t selfZID[12], uint8_t *plainMessage) {
+ return LIME_NOT_ENABLED;
+}
#endif /* HAVE_LIME */
char *lime_error_code_to_string(int errorCode) {
diff --git a/coreapi/linphone_proxy_config.h b/coreapi/linphone_proxy_config.h
index 9484589df..722cae051 100644
--- a/coreapi/linphone_proxy_config.h
+++ b/coreapi/linphone_proxy_config.h
@@ -547,6 +547,24 @@ LINPHONE_PUBLIC const char * linphone_proxy_config_get_ref_key(const LinphonePro
**/
LINPHONE_PUBLIC void linphone_proxy_config_set_ref_key(LinphoneProxyConfig *cfg, const char *refkey);
+/**
+ * Get The policy that is used to pass through NATs/firewalls when using this proxy config.
+ * If it is set to NULL, the default NAT policy from the core will be used instead.
+ * @param[in] cfg #LinphoneProxyConfig object
+ * @return LinphoneNatPolicy object in use.
+ * @see linphone_core_get_nat_policy()
+ */
+LINPHONE_PUBLIC LinphoneNatPolicy * linphone_proxy_config_get_nat_policy(const LinphoneProxyConfig *cfg);
+
+/**
+ * Set the policy to use to pass through NATs/firewalls when using this proxy config.
+ * If it is set to NULL, the default NAT policy from the core will be used instead.
+ * @param[in] cfg #LinphoneProxyConfig object
+ * @param[in] policy LinphoneNatPolicy object
+ * @see linphone_core_set_nat_policy()
+ */
+LINPHONE_PUBLIC void linphone_proxy_config_set_nat_policy(LinphoneProxyConfig *cfg, LinphoneNatPolicy *policy);
+
/**
* @}
*/
diff --git a/coreapi/linphone_tunnel.cc b/coreapi/linphone_tunnel.cc
index 827de9fdc..699de87b5 100644
--- a/coreapi/linphone_tunnel.cc
+++ b/coreapi/linphone_tunnel.cc
@@ -35,7 +35,7 @@ LinphoneTunnel* linphone_core_get_tunnel(const LinphoneCore *lc){
struct _LinphoneTunnel {
belledonnecomm::TunnelManager *manager;
- MSList *config_list;
+ bctbx_list_t *config_list;
};
extern "C" LinphoneTunnel* linphone_core_tunnel_new(LinphoneCore *lc){
@@ -55,7 +55,7 @@ static inline _LpConfig *config(const 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);
+ bctbx_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
ms_free(tunnel);
}
@@ -129,7 +129,7 @@ static LinphoneTunnelConfig *linphone_tunnel_config_from_string(const char *str)
static void linphone_tunnel_save_config(const LinphoneTunnel *tunnel) {
- MSList *elem = NULL;
+ bctbx_list_t *elem = NULL;
char *tmp = NULL, *old_tmp = NULL, *tc_str = NULL;
for(elem = tunnel->config_list; elem != NULL; elem = elem->next) {
LinphoneTunnelConfig *tunnel_config = (LinphoneTunnelConfig *)elem->data;
@@ -162,7 +162,7 @@ static void linphone_tunnel_add_server_intern(LinphoneTunnel *tunnel, LinphoneTu
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, linphone_tunnel_config_ref(tunnel_config));
+ tunnel->config_list = bctbx_list_append(tunnel->config_list, linphone_tunnel_config_ref(tunnel_config));
}
@@ -192,7 +192,7 @@ static void linphone_tunnel_load_config(LinphoneTunnel *tunnel){
}
static void linphone_tunnel_refresh_config(LinphoneTunnel *tunnel) {
- MSList *old_list = tunnel->config_list;
+ bctbx_list_t *old_list = tunnel->config_list;
tunnel->config_list = NULL;
bcTunnel(tunnel)->cleanServers();
while(old_list != NULL) {
@@ -209,16 +209,16 @@ void linphone_tunnel_add_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tu
}
void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config) {
- MSList *elem = ms_list_find(tunnel->config_list, tunnel_config);
+ bctbx_list_t *elem = bctbx_list_find(tunnel->config_list, tunnel_config);
if(elem != NULL) {
- tunnel->config_list = ms_list_remove(tunnel->config_list, tunnel_config);
+ tunnel->config_list = bctbx_list_remove(tunnel->config_list, tunnel_config);
linphone_tunnel_config_unref(tunnel_config);
linphone_tunnel_refresh_config(tunnel);
linphone_tunnel_save_config(tunnel);
}
}
-const MSList *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel){
+const bctbx_list_t *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel){
return tunnel->config_list;
}
@@ -226,7 +226,7 @@ void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel){
bcTunnel(tunnel)->cleanServers();
/* Free the list */
- ms_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
+ bctbx_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
tunnel->config_list = NULL;
linphone_tunnel_save_config(tunnel);
@@ -296,7 +296,7 @@ static void tunnelLogHandler(int level, const char *fmt, va_list l){
void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler){
tunnelOrtpLogHandler=logHandler;
- bcTunnel(tunnel)->enableLogs(enabled, tunnelLogHandler);
+ bcTunnel(tunnel)->enableLogs(enabled == FALSE ? false : true, tunnelLogHandler);
}
void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel *tunnel, const char* username,const char* passwd){
@@ -323,7 +323,7 @@ void linphone_tunnel_reconnect(LinphoneTunnel *tunnel){
}
void linphone_tunnel_enable_sip(LinphoneTunnel *tunnel, bool_t enable) {
- bcTunnel(tunnel)->tunnelizeSipPackets(enable);
+ bcTunnel(tunnel)->tunnelizeSipPackets(enable == FALSE ? false : true);
lp_config_set_int(config(tunnel), "tunnel", "sip", (enable ? TRUE : FALSE));
}
@@ -332,7 +332,7 @@ bool_t linphone_tunnel_sip_enabled(const LinphoneTunnel *tunnel) {
}
void linphone_tunnel_verify_server_certificate(LinphoneTunnel *tunnel, bool_t enable) {
- bcTunnel(tunnel)->verifyServerCertificate(enable);
+ bcTunnel(tunnel)->verifyServerCertificate(enable == FALSE ? false : true);
lp_config_set_int(config(tunnel), "tunnel", "verify_cert", (enable ? TRUE : FALSE));
}
@@ -356,8 +356,10 @@ void linphone_tunnel_configure(LinphoneTunnel *tunnel){
linphone_tunnel_enable_logs_with_handler(tunnel,TRUE,my_ortp_logv);
linphone_tunnel_load_config(tunnel);
linphone_tunnel_enable_sip(tunnel, tunnelizeSIPPackets);
- linphone_tunnel_set_mode(tunnel, mode);
linphone_tunnel_verify_server_certificate(tunnel, tunnelVerifyServerCertificate);
+ /*Tunnel is started here if mode equals true*/
+ linphone_tunnel_set_mode(tunnel, mode);
+
}
/* Deprecated functions */
@@ -380,5 +382,5 @@ bool_t linphone_tunnel_auto_detect_enabled(LinphoneTunnel *tunnel) {
}
void linphone_tunnel_simulate_udp_loss(LinphoneTunnel *tunnel, bool_t enabled) {
- bcTunnel(tunnel)->simulateUdpLoss(enabled);
+ bcTunnel(tunnel)->simulateUdpLoss(enabled == FALSE ? false : true);
}
diff --git a/coreapi/linphone_tunnel.h b/coreapi/linphone_tunnel.h
index 6a52748c0..8b68651ea 100644
--- a/coreapi/linphone_tunnel.h
+++ b/coreapi/linphone_tunnel.h
@@ -229,7 +229,7 @@ LINPHONE_PUBLIC void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, Linph
* @param tunnel LinphoneTunnel object
* @return \mslist{LinphoneTunnelConfig}
*/
-LINPHONE_PUBLIC const MSList *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel);
+LINPHONE_PUBLIC const bctbx_list_t *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel);
/**
* Remove all tunnel server addresses previously entered with linphone_tunnel_add_server()
diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c
index bcd8d5995..1893f705e 100644
--- a/coreapi/linphonecall.c
+++ b/coreapi/linphonecall.c
@@ -258,9 +258,9 @@ void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t
propagate_encryption_changed(call);
}
-static int get_max_codec_sample_rate(const MSList *codecs){
+static int get_max_codec_sample_rate(const bctbx_list_t *codecs){
int max_sample_rate=0;
- const MSList *it;
+ const bctbx_list_t *it;
for(it=codecs;it!=NULL;it=it->next){
PayloadType *pt=(PayloadType*)it->data;
int sample_rate;
@@ -274,8 +274,8 @@ static int get_max_codec_sample_rate(const MSList *codecs){
return max_sample_rate;
}
-static int find_payload_type_number(const MSList *assigned, const PayloadType *pt){
- const MSList *elem;
+static int find_payload_type_number(const bctbx_list_t *assigned, const PayloadType *pt){
+ const bctbx_list_t *elem;
const PayloadType *candidate=NULL;
for(elem=assigned;elem!=NULL;elem=elem->next){
const PayloadType *it=(const PayloadType*)elem->data;
@@ -292,8 +292,8 @@ static int find_payload_type_number(const MSList *assigned, const PayloadType *p
return candidate ? payload_type_get_number(candidate) : -1;
}
-bool_t is_payload_type_number_available(const MSList *l, int number, const PayloadType *ignore){
- const MSList *elem;
+bool_t is_payload_type_number_available(const bctbx_list_t *l, int number, const PayloadType *ignore){
+ const bctbx_list_t *elem;
for (elem=l; elem!=NULL; elem=elem->next){
const PayloadType *pt=(PayloadType*)elem->data;
if (pt!=ignore && payload_type_get_number(pt)==number) return FALSE;
@@ -301,8 +301,8 @@ bool_t is_payload_type_number_available(const MSList *l, int number, const Paylo
return TRUE;
}
-static void linphone_core_assign_payload_type_numbers(LinphoneCore *lc, MSList *codecs){
- MSList *elem;
+static void linphone_core_assign_payload_type_numbers(LinphoneCore *lc, bctbx_list_t *codecs){
+ bctbx_list_t *elem;
int dyn_number=lc->codecs_conf.dyn_pt;
PayloadType *red = NULL, *t140 = NULL;
@@ -347,8 +347,8 @@ static void linphone_core_assign_payload_type_numbers(LinphoneCore *lc, MSList *
}
}
-static bool_t has_telephone_event_at_rate(const MSList *tev, int rate){
- const MSList *it;
+static bool_t has_telephone_event_at_rate(const bctbx_list_t *tev, int rate){
+ const bctbx_list_t *it;
for(it=tev;it!=NULL;it=it->next){
const PayloadType *pt=(PayloadType*)it->data;
if (pt->clock_rate==rate) return TRUE;
@@ -356,9 +356,9 @@ static bool_t has_telephone_event_at_rate(const MSList *tev, int rate){
return FALSE;
}
-static MSList * create_telephone_events(LinphoneCore *lc, const MSList *codecs){
- const MSList *it;
- MSList *ret=NULL;
+static bctbx_list_t * create_telephone_events(LinphoneCore *lc, const bctbx_list_t *codecs){
+ const bctbx_list_t *it;
+ bctbx_list_t *ret=NULL;
for(it=codecs;it!=NULL;it=it->next){
const PayloadType *pt=(PayloadType*)it->data;
if (!has_telephone_event_at_rate(ret,pt->clock_rate)){
@@ -372,18 +372,18 @@ static MSList * create_telephone_events(LinphoneCore *lc, const MSList *codecs){
payload_type_set_number(tev, lc->codecs_conf.telephone_event_pt);
}
}
- ret=ms_list_append(ret,tev);
+ ret=bctbx_list_append(ret,tev);
}
}
return ret;
}
-static MSList *create_special_payload_types(LinphoneCore *lc, const MSList *codecs){
- MSList *ret=create_telephone_events(lc, codecs);
+static bctbx_list_t *create_special_payload_types(LinphoneCore *lc, const bctbx_list_t *codecs){
+ bctbx_list_t *ret=create_telephone_events(lc, codecs);
if (linphone_core_generic_confort_noise_enabled(lc)){
PayloadType *cn=payload_type_clone(&payload_type_cn);
payload_type_set_number(cn, 13);
- ret=ms_list_append(ret, cn);
+ ret=bctbx_list_append(ret, cn);
}
return ret;
}
@@ -391,12 +391,12 @@ static MSList *create_special_payload_types(LinphoneCore *lc, const MSList *code
typedef struct _CodecConstraints{
int bandwidth_limit;
int max_codecs;
- MSList *previously_used;
+ bctbx_list_t *previously_used;
}CodecConstraints;
-static MSList *make_codec_list(LinphoneCore *lc, CodecConstraints * hints, SalStreamType stype, const MSList *codecs){
- MSList *l=NULL;
- const MSList *it;
+static bctbx_list_t *make_codec_list(LinphoneCore *lc, CodecConstraints * hints, SalStreamType stype, const bctbx_list_t *codecs){
+ bctbx_list_t *l=NULL;
+ const bctbx_list_t *it;
int nb = 0;
for(it=codecs;it!=NULL;it=it->next){
@@ -423,13 +423,13 @@ static MSList *make_codec_list(LinphoneCore *lc, CodecConstraints * hints, SalSt
payload_type_set_flag(pt, PAYLOAD_TYPE_FROZEN_NUMBER);
}
- l=ms_list_append(l, pt);
+ l=bctbx_list_append(l, pt);
nb++;
if ((hints->max_codecs > 0) && (nb >= hints->max_codecs)) break;
}
if (stype==SalAudio){
- MSList *specials=create_special_payload_types(lc,l);
- l=ms_list_concat(l,specials);
+ bctbx_list_t *specials=create_special_payload_types(lc,l);
+ l=bctbx_list_concat(l,specials);
}
linphone_core_assign_payload_type_numbers(lc, l);
return l;
@@ -542,7 +542,7 @@ static void setup_zrtp_hash(LinphoneCall *call, SalMediaDescription *md) {
}
static void setup_rtcp_fb(LinphoneCall *call, SalMediaDescription *md) {
- MSList *pt_it;
+ bctbx_list_t *pt_it;
PayloadType *pt;
PayloadTypeAvpfParams avpf_params;
LinphoneCore *lc = call->core;
@@ -683,7 +683,7 @@ static void force_streams_dir_according_to_state(LinphoneCall *call, SalMediaDes
}
void linphone_call_make_local_media_description(LinphoneCall *call) {
- MSList *l;
+ bctbx_list_t *l;
SalMediaDescription *old_md=call->localdesc;
int i;
int max_index = 0;
@@ -770,7 +770,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
} else {
ms_message("Don't put audio stream on local offer for call [%p]",call);
md->streams[call->main_audio_stream_index].dir = SalStreamInactive;
- if(l) l=ms_list_free_with_data(l, (void (*)(void *))payload_type_destroy);
+ if(l) l=bctbx_list_free_with_data(l, (void (*)(void *))payload_type_destroy);
}
if (params->custom_sdp_media_attributes[LinphoneStreamTypeAudio])
md->streams[call->main_audio_stream_index].custom_sdp_attributes = sal_custom_sdp_attribute_clone(params->custom_sdp_media_attributes[LinphoneStreamTypeAudio]);
@@ -805,7 +805,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
} else {
ms_message("Don't put video stream on local offer for call [%p]",call);
md->streams[call->main_video_stream_index].dir = SalStreamInactive;
- if(l) l=ms_list_free_with_data(l, (void (*)(void *))payload_type_destroy);
+ if(l) l=bctbx_list_free_with_data(l, (void (*)(void *))payload_type_destroy);
}
if (params->custom_sdp_media_attributes[LinphoneStreamTypeVideo])
md->streams[call->main_video_stream_index].custom_sdp_attributes = sal_custom_sdp_attribute_clone(params->custom_sdp_media_attributes[LinphoneStreamTypeVideo]);
@@ -877,7 +877,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
static int find_port_offset(LinphoneCore *lc, int stream_index, int base_port){
int offset;
- MSList *elem;
+ bctbx_list_t *elem;
int tried_port;
int existing_port;
bool_t already_used=FALSE;
@@ -903,7 +903,7 @@ static int find_port_offset(LinphoneCore *lc, int stream_index, int base_port){
}
static int select_random_port(LinphoneCore *lc, int stream_index, int min_port, int max_port) {
- MSList *elem;
+ bctbx_list_t *elem;
int nb_tries;
int tried_port = 0;
int existing_port = 0;
@@ -1113,7 +1113,15 @@ void linphone_call_fill_media_multicast_addr(LinphoneCall *call) {
call->media_ports[call->main_video_stream_index].multicast_ip[0]='\0';
}
-static void linphone_call_create_ice_session(LinphoneCall *call, IceRole role){
+void linphone_call_check_ice_session(LinphoneCall *call, IceRole role, bool_t is_reinvite){
+ if (call->ice_session) return; /*already created*/
+
+ if (!linphone_nat_policy_ice_enabled(linphone_core_get_nat_policy(call->core))){
+ return;
+ }
+
+ if (is_reinvite && lp_config_get_int(call->core->config, "net", "allow_late_ice", 0) == 0) return;
+
call->ice_session = ice_session_new();
/*for backward compatibility purposes, shall be enabled by default in futur*/
ice_session_enable_message_integrity_check(call->ice_session,lp_config_get_int(call->core->config,"net","ice_session_enable_message_integrity_check",1));
@@ -1124,7 +1132,6 @@ static void linphone_call_create_ice_session(LinphoneCall *call, IceRole role){
types[2] = ICT_CandidateInvalid;
ice_session_set_default_candidates_types(call->ice_session, types);
}
-
ice_session_set_role(call->ice_session, role);
}
@@ -1142,9 +1149,8 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
linphone_call_fill_media_multicast_addr(call);
- if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) {
- linphone_call_create_ice_session(call, IR_Controlling);
- }
+ linphone_call_check_ice_session(call, IR_Controlling, FALSE);
+
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) {
call->ping_time=linphone_core_run_stun_tests(call->core,call);
}
@@ -1313,7 +1319,7 @@ static void linphone_call_compute_streams_indexes(LinphoneCall *call, const SalM
LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){
LinphoneCall *call = belle_sip_object_new(LinphoneCall);
SalMediaDescription *md;
- LinphoneFirewallPolicy fpol;
+ LinphoneNatPolicy *nat_policy = NULL;
int i;
call->dir=LinphoneCallIncoming;
@@ -1388,28 +1394,26 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
}
}
- fpol=linphone_core_get_firewall_policy(call->core);
- /*create the ice session now if ICE is required*/
- if (fpol==LinphonePolicyUseIce){
+ if (call->dest_proxy != NULL) nat_policy = linphone_proxy_config_get_nat_policy(call->dest_proxy);
+ if (nat_policy == NULL) nat_policy = linphone_core_get_nat_policy(call->core);
+ if ((nat_policy != NULL) && linphone_nat_policy_ice_enabled(nat_policy)) {
+ /* Create the ice session now if ICE is required */
if (md){
- linphone_call_create_ice_session(call, IR_Controlled);
+ linphone_call_check_ice_session(call, IR_Controlled, FALSE);
}else{
- fpol=LinphonePolicyNoFirewall;
+ nat_policy = NULL;
ms_warning("ICE not supported for incoming INVITE without SDP.");
}
}
/*reserve the sockets immediately*/
linphone_call_init_media_streams(call);
- switch (fpol) {
- case LinphonePolicyUseIce:
+ if (nat_policy != NULL) {
+ if (linphone_nat_policy_ice_enabled(nat_policy)) {
call->defer_notify_incoming = linphone_call_prepare_ice(call,TRUE) == 1;
- break;
- case LinphonePolicyUseStun:
+ } else if (linphone_nat_policy_stun_enabled(nat_policy)) {
call->ping_time=linphone_core_run_stun_tests(call->core,call);
- /* No break to also destroy ice session in this case. */
- break;
- case LinphonePolicyUseUpnp:
+ } else if (linphone_nat_policy_upnp_enabled(nat_policy)) {
#ifdef BUILD_UPNP
if(!lc->rtp_conf.disable_upnp) {
call->upnp_session = linphone_upnp_session_new(call);
@@ -1421,9 +1425,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
}
}
#endif //BUILD_UPNP
- break;
- default:
- break;
+ }
}
discover_mtu(lc,linphone_address_get_domain(from));
@@ -1440,11 +1442,11 @@ void linphone_call_free_media_resources(LinphoneCall *call){
int i;
linphone_call_stop_media_streams(call);
+ linphone_call_delete_upnp_session(call);
+ linphone_call_delete_ice_session(call);
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i){
ms_media_stream_sessions_uninit(&call->sessions[i]);
}
- linphone_call_delete_upnp_session(call);
- linphone_call_delete_ice_session(call);
linphone_call_stats_uninit(&call->stats[LINPHONE_CALL_STATS_AUDIO]);
linphone_call_stats_uninit(&call->stats[LINPHONE_CALL_STATS_VIDEO]);
linphone_call_stats_uninit(&call->stats[LINPHONE_CALL_STATS_TEXT]);
@@ -2468,13 +2470,15 @@ void linphone_call_init_audio_stream(LinphoneCall *call){
/* init zrtp even if we didn't explicitely set it, just in case peer offers it */
if (ms_zrtp_available()) {
+ char *uri = linphone_address_as_string_uri_only((call->dir==LinphoneCallIncoming) ? call->log->from : call->log->to);
MSZrtpParams params;
memset(¶ms,0,sizeof(MSZrtpParams));
/*call->current_params.media_encryption will be set later when zrtp is activated*/
params.zid_file=lc->zrtp_secrets_cache;
- params.uri= linphone_address_as_string_uri_only((call->dir==LinphoneCallIncoming) ? call->log->from : call->log->to);
+ params.uri=uri;
setZrtpCryptoTypesParameters(¶ms,call->core);
audio_stream_enable_zrtp(call->audiostream,¶ms);
+ if (uri != NULL) ms_free(uri);
}
media_stream_reclaim_sessions(&audiostream->ms, &call->sessions[call->main_audio_stream_index]);
@@ -2704,14 +2708,14 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
const char *gains=lp_config_get_string(lc->config,"sound","mic_eq_gains",NULL);
ms_filter_call_method(f,MS_EQUALIZER_SET_ACTIVE,&enabled);
if (enabled && gains){
- MSList *gains_list = ms_parse_equalizer_string(gains);
- MSList *it;
+ bctbx_list_t *gains_list = ms_parse_equalizer_string(gains);
+ bctbx_list_t *it;
for(it=gains_list; it; it=it->next) {
MSEqualizerGain *g = (MSEqualizerGain *)it->data;
ms_message("Read microphone equalizer gains: %f(~%f) --> %f",g->frequency,g->width,g->gain);
ms_filter_call_method(f,MS_EQUALIZER_SET_GAIN, g);
}
- if(gains_list) ms_list_free_with_data(gains_list, ms_free);
+ if(gains_list) bctbx_list_free_with_data(gains_list, ms_free);
}
}
if (st->spk_equalizer){
@@ -2720,14 +2724,14 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
const char *gains=lp_config_get_string(lc->config,"sound","spk_eq_gains",NULL);
ms_filter_call_method(f,MS_EQUALIZER_SET_ACTIVE,&enabled);
if (enabled && gains){
- MSList *gains_list = ms_parse_equalizer_string(gains);
- MSList *it;
+ bctbx_list_t *gains_list = ms_parse_equalizer_string(gains);
+ bctbx_list_t *it;
for(it=gains_list; it; it=it->next) {
MSEqualizerGain *g = (MSEqualizerGain *)it->data;
ms_message("Read speaker equalizer gains: %f(~%f) --> %f",g->frequency,g->width,g->gain);
ms_filter_call_method(f,MS_EQUALIZER_SET_GAIN, g);
}
- if(gains_list) ms_list_free_with_data(gains_list, ms_free);
+ if(gains_list) bctbx_list_free_with_data(gains_list, ms_free);
}
}
}
@@ -2860,7 +2864,7 @@ static int get_video_bw(LinphoneCall *call, const SalMediaDescription *md, const
static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *md, const SalStreamDescription *desc, int *used_pt){
int bw=0;
- const MSList *elem;
+ const bctbx_list_t *elem;
RtpProfile *prof=rtp_profile_new("Call profile");
bool_t first=TRUE;
LinphoneCore *lc=call->core;
@@ -4636,16 +4640,16 @@ void linphone_call_log_completed(LinphoneCall *call){
}
#endif
if (!call_logs_sqlite_db_found) {
- lc->call_logs=ms_list_prepend(lc->call_logs,linphone_call_log_ref(call->log));
- if (ms_list_size(lc->call_logs)>lc->max_call_logs){
- MSList *elem,*prevelem=NULL;
+ lc->call_logs=bctbx_list_prepend(lc->call_logs,linphone_call_log_ref(call->log));
+ if (bctbx_list_size(lc->call_logs)>(size_t)lc->max_call_logs){
+ bctbx_list_t *elem,*prevelem=NULL;
/*find the last element*/
for(elem=lc->call_logs;elem!=NULL;elem=elem->next){
prevelem=elem;
}
elem=prevelem;
linphone_call_log_unref((LinphoneCallLog*)elem->data);
- lc->call_logs=ms_list_remove_link(lc->call_logs,elem);
+ lc->call_logs=bctbx_list_remove_link(lc->call_logs,elem);
}
call_logs_write_to_config_file(lc);
}
diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c
index 057d2c272..e6cbdc451 100644
--- a/coreapi/linphonecore.c
+++ b/coreapi/linphonecore.c
@@ -102,7 +102,7 @@ static OrtpLogFunc liblinphone_log_func = NULL;
static LinphoneLogCollectionState liblinphone_log_collection_state = LinphoneLogCollectionDisabled;
static char * liblinphone_log_collection_path = NULL;
static char * liblinphone_log_collection_prefix = NULL;
-static int liblinphone_log_collection_max_file_size = LOG_COLLECTION_DEFAULT_MAX_FILE_SIZE;
+static size_t liblinphone_log_collection_max_file_size = LOG_COLLECTION_DEFAULT_MAX_FILE_SIZE;
static ortp_mutex_t liblinphone_log_collection_mutex;
static FILE * liblinphone_log_collection_file = NULL;
static size_t liblinphone_log_collection_file_size = 0;
@@ -209,6 +209,7 @@ void linphone_core_set_log_level(OrtpLogLevel loglevel) {
void linphone_core_set_log_level_mask(OrtpLogLevel loglevel) {
ortp_set_log_level_mask(NULL, loglevel);
+ bctbx_set_log_level_mask(NULL, loglevel);
if (loglevel == 0) {
sal_disable_log();
} else {
@@ -229,7 +230,7 @@ static int _open_log_collection_file_with_idx(int idx) {
if (liblinphone_log_collection_file == NULL) return -1;
fstat(fileno(liblinphone_log_collection_file), &statbuf);
- if (statbuf.st_size > liblinphone_log_collection_max_file_size) {
+ if ((size_t)statbuf.st_size > liblinphone_log_collection_max_file_size) {
fclose(liblinphone_log_collection_file);
return -1;
}
@@ -368,11 +369,11 @@ void linphone_core_set_log_collection_prefix(const char *prefix) {
}
}
-int linphone_core_get_log_collection_max_file_size(void) {
+size_t linphone_core_get_log_collection_max_file_size(void) {
return liblinphone_log_collection_max_file_size;
}
-void linphone_core_set_log_collection_max_file_size(int size) {
+void linphone_core_set_log_collection_max_file_size(size_t size) {
liblinphone_log_collection_max_file_size = size;
}
@@ -759,13 +760,22 @@ static void net_config_read (LinphoneCore *lc)
int tmp;
const char *tmpstr;
LpConfig *config=lc->config;
+ const char *nat_policy_ref;
+
+ nat_policy_ref = lp_config_get_string(lc->config, "net", "nat_policy_ref", NULL);
+ if (nat_policy_ref != NULL) {
+ lc->nat_policy = linphone_core_create_nat_policy_from_config(lc, nat_policy_ref);
+ }
lc->net_conf.nat_address_ip = NULL;
tmp=lp_config_get_int(config,"net","download_bw",0);
linphone_core_set_download_bandwidth(lc,tmp);
tmp=lp_config_get_int(config,"net","upload_bw",0);
linphone_core_set_upload_bandwidth(lc,tmp);
- linphone_core_set_stun_server(lc,lp_config_get_string(config,"net","stun_server",NULL));
+ if (lc->nat_policy == NULL) /* For compatibility, now the STUN server is stored in the NAT policy. */
+ linphone_core_set_stun_server(lc,lp_config_get_string(config,"net","stun_server",NULL));
+ else
+ linphone_core_set_stun_server(lc, linphone_nat_policy_get_stun_server(lc->nat_policy));
tmpstr=lp_config_get_string(lc->config,"net","nat_address",NULL);
if (tmpstr!=NULL && (strlen(tmpstr)<1)) tmpstr=NULL;
linphone_core_set_nat_address(lc,tmpstr);
@@ -782,7 +792,8 @@ static void net_config_read (LinphoneCore *lc)
linphone_core_enable_dns_srv(lc, tmp);
/* This is to filter out unsupported firewall policies */
- linphone_core_set_firewall_policy(lc, linphone_core_get_firewall_policy(lc));
+ if (nat_policy_ref == NULL)
+ linphone_core_set_firewall_policy(lc, linphone_core_get_firewall_policy(lc));
}
static void build_sound_devices_table(LinphoneCore *lc){
@@ -790,8 +801,8 @@ static void build_sound_devices_table(LinphoneCore *lc){
const char **old;
int ndev;
int i;
- const MSList *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_card_manager(lc->factory));
- ndev=ms_list_size(elem);
+ const bctbx_list_t *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_card_manager(lc->factory));
+ ndev=bctbx_list_size(elem);
devices=ms_malloc((ndev+1)*sizeof(const char *));
for (i=0;elem!=NULL;elem=elem->next,i++){
devices[i]=ms_snd_card_get_string_id((MSSndCard *)elem->data);
@@ -799,7 +810,7 @@ static void build_sound_devices_table(LinphoneCore *lc){
devices[ndev]=NULL;
old=lc->sound_conf.cards;
lc->sound_conf.cards=devices;
- if (old!=NULL) ms_free(old);
+ if (old!=NULL) ms_free((void *)old);
}
static const char *get_default_local_ring(LinphoneCore * lc){
@@ -871,10 +882,9 @@ static void sound_config_read(LinphoneCore *lc)
linphone_core_set_sound_source(lc,tmpbuf[0]);
*/
- tmpbuf = get_default_local_ring(lc);
- tmpbuf=lp_config_get_string(lc->config,"sound","local_ring",tmpbuf);
- if (ortp_file_exist(tmpbuf)==-1) {
- ms_warning("%s does not exist",tmpbuf);
+ tmpbuf=lp_config_get_string(lc->config,"sound","local_ring",NULL);
+ if (tmpbuf==NULL||ortp_file_exist(tmpbuf)!=0) {
+ if (tmpbuf) ms_warning("%s does not exist",tmpbuf);
tmpbuf = get_default_local_ring(lc);
}
linphone_core_set_ring(lc,tmpbuf);
@@ -1131,10 +1141,10 @@ static void rtp_config_read(LinphoneCore *lc)
linphone_core_enable_video_multicast(lc,tmp_int);
}
-static PayloadType * find_payload(const MSList *default_list, const char *mime_type, int clock_rate, int channels, const char *recv_fmtp){
+static PayloadType * find_payload(const bctbx_list_t *default_list, const char *mime_type, int clock_rate, int channels, const char *recv_fmtp){
PayloadType *candidate=NULL;
PayloadType *it;
- const MSList *elem;
+ const bctbx_list_t *elem;
for(elem=default_list;elem!=NULL;elem=elem->next){
it=(PayloadType*)elem->data;
@@ -1159,8 +1169,8 @@ static PayloadType * find_payload(const MSList *default_list, const char *mime_t
return candidate;
}
-static PayloadType* find_payload_type_from_list(const char* type, int rate, int channels, const MSList* from) {
- const MSList *elem;
+static PayloadType* find_payload_type_from_list(const char* type, int rate, int channels, const bctbx_list_t* from) {
+ const bctbx_list_t *elem;
for(elem=from;elem!=NULL;elem=elem->next){
PayloadType *pt=(PayloadType*)elem->data;
if ((strcasecmp(type, payload_type_get_mime(pt)) == 0)
@@ -1204,7 +1214,7 @@ static bool_t get_codec(LinphoneCore *lc, SalStreamType type, int index, Payload
}
pt = find_payload(type == SalAudio ? lc->default_audio_codecs : type == SalVideo ? lc->default_video_codecs : lc->default_text_codecs ,mime,rate,channels,fmtp);
if (!pt){
- MSList **default_list = (type==SalAudio) ? &lc->default_audio_codecs : type == SalVideo ? &lc->default_video_codecs : &lc->default_text_codecs;
+ bctbx_list_t **default_list = (type==SalAudio) ? &lc->default_audio_codecs : type == SalVideo ? &lc->default_video_codecs : &lc->default_text_codecs;
if (type == SalAudio)
ms_warning("Codec %s/%i/%i read from conf is not in the default list.",mime,rate,channels);
else if (type == SalVideo)
@@ -1218,7 +1228,7 @@ static bool_t get_codec(LinphoneCore *lc, SalStreamType type, int index, Payload
pt->channels=channels;
payload_type_set_number(pt,-1); /*dynamic assignment*/
payload_type_set_recv_fmtp(pt,fmtp);
- *default_list=ms_list_append(*default_list, pt);
+ *default_list=bctbx_list_append(*default_list, pt);
}
if (enabled ) pt->flags|=PAYLOAD_TYPE_ENABLED;
else pt->flags&=~PAYLOAD_TYPE_ENABLED;
@@ -1245,23 +1255,23 @@ static SalStreamType payload_type_get_stream_type(const PayloadType *pt){
/*this function merges the payload types from the codec default list with the list read from configuration file.
* If a new codec becomes supported in Liblinphone or if the list from configuration file is empty or incomplete, all the supported codecs are added
* automatically. This 'l' list is entirely destroyed and rewritten.*/
-static MSList *add_missing_supported_codecs(LinphoneCore *lc, const MSList *default_list, MSList *l){
- const MSList *elem;
- MSList *newlist;
+static bctbx_list_t *add_missing_supported_codecs(LinphoneCore *lc, const bctbx_list_t *default_list, bctbx_list_t *l){
+ const bctbx_list_t *elem;
+ bctbx_list_t *newlist;
PayloadType *last_seen = NULL;
for(elem=default_list; elem!=NULL; elem=elem->next){
- MSList *elem2=ms_list_find(l,elem->data);
+ bctbx_list_t *elem2=bctbx_list_find(l,elem->data);
if (!elem2){
PayloadType *pt=(PayloadType*)elem->data;
/*this codec from default list should be inserted in the list, with respect to the default_list order*/
if (!linphone_core_codec_supported(lc, payload_type_get_stream_type(pt), pt->mime_type)) continue;
if (!last_seen){
- l=ms_list_prepend(l,pt);
+ l=bctbx_list_prepend(l,pt);
}else{
- const MSList *after=ms_list_find(l,last_seen);
- l=ms_list_insert(l, after->next, pt);
+ const bctbx_list_t *after=bctbx_list_find(l,last_seen);
+ l=bctbx_list_insert(l, after->next, pt);
}
last_seen = pt;
ms_message("Supported codec %s/%i fmtp=%s automatically added to codec list.", pt->mime_type,
@@ -1270,8 +1280,8 @@ static MSList *add_missing_supported_codecs(LinphoneCore *lc, const MSList *defa
last_seen = (PayloadType*)elem2->data;
}
}
- newlist=ms_list_copy_with_data(l,(void *(*)(void*))payload_type_clone);
- ms_list_free(l);
+ newlist=bctbx_list_copy_with_data(l,(void *(*)(void*))payload_type_clone);
+ bctbx_list_free(l);
return newlist;
}
@@ -1279,10 +1289,10 @@ static MSList *add_missing_supported_codecs(LinphoneCore *lc, const MSList *defa
* This function adds missing codecs, if required by configuration.
* This 'l' list is entirely destroyed and a new list is returned.
*/
-static MSList *handle_missing_codecs(LinphoneCore *lc, const MSList *default_list, MSList *l, MSFormatType ft){
+static bctbx_list_t *handle_missing_codecs(LinphoneCore *lc, const bctbx_list_t *default_list, bctbx_list_t *l, MSFormatType ft){
const char *name = "unknown";
int add_missing;
- MSList *ret;
+ bctbx_list_t *ret;
switch(ft){
case MSAudio:
@@ -1301,29 +1311,29 @@ static MSList *handle_missing_codecs(LinphoneCore *lc, const MSList *default_lis
if (add_missing){
ret = add_missing_supported_codecs(lc, default_list, l);
}else{
- ret = ms_list_copy_with_data(l,(void *(*)(void*))payload_type_clone);
- ms_list_free(l);
+ ret = bctbx_list_copy_with_data(l,(void *(*)(void*))payload_type_clone);
+ bctbx_list_free(l);
}
return ret;
}
-static MSList *codec_append_if_new(MSList *l, PayloadType *pt){
- MSList *elem;
+static bctbx_list_t *codec_append_if_new(bctbx_list_t *l, PayloadType *pt){
+ bctbx_list_t *elem;
for (elem=l;elem!=NULL;elem=elem->next){
PayloadType *ept=(PayloadType*)elem->data;
if (pt==ept)
return l;
}
- l=ms_list_append(l,pt);
+ l=bctbx_list_append(l,pt);
return l;
}
static void codecs_config_read(LinphoneCore *lc){
int i;
PayloadType *pt;
- MSList *audio_codecs=NULL;
- MSList *video_codecs=NULL;
- MSList *text_codecs=NULL;
+ bctbx_list_t *audio_codecs=NULL;
+ bctbx_list_t *video_codecs=NULL;
+ bctbx_list_t *text_codecs=NULL;
lc->codecs_conf.dyn_pt=96;
lc->codecs_conf.telephone_event_pt=lp_config_get_int(lc->config,"misc","telephone_event_pt",101);
@@ -1357,15 +1367,15 @@ static void codecs_config_read(LinphoneCore *lc){
}
static void build_video_devices_table(LinphoneCore *lc){
- const MSList *elem;
+ const bctbx_list_t *elem;
int i;
int ndev;
const char **devices;
if (lc->video_conf.cams)
- ms_free(lc->video_conf.cams);
+ ms_free((void *)lc->video_conf.cams);
/* retrieve all video devices */
elem=ms_web_cam_manager_get_list(ms_factory_get_web_cam_manager(lc->factory));
- ndev=ms_list_size(elem);
+ ndev=bctbx_list_size(elem);
devices=ms_malloc((ndev+1)*sizeof(const char *));
for (i=0;elem!=NULL;elem=elem->next,i++){
devices[i]=ms_web_cam_get_string_id((MSWebCam *)elem->data);
@@ -1378,12 +1388,9 @@ static void video_config_read(LinphoneCore *lc){
#ifdef VIDEO_ENABLED
int capture, display, self_view, reuse_source;
int automatic_video=1;
-#endif
const char *str;
-#ifdef VIDEO_ENABLED
LinphoneVideoPolicy vpol;
memset(&vpol, 0, sizeof(LinphoneVideoPolicy));
-#endif
build_video_devices_table(lc);
str=lp_config_get_string(lc->config,"video","device",NULL);
@@ -1398,7 +1405,6 @@ static void video_config_read(LinphoneCore *lc){
linphone_core_set_preferred_framerate(lc,lp_config_get_float(lc->config,"video","framerate",0));
-#ifdef VIDEO_ENABLED
#if defined(ANDROID) || defined(__ios)
automatic_video=0;
#endif
@@ -1503,7 +1509,7 @@ int linphone_core_get_sip_transport_timeout(LinphoneCore *lc) {
return sal_get_transport_timeout(lc->sal);
}
-void linphone_core_set_dns_servers(LinphoneCore *lc, const MSList *servers){
+void linphone_core_set_dns_servers(LinphoneCore *lc, const bctbx_list_t *servers){
sal_set_dns_servers(lc->sal, servers);
}
@@ -1545,7 +1551,7 @@ const char * linphone_core_get_version(void){
}
static void linphone_core_register_payload_type(LinphoneCore *lc, const PayloadType *const_pt, const char *recv_fmtp, bool_t enabled){
- MSList **codec_list = const_pt->type==PAYLOAD_VIDEO ? &lc->default_video_codecs : const_pt->type==PAYLOAD_TEXT ? &lc->default_text_codecs : &lc->default_audio_codecs;
+ bctbx_list_t **codec_list = const_pt->type==PAYLOAD_VIDEO ? &lc->default_video_codecs : const_pt->type==PAYLOAD_TEXT ? &lc->default_text_codecs : &lc->default_audio_codecs;
PayloadType *pt=payload_type_clone(const_pt);
int number=-1;
payload_type_set_enable(pt,enabled);
@@ -1557,7 +1563,7 @@ static void linphone_core_register_payload_type(LinphoneCore *lc, const PayloadT
);
ms_message("Codec %s/%i fmtp=[%s] number=%i, enabled=%i) added to the list of possible codecs.", pt->mime_type, pt->clock_rate,
pt->recv_fmtp ? pt->recv_fmtp : "", number, (int)payload_type_enabled(pt));
- *codec_list=ms_list_append(*codec_list,pt);
+ *codec_list=bctbx_list_append(*codec_list,pt);
}
static void linphone_core_register_static_payloads(LinphoneCore *lc){
@@ -1579,9 +1585,9 @@ static void linphone_core_register_static_payloads(LinphoneCore *lc){
}
static void linphone_core_free_payload_types(LinphoneCore *lc){
- ms_list_free_with_data(lc->default_audio_codecs, (void (*)(void*))payload_type_destroy);
- ms_list_free_with_data(lc->default_video_codecs, (void (*)(void*))payload_type_destroy);
- ms_list_free_with_data(lc->default_text_codecs, (void (*)(void*))payload_type_destroy);
+ bctbx_list_free_with_data(lc->default_audio_codecs, (void (*)(void*))payload_type_destroy);
+ bctbx_list_free_with_data(lc->default_video_codecs, (void (*)(void*))payload_type_destroy);
+ bctbx_list_free_with_data(lc->default_text_codecs, (void (*)(void*))payload_type_destroy);
}
void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message){
@@ -1593,7 +1599,7 @@ static void misc_config_read(LinphoneCore *lc) {
LpConfig *config=lc->config;
const char *uuid;
- lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",30);
+ lc->max_call_logs=(unsigned int)lp_config_get_int(config,"misc","history_max_size",30);
lc->max_calls=lp_config_get_int(config,"misc","max_calls",NB_MAX_CALLS);
uuid=lp_config_get_string(config,"misc","uuid",NULL);
@@ -1745,7 +1751,7 @@ static void linphone_core_register_default_codecs(LinphoneCore *lc){
static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *notified_event, const LinphoneContent *body) {
if (strcmp(notified_event, "Presence") == 0) {
- const MSList* friendLists = linphone_core_get_friends_lists(lc);
+ const bctbx_list_t* friendLists = linphone_core_get_friends_lists(lc);
while( friendLists != NULL ){
LinphoneFriendList* list = friendLists->data;
ms_message("notify presence for list %p", list);
@@ -1843,17 +1849,17 @@ LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, st
return core;
}
-const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc)
+const bctbx_list_t *linphone_core_get_audio_codecs(const LinphoneCore *lc)
{
return lc->codecs_conf.audio_codecs;
}
-const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc)
+const bctbx_list_t *linphone_core_get_video_codecs(const LinphoneCore *lc)
{
return lc->codecs_conf.video_codecs;
}
-const MSList *linphone_core_get_text_codecs(const LinphoneCore *lc)
+const bctbx_list_t *linphone_core_get_text_codecs(const LinphoneCore *lc)
{
return lc->codecs_conf.text_codecs;
}
@@ -1970,8 +1976,8 @@ LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc){
* The list is taken by the LinphoneCore thus the application should not free it.
* This list is made of struct PayloadType describing the codec parameters.
**/
-int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs){
- if (lc->codecs_conf.audio_codecs!=NULL) ms_list_free(lc->codecs_conf.audio_codecs);
+int linphone_core_set_audio_codecs(LinphoneCore *lc, bctbx_list_t *codecs){
+ if (lc->codecs_conf.audio_codecs!=NULL) bctbx_list_free(lc->codecs_conf.audio_codecs);
lc->codecs_conf.audio_codecs=codecs;
_linphone_core_codec_config_write(lc);
linphone_core_update_allocated_audio_bandwidth(lc);
@@ -1988,16 +1994,16 @@ int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs){
* The list is taken by the LinphoneCore thus the application should not free it.
* This list is made of struct PayloadType describing the codec parameters.
**/
-int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs){
- if (lc->codecs_conf.video_codecs!=NULL) ms_list_free(lc->codecs_conf.video_codecs);
+int linphone_core_set_video_codecs(LinphoneCore *lc, bctbx_list_t *codecs){
+ if (lc->codecs_conf.video_codecs!=NULL) bctbx_list_free(lc->codecs_conf.video_codecs);
lc->codecs_conf.video_codecs=codecs;
_linphone_core_codec_config_write(lc);
return 0;
}
-int linphone_core_set_text_codecs(LinphoneCore *lc, MSList *codecs) {
+int linphone_core_set_text_codecs(LinphoneCore *lc, bctbx_list_t *codecs) {
if (lc->codecs_conf.text_codecs != NULL)
- ms_list_free(lc->codecs_conf.text_codecs);
+ bctbx_list_free(lc->codecs_conf.text_codecs);
lc->codecs_conf.text_codecs = codecs;
_linphone_core_codec_config_write(lc);
@@ -2023,8 +2029,8 @@ bool_t linphone_core_generic_confort_noise_enabled(const LinphoneCore *lc){
return lp_config_get_int(lc->config, "misc", "use_cn", FALSE);
}
-const MSList* linphone_core_get_friend_list(const LinphoneCore *lc) {
- MSList *lists = lc->friends_lists;
+const bctbx_list_t* linphone_core_get_friend_list(const LinphoneCore *lc) {
+ bctbx_list_t *lists = lc->friends_lists;
if (lists) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
if (list) {
@@ -2034,7 +2040,7 @@ const MSList* linphone_core_get_friend_list(const LinphoneCore *lc) {
return NULL;
}
-const MSList* linphone_core_get_friends_lists(const LinphoneCore *lc) {
+const bctbx_list_t* linphone_core_get_friends_lists(const LinphoneCore *lc) {
return lc->friends_lists;
}
@@ -2046,7 +2052,7 @@ LinphoneFriendList* linphone_core_get_default_friend_list(const LinphoneCore *lc
}
void linphone_core_remove_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
- MSList *elem = ms_list_find(lc->friends_lists, list);
+ bctbx_list_t *elem = bctbx_list_find(lc->friends_lists, list);
if (elem == NULL) return;
#ifdef SQLITE_STORAGE_ENABLED
linphone_core_remove_friends_list_from_db(lc, list);
@@ -2054,7 +2060,7 @@ void linphone_core_remove_friend_list(LinphoneCore *lc, LinphoneFriendList *list
linphone_core_notify_friend_list_removed(lc, list);
list->lc = NULL;
linphone_friend_list_unref(list);
- lc->friends_lists = ms_list_remove_link(lc->friends_lists, elem);
+ lc->friends_lists = bctbx_list_remove_link(lc->friends_lists, elem);
}
void linphone_core_add_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
@@ -2062,7 +2068,7 @@ void linphone_core_add_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
if (!list->lc) {
list->lc = lc;
}
- lc->friends_lists = ms_list_append(lc->friends_lists, linphone_friend_list_ref(list));
+ lc->friends_lists = bctbx_list_append(lc->friends_lists, linphone_friend_list_ref(list));
#ifdef SQLITE_STORAGE_ENABLED
linphone_core_store_friends_list_in_db(lc, list);
#endif
@@ -2074,7 +2080,7 @@ void linphone_core_add_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
if (rls_uri && lp_config_get_int(lc->config, "sip", "use_rls_presence", 0)) {
linphone_friend_list_set_rls_uri(list, rls_uri);
}
- lc->friends_lists = ms_list_append(lc->friends_lists, linphone_friend_list_ref(list));
+ lc->friends_lists = bctbx_list_append(lc->friends_lists, linphone_friend_list_ref(list));
linphone_friend_list_unref(list);
}
}
@@ -2198,7 +2204,7 @@ bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc){
static void apply_jitter_value(LinphoneCore *lc, int value, MSFormatType stype){
LinphoneCall *call;
- MSList *it;
+ bctbx_list_t *it;
for (it=lc->calls;it!=NULL;it=it->next){
MediaStream *ms;
call=(LinphoneCall*)it->data;
@@ -2609,13 +2615,13 @@ static void monitor_network_state(LinphoneCore *lc, time_t curtime){
}
static void proxy_update(LinphoneCore *lc){
- MSList *elem,*next;
- ms_list_for_each(lc->sip_conf.proxies,(void (*)(void*))&linphone_proxy_config_update);
+ bctbx_list_t *elem,*next;
+ bctbx_list_for_each(lc->sip_conf.proxies,(void (*)(void*))&linphone_proxy_config_update);
for(elem=lc->sip_conf.deleted_proxies;elem!=NULL;elem=next){
LinphoneProxyConfig* cfg = (LinphoneProxyConfig*)elem->data;
next=elem->next;
if (ms_time(NULL) - cfg->deletion_date > 32) {
- lc->sip_conf.deleted_proxies =ms_list_remove_link(lc->sip_conf.deleted_proxies,elem);
+ lc->sip_conf.deleted_proxies =bctbx_list_remove_link(lc->sip_conf.deleted_proxies,elem);
ms_message("Proxy config for [%s] is definitely removed from core.",linphone_proxy_config_get_addr(cfg));
_linphone_proxy_config_release_ops(cfg);
linphone_proxy_config_unref(cfg);
@@ -2635,14 +2641,14 @@ static void assign_buddy_info(LinphoneCore *lc, BuddyInfo *info){
}
static void analyze_buddy_lookup_results(LinphoneCore *lc, LinphoneProxyConfig *cfg){
- MSList *elem;
+ bctbx_list_t *elem;
SipSetupContext *ctx=linphone_proxy_config_get_sip_setup_context(cfg);
- for (elem=lc->bl_reqs;elem!=NULL;elem=ms_list_next(elem)){
+ for (elem=lc->bl_reqs;elem!=NULL;elem=bctbx_list_next(elem)){
BuddyLookupRequest *req=(BuddyLookupRequest *)elem->data;
if (req->status==BuddyLookupDone || req->status==BuddyLookupFailure){
if (req->results!=NULL){
BuddyInfo *i=(BuddyInfo*)req->results->data;
- ms_list_free(req->results);
+ bctbx_list_free(req->results);
req->results=NULL;
assign_buddy_info(lc,i);
}
@@ -2651,13 +2657,13 @@ static void analyze_buddy_lookup_results(LinphoneCore *lc, LinphoneProxyConfig *
}
}
/*purge completed requests */
- while((elem=ms_list_find(lc->bl_reqs,NULL))!=NULL){
- lc->bl_reqs=ms_list_remove_link(lc->bl_reqs,elem);
+ while((elem=bctbx_list_find(lc->bl_reqs,NULL))!=NULL){
+ lc->bl_reqs=bctbx_list_remove_link(lc->bl_reqs,elem);
}
}
static void linphone_core_grab_buddy_infos(LinphoneCore *lc, LinphoneProxyConfig *cfg){
- const MSList *elem;
+ const bctbx_list_t *elem;
SipSetupContext *ctx=linphone_proxy_config_get_sip_setup_context(cfg);
for(elem=linphone_core_get_friend_list(lc);elem!=NULL;elem=elem->next){
LinphoneFriend *lf=(LinphoneFriend*)elem->data;
@@ -2670,7 +2676,7 @@ static void linphone_core_grab_buddy_infos(LinphoneCore *lc, LinphoneProxyConfig
buddy_lookup_request_set_key(req,tmp);
buddy_lookup_request_set_max_results(req,1);
sip_setup_context_buddy_lookup_submit(ctx,req);
- lc->bl_reqs=ms_list_append(lc->bl_reqs,req);
+ lc->bl_reqs=bctbx_list_append(lc->bl_reqs,req);
ms_free(tmp);
}
}
@@ -2707,7 +2713,7 @@ static void linphone_core_do_plugin_tasks(LinphoneCore *lc){
* serialized with a mutex.
**/
void linphone_core_iterate(LinphoneCore *lc){
- MSList *calls;
+ bctbx_list_t *calls;
LinphoneCall *call;
uint64_t curtime_ms = ms_get_cur_time_ms(); /*monotonic time*/
int elapsed;
@@ -2862,11 +2868,11 @@ void linphone_core_iterate(LinphoneCore *lc){
}
if (one_second_elapsed) {
- MSList *elem = NULL;
+ bctbx_list_t *elem = NULL;
if (lp_config_needs_commit(lc->config)) {
lp_config_sync(lc->config);
}
- for (elem = lc->friends_lists; elem != NULL; elem = ms_list_next(elem)) {
+ for (elem = lc->friends_lists; elem != NULL; elem = bctbx_list_next(elem)) {
LinphoneFriendList *list = (LinphoneFriendList *)elem->data;
if (list->dirty_friends_to_update) {
linphone_friend_list_update_dirty_friends(list);
@@ -2973,29 +2979,29 @@ void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, L
system.
*/
-static MSList *make_routes_for_proxy(LinphoneProxyConfig *proxy, const LinphoneAddress *dest){
- MSList *ret=NULL;
+static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const LinphoneAddress *dest){
+ bctbx_list_t *ret=NULL;
const char *local_route=linphone_proxy_config_get_route(proxy);
const LinphoneAddress *srv_route=linphone_proxy_config_get_service_route(proxy);
if (local_route){
- ret=ms_list_append(ret,sal_address_new(local_route));
+ ret=bctbx_list_append(ret,sal_address_new(local_route));
}
if (srv_route){
- ret=ms_list_append(ret,sal_address_clone((SalAddress*)srv_route));
+ ret=bctbx_list_append(ret,sal_address_clone((SalAddress*)srv_route));
}
if (ret==NULL){
/*if the proxy address matches the domain part of the destination, then use the same transport
* as the one used for registration. This is done by forcing a route to this proxy.*/
SalAddress *proxy_addr=sal_address_new(linphone_proxy_config_get_addr(proxy));
if (strcmp(sal_address_get_domain(proxy_addr),linphone_address_get_domain(dest))==0){
- ret=ms_list_append(ret,proxy_addr);
+ ret=bctbx_list_append(ret,proxy_addr);
}else sal_address_destroy(proxy_addr);
}
return ret;
}
LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const LinphoneAddress *uri){
- const MSList *elem;
+ const bctbx_list_t *elem;
LinphoneProxyConfig *found_cfg=NULL;
LinphoneProxyConfig *found_reg_cfg=NULL;
LinphoneProxyConfig *found_noreg_cfg=NULL;
@@ -3210,18 +3216,18 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
return call;
}
-static void linphone_transfer_routes_to_op(MSList *routes, SalOp *op){
- MSList *it;
+static void linphone_transfer_routes_to_op(bctbx_list_t *routes, SalOp *op){
+ bctbx_list_t *it;
for(it=routes;it!=NULL;it=it->next){
SalAddress *addr=(SalAddress*)it->data;
sal_op_add_route_address(op,addr);
sal_address_destroy(addr);
}
- ms_list_free(routes);
+ bctbx_list_free(routes);
}
void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact){
- MSList *routes=NULL;
+ bctbx_list_t *routes=NULL;
LinphoneProxyConfig *proxy=linphone_core_lookup_known_proxy(lc,dest);
const char *identity;
if (proxy){
@@ -3435,7 +3441,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
linphone_core_notify_display_status(lc,barmesg);
/* play the ring if this is the only call*/
- if (ms_list_size(lc->calls)==1){
+ if (bctbx_list_size(lc->calls)==1){
MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard;
lc->current_call=call;
if (lc->ringstream && lc->dmfs_playing_start_time!=0){
@@ -3604,6 +3610,8 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
ms_error("linphone_core_update_call() is not allowed in [%s] state",linphone_call_state_to_string(call->state));
return -1;
}
+
+ linphone_call_check_ice_session(call, IR_Controlling, TRUE);
if (params!=NULL){
call->broken = FALSE;
@@ -3787,11 +3795,10 @@ int _linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, cons
/*update multicast params according to call params*/
linphone_call_fill_media_multicast_addr(call);
+ linphone_call_check_ice_session(call, IR_Controlled, TRUE);
linphone_call_init_media_streams(call); /*so that video stream is initialized if necessary*/
- if (call->ice_session != NULL) {
- if (linphone_call_prepare_ice(call,TRUE)==1)
- return 0;/*deferred to completion of ICE gathering*/
- }
+ if (linphone_call_prepare_ice(call,TRUE)==1)
+ return 0;/*deferred to completion of ICE gathering*/
#ifdef BUILD_UPNP
if(call->upnp_session != NULL) {
@@ -3846,7 +3853,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
SalOp *replaced;
SalMediaDescription *new_md;
bool_t was_ringing=FALSE;
- MSList * iterator, *copy;
+ bctbx_list_t * iterator, *copy;
if (call==NULL){
//if just one call is present answer the only one ...
@@ -3868,7 +3875,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
}
- for (iterator=copy=ms_list_copy(linphone_core_get_calls(lc));iterator!=NULL;iterator=iterator->next) {
+ for (iterator=copy=bctbx_list_copy(linphone_core_get_calls(lc));iterator!=NULL;iterator=iterator->next) {
LinphoneCall *a_call=(LinphoneCall*)iterator->data;
if (a_call==call) continue;
switch(a_call->state){
@@ -3885,7 +3892,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
break; /*nothing to do*/
}
}
- ms_list_free(copy);
+ bctbx_list_free(copy);
/* check if this call is supposed to replace an already running one*/
replaced=sal_call_get_replaces(call->op);
@@ -4023,7 +4030,7 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call)
LinphoneCall *call;
if (the_call == NULL){
call = linphone_core_get_current_call(lc);
- if (ms_list_size(lc->calls)==1){
+ if (bctbx_list_size(lc->calls)==1){
call=(LinphoneCall*)lc->calls->data;
}else{
ms_warning("No unique call to terminate !");
@@ -4085,7 +4092,7 @@ int linphone_core_decline_call(LinphoneCore *lc, LinphoneCall * call, LinphoneRe
* @param lc The LinphoneCore
**/
int linphone_core_terminate_all_calls(LinphoneCore *lc){
- MSList *calls=lc->calls;
+ bctbx_list_t *calls=lc->calls;
while(calls) {
LinphoneCall *c=(LinphoneCall*)calls->data;
calls=calls->next;
@@ -4105,7 +4112,7 @@ int linphone_core_terminate_all_calls(LinphoneCore *lc){
*
* @ingroup call_control
**/
-const MSList *linphone_core_get_calls(LinphoneCore *lc)
+const bctbx_list_t *linphone_core_get_calls(LinphoneCore *lc)
{
return lc->calls;
}
@@ -4181,7 +4188,7 @@ int _linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call){
* @ingroup call_control
**/
int linphone_core_pause_all_calls(LinphoneCore *lc){
- const MSList *elem;
+ const bctbx_list_t *elem;
for(elem=lc->calls;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall *)elem->data;
LinphoneCallState cs=linphone_call_get_state(call);
@@ -4296,7 +4303,7 @@ LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const c
return call;
}
LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, const LinphoneAddress *raddr){
- MSList *elem=ms_list_find_custom(lc->calls,(int (*)(const void*,const void *))remote_address_compare,raddr);
+ bctbx_list_t *elem=bctbx_list_find_custom(lc->calls,(int (*)(const void*,const void *))remote_address_compare,raddr);
if (elem) return (LinphoneCall*) elem->data;
return NULL;
@@ -4305,8 +4312,8 @@ LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, const
int linphone_core_send_publish(LinphoneCore *lc,
LinphonePresenceModel *presence)
{
- const MSList *elem;
- for (elem=linphone_core_get_proxy_config_list(lc);elem!=NULL;elem=ms_list_next(elem)){
+ const bctbx_list_t *elem;
+ for (elem=linphone_core_get_proxy_config_list(lc);elem!=NULL;elem=bctbx_list_next(elem)){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
if (cfg->publish) linphone_proxy_config_send_publish(cfg,presence);
}
@@ -4659,7 +4666,7 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap, M
sndcard=ms_snd_card_manager_get_default_playback_card(ms_factory_get_snd_card_manager(f));
}
if (sndcard==NULL){/*looks like a bug! take the first one !*/
- const MSList *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_card_manager(f));
+ const bctbx_list_t *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_card_manager(f));
if (elem) sndcard=(MSSndCard*)elem->data;
}
}
@@ -5053,8 +5060,8 @@ bool_t linphone_core_is_mic_muted(LinphoneCore *lc) {
void linphone_core_enable_mic(LinphoneCore *lc, bool_t enable) {
LinphoneCall *call;
- const MSList *list;
- const MSList *elem;
+ const bctbx_list_t *list;
+ const bctbx_list_t *elem;
if (linphone_core_is_in_conference(lc)){
linphone_conference_mute_microphone(lc->conf_ctx, !enable);
@@ -5107,29 +5114,18 @@ void linphone_core_send_dtmf(LinphoneCore *lc, char dtmf)
linphone_call_send_dtmf(call, dtmf);
}
-void linphone_core_set_stun_server(LinphoneCore *lc, const char *server){
- if (lc->net_conf.stun_server!=NULL)
- ms_free(lc->net_conf.stun_server);
- if (server)
- lc->net_conf.stun_server=ms_strdup(server);
- else lc->net_conf.stun_server=NULL;
-
- /* each time the stun server is changed, we must clean the resolved cached addrinfo*/
- if (lc->net_conf.stun_addrinfo){
- freeaddrinfo(lc->net_conf.stun_addrinfo);
- lc->net_conf.stun_addrinfo=NULL;
- }
- /*if a stun server is set, we must request asynchronous resolution immediately to be ready for call*/
- if (lc->net_conf.stun_server){
- linphone_core_resolve_stun_server(lc);
- }
-
- if (linphone_core_ready(lc))
- lp_config_set_string(lc->config,"net","stun_server",lc->net_conf.stun_server);
+void linphone_core_set_stun_server(LinphoneCore *lc, const char *server) {
+ if (lc->nat_policy != NULL)
+ linphone_nat_policy_set_stun_server(lc->nat_policy, server);
+ else
+ lp_config_set_string(lc->config, "net", "stun_server", server);
}
const char * linphone_core_get_stun_server(const LinphoneCore *lc){
- return lc->net_conf.stun_server;
+ if (lc->nat_policy != NULL)
+ return linphone_nat_policy_get_stun_server(lc->nat_policy);
+ else
+ return lp_config_get_string(lc->config, "net", "stun_server", NULL);
}
@@ -5198,66 +5194,74 @@ const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc)
return lc->net_conf.nat_address_ip;
}
-void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol){
- const char *policy = "none";
+void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol) {
+ LinphoneNatPolicy *nat_policy;
+ char *stun_server = NULL;
+ char *stun_server_username = NULL;
+
+ if (lc->nat_policy != NULL) {
+ nat_policy = linphone_nat_policy_ref(lc->nat_policy);
+ stun_server = ms_strdup(linphone_nat_policy_get_stun_server(nat_policy));
+ stun_server_username = ms_strdup(linphone_nat_policy_get_stun_server_username(nat_policy));
+ linphone_nat_policy_clear(nat_policy);
+ } else {
+ nat_policy = linphone_core_create_nat_policy(lc);
+ stun_server = ms_strdup(linphone_core_get_stun_server(lc));
+ }
switch (pol) {
default:
case LinphonePolicyNoFirewall:
- policy = "none";
- break;
case LinphonePolicyUseNatAddress:
- policy = "nat_address";
break;
case LinphonePolicyUseStun:
- policy = "stun";
+ linphone_nat_policy_enable_stun(nat_policy, TRUE);
break;
case LinphonePolicyUseIce:
- policy = "ice";
+ linphone_nat_policy_enable_ice(nat_policy, TRUE);
+ linphone_nat_policy_enable_stun(nat_policy, TRUE);
break;
case LinphonePolicyUseUpnp:
#ifdef BUILD_UPNP
- policy = "upnp";
+ linphone_nat_policy_enable_upnp(nat_policy, TRUE);
#else
ms_warning("UPNP is not available, reset firewall policy to no firewall");
- pol = LinphonePolicyNoFirewall;
- policy = "none";
#endif //BUILD_UPNP
break;
}
-#ifdef BUILD_UPNP
- if(pol == LinphonePolicyUseUpnp) {
- if(lc->upnp == NULL) {
- lc->upnp = linphone_upnp_context_new(lc);
- }
- } else {
- if(lc->upnp != NULL) {
- linphone_upnp_context_destroy(lc->upnp);
- lc->upnp = NULL;
- }
+
+ if (stun_server_username != NULL) {
+ linphone_nat_policy_set_stun_server_username(nat_policy, stun_server_username);
+ ms_free(stun_server_username);
}
- linphone_core_enable_keep_alive(lc, (lc->sip_conf.keepalive_period > 0));
-#endif //BUILD_UPNP
- switch(pol) {
- case LinphonePolicyUseUpnp:
- sal_nat_helper_enable(lc->sal, FALSE);
- sal_enable_auto_contacts(lc->sal,FALSE);
- sal_use_rport(lc->sal, FALSE);
- break;
- default:
- sal_nat_helper_enable(lc->sal, lp_config_get_int(lc->config,"net","enable_nat_helper",1));
- sal_enable_auto_contacts(lc->sal,TRUE);
- sal_use_rport(lc->sal, lp_config_get_int(lc->config,"sip","use_rport",1));
- break;
+ if (stun_server != NULL) {
+ linphone_nat_policy_set_stun_server(nat_policy, stun_server);
+ ms_free(stun_server);
}
- if (lc->sip_conf.contact) update_primary_contact(lc);
- if (linphone_core_ready(lc))
- lp_config_set_string(lc->config,"net","firewall_policy",policy);
+ linphone_core_set_nat_policy(lc, nat_policy);
+ linphone_nat_policy_unref(nat_policy);
+
+ /* Ensure that the firewall policy is cleared in the config because it has been replaced by the nat_policy. */
+ lp_config_set_string(lc->config, "net", "firewall_policy", NULL);
}
-LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc){
+
+LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc) {
const char *policy;
+
policy = lp_config_get_string(lc->config, "net", "firewall_policy", NULL);
- if ((policy == NULL) || (strcmp(policy, "0") == 0))
+ if (policy == NULL) {
+ LinphoneNatPolicy *nat_policy = linphone_core_get_nat_policy(lc);
+ if (nat_policy == NULL) {
+ return LinphonePolicyNoFirewall;
+ } else if (linphone_nat_policy_upnp_enabled(nat_policy))
+ return LinphonePolicyUseUpnp;
+ else if (linphone_nat_policy_ice_enabled(nat_policy))
+ return LinphonePolicyUseIce;
+ else if (linphone_nat_policy_stun_enabled(nat_policy))
+ return LinphonePolicyUseStun;
+ else
+ return LinphonePolicyNoFirewall;
+ } else if (strcmp(policy, "0") == 0)
return LinphonePolicyNoFirewall;
else if ((strcmp(policy, "nat_address") == 0) || (strcmp(policy, "1") == 0))
return LinphonePolicyUseNatAddress;
@@ -5271,6 +5275,49 @@ LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc)
return LinphonePolicyNoFirewall;
}
+void linphone_core_set_nat_policy(LinphoneCore *lc, LinphoneNatPolicy *policy) {
+ if (policy != NULL) policy = linphone_nat_policy_ref(policy); /* Prevent object destruction if the same policy is used */
+ else{
+ ms_error("linphone_core_set_nat_policy() setting to NULL is not allowed");
+ return ;
+ }
+ if (lc->nat_policy != NULL) {
+ linphone_nat_policy_unref(lc->nat_policy);
+ lc->nat_policy = NULL;
+ }
+ if (policy != NULL){
+ lc->nat_policy = policy;
+ /*start an immediate (but asynchronous) resolution.*/
+ linphone_nat_policy_resolve_stun_server(policy);
+ }
+
+#ifdef BUILD_UPNP
+ linphone_core_enable_keep_alive(lc, (lc->sip_conf.keepalive_period > 0));
+ if (linphone_nat_policy_upnp_enabled(policy)) {
+ if (lc->upnp == NULL) {
+ lc->upnp = linphone_upnp_context_new(lc);
+ }
+ sal_nat_helper_enable(lc->sal, FALSE);
+ sal_enable_auto_contacts(lc->sal, FALSE);
+ sal_use_rport(lc->sal, FALSE);
+ } else {
+ if (lc->upnp != NULL) {
+ linphone_upnp_context_destroy(lc->upnp);
+ lc->upnp = NULL;
+ }
+#endif
+ sal_nat_helper_enable(lc->sal, lp_config_get_int(lc->config, "net", "enable_nat_helper", 1));
+ sal_enable_auto_contacts(lc->sal, TRUE);
+ sal_use_rport(lc->sal, lp_config_get_int(lc->config, "sip", "use_rport", 1));
+ if (lc->sip_conf.contact) update_primary_contact(lc);
+#ifdef BUILD_UPNP
+ }
+#endif
+}
+
+LinphoneNatPolicy * linphone_core_get_nat_policy(const LinphoneCore *lc) {
+ return lc->nat_policy;
+}
/*******************************************************************************
@@ -5290,7 +5337,7 @@ void linphone_core_set_call_logs_database_path(LinphoneCore *lc, const char *pat
}
}
-const MSList* linphone_core_get_call_logs(LinphoneCore *lc) {
+const bctbx_list_t* linphone_core_get_call_logs(LinphoneCore *lc) {
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
linphone_core_get_call_history(lc);
@@ -5309,8 +5356,8 @@ void linphone_core_clear_call_logs(LinphoneCore *lc) {
}
#endif
if (!call_logs_sqlite_db_found) {
- ms_list_for_each(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
- lc->call_logs = ms_list_free(lc->call_logs);
+ bctbx_list_for_each(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
+ lc->call_logs = bctbx_list_free(lc->call_logs);
call_logs_write_to_config_file(lc);
}
}
@@ -5332,14 +5379,14 @@ void linphone_core_remove_call_log(LinphoneCore *lc, LinphoneCallLog *cl) {
}
#endif
if (!call_logs_sqlite_db_found) {
- lc->call_logs = ms_list_remove(lc->call_logs, cl);
+ lc->call_logs = bctbx_list_remove(lc->call_logs, cl);
call_logs_write_to_config_file(lc);
linphone_call_log_unref(cl);
}
}
void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
- MSList *logs_to_migrate = NULL;
+ bctbx_list_t *logs_to_migrate = NULL;
LpConfig *lpc = NULL;
int original_logs_count, migrated_logs_count;
int i;
@@ -5363,7 +5410,7 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
}
// This is because there must have been a call previously to linphone_core_call_log_storage_init
- lc->call_logs = ms_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
+ lc->call_logs = bctbx_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
call_logs_read_from_config_file(lc);
if (!lc->call_logs) {
@@ -5373,17 +5420,17 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
logs_to_migrate = lc->call_logs;
lc->call_logs = NULL;
- // We can't use ms_list_for_each because logs_to_migrate are listed in the wrong order (latest first), and we want to store the logs latest last
- for (i = ms_list_size(logs_to_migrate) - 1; i >= 0; i--) {
- LinphoneCallLog *log = (LinphoneCallLog *) ms_list_nth_data(logs_to_migrate, i);
+ // We can't use bctbx_list_for_each because logs_to_migrate are listed in the wrong order (latest first), and we want to store the logs latest last
+ for (i = bctbx_list_size(logs_to_migrate) - 1; i >= 0; i--) {
+ LinphoneCallLog *log = (LinphoneCallLog *) bctbx_list_nth_data(logs_to_migrate, i);
linphone_core_store_call_log(lc, log);
}
- original_logs_count = ms_list_size(logs_to_migrate);
- migrated_logs_count = ms_list_size(lc->call_logs);
+ original_logs_count = bctbx_list_size(logs_to_migrate);
+ migrated_logs_count = bctbx_list_size(lc->call_logs);
if (original_logs_count == migrated_logs_count) {
int i = 0;
- ms_debug("call logs migration successful: %i logs migrated", ms_list_size(lc->call_logs));
+ ms_debug("call logs migration successful: %u logs migrated", (unsigned int)bctbx_list_size(lc->call_logs));
lp_config_set_int(lpc, "misc", "call_logs_migration_done", 1);
for (; i < original_logs_count; i++) {
@@ -5395,7 +5442,7 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
ms_error("not as many logs saved in db has logs read from rc (%i in rc against %i in db)!", original_logs_count, migrated_logs_count);
}
- ms_list_free_with_data(logs_to_migrate, (void (*)(void*))linphone_call_log_unref);
+ bctbx_list_free_with_data(logs_to_migrate, (void (*)(void*))linphone_call_log_unref);
}
@@ -5771,7 +5818,7 @@ void * linphone_core_get_native_video_window_id(const LinphoneCore *lc){
static void unset_video_window_id(LinphoneCore *lc, bool_t preview, void *id){
#ifdef VIDEO_ENABLED
LinphoneCall *call;
- MSList *elem;
+ bctbx_list_t *elem;
#endif
if ((id != NULL)
@@ -6371,13 +6418,6 @@ void net_config_uninit(LinphoneCore *lc)
{
net_config_t *config=&lc->net_conf;
- if (config->stun_server!=NULL){
- ms_free(config->stun_server);
- }
- if (config->stun_addrinfo){
- freeaddrinfo(config->stun_addrinfo);
- config->stun_addrinfo=NULL;
- }
if (config->nat_address!=NULL){
lp_config_set_string(lc->config,"net","nat_address",config->nat_address);
ms_free(lc->net_conf.nat_address);
@@ -6386,12 +6426,18 @@ void net_config_uninit(LinphoneCore *lc)
ms_free(lc->net_conf.nat_address_ip);
}
lp_config_set_int(lc->config,"net","mtu",config->mtu);
+ if (lc->nat_policy != NULL) {
+ lp_config_set_string(lc->config, "net", "nat_policy_ref", lc->nat_policy->ref);
+ linphone_nat_policy_save_to_config(lc->nat_policy);
+ linphone_nat_policy_unref(lc->nat_policy);
+ lc->nat_policy = NULL;
+ }
}
void sip_config_uninit(LinphoneCore *lc)
{
- MSList *elem;
+ bctbx_list_t *elem;
int i;
sip_config_t *config=&lc->sip_conf;
bool_t still_registered=TRUE;
@@ -6405,7 +6451,7 @@ void sip_config_uninit(LinphoneCore *lc)
lp_config_set_int(lc->config,"sip","register_only_when_upnp_is_ok",config->register_only_when_upnp_is_ok);
if (lc->sip_network_reachable) {
- for(elem=config->proxies;elem!=NULL;elem=ms_list_next(elem)){
+ for(elem=config->proxies;elem!=NULL;elem=bctbx_list_next(elem)){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)(elem->data);
_linphone_proxy_config_unpublish(cfg); /* to unpublish without changing the stored flag enable_publish */
_linphone_proxy_config_unregister(cfg); /* to unregister without changing the stored flag enable_register */
@@ -6416,7 +6462,7 @@ void sip_config_uninit(LinphoneCore *lc)
for (i=0;i<20&&still_registered;i++){
still_registered=FALSE;
sal_iterate(lc->sal);
- for(elem=config->proxies;elem!=NULL;elem=ms_list_next(elem)){
+ for(elem=config->proxies;elem!=NULL;elem=bctbx_list_next(elem)){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)(elem->data);
LinphoneRegistrationState state = linphone_proxy_config_get_state(cfg);
still_registered|=(state==LinphoneRegistrationOk||state==LinphoneRegistrationProgress);
@@ -6425,13 +6471,13 @@ void sip_config_uninit(LinphoneCore *lc)
}
if (i>=20) ms_warning("Cannot complete unregistration, giving up");
}
- config->proxies=ms_list_free_with_data(config->proxies,(void (*)(void*)) _linphone_proxy_config_release);
+ config->proxies=bctbx_list_free_with_data(config->proxies,(void (*)(void*)) _linphone_proxy_config_release);
- config->deleted_proxies=ms_list_free_with_data(config->deleted_proxies,(void (*)(void*)) _linphone_proxy_config_release);
+ config->deleted_proxies=bctbx_list_free_with_data(config->deleted_proxies,(void (*)(void*)) _linphone_proxy_config_release);
/*no longuer need to write proxy config if not changedlinphone_proxy_config_write_to_config_file(lc->config,NULL,i);*/ /*mark the end */
- lc->auth_info=ms_list_free_with_data(lc->auth_info,(void (*)(void*))linphone_auth_info_destroy);
+ lc->auth_info=bctbx_list_free_with_data(lc->auth_info,(void (*)(void*))linphone_auth_info_destroy);
/*now that we are unregisted, we no longer need the tunnel.*/
#ifdef TUNNEL_ENABLED
@@ -6494,7 +6540,7 @@ void rtp_config_uninit(LinphoneCore *lc)
static void sound_config_uninit(LinphoneCore *lc)
{
sound_config_t *config=&lc->sound_conf;
- ms_free(config->cards);
+ ms_free((void *)config->cards);
lp_config_set_string(lc->config,"sound","remote_ring",config->remote_ring);
lp_config_set_float(lc->config,"sound","playback_gain_db",config->soft_play_lev);
@@ -6502,7 +6548,7 @@ static void sound_config_uninit(LinphoneCore *lc)
if (config->local_ring) ms_free(config->local_ring);
if (config->remote_ring) ms_free(config->remote_ring);
- lc->tones=ms_list_free_with_data(lc->tones, (void (*)(void*))linphone_tone_description_destroy);
+ lc->tones=bctbx_list_free_with_data(lc->tones, (void (*)(void*))linphone_tone_description_destroy);
}
static void video_config_uninit(LinphoneCore *lc)
@@ -6511,18 +6557,18 @@ static void video_config_uninit(LinphoneCore *lc)
lp_config_set_int(lc->config,"video","display",lc->video_conf.display);
lp_config_set_int(lc->config,"video","capture",lc->video_conf.capture);
if (lc->video_conf.cams)
- ms_free(lc->video_conf.cams);
+ ms_free((void *)lc->video_conf.cams);
}
void _linphone_core_codec_config_write(LinphoneCore *lc){
if (linphone_core_ready(lc)){
PayloadType *pt;
codecs_config_t *config=&lc->codecs_conf;
- MSList *node;
+ bctbx_list_t *node;
char key[50];
int index;
index=0;
- for(node=config->audio_codecs;node!=NULL;node=ms_list_next(node)){
+ for(node=config->audio_codecs;node!=NULL;node=bctbx_list_next(node)){
pt=(PayloadType*)(node->data);
sprintf(key,"audio_codec_%i",index);
lp_config_set_string(lc->config,key,"mime",pt->mime_type);
@@ -6535,7 +6581,7 @@ void _linphone_core_codec_config_write(LinphoneCore *lc){
lp_config_clean_section (lc->config,key);
index=0;
- for(node=config->video_codecs;node!=NULL;node=ms_list_next(node)){
+ for(node=config->video_codecs;node!=NULL;node=bctbx_list_next(node)){
pt=(PayloadType*)(node->data);
sprintf(key,"video_codec_%i",index);
lp_config_set_string(lc->config,key,"mime",pt->mime_type);
@@ -6552,17 +6598,17 @@ void _linphone_core_codec_config_write(LinphoneCore *lc){
static void codecs_config_uninit(LinphoneCore *lc)
{
_linphone_core_codec_config_write(lc);
- ms_list_free_with_data(lc->codecs_conf.audio_codecs, (void (*)(void*))payload_type_destroy);
- ms_list_free_with_data(lc->codecs_conf.video_codecs, (void (*)(void*))payload_type_destroy);
- ms_list_free_with_data(lc->codecs_conf.text_codecs, (void (*)(void*))payload_type_destroy);
+ bctbx_list_free_with_data(lc->codecs_conf.audio_codecs, (void (*)(void*))payload_type_destroy);
+ bctbx_list_free_with_data(lc->codecs_conf.video_codecs, (void (*)(void*))payload_type_destroy);
+ bctbx_list_free_with_data(lc->codecs_conf.text_codecs, (void (*)(void*))payload_type_destroy);
}
void friends_config_uninit(LinphoneCore* lc)
{
ms_message("Destroying friends.");
- lc->friends_lists = ms_list_free_with_data(lc->friends_lists, (void (*)(void*))_linphone_friend_list_release);
+ lc->friends_lists = bctbx_list_free_with_data(lc->friends_lists, (void (*)(void*))_linphone_friend_list_release);
if (lc->subscribers) {
- lc->subscribers = ms_list_free_with_data(lc->subscribers, (void (*)(void *))_linphone_friend_release);
+ lc->subscribers = bctbx_list_free_with_data(lc->subscribers, (void (*)(void *))_linphone_friend_release);
}
if (lc->presence_model) {
linphone_presence_model_unref(lc->presence_model);
@@ -6589,7 +6635,7 @@ LpConfig * linphone_core_create_lp_config(LinphoneCore *lc, const char *filename
static void linphone_core_uninit(LinphoneCore *lc)
{
- MSList *elem = NULL;
+ bctbx_list_t *elem = NULL;
int i=0;
bool_t wait_until_unsubscribe = FALSE;
linphone_task_list_free(&lc->hooks);
@@ -6602,7 +6648,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
ms_usleep(10000);
}
- for (elem = lc->friends_lists; elem != NULL; elem = ms_list_next(elem)) {
+ for (elem = lc->friends_lists; elem != NULL; elem = bctbx_list_next(elem)) {
LinphoneFriendList *list = (LinphoneFriendList *)elem->data;
linphone_friend_list_enable_subscriptions(list,FALSE);
if (list->event)
@@ -6614,7 +6660,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
ms_usleep(10000);
}
- lc->chatrooms = ms_list_free_with_data(lc->chatrooms, (MSIterateFunc)linphone_chat_room_release);
+ lc->chatrooms = bctbx_list_free_with_data(lc->chatrooms, (MSIterateFunc)linphone_chat_room_release);
linphone_core_set_state(lc,LinphoneGlobalShutdown,"Shutting down");
#ifdef VIDEO_ENABLED
@@ -6648,11 +6694,11 @@ static void linphone_core_uninit(LinphoneCore *lc)
lp_config_destroy(lc->config);
lc->config = NULL; /* Mark the config as NULL to block further calls */
- ms_list_for_each(lc->call_logs,(void (*)(void*))linphone_call_log_unref);
- lc->call_logs=ms_list_free(lc->call_logs);
+ bctbx_list_for_each(lc->call_logs,(void (*)(void*))linphone_call_log_unref);
+ lc->call_logs=bctbx_list_free(lc->call_logs);
- ms_list_for_each(lc->last_recv_msg_ids,ms_free);
- lc->last_recv_msg_ids=ms_list_free(lc->last_recv_msg_ids);
+ bctbx_list_for_each(lc->last_recv_msg_ids,ms_free);
+ lc->last_recv_msg_ids=bctbx_list_free(lc->last_recv_msg_ids);
if(lc->zrtp_secrets_cache != NULL) {
ms_free(lc->zrtp_secrets_cache);
@@ -6680,14 +6726,14 @@ static void linphone_core_uninit(LinphoneCore *lc)
}
linphone_core_free_payload_types(lc);
- if (lc->supported_formats) ms_free(lc->supported_formats);
+ if (lc->supported_formats) ms_free((void *)lc->supported_formats);
linphone_core_message_storage_close(lc);
linphone_core_call_log_storage_close(lc);
linphone_core_friends_storage_close(lc);
linphone_core_set_state(lc,LinphoneGlobalOff,"Off");
linphone_core_deactivate_log_serialization_if_needed();
- ms_list_free_with_data(lc->vtable_refs,(void (*)(void *))v_table_reference_destroy);
+ bctbx_list_free_with_data(lc->vtable_refs,(void (*)(void *))v_table_reference_destroy);
ms_factory_destroy(lc->factory);
}
@@ -6704,7 +6750,7 @@ static void stop_refreshing_proxy_config(bool_t is_sip_reachable, LinphoneProxyC
}
static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable, time_t curtime){
// second get the list of available proxies
- const MSList *elem = NULL;
+ const bctbx_list_t *elem = NULL;
if (lc->sip_network_reachable==is_sip_reachable) return; // no change, ignore.
lc->network_reachable_to_be_notified=TRUE;
@@ -6728,7 +6774,7 @@ static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable,
linphone_core_invalidate_friend_subscriptions(lc);
sal_reset_transports(lc->sal);
/*mark all calls as broken, so that they can be either dropped immediately or restaured when network will be back*/
- ms_list_for_each(lc->calls, (MSIterateFunc) linphone_call_set_broken);
+ bctbx_list_for_each(lc->calls, (MSIterateFunc) linphone_call_set_broken);
}else{
linphone_core_resolve_stun_server(lc);
}
@@ -6749,7 +6795,7 @@ static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable,
void linphone_core_repair_calls(LinphoneCore *lc){
if (lc->calls && lp_config_get_int(lc->config, "sip", "repair_broken_calls", 1) && lc->media_network_reachable){
/*if we are registered and there were broken calls due to a past network disconnection, attempt to repair them*/
- ms_list_for_each(lc->calls, (MSIterateFunc) linphone_call_repair_if_broken);
+ bctbx_list_for_each(lc->calls, (MSIterateFunc) linphone_call_repair_if_broken);
}
}
@@ -6760,10 +6806,10 @@ static void set_media_network_reachable(LinphoneCore* lc, bool_t is_media_reacha
if (!lc->media_network_reachable){
/*mark all calls as broken, so that they can be either dropped immediately or restaured when network will be back*/
- ms_list_for_each(lc->calls, (MSIterateFunc) linphone_call_set_broken);
+ bctbx_list_for_each(lc->calls, (MSIterateFunc) linphone_call_set_broken);
}else{
if (lp_config_get_int(lc->config, "net", "recreate_sockets_when_network_is_up", 0)){
- ms_list_for_each(lc->calls, (MSIterateFunc)linphone_call_refresh_sockets);
+ bctbx_list_for_each(lc->calls, (MSIterateFunc)linphone_call_refresh_sockets);
}
linphone_core_repair_calls(lc);
}
@@ -6775,7 +6821,7 @@ static void set_network_reachable(LinphoneCore *lc, bool_t is_network_reachable,
}
void linphone_core_refresh_registers(LinphoneCore* lc) {
- const MSList *elem;
+ const bctbx_list_t *elem;
if (!lc->sip_network_reachable) {
ms_warning("Refresh register operation not available (network unreachable)");
return;
@@ -6790,7 +6836,7 @@ void linphone_core_refresh_registers(LinphoneCore* lc) {
}
void __linphone_core_invalidate_registers(LinphoneCore* lc){
- const MSList *elem=linphone_core_get_proxy_config_list(lc);
+ const bctbx_list_t *elem=linphone_core_get_proxy_config_list(lc);
for(;elem!=NULL;elem=elem->next){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
if (linphone_proxy_config_register_enabled(cfg)) {
@@ -6843,7 +6889,7 @@ void linphone_core_destroy(LinphoneCore *lc){
* @ingroup call_control
**/
int linphone_core_get_calls_nb(const LinphoneCore *lc){
- return ms_list_size(lc->calls);;
+ return bctbx_list_size(lc->calls);;
}
/**
@@ -6867,7 +6913,7 @@ static void notify_soundcard_usage(LinphoneCore *lc, bool_t used){
}
void linphone_core_soundcard_hint_check( LinphoneCore* lc){
- MSList* the_calls = lc->calls;
+ bctbx_list_t* the_calls = lc->calls;
LinphoneCall* call = NULL;
bool_t dont_need_sound = TRUE;
bool_t use_rtp_io = lp_config_get_int(lc->config, "sound", "rtp_io", FALSE);
@@ -6893,7 +6939,7 @@ int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call)
{
if (linphone_core_can_we_add_call(lc)){
if (lc->calls==NULL) notify_soundcard_usage(lc,TRUE);
- lc->calls = ms_list_append(lc->calls,call);
+ lc->calls = bctbx_list_append(lc->calls,call);
return 0;
}
return -1;
@@ -6901,13 +6947,13 @@ int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call)
int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
{
- MSList *it;
- MSList *the_calls = lc->calls;
+ bctbx_list_t *it;
+ bctbx_list_t *the_calls = lc->calls;
- it=ms_list_find(the_calls,call);
+ it=bctbx_list_find(the_calls,call);
if (it)
{
- the_calls = ms_list_remove_link(the_calls,it);
+ the_calls = bctbx_list_remove_link(the_calls,it);
}
else
{
@@ -7179,7 +7225,7 @@ const char *linphone_core_get_user_certificates_path(LinphoneCore *lc){
}
LinphoneCall* linphone_core_find_call_from_uri(const LinphoneCore *lc, const char *uri) {
- MSList *calls;
+ bctbx_list_t *calls;
LinphoneCall *c;
const LinphoneAddress *address;
char *current_uri;
@@ -7214,7 +7260,7 @@ LinphoneCall* linphone_core_find_call_from_uri(const LinphoneCore *lc, const cha
* @param lc The LinphoneCore
**/
bool_t linphone_core_sound_resources_locked(LinphoneCore *lc){
- MSList *elem;
+ bctbx_list_t *elem;
for(elem=lc->calls;elem!=NULL;elem=elem->next) {
LinphoneCall *c=(LinphoneCall*)elem->data;
@@ -7784,7 +7830,7 @@ int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call) {
}
int linphone_core_add_all_to_conference(LinphoneCore *lc) {
- MSList *calls=lc->calls;
+ bctbx_list_t *calls=lc->calls;
while (calls) {
LinphoneCall *call=(LinphoneCall*)calls->data;
calls=calls->next;
diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h
index 773c16877..eafc3512d 100644
--- a/coreapi/linphonecore.h
+++ b/coreapi/linphonecore.h
@@ -406,6 +406,7 @@ LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
#include "content.h"
#include "event.h"
#include "linphonefriend.h"
+#include "nat_policy.h"
#include "xmlrpc.h"
#include "conference.h"
#else
@@ -415,6 +416,7 @@ LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
#include "linphone/content.h"
#include "linphone/event.h"
#include "linphone/linphonefriend.h"
+#include "linphone/nat_policy.h"
#include "linphone/xmlrpc.h"
#include "linphone/conference.h"
#endif
@@ -1474,7 +1476,7 @@ LINPHONE_PUBLIC int linphone_chat_room_get_history_size(LinphoneChatRoom *cr);
* @param[in] nb_message Number of message to retrieve. 0 means everything.
* @return \mslist{LinphoneChatMessage}
*/
-LINPHONE_PUBLIC MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message);
+LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message);
/**
* Gets the partial list of messages in the given range, sorted from oldest to most recent.
@@ -1483,7 +1485,7 @@ LINPHONE_PUBLIC MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int
* @param[in] end The last message of the range to be retrieved. History oldest message has index of history size - 1 (use #linphone_chat_room_get_history_size to retrieve history size)
* @return \mslist{LinphoneChatMessage}
*/
-LINPHONE_PUBLIC MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end);
+LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end);
/**
* Notifies the destination of the chat message being composed that the user is typing a new message.
@@ -1534,7 +1536,7 @@ LINPHONE_PUBLIC uint32_t linphone_chat_room_get_char(const LinphoneChatRoom *cr)
* @param[in] lc #LinphoneCore object
* @return \mslist{LinphoneChatRoom}
**/
-LINPHONE_PUBLIC const MSList* linphone_core_get_chat_rooms(LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t* linphone_core_get_chat_rooms(LinphoneCore *lc);
LINPHONE_PUBLIC unsigned int linphone_chat_message_store(LinphoneChatMessage *msg);
/**
@@ -2194,6 +2196,7 @@ typedef struct _LCCallbackObj
/**
* Policy to use to pass through firewalls.
* @ingroup network_parameters
+ * @deprecated Use LinphoneNatPolicy instead
**/
typedef enum _LinphoneFirewallPolicy {
LinphonePolicyNoFirewall, /**< Do not use any mechanism to pass through firewalls */
@@ -2264,7 +2267,7 @@ LINPHONE_PUBLIC void linphone_core_set_log_collection_prefix(const char *prefix)
* Get the max file size in bytes of the files used for log collection.
* @return The max file size in bytes of the files used for log collection.
*/
-LINPHONE_PUBLIC int linphone_core_get_log_collection_max_file_size(void);
+LINPHONE_PUBLIC size_t linphone_core_get_log_collection_max_file_size(void);
/**
* Set the max file size in bytes of the files used for log collection.
@@ -2274,7 +2277,7 @@ LINPHONE_PUBLIC int linphone_core_get_log_collection_max_file_size(void);
* on runtime, logs chronological order COULD be broken.
* @param[in] size The max file size in bytes of the files used for log collection.
*/
-LINPHONE_PUBLIC void linphone_core_set_log_collection_max_file_size(int size);
+LINPHONE_PUBLIC void linphone_core_set_log_collection_max_file_size(size_t size);
/**
* Set the url of the server where to upload the collected log files.
@@ -2754,58 +2757,58 @@ LINPHONE_PUBLIC bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc);
/**
* Forces liblinphone to use the supplied list of dns servers, instead of system's ones.
* @param[in] lc #LinphoneCore object.
- * @param[in] servers A #MSList of strings containing the IP addresses of DNS servers to be used.
+ * @param[in] servers A #bctbx_list_t of strings containing the IP addresses of DNS servers to be used.
* Setting to NULL restores default behaviour, which is to use the DNS server list provided by the system.
* The list is copied internally.
* @ingroup media_parameters
*/
-LINPHONE_PUBLIC void linphone_core_set_dns_servers(LinphoneCore *lc, const MSList *servers);
+LINPHONE_PUBLIC void linphone_core_set_dns_servers(LinphoneCore *lc, const bctbx_list_t *servers);
/**
* Returns the list of available audio codecs.
* @param[in] lc The LinphoneCore object
* @return \mslist{PayloadType}
*
- * This list is unmodifiable. The ->data field of the MSList points a PayloadType
+ * This list is unmodifiable. The ->data field of the bctbx_list_t points a PayloadType
* structure holding the codec information.
- * It is possible to make copy of the list with ms_list_copy() in order to modify it
+ * It is possible to make copy of the list with bctbx_list_copy() in order to modify it
* (such as the order of codecs).
* @ingroup media_parameters
**/
-LINPHONE_PUBLIC const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_audio_codecs(const LinphoneCore *lc);
-LINPHONE_PUBLIC int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs);
+LINPHONE_PUBLIC int linphone_core_set_audio_codecs(LinphoneCore *lc, bctbx_list_t *codecs);
/**
* Returns the list of available video codecs.
* @param[in] lc The LinphoneCore object
* @return \mslist{PayloadType}
*
- * This list is unmodifiable. The ->data field of the MSList points a PayloadType
+ * This list is unmodifiable. The ->data field of the bctbx_list_t points a PayloadType
* structure holding the codec information.
- * It is possible to make copy of the list with ms_list_copy() in order to modify it
+ * It is possible to make copy of the list with bctbx_list_copy() in order to modify it
* (such as the order of codecs).
* @ingroup media_parameters
**/
-LINPHONE_PUBLIC const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_video_codecs(const LinphoneCore *lc);
-LINPHONE_PUBLIC int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);
+LINPHONE_PUBLIC int linphone_core_set_video_codecs(LinphoneCore *lc, bctbx_list_t *codecs);
/**
* Returns the list of available text codecs.
* @param[in] lc The LinphoneCore object
* @return \mslist{PayloadType}
*
- * This list is unmodifiable. The ->data field of the MSList points a PayloadType
+ * This list is unmodifiable. The ->data field of the bctbx_list_t points a PayloadType
* structure holding the codec information.
- * It is possible to make copy of the list with ms_list_copy() in order to modify it
+ * It is possible to make copy of the list with bctbx_list_copy() in order to modify it
* (such as the order of codecs).
* @ingroup media_parameters
**/
-LINPHONE_PUBLIC const MSList *linphone_core_get_text_codecs(const LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_text_codecs(const LinphoneCore *lc);
-LINPHONE_PUBLIC int linphone_core_set_text_codecs(LinphoneCore *lc, MSList *codecs);
+LINPHONE_PUBLIC int linphone_core_set_text_codecs(LinphoneCore *lc, bctbx_list_t *codecs);
LINPHONE_PUBLIC void linphone_core_enable_generic_confort_noise(LinphoneCore *lc, bool_t enabled);
@@ -2932,7 +2935,7 @@ LINPHONE_PUBLIC void linphone_core_remove_proxy_config(LinphoneCore *lc, Linphon
* @param[in] lc The LinphoneCore object
* @return \mslist{LinphoneProxyConfig}
**/
-LINPHONE_PUBLIC const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
/** @deprecated Use linphone_core_set_default_proxy_config() instead. */
#define linphone_core_set_default_proxy(lc, config) linphone_core_set_default_proxy_config(lc, config)
@@ -2985,7 +2988,7 @@ LINPHONE_PUBLIC void linphone_core_add_auth_info(LinphoneCore *lc, const Linphon
LINPHONE_PUBLIC void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
-LINPHONE_PUBLIC const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_auth_info_list(const LinphoneCore *lc);
/**
* Find authentication info matching realm, username, domain criteria.
@@ -3192,6 +3195,7 @@ LINPHONE_PUBLIC const char *linphone_core_get_nat_address(const LinphoneCore *lc
* @param[in] lc #LinphoneCore object.
* @param[in] pol The #LinphoneFirewallPolicy to use.
* @ingroup network_parameters
+ * @deprecated Use linphone_core_set_nat_policy() instead.
*/
LINPHONE_PUBLIC void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol);
@@ -3200,9 +3204,30 @@ LINPHONE_PUBLIC void linphone_core_set_firewall_policy(LinphoneCore *lc, Linphon
* @param[in] lc #LinphoneCore object.
* @return The #LinphoneFirewallPolicy that is being used.
* @ingroup network_parameters
+ * @deprecated Use linphone_core_get_nat_policy() instead.
*/
LINPHONE_PUBLIC LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc);
+/**
+ * Set the policy to use to pass through NATs/firewalls.
+ * It may be overridden by a NAT policy for a specific proxy config.
+ * @param[in] lc #LinphoneCore object
+ * @param[in] policy LinphoneNatPolicy object
+ * @ingroup network_parameters
+ * @see linphone_proxy_config_set_nat_policy()
+ */
+LINPHONE_PUBLIC void linphone_core_set_nat_policy(LinphoneCore *lc, 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.
+ * @param[in] lc #LinphoneCore object
+ * @return LinphoneNatPolicy object in use.
+ * @ingroup network_parameters
+ * @see linphone_proxy_config_get_nat_policy()
+ */
+LINPHONE_PUBLIC LinphoneNatPolicy * linphone_core_get_nat_policy(const LinphoneCore *lc);
+
/* sound functions */
/* returns a null terminated static array of string describing the sound devices */
LINPHONE_PUBLIC const char** linphone_core_get_sound_devices(LinphoneCore *lc);
@@ -3365,7 +3390,7 @@ LINPHONE_PUBLIC void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *l
* @param[in] lc LinphoneCore object
* @return \mslist{LinphoneCallLog}
**/
-LINPHONE_PUBLIC const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_call_logs(LinphoneCore *lc);
/**
* Get the list of call logs (past calls) that matches the given #LinphoneAddress.
@@ -3374,7 +3399,7 @@ LINPHONE_PUBLIC const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
* @param[in] addr LinphoneAddress object
* @return \mslist{LinphoneCallLog}
**/
-LINPHONE_PUBLIC MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr);
+LINPHONE_PUBLIC bctbx_list_t * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr);
/**
* Get the latest outgoing call log.
@@ -3862,7 +3887,7 @@ LINPHONE_PUBLIC LpConfig * linphone_core_create_lp_config(LinphoneCore *lc, cons
LINPHONE_PUBLIC void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneCoreWaitingCallback cb, void *user_context);
/*returns the list of registered SipSetup (linphonecore plugins) */
-LINPHONE_PUBLIC const MSList * linphone_core_get_sip_setups(LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_sip_setups(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_destroy(LinphoneCore *lc);
@@ -3886,7 +3911,7 @@ int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, r
LINPHONE_PUBLIC int linphone_core_get_calls_nb(const LinphoneCore *lc);
-LINPHONE_PUBLIC const MSList *linphone_core_get_calls(LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_calls(LinphoneCore *lc);
LINPHONE_PUBLIC LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc);
/**
@@ -4162,7 +4187,7 @@ typedef unsigned int ContactSearchID;
typedef struct _LinphoneContactSearch LinphoneContactSearch;
typedef struct _LinphoneContactProvider LinphoneContactProvider;
-typedef void (*ContactSearchCallback)( LinphoneContactSearch* id, MSList* friends, void* data );
+typedef void (*ContactSearchCallback)( LinphoneContactSearch* id, bctbx_list_t* friends, void* data );
/*
* Remote provisioning
diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc
index 0c5a6fcfc..a96901c52 100644
--- a/coreapi/linphonecore_jni.cc
+++ b/coreapi/linphonecore_jni.cc
@@ -140,6 +140,14 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
return JNI_VERSION_1_2;
}
+static const char* GetStringUTFChars(JNIEnv* env, jstring string) {
+ const char *cstring = string ? env->GetStringUTFChars(string, NULL) : NULL;
+ return cstring;
+}
+
+static void ReleaseStringUTFChars(JNIEnv* env, jstring string, const char *cstring) {
+ if (string) env->ReleaseStringUTFChars(string, cstring);
+}
//LinphoneFactory
extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIEnv* env
@@ -147,7 +155,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIE
,jboolean isDebug
,jstring jdebugTag) {
if (isDebug) {
- LogDomain = env->GetStringUTFChars(jdebugTag, NULL);
+ LogDomain = GetStringUTFChars(env, jdebugTag);
linphone_core_enable_logs_with_cb(linphone_android_ortp_log_handler);
} else {
linphone_core_disable_logs();
@@ -172,9 +180,9 @@ extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setLogCollectionP
,jobject thiz
,jstring jpath) {
- const char* path = env->GetStringUTFChars(jpath, NULL);
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_log_collection_path(path);
- env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
// LinphoneCore
@@ -1338,8 +1346,8 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*
,jstring jfactoryConfig
,jobject juserdata){
- const char* userConfig = juserConfig?env->GetStringUTFChars(juserConfig, NULL):NULL;
- const char* factoryConfig = jfactoryConfig?env->GetStringUTFChars(jfactoryConfig, NULL):NULL;
+ const char* userConfig = GetStringUTFChars(env, juserConfig);
+ const char* factoryConfig = GetStringUTFChars(env, jfactoryConfig);
LinphoneJavaBindings *ljb = new LinphoneJavaBindings(env);
@@ -1353,8 +1361,8 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*
LinphoneCore *lc = linphone_core_new(vTable, userConfig, factoryConfig, ljb);
jlong nativePtr = (jlong)lc;
- if (userConfig) env->ReleaseStringUTFChars(juserConfig, userConfig);
- if (factoryConfig) env->ReleaseStringUTFChars(jfactoryConfig, factoryConfig);
+ ReleaseStringUTFChars(env, juserConfig, userConfig);
+ ReleaseStringUTFChars(env, jfactoryConfig, factoryConfig);
return nativePtr;
}
@@ -1444,26 +1452,26 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_stopRinging(JNIEnv* env,
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setChatDatabasePath(JNIEnv* env, jobject thiz, jlong lc, jstring jpath) {
- const char* path = env->GetStringUTFChars(jpath, NULL);
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_chat_database_path((LinphoneCore*)lc, path);
- env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCallLogsDatabasePath( JNIEnv* env, jobject thiz, jlong lc, jstring jpath) {
- const char* path = env->GetStringUTFChars(jpath, NULL);
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_call_logs_database_path((LinphoneCore*)lc, path);
- env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFriendsDatabasePath( JNIEnv* env, jobject thiz, jlong lc, jstring jpath) {
- const char* path = env->GetStringUTFChars(jpath, NULL);
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_friends_database_path((LinphoneCore*)lc, path);
- env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact2(JNIEnv* env, jobject thiz, jlong lc, jstring jcontact) {
- const char* contact = env->GetStringUTFChars(jcontact, NULL);
+ const char* contact = GetStringUTFChars(env, jcontact);
linphone_core_set_primary_contact((LinphoneCore*)lc, contact);
- env->ReleaseStringUTFChars(jcontact, contact);
+ ReleaseStringUTFChars(env, jcontact, contact);
}
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getPrimaryContact(JNIEnv* env, jobject thiz, jlong lc) {
@@ -1473,8 +1481,8 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getPrimaryContact(JNI
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact(JNIEnv* env, jobject thiz, jlong lc, jstring jdisplayname, jstring jusername) {
- const char* displayname = jdisplayname ? env->GetStringUTFChars(jdisplayname, NULL) : NULL;
- const char* username = jusername ? env->GetStringUTFChars(jusername, NULL) : NULL;
+ const char* displayname = GetStringUTFChars(env, jdisplayname);
+ const char* username = GetStringUTFChars(env, jusername);
LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed((LinphoneCore*)lc);
if (parsed != NULL) {
@@ -1484,8 +1492,8 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact(JNIEnv
linphone_core_set_primary_contact((LinphoneCore*)lc, contact);
}
- if (jdisplayname) env->ReleaseStringUTFChars(jdisplayname, displayname);
- if (jusername) env->ReleaseStringUTFChars(jusername, username);
+ ReleaseStringUTFChars(env, jdisplayname, displayname);
+ ReleaseStringUTFChars(env, jusername, username);
}
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getPrimaryContactUsername(JNIEnv* env, jobject thiz, jlong lc) {
@@ -1575,16 +1583,14 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getAuthInfosList(J
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findAuthInfos(JNIEnv* env, jobject thiz, jlong lc, jstring jusername, jstring jrealm, jstring jdomain) {
- const char* username = env->GetStringUTFChars(jusername, NULL);
- const char* realm = jrealm ? env->GetStringUTFChars(jrealm, NULL) : NULL;
- const char* domain = jdomain ? env->GetStringUTFChars(jdomain, NULL) : NULL;
+ const char* username = GetStringUTFChars(env, jusername);
+ const char* realm = GetStringUTFChars(env, jrealm);
+ const char* domain = GetStringUTFChars(env, jdomain);
const LinphoneAuthInfo *authInfo = linphone_core_find_auth_info((LinphoneCore*)lc, realm, username, domain);
- if (realm)
- env->ReleaseStringUTFChars(jrealm, realm);
- if (domain)
- env->ReleaseStringUTFChars(jdomain, domain);
- env->ReleaseStringUTFChars(jusername, username);
+ ReleaseStringUTFChars(env, jrealm, realm);
+ ReleaseStringUTFChars(env, jdomain, domain);
+ ReleaseStringUTFChars(env, jusername, username);
return (jlong) authInfo;
}
@@ -1612,9 +1618,9 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_invite(JNIEnv* env
,jobject thiz
,jlong lc
,jstring juri) {
- const char* uri = env->GetStringUTFChars(juri, NULL);
+ const char* uri = GetStringUTFChars(env, juri);
LinphoneCall* lCall = linphone_core_invite((LinphoneCore*)lc,uri);
- env->ReleaseStringUTFChars(juri, uri);
+ ReleaseStringUTFChars(env, juri, uri);
return getCall(env,lCall);
}
extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_inviteAddress(JNIEnv* env
@@ -1797,9 +1803,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_interpretUrl( JNIEnv*
,jobject thiz
,jlong lc
,jstring jurl) {
- const char* url = env->GetStringUTFChars(jurl, NULL);
+ const char* url = GetStringUTFChars(env, jurl);
jlong result = (jlong)linphone_core_interpret_url((LinphoneCore*)lc,url);
- env->ReleaseStringUTFChars(jurl, url);
+ ReleaseStringUTFChars(env, jurl, url);
return result;
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_sendDtmf( JNIEnv* env
@@ -1855,9 +1861,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv*
,jstring jmime
,jint rate
,jint channels) {
- const char* mime = env->GetStringUTFChars(jmime, NULL);
+ const char* mime = GetStringUTFChars(env, jmime);
jlong result = (jlong)linphone_core_find_payload_type((LinphoneCore*)lc,mime,rate,channels);
- env->ReleaseStringUTFChars(jmime, mime);
+ ReleaseStringUTFChars(env, jmime, mime);
return result;
}
@@ -2001,9 +2007,9 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAdaptiveRateAlgorithm
,jobject thiz
,jlong lc
,jstring jalg) {
- const char* alg = jalg?env->GetStringUTFChars(jalg, NULL):NULL;
+ const char* alg = GetStringUTFChars(env, jalg);
linphone_core_set_adaptive_rate_algorithm((LinphoneCore*)lc,alg);
- if (alg) env->ReleaseStringUTFChars(jalg, alg);
+ ReleaseStringUTFChars(env, jalg, alg);
}
@@ -2050,23 +2056,23 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addFriend(JNIEnv* env
}
extern "C" jint Java_org_linphone_core_LinphoneFriendListImpl_importFriendsFromVCardFile(JNIEnv* env, jobject thiz, jlong list, jstring jpath) {
- const char* path = env->GetStringUTFChars(jpath, NULL);
+ const char* path = GetStringUTFChars(env, jpath);
int count = linphone_friend_list_import_friends_from_vcard4_file((LinphoneFriendList*)list, path);
- env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
return count;
}
extern "C" jint Java_org_linphone_core_LinphoneFriendListImpl_importFriendsFromVCardBuffer(JNIEnv* env, jobject thiz, jlong list, jstring jbuffer) {
- const char* buffer = env->GetStringUTFChars(jbuffer, NULL);
+ const char* buffer = GetStringUTFChars(env, jbuffer);
int count = linphone_friend_list_import_friends_from_vcard4_buffer((LinphoneFriendList*)list, buffer);
- env->ReleaseStringUTFChars(jbuffer, buffer);
+ ReleaseStringUTFChars(env, jbuffer, buffer);
return count;
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_exportFriendsToVCardFile(JNIEnv* env, jobject thiz, jlong list, jstring jpath) {
- const char* path = env->GetStringUTFChars(jpath, NULL);
+ const char* path = GetStringUTFChars(env, jpath);
linphone_friend_list_export_friends_as_vcard4_file((LinphoneFriendList*)list, path);
- env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_enableSubscriptions(JNIEnv* env, jobject thiz, jlong list, jboolean enable) {
@@ -2144,9 +2150,9 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPresenceInfo(JNIEnv*
,jint minutes_away
,jstring jalternative_contact
,jint status) {
- const char* alternative_contact = jalternative_contact?env->GetStringUTFChars(jalternative_contact, NULL):NULL;
+ const char* alternative_contact = GetStringUTFChars(env, jalternative_contact);
linphone_core_set_presence_info((LinphoneCore*)lc,minutes_away,alternative_contact,(LinphoneOnlineStatus)status);
- if (alternative_contact) env->ReleaseStringUTFChars(jalternative_contact, alternative_contact);
+ ReleaseStringUTFChars(env, jalternative_contact, alternative_contact);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getPresenceInfo(JNIEnv *env, jobject thiz, jlong lc) {
return (jint)linphone_core_get_presence_info((LinphoneCore *)lc);
@@ -2180,9 +2186,9 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getOrCreateChatRoom(J
,jlong lc
,jstring jto) {
- const char* to = env->GetStringUTFChars(jto, NULL);
+ const char* to = GetStringUTFChars(env, jto);
LinphoneChatRoom* lResult = linphone_core_get_chat_room_from_uri((LinphoneCore*)lc,to);
- env->ReleaseStringUTFChars(jto, to);
+ ReleaseStringUTFChars(env, jto, to);
return getChatRoom(env, lResult);
}
@@ -2219,17 +2225,17 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlayFile(JNIEnv* env
,jobject thiz
,jlong lc
,jstring jpath) {
- const char* path = jpath?env->GetStringUTFChars(jpath, NULL):NULL;
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_play_file((LinphoneCore*)lc,path);
- if (path) env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setRing(JNIEnv* env
,jobject thiz
,jlong lc
,jstring jpath) {
- const char* path = jpath?env->GetStringUTFChars(jpath, NULL):NULL;
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_ring((LinphoneCore*)lc,path);
- if (path) env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getRing(JNIEnv* env
,jobject thiz
@@ -2247,9 +2253,9 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setTone(JNIEnv* env
,jlong lc
,jint toneid
,jstring jpath) {
- const char* path = jpath ? env->GetStringUTFChars(jpath, NULL) : NULL;
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_tone((LinphoneCore *)lc, (LinphoneToneID)toneid, path);
- if (path) env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCallErrorTone(JNIEnv* env
@@ -2257,25 +2263,25 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCallErrorTone(JNIEnv*
,jlong lc
,jint reason
,jstring jpath) {
- const char* path = jpath ? env->GetStringUTFChars(jpath, NULL) : NULL;
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_call_error_tone((LinphoneCore *)lc, (LinphoneReason)reason, path);
- if (path) env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setRootCA(JNIEnv* env
,jobject thiz
,jlong lc
,jstring jpath) {
- const char* path = jpath?env->GetStringUTFChars(jpath, NULL):NULL;
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_root_ca((LinphoneCore*)lc,path);
- if (path) env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setRingback(JNIEnv* env
,jobject thiz
,jlong lc
,jstring jpath) {
- const char* path = jpath?env->GetStringUTFChars(jpath, NULL):NULL;
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_ringback((LinphoneCore*)lc,path);
- if (path) env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
@@ -2283,9 +2289,9 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setProvisioningUri(JNIEn
,jobject thiz
,jlong lc
,jstring jpath) {
- const char* path = jpath?env->GetStringUTFChars(jpath, NULL):NULL;
+ const char* path = GetStringUTFChars(env, jpath);
linphone_core_set_provisioning_uri((LinphoneCore*)lc,path);
- if (path) env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getProvisioningUri(JNIEnv* env
@@ -2453,9 +2459,9 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_finalize(JNIEnv*
}
extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setIdentity(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jidentity) {
- const char* identity = env->GetStringUTFChars(jidentity, NULL);
+ const char* identity = GetStringUTFChars(env, jidentity);
linphone_proxy_config_set_identity((LinphoneProxyConfig*)proxyCfg,identity);
- env->ReleaseStringUTFChars(jidentity, identity);
+ ReleaseStringUTFChars(env, jidentity, identity);
}
extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getIdentity(JNIEnv* env,jobject thiz,jlong proxyCfg) {
const char* identity = linphone_proxy_config_get_identity((LinphoneProxyConfig*)proxyCfg);
@@ -2472,9 +2478,9 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setAddress(JNIEnv
linphone_proxy_config_set_identity_address((LinphoneProxyConfig*)proxyCfg, (LinphoneAddress*) jidentity);
}
extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setProxy(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jproxy) {
- const char* proxy = env->GetStringUTFChars(jproxy, NULL);
+ const char* proxy = GetStringUTFChars(env, jproxy);
jint err=linphone_proxy_config_set_server_addr((LinphoneProxyConfig*)proxyCfg,proxy);
- env->ReleaseStringUTFChars(jproxy, proxy);
+ ReleaseStringUTFChars(env, jproxy, proxy);
return err;
}
extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getProxy(JNIEnv* env,jobject thiz,jlong proxyCfg) {
@@ -2486,14 +2492,14 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getProxy(JNIEn
}
}
extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setContactParameters(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jparams) {
- const char* params = jparams ? env->GetStringUTFChars(jparams, NULL) : NULL;
+ const char* params = GetStringUTFChars(env, jparams);
linphone_proxy_config_set_contact_parameters((LinphoneProxyConfig*)proxyCfg, params);
- if (jparams) env->ReleaseStringUTFChars(jparams, params);
+ ReleaseStringUTFChars(env, jparams, params);
}
extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setContactUriParameters(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jparams) {
- const char* params = jparams ? env->GetStringUTFChars(jparams, NULL) : NULL;
+ const char* params = GetStringUTFChars(env, jparams);
linphone_proxy_config_set_contact_uri_parameters((LinphoneProxyConfig*)proxyCfg, params);
- if (jparams) env->ReleaseStringUTFChars(jparams, params);
+ ReleaseStringUTFChars(env, jparams, params);
}
extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getContactParameters(JNIEnv* env,jobject thiz,jlong proxyCfg) {
const char* params = linphone_proxy_config_get_contact_parameters((LinphoneProxyConfig*)proxyCfg);
@@ -2507,9 +2513,9 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getContactUriP
extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) {
if (jroute != NULL) {
- const char* route = env->GetStringUTFChars(jroute, NULL);
+ const char* route = GetStringUTFChars(env, jroute);
jint err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route);
- env->ReleaseStringUTFChars(jroute, route);
+ ReleaseStringUTFChars(env, jroute, route);
return err;
} else {
return (jint)linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,NULL);
@@ -2545,7 +2551,7 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhone
ms_error("cannot normalized null number");
}
char * normalized_phone;
- const char* number = env->GetStringUTFChars(jnumber, NULL);
+ const char* number = GetStringUTFChars(env, jnumber);
int len = env->GetStringLength(jnumber);
if (len == 0) {
ms_warning("cannot normalize empty number");
@@ -2553,26 +2559,26 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhone
}
normalized_phone = linphone_proxy_config_normalize_phone_number((LinphoneProxyConfig*)proxyCfg,number);
jstring normalizedNumber = env->NewStringUTF(normalized_phone ? normalized_phone : number);
- env->ReleaseStringUTFChars(jnumber, number);
+ ReleaseStringUTFChars(env, jnumber, number);
ms_free(normalized_phone);
return normalizedNumber;
}
extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_normalizeSipUri(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jusername) {
- const char* username = env->GetStringUTFChars(jusername, NULL);
+ const char* username = GetStringUTFChars(env, jusername);
LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri((LinphoneProxyConfig*)proxyCfg, username);
- env->ReleaseStringUTFChars(jusername, username);
+ ReleaseStringUTFChars(env, jusername, username);
return (jlong) addr;
}
extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jlong proxyCfg, jstring jiso) {
- const char* iso = env->GetStringUTFChars(jiso, NULL);
+ const char* iso = GetStringUTFChars(env, jiso);
int prefix = linphone_dial_plan_lookup_ccc_from_iso(iso);
- env->ReleaseStringUTFChars(jiso, iso);
+ ReleaseStringUTFChars(env, jiso, iso);
return (jint) prefix;
}
extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromE164(JNIEnv* env, jobject thiz, jlong proxyCfg, jstring je164) {
- const char* e164 = env->GetStringUTFChars(je164, NULL);
+ const char* e164 = GetStringUTFChars(env, je164);
int prefix = linphone_dial_plan_lookup_ccc_from_e164(e164);
- env->ReleaseStringUTFChars(je164, e164);
+ ReleaseStringUTFChars(env, je164, e164);
return (jint) prefix;
}
extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIEnv* env
@@ -2598,9 +2604,9 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialPrefix(JNI
,jobject thiz
,jlong proxyCfg
,jstring jprefix) {
- const char* prefix = env->GetStringUTFChars(jprefix, NULL);
+ const char* prefix = GetStringUTFChars(env, jprefix);
linphone_proxy_config_set_dial_prefix((LinphoneProxyConfig*)proxyCfg,prefix);
- env->ReleaseStringUTFChars(jprefix, prefix);
+ ReleaseStringUTFChars(env, jprefix, prefix);
}
extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDialPrefix(JNIEnv* env,jobject thiz,jlong proxyCfg) {
@@ -2712,9 +2718,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getUsernam
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setPassword
(JNIEnv *env, jobject, jlong auth_info, jstring jpassword) {
- const char* password = jpassword?env->GetStringUTFChars(jpassword, NULL):NULL;
+ const char* password = GetStringUTFChars(env, jpassword);
linphone_auth_info_set_passwd((LinphoneAuthInfo*)auth_info,password);
- if (password) env->ReleaseStringUTFChars(jpassword, password);
+ ReleaseStringUTFChars(env, jpassword, password);
}
/*
@@ -2724,9 +2730,9 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setPassword
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setRealm
(JNIEnv *env, jobject, jlong auth_info, jstring jrealm) {
- const char* realm = jrealm?env->GetStringUTFChars(jrealm, NULL):NULL;
+ const char* realm = GetStringUTFChars(env, jrealm);
linphone_auth_info_set_realm((LinphoneAuthInfo*)auth_info,realm);
- if (realm) env->ReleaseStringUTFChars(jrealm, realm);
+ ReleaseStringUTFChars(env, jrealm, realm);
}
/*
@@ -2736,10 +2742,9 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setRealm
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setDomain
(JNIEnv *env, jobject, jlong auth_info, jstring jdomain) {
- const char* domain = jdomain ? env->GetStringUTFChars(jdomain, NULL) : NULL;
+ const char* domain = GetStringUTFChars(env, jdomain);
linphone_auth_info_set_domain((LinphoneAuthInfo*)auth_info, domain);
- if (domain)
- env->ReleaseStringUTFChars(jdomain, domain);
+ ReleaseStringUTFChars(env, jdomain, domain);
}
/*
@@ -2749,9 +2754,9 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setDomain
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setUsername
(JNIEnv *env, jobject, jlong auth_info, jstring jusername) {
- const char* username = jusername?env->GetStringUTFChars(jusername, NULL):NULL;
+ const char* username = GetStringUTFChars(env, jusername);
linphone_auth_info_set_username((LinphoneAuthInfo*)auth_info,username);
- if (username) env->ReleaseStringUTFChars(jusername, username);
+ ReleaseStringUTFChars(env, jusername, username);
}
/*
@@ -2761,9 +2766,9 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setUsername
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setUserId
(JNIEnv *env, jobject, jlong auth_info, jstring juserid) {
- const char* userid = juserid?env->GetStringUTFChars(juserid, NULL):NULL;
+ const char* userid = GetStringUTFChars(env, juserid);
linphone_auth_info_set_userid((LinphoneAuthInfo*)auth_info,userid);
- if (userid) env->ReleaseStringUTFChars(juserid, userid);
+ ReleaseStringUTFChars(env, juserid, userid);
}
/*
@@ -2788,9 +2793,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getUserId
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setHa1
(JNIEnv *env, jobject, jlong auth_info, jstring jha1) {
- const char* ha1 = jha1?env->GetStringUTFChars(jha1, NULL):NULL;
+ const char* ha1 = GetStringUTFChars(env, jha1);
linphone_auth_info_set_ha1((LinphoneAuthInfo*)auth_info,ha1);
- if (ha1) env->ReleaseStringUTFChars(jha1, ha1);
+ ReleaseStringUTFChars(env, jha1, ha1);
}
@@ -2816,14 +2821,14 @@ extern "C" jlong Java_org_linphone_core_LinphoneAddressImpl_newLinphoneAddressIm
,jobject thiz
,jstring juri
,jstring jdisplayName) {
- const char* uri = juri?env->GetStringUTFChars(juri, NULL):NULL;
+ const char* uri = GetStringUTFChars(env, juri);
LinphoneAddress* address = linphone_address_new(uri);
if (jdisplayName && address) {
- const char* displayName = env->GetStringUTFChars(jdisplayName, NULL);
+ const char* displayName = GetStringUTFChars(env, jdisplayName);
linphone_address_set_display_name(address,displayName);
- env->ReleaseStringUTFChars(jdisplayName, displayName);
+ ReleaseStringUTFChars(env, jdisplayName, displayName);
}
- if (uri) env->ReleaseStringUTFChars(juri, uri);
+ ReleaseStringUTFChars(env, juri, uri);
return (jlong) address;
}
@@ -2908,25 +2913,25 @@ extern "C" void Java_org_linphone_core_LinphoneAddressImpl_setDisplayName(JNIEnv
,jobject thiz
,jlong address
,jstring jdisplayName) {
- const char* displayName = jdisplayName!= NULL?env->GetStringUTFChars(jdisplayName, NULL):NULL;
+ const char* displayName = GetStringUTFChars(env, jdisplayName);
linphone_address_set_display_name((LinphoneAddress*)address,displayName);
- if (displayName != NULL) env->ReleaseStringUTFChars(jdisplayName, displayName);
+ ReleaseStringUTFChars(env, jdisplayName, displayName);
}
extern "C" void Java_org_linphone_core_LinphoneAddressImpl_setUserName(JNIEnv* env
,jobject thiz
,jlong address
,jstring juserName) {
- const char* userName = juserName!= NULL?env->GetStringUTFChars(juserName, NULL):NULL;
+ const char* userName = GetStringUTFChars(env, juserName);
linphone_address_set_username((LinphoneAddress*)address,userName);
- if (userName != NULL) env->ReleaseStringUTFChars(juserName, userName);
+ ReleaseStringUTFChars(env, juserName, userName);
}
extern "C" void Java_org_linphone_core_LinphoneAddressImpl_setDomain(JNIEnv* env
,jobject thiz
,jlong address
,jstring jdomain) {
- const char* domain = jdomain!= NULL?env->GetStringUTFChars(jdomain, NULL):NULL;
+ const char* domain = GetStringUTFChars(env, jdomain);
linphone_address_set_domain((LinphoneAddress*)address,domain);
- if (domain != NULL) env->ReleaseStringUTFChars(jdomain, domain);
+ ReleaseStringUTFChars(env, jdomain, domain);
}
extern "C" void Java_org_linphone_core_LinphoneAddressImpl_setTransport(JNIEnv* env
,jobject thiz
@@ -3099,8 +3104,9 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getCallLogs(JNIEnv
extern "C" void Java_org_linphone_core_LinphoneCallImpl_takeSnapshot( JNIEnv* env
,jobject thiz
,jlong ptr, jstring path) {
- const char* filePath = path != NULL ? env->GetStringUTFChars(path, NULL) : NULL;
+ const char* filePath = GetStringUTFChars(env, path);
linphone_call_take_video_snapshot((LinphoneCall*)ptr, filePath);
+ ReleaseStringUTFChars(env, path, filePath);
}
extern "C" void Java_org_linphone_core_LinphoneCallImpl_zoomVideo( JNIEnv* env
@@ -3246,10 +3252,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNI
LinphoneFriend* lResult;
if (jFriendUri) {
- const char* friendUri = env->GetStringUTFChars(jFriendUri, NULL);
+ const char* friendUri = GetStringUTFChars(env, jFriendUri);
lResult = linphone_friend_new_with_address(friendUri);
linphone_friend_set_user_data(lResult,env->NewWeakGlobalRef(thiz));
- env->ReleaseStringUTFChars(jFriendUri, friendUri);
+ ReleaseStringUTFChars(env, jFriendUri, friendUri);
} else {
lResult = linphone_friend_new();
linphone_friend_set_user_data(lResult,env->NewWeakGlobalRef(thiz));
@@ -3265,9 +3271,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneFriendListImpl_newLinphoneFriend
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_setUri(JNIEnv* env, jobject thiz, jlong list, jstring juri) {
- const char* uri = env->GetStringUTFChars(juri, NULL);
+ const char* uri = GetStringUTFChars(env, juri);
linphone_friend_list_set_uri((LinphoneFriendList*)list, uri);
- env->ReleaseStringUTFChars(juri, uri);
+ ReleaseStringUTFChars(env, juri, uri);
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_synchronizeFriendsFromServer(JNIEnv* env, jobject thiz, jlong list) {
@@ -3401,28 +3407,28 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setName(JNIEnv* env
,jobject thiz
,jlong ptr
,jstring jname) {
- const char* name = env->GetStringUTFChars(jname, NULL);
+ const char* name = GetStringUTFChars(env, jname);
linphone_friend_set_name((LinphoneFriend*)ptr, name);
- env->ReleaseStringUTFChars(jname, name);
+ ReleaseStringUTFChars(env, jname, name);
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_setRLSUri(JNIEnv* env
,jobject thiz
,jlong ptr
,jstring jrlsUri) {
- const char* uri = env->GetStringUTFChars(jrlsUri, NULL);
+ const char* uri = GetStringUTFChars(env, jrlsUri);
linphone_friend_list_set_rls_uri((LinphoneFriendList*)ptr, uri);
- env->ReleaseStringUTFChars(jrlsUri, uri);
+ ReleaseStringUTFChars(env, jrlsUri, uri);
}
extern "C" jobject Java_org_linphone_core_LinphoneFriendListImpl_findFriendByUri(JNIEnv* env
,jobject thiz
,jlong friendListptr
,jstring juri) {
- const char* uri = env->GetStringUTFChars(juri, NULL);
+ const char* uri = GetStringUTFChars(env, juri);
LinphoneFriend* lFriend;
lFriend = linphone_friend_list_find_friend_by_uri((LinphoneFriendList*)friendListptr, uri);
- env->ReleaseStringUTFChars(juri, uri);
+ ReleaseStringUTFChars(env, juri, uri);
if(lFriend != NULL) {
jobject jfriend = getFriend(env,lFriend);
// don't release local ref since it will be handled above by java
@@ -3526,9 +3532,9 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_addPhoneNumber(JNIEnv*
,jlong ptr
,jstring jphone) {
if (jphone) {
- const char* phone = env->GetStringUTFChars(jphone, NULL);
+ const char* phone = GetStringUTFChars(env, jphone);
linphone_friend_add_phone_number((LinphoneFriend*)ptr, phone);
- env->ReleaseStringUTFChars(jphone, phone);
+ ReleaseStringUTFChars(env, jphone, phone);
}
}
@@ -3537,9 +3543,9 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_removePhoneNumber(JNIE
,jlong ptr
,jstring jphone) {
if (jphone) {
- const char* phone = env->GetStringUTFChars(jphone, NULL);
+ const char* phone = GetStringUTFChars(env, jphone);
linphone_friend_remove_phone_number((LinphoneFriend*)ptr, phone);
- env->ReleaseStringUTFChars(jphone, phone);
+ ReleaseStringUTFChars(env, jphone, phone);
}
}
@@ -3575,9 +3581,9 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setOrganization(JNIEnv
LinphoneFriend *lf = (LinphoneFriend *)ptr;
LinphoneVcard *lvc = linphone_friend_get_vcard(lf);
if (lvc) {
- const char* org = env->GetStringUTFChars(jorg, NULL);
+ const char* org = GetStringUTFChars(env, jorg);
linphone_vcard_set_organization(lvc, org);
- env->ReleaseStringUTFChars(jorg, org);
+ ReleaseStringUTFChars(env, jorg, org);
}
}
@@ -3635,9 +3641,9 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setRefKey(JNIEnv* env
,jobject thiz
,jlong ptr
,jstring jkey) {
- const char* key = env->GetStringUTFChars(jkey, NULL);
+ const char* key = GetStringUTFChars(env, jkey);
linphone_friend_set_ref_key((LinphoneFriend*)ptr,key);
- env->ReleaseStringUTFChars(jkey, key);
+ ReleaseStringUTFChars(env, jkey, key);
}
extern "C" jstring Java_org_linphone_core_LinphoneFriendImpl_getRefKey(JNIEnv* env
,jobject thiz
@@ -3701,9 +3707,9 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getFriendByAddress(JN
,jobject thiz
,jlong ptr
,jstring jaddress) {
- const char* address = env->GetStringUTFChars(jaddress, NULL);
+ const char* address = GetStringUTFChars(env, jaddress);
LinphoneFriend *lf = linphone_core_get_friend_by_address((LinphoneCore*)ptr, address);
- env->ReleaseStringUTFChars(jaddress, address);
+ ReleaseStringUTFChars(env, jaddress, address);
if(lf != NULL) {
jobject jfriend = getFriend(env,lf);
return jfriend;
@@ -3759,9 +3765,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatM
,jobject thiz
,jlong ptr
,jstring jmessage) {
- const char* message = env->GetStringUTFChars(jmessage, NULL);
+ const char* message = GetStringUTFChars(env, jmessage);
LinphoneChatMessage *chatMessage = linphone_chat_room_create_message((LinphoneChatRoom *)ptr, message);
- env->ReleaseStringUTFChars(jmessage, message);
+ ReleaseStringUTFChars(env, jmessage, message);
return (jlong) chatMessage;
}
@@ -3774,17 +3780,15 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatM
,jlong time
,jboolean read
,jboolean incoming) {
- const char* message = jmessage?env->GetStringUTFChars(jmessage, NULL):NULL;
- const char* url = jurl?env->GetStringUTFChars(jurl, NULL):NULL;
+ const char* message = GetStringUTFChars(env, jmessage);
+ const char* url = GetStringUTFChars(env, jurl);
LinphoneChatMessage *chatMessage = linphone_chat_room_create_message_2(
(LinphoneChatRoom *)ptr, message, url, (LinphoneChatMessageState)state,
(time_t)time, read, incoming);
- if (jmessage != NULL)
- env->ReleaseStringUTFChars(jmessage, message);
- if (jurl != NULL)
- env->ReleaseStringUTFChars(jurl, url);
+ ReleaseStringUTFChars(env, jmessage, message);
+ ReleaseStringUTFChars(env, jurl, url);
return (jlong) chatMessage;
}
@@ -3828,14 +3832,14 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createFileTransferM
LinphoneChatMessage *message = NULL;
const char *tmp;
- linphone_content_set_type(content, tmp = env->GetStringUTFChars(jtype, NULL));
- env->ReleaseStringUTFChars(jtype, tmp);
+ linphone_content_set_type(content, tmp = GetStringUTFChars(env, jtype));
+ ReleaseStringUTFChars(env, jtype, tmp);
- linphone_content_set_subtype(content, tmp = env->GetStringUTFChars(jsubtype, NULL));
- env->ReleaseStringUTFChars(jsubtype, tmp);
+ linphone_content_set_subtype(content, tmp = GetStringUTFChars(env, jsubtype));
+ ReleaseStringUTFChars(env, jsubtype, tmp);
- linphone_content_set_name(content, tmp = env->GetStringUTFChars(jname, NULL));
- env->ReleaseStringUTFChars(jname, tmp);
+ linphone_content_set_name(content, tmp = GetStringUTFChars(env, jname));
+ ReleaseStringUTFChars(env, jname, tmp);
linphone_content_set_size(content, data_size);
@@ -3865,17 +3869,15 @@ extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getAppData(JNI
}
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setAppData(JNIEnv* env, jobject thiz, jlong ptr, jstring appdata) {
- const char * data = appdata ? env->GetStringUTFChars(appdata, NULL) : NULL;
+ const char * data = GetStringUTFChars(env, appdata);
linphone_chat_message_set_appdata((LinphoneChatMessage *)ptr, data);
- if (appdata)
- env->ReleaseStringUTFChars(appdata, data);
+ ReleaseStringUTFChars(env, appdata, data);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFileTransferServer(JNIEnv* env, jobject thiz, jlong ptr, jstring server_url) {
- const char * url = server_url ? env->GetStringUTFChars(server_url, NULL) : NULL;
+ const char * url = GetStringUTFChars(env, server_url);
linphone_core_set_file_transfer_server((LinphoneCore *)ptr, url);
- if (server_url)
- env->ReleaseStringUTFChars(server_url, url);
+ ReleaseStringUTFChars(env, server_url, url);
}
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getFileTransferServer(JNIEnv* env, jobject thiz, jlong ptr) {
@@ -3917,20 +3919,20 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getErrorInfo(JNI
extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getCustomHeader(JNIEnv* env
,jobject thiz
,jlong ptr, jstring jheader_name) {
- const char *name=env->GetStringUTFChars(jheader_name,NULL);
+ const char *name = GetStringUTFChars(env, jheader_name);
const char *value=linphone_chat_message_get_custom_header((LinphoneChatMessage*)ptr,name);
- env->ReleaseStringUTFChars(jheader_name, name);
+ ReleaseStringUTFChars(env, jheader_name, name);
return value ? env->NewStringUTF(value) : NULL;
}
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_addCustomHeader(JNIEnv* env
,jobject thiz
,jlong ptr, jstring jheader_name, jstring jheader_value) {
- const char *name=env->GetStringUTFChars(jheader_name,NULL);
- const char *value=env->GetStringUTFChars(jheader_value,NULL);
+ const char *name = GetStringUTFChars(env, jheader_name);
+ const char *value = GetStringUTFChars(env, jheader_value);
linphone_chat_message_add_custom_header((LinphoneChatMessage*)ptr,name,value);
- env->ReleaseStringUTFChars(jheader_name, name);
- env->ReleaseStringUTFChars(jheader_value, value);
+ ReleaseStringUTFChars(env, jheader_name, name);
+ ReleaseStringUTFChars(env, jheader_value, value);
}
extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getExternalBodyUrl(JNIEnv* env
@@ -3943,9 +3945,9 @@ extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setExternalBodyUr
,jobject thiz
,jlong ptr
,jstring jurl) {
- const char* url = env->GetStringUTFChars(jurl, NULL);
+ const char* url = GetStringUTFChars(env, jurl);
linphone_chat_message_set_external_body_url((LinphoneChatMessage *)ptr, url);
- env->ReleaseStringUTFChars(jurl, url);
+ ReleaseStringUTFChars(env, jurl, url);
}
extern "C" jlong Java_org_linphone_core_LinphoneChatMessageImpl_getFrom(JNIEnv* env
,jobject thiz
@@ -3998,9 +4000,9 @@ extern "C" jint Java_org_linphone_core_LinphoneChatMessageImpl_getStorageId(JNIE
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setFileTransferFilepath(JNIEnv* env
,jobject thiz
,jlong ptr, jstring jpath) {
- const char* path = env->GetStringUTFChars(jpath, NULL);
+ const char* path = GetStringUTFChars(env, jpath);
linphone_chat_message_set_file_transfer_filepath((LinphoneChatMessage*)ptr, path);
- env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
extern "C" jint Java_org_linphone_core_LinphoneChatMessageImpl_downloadFile(JNIEnv* env
@@ -4156,9 +4158,9 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv*
,jobject thiz
,jlong ptr
,jstring jmessage) {
- const char* message = env->GetStringUTFChars(jmessage, NULL);
+ const char* message = GetStringUTFChars(env, jmessage);
linphone_chat_room_send_message((LinphoneChatRoom*)ptr, message);
- env->ReleaseStringUTFChars(jmessage, message);
+ ReleaseStringUTFChars(env, jmessage, message);
}
static void chat_room_impl_callback(LinphoneChatMessage* msg, LinphoneChatMessageState state, void* ud) {
@@ -4263,10 +4265,9 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDeviceRotation(JNIEnv
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setRemoteRingbackTone(JNIEnv *env, jobject thiz, jlong lc, jstring jtone){
- const char* tone = NULL;
- if (jtone) tone=env->GetStringUTFChars(jtone, NULL);
+ const char* tone = GetStringUTFChars(env, jtone);
linphone_core_set_remote_ringback_tone((LinphoneCore*)lc,tone);
- if (tone) env->ReleaseStringUTFChars(jtone,tone);
+ ReleaseStringUTFChars(env, jtone,tone);
}
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getRemoteRingbackTone(JNIEnv *env, jobject thiz, jlong lc){
@@ -4285,10 +4286,9 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getFirewallPolicy(JNIEnv
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStunServer(JNIEnv *env, jobject thiz, jlong lc, jstring jserver){
- const char* server = NULL;
- if (jserver) server=env->GetStringUTFChars(jserver, NULL);
+ const char* server = GetStringUTFChars(env, jserver);
linphone_core_set_stun_server((LinphoneCore*)lc,server);
- if (server) env->ReleaseStringUTFChars(jserver,server);
+ ReleaseStringUTFChars(env, jserver,server);
}
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv *env, jobject thiz, jlong lc){
@@ -4355,9 +4355,9 @@ extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setSessionName(JNI
,jobject thiz
,jlong cp
,jstring jname) {
- const char *name = jname ? env->GetStringUTFChars(jname,NULL) : NULL;
+ const char *name = GetStringUTFChars(env, jname);
linphone_call_params_set_session_name((LinphoneCallParams*)cp,name);
- if (name) env->ReleaseStringUTFChars(jname,name);
+ ReleaseStringUTFChars(env, jname, name);
}
extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_audioBandwidth(JNIEnv *env, jobject thiz, jlong lcp, jint bw){
@@ -4390,47 +4390,47 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_localConferenc
}
extern "C" jstring Java_org_linphone_core_LinphoneCallParamsImpl_getCustomHeader(JNIEnv *env, jobject thiz, jlong lcp, jstring jheader_name){
- const char* header_name=env->GetStringUTFChars(jheader_name, NULL);
- const char *header_value=linphone_call_params_get_custom_header((LinphoneCallParams*)lcp,header_name);
- env->ReleaseStringUTFChars(jheader_name, header_name);
+ const char* header_name = GetStringUTFChars(env, jheader_name);
+ const char *header_value = linphone_call_params_get_custom_header((LinphoneCallParams*)lcp,header_name);
+ ReleaseStringUTFChars(env, jheader_name, header_name);
return header_value ? env->NewStringUTF(header_value) : NULL;
}
extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_addCustomHeader(JNIEnv *env, jobject thiz, jlong lcp, jstring jheader_name, jstring jheader_value){
- const char* header_name=env->GetStringUTFChars(jheader_name, NULL);
- const char* header_value=env->GetStringUTFChars(jheader_value, NULL);
+ const char* header_name = GetStringUTFChars(env, jheader_name);
+ const char* header_value = GetStringUTFChars(env, jheader_value);
linphone_call_params_add_custom_header((LinphoneCallParams*)lcp,header_name,header_value);
- env->ReleaseStringUTFChars(jheader_name, header_name);
- env->ReleaseStringUTFChars(jheader_value, header_value);
+ ReleaseStringUTFChars(env, jheader_name, header_name);
+ ReleaseStringUTFChars(env, jheader_value, header_value);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_addCustomSdpAttribute(JNIEnv *env, jobject thiz, jlong ptr, jstring jname, jstring jvalue) {
- const char *name = env->GetStringUTFChars(jname, NULL);
- const char *value = env->GetStringUTFChars(jvalue, NULL);
+ const char *name = GetStringUTFChars(env, jname);
+ const char *value = GetStringUTFChars(env, jvalue);
linphone_call_params_add_custom_sdp_attribute((LinphoneCallParams *)ptr, name, value);
- env->ReleaseStringUTFChars(jname, name);
- env->ReleaseStringUTFChars(jvalue, value);
+ ReleaseStringUTFChars(env, jname, name);
+ ReleaseStringUTFChars(env, jvalue, value);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_addCustomSdpMediaAttribute(JNIEnv *env, jobject thiz, jlong ptr, jint jtype, jstring jname, jstring jvalue) {
- const char *name = env->GetStringUTFChars(jname, NULL);
- const char *value = env->GetStringUTFChars(jvalue, NULL);
+ const char *name = GetStringUTFChars(env, jname);
+ const char *value = GetStringUTFChars(env, jvalue);
linphone_call_params_add_custom_sdp_media_attribute((LinphoneCallParams *)ptr, (LinphoneStreamType)jtype, name, value);
- env->ReleaseStringUTFChars(jname, name);
- env->ReleaseStringUTFChars(jvalue, value);
+ ReleaseStringUTFChars(env, jname, name);
+ ReleaseStringUTFChars(env, jvalue, value);
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_getCustomSdpAttribute(JNIEnv *env, jobject thiz, jlong ptr, jstring jname) {
- const char *name = env->GetStringUTFChars(jname, NULL);
+ const char *name = GetStringUTFChars(env, jname);
const char *value = linphone_call_params_get_custom_sdp_attribute((LinphoneCallParams *)ptr, name);
- env->ReleaseStringUTFChars(jname, name);
+ ReleaseStringUTFChars(env, jname, name);
return value ? env->NewStringUTF(value) : NULL;
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_getCustomSdpMediaAttribute(JNIEnv *env, jobject thiz, jlong ptr, jint jtype, jstring jname) {
- const char *name = env->GetStringUTFChars(jname, NULL);
+ const char *name = GetStringUTFChars(env, jname);
const char *value = linphone_call_params_get_custom_sdp_media_attribute((LinphoneCallParams *)ptr, (LinphoneStreamType)jtype, name);
- env->ReleaseStringUTFChars(jname, name);
+ ReleaseStringUTFChars(env, jname, name);
return value ? env->NewStringUTF(value) : NULL;
}
@@ -4444,9 +4444,9 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_clearCustom
extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setRecordFile(JNIEnv *env, jobject thiz, jlong lcp, jstring jrecord_file){
if (jrecord_file){
- const char* record_file=env->GetStringUTFChars(jrecord_file, NULL);
+ const char* record_file = GetStringUTFChars(env, jrecord_file);
linphone_call_params_set_record_file((LinphoneCallParams*)lcp,record_file);
- env->ReleaseStringUTFChars(jrecord_file, record_file);
+ ReleaseStringUTFChars(env, jrecord_file, record_file);
}else linphone_call_params_set_record_file((LinphoneCallParams*)lcp,NULL);
}
@@ -4553,9 +4553,9 @@ extern "C" float Java_org_linphone_core_LinphoneCoreImpl_getPreferredFramerate(J
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setPreferredVideoSizeByName(JNIEnv *env, jobject thiz, jlong lc, jstring jName) {
- const char* cName = env->GetStringUTFChars(jName, NULL);
+ const char* cName = GetStringUTFChars(env, jName);
linphone_core_set_preferred_video_size_by_name((LinphoneCore *)lc, cName);
- env->ReleaseStringUTFChars(jName, cName);
+ ReleaseStringUTFChars(env, jName, cName);
}
extern "C" jintArray Java_org_linphone_core_LinphoneCoreImpl_getPreferredVideoSize(JNIEnv *env, jobject thiz, jlong lc){
@@ -4662,9 +4662,9 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getQuality
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setQualityReportingCollector(JNIEnv *env, jobject thiz, jlong ptr, jstring jcollector) {
if (jcollector){
- const char *collector=env->GetStringUTFChars(jcollector, NULL);
+ const char *collector = GetStringUTFChars(env, jcollector);
linphone_proxy_config_set_quality_reporting_collector((LinphoneProxyConfig *)ptr, collector);
- env->ReleaseStringUTFChars(jcollector,collector);
+ ReleaseStringUTFChars(env, jcollector, collector);
}
}
@@ -4675,9 +4675,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getQual
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setRealm(JNIEnv *env, jobject thiz, jlong ptr, jstring jrealm) {
if (jrealm){
- const char *realm=env->GetStringUTFChars(jrealm, NULL);
+ const char *realm = GetStringUTFChars(env, jrealm);
linphone_proxy_config_set_realm((LinphoneProxyConfig *)ptr, realm);
- env->ReleaseStringUTFChars(jrealm,realm);
+ ReleaseStringUTFChars(env, jrealm, realm);
}
}
@@ -4688,9 +4688,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getReal
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_isPhoneNumber(JNIEnv *env, jobject thiz, jlong ptr, jstring jusername) {
if(jusername){
- const char *username=env->GetStringUTFChars(jusername, NULL);
+ const char *username = GetStringUTFChars(env, jusername);
bool_t res = linphone_proxy_config_is_phone_number((LinphoneProxyConfig *)ptr, username);
- env->ReleaseStringUTFChars(jusername,username);
+ ReleaseStringUTFChars(env, jusername, username);
return (jboolean) res;
} else {
return JNI_FALSE;
@@ -4698,17 +4698,17 @@ JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_isPhon
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setCustomHeader(JNIEnv *env, jobject thiz, jlong prt, jstring jname, jstring jvalue) {
- const char *name = jname ? env->GetStringUTFChars(jname, NULL) : NULL;
- const char *value = jvalue ? env->GetStringUTFChars(jvalue, NULL) : NULL;
+ const char *name = GetStringUTFChars(env, jname);
+ const char *value = GetStringUTFChars(env, jvalue);
linphone_proxy_config_set_custom_header((LinphoneProxyConfig*) prt, name, value);
- if (jname) env->ReleaseStringUTFChars(jname, name);
- if (jvalue) env->ReleaseStringUTFChars(jvalue, value);
+ ReleaseStringUTFChars(env, jname, name);
+ ReleaseStringUTFChars(env, jvalue, value);
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getCustomHeader(JNIEnv *env, jobject thiz, jlong ptr, jstring jname) {
- const char *name = jname ? env->GetStringUTFChars(jname, NULL) : NULL;
+ const char *name = GetStringUTFChars(env, jname);
const char *value = linphone_proxy_config_get_custom_header((LinphoneProxyConfig *)ptr, name);
- if (jname) env->ReleaseStringUTFChars(jname, name);
+ ReleaseStringUTFChars(env, jname, name);
return value ? env->NewStringUTF(value) : NULL;
}
@@ -4830,9 +4830,9 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getConference(JNIEnv
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_startConferenceRecording(JNIEnv *env,jobject thiz,jlong pCore, jstring jpath){
int err=-1;
if (jpath){
- const char *path=env->GetStringUTFChars(jpath, NULL);
+ const char *path = GetStringUTFChars(env, jpath);
err=linphone_core_start_conference_recording((LinphoneCore*)pCore,path);
- env->ReleaseStringUTFChars(jpath,path);
+ ReleaseStringUTFChars(env, jpath, path);
}
return err;
}
@@ -4854,9 +4854,9 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getCallsNb(JNIEnv *env,j
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_transferCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jstring jReferTo) {
- const char* cReferTo=env->GetStringUTFChars(jReferTo, NULL);
+ const char* cReferTo = GetStringUTFChars(env, jReferTo);
jint err = linphone_core_transfer_call((LinphoneCore *) pCore, (LinphoneCall *) pCall, cReferTo);
- env->ReleaseStringUTFChars(jReferTo, cReferTo);
+ ReleaseStringUTFChars(env, jReferTo, cReferTo);
return err;
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_transferCallToAnother(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jlong pDestCall) {
@@ -4869,18 +4869,18 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_startReferedCall(JNIE
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIEnv *env,jobject thiz,jlong pCore, jstring jFile) {
if (jFile) {
- const char* cFile=env->GetStringUTFChars(jFile, NULL);
+ const char* cFile =GetStringUTFChars(env, jFile);
linphone_core_set_zrtp_secrets_file((LinphoneCore *) pCore,cFile);
- env->ReleaseStringUTFChars(jFile, cFile);
+ ReleaseStringUTFChars(env, jFile, cFile);
} else {
linphone_core_set_zrtp_secrets_file((LinphoneCore *) pCore,NULL);
}
}
extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_findCallFromUri(JNIEnv *env,jobject thiz,jlong pCore, jstring jUri) {
- const char* cUri=env->GetStringUTFChars(jUri, NULL);
+ const char* cUri = GetStringUTFChars(env, jUri);
const LinphoneCall *call=linphone_core_find_call_from_uri((const LinphoneCore *) pCore,cUri);
- env->ReleaseStringUTFChars(jUri, cUri);
+ ReleaseStringUTFChars(env, jUri, cUri);
return (jobject) getCall(env,(LinphoneCall*)call);
}
@@ -5003,14 +5003,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAddServerAndMirror
LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel;
if (!tunnel) return;
- const char* cHost=env->GetStringUTFChars(jHost, NULL);
+ const char* cHost = GetStringUTFChars(env, jHost);
LinphoneTunnelConfig *tunnelconfig = linphone_tunnel_config_new();
linphone_tunnel_config_set_host(tunnelconfig, cHost);
linphone_tunnel_config_set_port(tunnelconfig, port);
linphone_tunnel_config_set_delay(tunnelconfig, delay);
linphone_tunnel_config_set_remote_udp_mirror_port(tunnelconfig, mirror);
linphone_tunnel_add_server(tunnel, tunnelconfig);
- env->ReleaseStringUTFChars(jHost, cHost);
+ ReleaseStringUTFChars(env, jHost, cHost);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAddServer(JNIEnv *env, jobject thiz, jlong pCore, jlong tunnelconfigptr) {
@@ -5053,13 +5053,13 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelSetHttpProxy(JNIEn
LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel;
if (!tunnel) return;
- const char* cHost=(jHost!=NULL) ? env->GetStringUTFChars(jHost, NULL) : NULL;
- const char* cUsername= (username!=NULL) ? env->GetStringUTFChars(username, NULL) : NULL;
- const char* cPassword= (password!=NULL) ? env->GetStringUTFChars(password, NULL) : NULL;
+ const char* cHost = GetStringUTFChars(env, jHost);
+ const char* cUsername = GetStringUTFChars(env, username);
+ const char* cPassword = GetStringUTFChars(env, password);
linphone_tunnel_set_http_proxy(tunnel,cHost, port,cUsername,cPassword);
- if (cHost) env->ReleaseStringUTFChars(jHost, cHost);
- if (cUsername) env->ReleaseStringUTFChars(username, cUsername);
- if (cPassword) env->ReleaseStringUTFChars(password, cPassword);
+ ReleaseStringUTFChars(env, jHost, cHost);
+ ReleaseStringUTFChars(env, username, cUsername);
+ ReleaseStringUTFChars(env, password, cPassword);
}
@@ -5111,11 +5111,11 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_tunnelSipEnabled(JNI
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUserAgent(JNIEnv *env,jobject thiz,jlong pCore, jstring name, jstring version){
- const char* cname=env->GetStringUTFChars(name, NULL);
- const char* cversion=env->GetStringUTFChars(version, NULL);
+ const char* cname = GetStringUTFChars(env, name);
+ const char* cversion = GetStringUTFChars(env, version);
linphone_core_set_user_agent((LinphoneCore *)pCore,cname,cversion);
- env->ReleaseStringUTFChars(name, cname);
- env->ReleaseStringUTFChars(version, cversion);
+ ReleaseStringUTFChars(env, name, cname);
+ ReleaseStringUTFChars(env, version, cversion);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isTunnelAvailable(JNIEnv *env,jobject thiz){
@@ -5140,9 +5140,9 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_getVideoAutoAcceptPo
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStaticPicture(JNIEnv *env, jobject thiz, jlong lc, jstring path) {
- const char *cpath = env->GetStringUTFChars(path, NULL);
+ const char *cpath = GetStringUTFChars(env, path);
linphone_core_set_static_picture((LinphoneCore *)lc, cpath);
- env->ReleaseStringUTFChars(path, cpath);
+ ReleaseStringUTFChars(env, path, cpath);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCpuCountNative(JNIEnv *env, jobject thiz, jlong coreptr, jint count) {
@@ -5275,20 +5275,20 @@ static LinphoneContent *create_content_from_java_args(JNIEnv *env, LinphoneCore
void *data = (void*)env->GetByteArrayElements(jdata,NULL);
const char *tmp;
- linphone_content_set_type(content, tmp = env->GetStringUTFChars(jtype, NULL));
- env->ReleaseStringUTFChars(jtype, tmp);
+ linphone_content_set_type(content, tmp = GetStringUTFChars(env, jtype));
+ ReleaseStringUTFChars(env, jtype, tmp);
- linphone_content_set_subtype(content, tmp = env->GetStringUTFChars(jsubtype, NULL));
- env->ReleaseStringUTFChars(jsubtype, tmp);
+ linphone_content_set_subtype(content, tmp = GetStringUTFChars(env, jsubtype));
+ ReleaseStringUTFChars(env, jsubtype, tmp);
if (jname){
- linphone_content_set_name(content, tmp = env->GetStringUTFChars(jname, NULL));
- env->ReleaseStringUTFChars(jname, tmp);
+ linphone_content_set_name(content, tmp = GetStringUTFChars(env, jname));
+ ReleaseStringUTFChars(env, jname, tmp);
}
if (jencoding){
- linphone_content_set_encoding(content, tmp = env->GetStringUTFChars(jencoding,NULL));
- env->ReleaseStringUTFChars(jencoding, tmp);
+ linphone_content_set_encoding(content, tmp = GetStringUTFChars(env, jencoding));
+ ReleaseStringUTFChars(env, jencoding, tmp);
}
linphone_content_set_buffer(content, data, env->GetArrayLength(jdata));
@@ -5309,12 +5309,12 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_subscribe(JNIE
LinphoneContent * content = create_content_from_java_args(env, (LinphoneCore*)coreptr, jtype, jsubtype, jdata, jencoding, NULL);
LinphoneEvent *ev;
jobject jev=NULL;
- const char *evname=env->GetStringUTFChars(jevname,NULL);
+ const char *evname = GetStringUTFChars(env, jevname);
ev=linphone_core_subscribe(lc,addr,evname,expires, content);
if (content) linphone_content_unref(content);
- env->ReleaseStringUTFChars(jevname,evname);
+ ReleaseStringUTFChars(env, jevname, evname);
if (ev){
jev=getEvent(env,ev);
}
@@ -5333,11 +5333,11 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_publish(JNIEnv
LinphoneContent * content = create_content_from_java_args(env, (LinphoneCore*)coreptr, jtype, jsubtype, jdata, jencoding, NULL);
LinphoneEvent *ev;
jobject jev=NULL;
- const char *evname=env->GetStringUTFChars(jevname,NULL);
+ const char *evname = GetStringUTFChars(env, jevname);
ev=linphone_core_publish(lc,addr,evname,expires, content);
if (content) linphone_content_unref(content);
- env->ReleaseStringUTFChars(jevname,evname);
+ ReleaseStringUTFChars(env, jevname, evname);
if (ev){
jev=getEvent(env,ev);
}
@@ -5346,16 +5346,16 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_publish(JNIEnv
// LpConfig
extern "C" jlong Java_org_linphone_core_LpConfigImpl_newLpConfigImpl(JNIEnv *env, jobject thiz, jstring file) {
- const char *cfile = env->GetStringUTFChars(file, NULL);
+ const char *cfile = GetStringUTFChars(env, file);
LpConfig *lp = lp_config_new(cfile);
- env->ReleaseStringUTFChars(file, cfile);
+ ReleaseStringUTFChars(env, file, cfile);
return (jlong) lp;
}
extern "C" jlong Java_org_linphone_core_LpConfigImpl_newLpConfigImplFromBuffer(JNIEnv *env, jobject thiz, jstring buffer) {
- const char *cbuffer = env->GetStringUTFChars(buffer, NULL);
+ const char *cbuffer = GetStringUTFChars(env, buffer);
LpConfig *lp = lp_config_new_from_buffer(cbuffer);
- env->ReleaseStringUTFChars(buffer, cbuffer);
+ ReleaseStringUTFChars(env, buffer, cbuffer);
return (jlong) lp;
}
@@ -5371,77 +5371,77 @@ extern "C" void Java_org_linphone_core_LpConfigImpl_delete(JNIEnv *env, jobject
extern "C" void Java_org_linphone_core_LpConfigImpl_setInt(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jint value) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
lp_config_set_int((LpConfig *)lpc, csection, ckey, (int) value);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
}
extern "C" jint Java_org_linphone_core_LpConfigImpl_getInt(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jint defaultValue) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
int returnValue = lp_config_get_int((LpConfig *)lpc, csection, ckey, (int) defaultValue);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
return (jint) returnValue;
}
extern "C" void Java_org_linphone_core_LpConfigImpl_setFloat(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jfloat value) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
lp_config_set_float((LpConfig *)lpc, csection, ckey, (float) value);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
}
extern "C" jfloat Java_org_linphone_core_LpConfigImpl_getFloat(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jfloat defaultValue) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
float returnValue = lp_config_get_float((LpConfig *)lpc, csection, ckey, (float) defaultValue);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
return (jfloat) returnValue;
}
extern "C" void Java_org_linphone_core_LpConfigImpl_setBool(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jboolean value) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
lp_config_set_int((LpConfig *)lpc, csection, ckey, value ? 1 : 0);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
}
extern "C" jboolean Java_org_linphone_core_LpConfigImpl_getBool(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jboolean defaultValue) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
int returnValue = lp_config_get_int((LpConfig *)lpc, csection, ckey, defaultValue ? 1 : 0);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
return (jboolean) returnValue == 1;
}
extern "C" void Java_org_linphone_core_LpConfigImpl_setString(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jstring value) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
- const char *cvalue = value ? env->GetStringUTFChars(value, NULL) : NULL;
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
+ const char *cvalue = GetStringUTFChars(env, value);
lp_config_set_string((LpConfig *)lpc, csection, ckey, cvalue);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
- if (value) env->ReleaseStringUTFChars(value, cvalue);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
+ ReleaseStringUTFChars(env, value, cvalue);
}
extern "C" jstring Java_org_linphone_core_LpConfigImpl_getString(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jstring defaultValue) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
- const char *cvalue = defaultValue ? env->GetStringUTFChars(defaultValue, NULL) : NULL;
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
+ const char *cvalue = GetStringUTFChars(env, defaultValue);
const char *returnValue = lp_config_get_string((LpConfig *)lpc, csection, ckey, cvalue);
@@ -5449,33 +5449,32 @@ extern "C" jstring Java_org_linphone_core_LpConfigImpl_getString(JNIEnv *env, jo
if (returnValue)
jreturnValue = env->NewStringUTF(returnValue);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
- if (cvalue)
- env->ReleaseStringUTFChars(defaultValue, cvalue);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
+ ReleaseStringUTFChars(env, defaultValue, cvalue);
return jreturnValue;
}
extern "C" void Java_org_linphone_core_LpConfigImpl_setIntRange(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jint min, jint max) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
lp_config_set_range((LpConfig *)lpc, csection, ckey, min, max);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
}
extern "C" jintArray Java_org_linphone_core_LpConfigImpl_getIntRange(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jint defaultmin, jint defaultmax) {
- const char *csection = env->GetStringUTFChars(section, NULL);
- const char *ckey = env->GetStringUTFChars(key, NULL);
+ const char *csection = GetStringUTFChars(env, section);
+ const char *ckey = GetStringUTFChars(env, key);
int *values = (int*)calloc(2, sizeof(int));
lp_config_get_range((LpConfig *)lpc, csection, ckey, &values[0], &values[1], defaultmin, defaultmax);
jintArray returnValues = env->NewIntArray(2);
env->SetIntArrayRegion(returnValues, 0, 2, values);
ms_free(values);
- env->ReleaseStringUTFChars(section, csection);
- env->ReleaseStringUTFChars(key, ckey);
+ ReleaseStringUTFChars(env, section, csection);
+ ReleaseStringUTFChars(env, key, ckey);
return returnValues;
}
@@ -5587,15 +5586,14 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneInfoMessageImpl_setContent
LinphoneContent * content = linphone_content_new();
const char *tmp;
- linphone_content_set_type(content, tmp = env->GetStringUTFChars(jtype,NULL));
- env->ReleaseStringUTFChars(jtype, tmp);
+ linphone_content_set_type(content, tmp = GetStringUTFChars(env, jtype));
+ ReleaseStringUTFChars(env, jtype, tmp);
- linphone_content_set_type(content, tmp = env->GetStringUTFChars(jsubtype,NULL));
- env->ReleaseStringUTFChars(jsubtype, tmp);
+ linphone_content_set_type(content, tmp = GetStringUTFChars(env, jsubtype));
+ ReleaseStringUTFChars(env, jsubtype, tmp);
-
- linphone_content_set_string_buffer(content, tmp = env->GetStringUTFChars(jdata,NULL));
- env->ReleaseStringUTFChars(jdata, tmp);
+ linphone_content_set_string_buffer(content, tmp = GetStringUTFChars(env, jdata));
+ ReleaseStringUTFChars(env, jdata, tmp);
linphone_info_message_set_content(infomsg, content);
linphone_content_unref(content);
@@ -5607,12 +5605,11 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneInfoMessageImpl_setContent
* Signature: (JLjava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneInfoMessageImpl_addHeader(JNIEnv *env, jobject jobj, jlong infoptr, jstring jname, jstring jvalue){
- const char *name=NULL,*value=NULL;
- name=env->GetStringUTFChars(jname,NULL);
- value=env->GetStringUTFChars(jvalue,NULL);
+ const char *name = GetStringUTFChars(env, jname);
+ const char *value = GetStringUTFChars(env, jvalue);
linphone_info_message_add_header((LinphoneInfoMessage*)infoptr,name,value);
- env->ReleaseStringUTFChars(jname,name);
- env->ReleaseStringUTFChars(jvalue,value);
+ ReleaseStringUTFChars(env, jname, name);
+ ReleaseStringUTFChars(env, jvalue, value);
}
/*
@@ -5621,9 +5618,9 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneInfoMessageImpl_addHeader(
* Signature: (JLjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneInfoMessageImpl_getHeader(JNIEnv *env, jobject jobj, jlong infoptr, jstring jname){
- const char *name=env->GetStringUTFChars(jname,NULL);
+ const char *name = GetStringUTFChars(env, jname);
const char *ret=linphone_info_message_get_header((LinphoneInfoMessage*)infoptr,name);
- env->ReleaseStringUTFChars(jname,name);
+ ReleaseStringUTFChars(env, jname, name);
return ret ? env->NewStringUTF(ret) : NULL;
}
@@ -5796,10 +5793,10 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_createSubscrib
LinphoneAddress *addr = (LinphoneAddress*) jaddr;
LinphoneEvent *event;
jobject jevent = NULL;
- const char *event_name = env->GetStringUTFChars(jeventname, NULL);
+ const char *event_name = GetStringUTFChars(env, jeventname);
event = linphone_core_create_subscribe(lc, addr, event_name, expires);
- env->ReleaseStringUTFChars(jeventname, event_name);
+ ReleaseStringUTFChars(env, jeventname, event_name);
if (event) {
jevent = getEvent(env, event);
}
@@ -5819,10 +5816,10 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_createPublish(
LinphoneAddress *addr = (LinphoneAddress*) jaddr;
LinphoneEvent *event;
jobject jevent = NULL;
- const char *event_name = env->GetStringUTFChars(jeventname, NULL);
+ const char *event_name = GetStringUTFChars(env, jeventname);
event = linphone_core_create_publish(lc, addr, event_name, expires);
- env->ReleaseStringUTFChars(jeventname, event_name);
+ ReleaseStringUTFChars(env, jeventname, event_name);
if (event) {
jevent = getEvent(env, event);
}
@@ -5837,18 +5834,18 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneEventImpl_sendPublish(JNIE
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneEventImpl_addCustomHeader(JNIEnv *env, jobject thiz, jlong jevent, jstring jname, jstring jvalue) {
- const char *name = jname ? env->GetStringUTFChars(jname, NULL) : NULL;
- const char *value = jvalue ? env->GetStringUTFChars(jvalue, NULL) : NULL;
+ const char *name = GetStringUTFChars(env, jname);
+ const char *value = GetStringUTFChars(env, jvalue);
linphone_event_add_custom_header((LinphoneEvent*) jevent, name, value);
- if (jname) env->ReleaseStringUTFChars(jname, name);
- if (jvalue) env->ReleaseStringUTFChars(jvalue, value);
+ ReleaseStringUTFChars(env, jname, name);
+ ReleaseStringUTFChars(env, jvalue, value);
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneEventImpl_getCustomHeader(JNIEnv *env, jobject thiz, jlong jevent, jstring jname) {
- const char *name = jname ? env->GetStringUTFChars(jname, NULL) : NULL;
+ const char *name = GetStringUTFChars(env, jname);
const char *header = linphone_event_get_custom_header((LinphoneEvent*) jevent, name);
jstring jheader = header ? env->NewStringUTF(header) : NULL;
- if (jname) env->ReleaseStringUTFChars(jname, name);
+ ReleaseStringUTFChars(env, jname, name);
return jheader;
}
@@ -5880,10 +5877,10 @@ JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceModelImpl_newPresenceMode
*/
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceModelImpl_newPresenceModelImpl__ILjava_lang_String_2(JNIEnv *env, jobject jobj, jint type, jstring description) {
LinphonePresenceModel *model;
- const char *cdescription = description ? env->GetStringUTFChars(description, NULL) : NULL;
+ const char *cdescription = GetStringUTFChars(env, description);
model = linphone_presence_model_new_with_activity((LinphonePresenceActivityType)type, cdescription);
model = linphone_presence_model_ref(model);
- if (cdescription) env->ReleaseStringUTFChars(description, cdescription);
+ ReleaseStringUTFChars(env, description, cdescription);
return (jlong)model;
}
@@ -5895,14 +5892,14 @@ JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceModelImpl_newPresenceMode
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceModelImpl_newPresenceModelImpl__ILjava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2(
JNIEnv *env, jobject jobj, jint type, jstring description, jstring note, jstring lang) {
LinphonePresenceModel *model;
- const char *cdescription = description ? env->GetStringUTFChars(description, NULL) : NULL;
- const char *cnote = note ? env->GetStringUTFChars(note, NULL) : NULL;
- const char *clang = lang ? env->GetStringUTFChars(lang, NULL) : NULL;
+ const char *cdescription = GetStringUTFChars(env, description);
+ const char *cnote =GetStringUTFChars(env, note);
+ const char *clang = GetStringUTFChars(env, lang);
model = linphone_presence_model_new_with_activity_and_note((LinphonePresenceActivityType)type, cdescription, cnote, clang);
model = linphone_presence_model_ref(model);
- if (cdescription) env->ReleaseStringUTFChars(description, cdescription);
- if (cnote) env->ReleaseStringUTFChars(note, cnote);
- if (clang) env->ReleaseStringUTFChars(lang, clang);
+ ReleaseStringUTFChars(env, description, cdescription);
+ ReleaseStringUTFChars(env, note, cnote);
+ ReleaseStringUTFChars(env, lang, clang);
return (jlong)model;
}
@@ -5967,9 +5964,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceModelImpl_getContact(JN
*/
JNIEXPORT void JNICALL Java_org_linphone_core_PresenceModelImpl_setContact(JNIEnv *env, jobject jobj, jlong ptr, jstring contact) {
LinphonePresenceModel *model = (LinphonePresenceModel *)ptr;
- const char *ccontact = contact ? env->GetStringUTFChars(contact, NULL) : NULL;
+ const char *ccontact = GetStringUTFChars(env, contact);
linphone_presence_model_set_contact(model, ccontact);
- if (ccontact) env->ReleaseStringUTFChars(contact, ccontact);
+ ReleaseStringUTFChars(env, contact, ccontact);
}
/*
@@ -5991,9 +5988,9 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_PresenceModelImpl_getActivity(J
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceModelImpl_setActivity(JNIEnv *env, jobject jobj, jlong ptr, jint acttype, jstring description) {
LinphonePresenceModel *model = (LinphonePresenceModel *)ptr;
- const char *cdescription = description ? env->GetStringUTFChars(description, NULL) : NULL;
+ const char *cdescription = GetStringUTFChars(env, description);
jint res = (jint)linphone_presence_model_set_activity(model, (LinphonePresenceActivityType)acttype, cdescription);
- if (cdescription) env->ReleaseStringUTFChars(description, cdescription);
+ ReleaseStringUTFChars(env, description, cdescription);
return res;
}
@@ -6045,9 +6042,9 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceModelImpl_clearActivities(
*/
JNIEXPORT jobject JNICALL Java_org_linphone_core_PresenceModelImpl_getNote(JNIEnv *env , jobject jobj, jlong ptr, jstring lang) {
LinphonePresenceModel *model = (LinphonePresenceModel *)ptr;
- const char *clang = lang ? env->GetStringUTFChars(lang, NULL) : NULL;
+ const char *clang = GetStringUTFChars(env, lang);
LinphonePresenceNote *note = linphone_presence_model_get_note(model, clang);
- if (clang) env->ReleaseStringUTFChars(lang, clang);
+ ReleaseStringUTFChars(env, lang, clang);
if (note == NULL) return NULL;
RETURN_USER_DATA_OBJECT("PresenceNoteImpl", linphone_presence_note, note)
}
@@ -6059,11 +6056,11 @@ JNIEXPORT jobject JNICALL Java_org_linphone_core_PresenceModelImpl_getNote(JNIEn
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceModelImpl_addNote(JNIEnv *env, jobject jobj, jlong ptr, jstring description, jstring lang) {
LinphonePresenceModel *model = (LinphonePresenceModel *)ptr;
- const char *cdescription = description ? env->GetStringUTFChars(description, NULL) : NULL;
- const char *clang = lang ? env->GetStringUTFChars(lang, NULL) : NULL;
+ const char *cdescription = GetStringUTFChars(env, description);
+ const char *clang = GetStringUTFChars(env, lang);
jint res = (jint)linphone_presence_model_add_note(model, cdescription, clang);
- if (cdescription) env->ReleaseStringUTFChars(description, cdescription);
- if (clang) env->ReleaseStringUTFChars(lang, clang);
+ ReleaseStringUTFChars(env, description, cdescription);
+ ReleaseStringUTFChars(env, lang, clang);
return res;
}
@@ -6166,10 +6163,10 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceModelImpl_clearPersons(JNI
*/
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceActivityImpl_newPresenceActivityImpl(JNIEnv *env, jobject jobj, jint type, jstring description) {
LinphonePresenceActivity *activity;
- const char *cdescription = description ? env->GetStringUTFChars(description, NULL) : NULL;
+ const char *cdescription = GetStringUTFChars(env, description);
activity = linphone_presence_activity_new((LinphonePresenceActivityType)type, cdescription);
activity = linphone_presence_activity_ref(activity);
- if (cdescription) env->ReleaseStringUTFChars(description, cdescription);
+ ReleaseStringUTFChars(env, description, cdescription);
return (jlong)activity;
}
@@ -6234,9 +6231,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceActivityImpl_getDescrip
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceActivityImpl_setDescription(JNIEnv *env, jobject jobj, jlong ptr, jstring description) {
LinphonePresenceActivity *activity = (LinphonePresenceActivity *)ptr;
- const char *cdescription = description ? env->GetStringUTFChars(description, NULL) : NULL;
+ const char *cdescription = GetStringUTFChars(env, description);
linphone_presence_activity_set_description(activity, cdescription);
- if (cdescription) env->ReleaseStringUTFChars(description, cdescription);
+ ReleaseStringUTFChars(env, description, cdescription);
return (jint)0;
}
@@ -6247,12 +6244,12 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceActivityImpl_setDescriptio
*/
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceServiceImpl_newPresenceServiceImpl(JNIEnv *env, jobject jobj, jstring id, jint basic_status, jstring contact) {
LinphonePresenceService *service;
- const char *cid = id ? env->GetStringUTFChars(id, NULL) : NULL;
- const char *ccontact = contact ? env->GetStringUTFChars(contact, NULL) : NULL;
+ const char *cid = GetStringUTFChars(env, id);
+ const char *ccontact = GetStringUTFChars(env, contact);
service = linphone_presence_service_new(cid, (LinphonePresenceBasicStatus)basic_status, ccontact);
service = linphone_presence_service_ref(service);
- if (cid) env->ReleaseStringUTFChars(id, cid);
- if (ccontact) env->ReleaseStringUTFChars(contact, ccontact);
+ ReleaseStringUTFChars(env, id, cid);
+ ReleaseStringUTFChars(env, contact, ccontact);
return (jlong)service;
}
@@ -6286,9 +6283,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceServiceImpl_getId(JNIEn
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceServiceImpl_setId(JNIEnv *env, jobject jobj, jlong ptr, jstring id) {
LinphonePresenceService *service = (LinphonePresenceService *)ptr;
- const char *cid = id ? env->GetStringUTFChars(id, NULL) : NULL;
+ const char *cid = GetStringUTFChars(env, id);
linphone_presence_service_set_id(service, cid);
- if (cid) env->ReleaseStringUTFChars(id, cid);
+ ReleaseStringUTFChars(env, id, cid);
return (jint)0;
}
@@ -6332,9 +6329,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceServiceImpl_getContact(
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceServiceImpl_setContact(JNIEnv *env, jobject jobj, jlong ptr, jstring contact) {
LinphonePresenceService *service = (LinphonePresenceService *)ptr;
- const char *ccontact = contact ? env->GetStringUTFChars(contact, NULL) : NULL;
+ const char *ccontact = GetStringUTFChars(env, contact);
linphone_presence_service_set_contact(service, ccontact);
- if (ccontact) env->ReleaseStringUTFChars(contact, ccontact);
+ ReleaseStringUTFChars(env, contact, ccontact);
return (jint)0;
}
@@ -6386,10 +6383,10 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceServiceImpl_clearNotes(JNI
*/
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresencePersonImpl_newPresencePersonImpl(JNIEnv *env, jobject jobj, jstring id) {
LinphonePresencePerson *person;
- const char *cid = id ? env->GetStringUTFChars(id, NULL) : NULL;
+ const char *cid = GetStringUTFChars(env, id);
person = linphone_presence_person_new(cid);
person = linphone_presence_person_ref(person);
- if (cid) env->ReleaseStringUTFChars(id, cid);
+ ReleaseStringUTFChars(env, id, cid);
return (jlong)person;
}
@@ -6423,9 +6420,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PresencePersonImpl_getId(JNIEnv
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresencePersonImpl_setId(JNIEnv *env, jobject jobj, jlong ptr, jstring id) {
LinphonePresencePerson *person = (LinphonePresencePerson *)ptr;
- const char *cid = id ? env->GetStringUTFChars(id, NULL) : NULL;
+ const char *cid = GetStringUTFChars(env, id);
linphone_presence_person_set_id(person, cid);
- if (cid) env->ReleaseStringUTFChars(id, cid);
+ ReleaseStringUTFChars(env, id, cid);
return (jint)0;
}
@@ -6559,12 +6556,12 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresencePersonImpl_clearActivitesN
*/
JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceNoteImpl_newPresenceNoteImpl(JNIEnv *env, jobject jobj, jstring content, jstring lang) {
LinphonePresenceNote *note;
- const char *ccontent = content ? env->GetStringUTFChars(content, NULL) : NULL;
- const char *clang = lang ? env->GetStringUTFChars(lang, NULL) : NULL;
+ const char *ccontent = GetStringUTFChars(env, content);
+ const char *clang = GetStringUTFChars(env, lang);
note = linphone_presence_note_new(ccontent, clang);
note = linphone_presence_note_ref(note);
- if (clang) env->ReleaseStringUTFChars(lang, clang);
- if (ccontent) env->ReleaseStringUTFChars(content, ccontent);
+ ReleaseStringUTFChars(env, lang, clang);
+ ReleaseStringUTFChars(env, content, ccontent);
return (jlong)note;
}
@@ -6596,9 +6593,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceNoteImpl_getContent(JNI
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceNoteImpl_setContent(JNIEnv *env, jobject jobj, jlong ptr, jstring content) {
LinphonePresenceNote *note = (LinphonePresenceNote *)ptr;
- const char *ccontent = content ? env->GetStringUTFChars(content, NULL) : NULL;
+ const char *ccontent = GetStringUTFChars(env, content);
linphone_presence_note_set_content(note, ccontent);
- if (ccontent) env->ReleaseStringUTFChars(content, ccontent);
+ ReleaseStringUTFChars(env, content, ccontent);
return (jint)0;
}
@@ -6620,9 +6617,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceNoteImpl_getLang(JNIEnv
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceNoteImpl_setLang(JNIEnv *env, jobject jobj, jlong ptr, jstring lang) {
LinphonePresenceNote *note = (LinphonePresenceNote *)ptr;
- const char *clang = lang ? env->GetStringUTFChars(lang, NULL) : NULL;
+ const char *clang = GetStringUTFChars(env, lang);
linphone_presence_note_set_lang(note, clang);
- if (clang) env->ReleaseStringUTFChars(lang, clang);
+ ReleaseStringUTFChars(env, lang, clang);
return (jint)0;
}
@@ -6633,9 +6630,9 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceNoteImpl_setLang(JNIEnv *e
*/
JNIEXPORT void JNICALL Java_org_linphone_core_PayloadTypeImpl_setRecvFmtp(JNIEnv *env, jobject jobj, jlong ptr, jstring jfmtp){
PayloadType *pt=(PayloadType *)ptr;
- const char *fmtp=jfmtp ? env->GetStringUTFChars(jfmtp,NULL) : NULL;
+ const char *fmtp = GetStringUTFChars(env, jfmtp);
payload_type_set_recv_fmtp(pt,fmtp);
- if (fmtp) env->ReleaseStringUTFChars(jfmtp,fmtp);
+ ReleaseStringUTFChars(env, jfmtp, fmtp);
}
/*
@@ -6656,9 +6653,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_PayloadTypeImpl_getRecvFmtp(JNI
*/
JNIEXPORT void JNICALL Java_org_linphone_core_PayloadTypeImpl_setSendFmtp(JNIEnv *env, jobject jobj, jlong ptr , jstring jfmtp){
PayloadType *pt=(PayloadType *)ptr;
- const char *fmtp=jfmtp ? env->GetStringUTFChars(jfmtp,NULL) : NULL;
+ const char *fmtp = GetStringUTFChars(env, jfmtp);
payload_type_set_send_fmtp(pt,fmtp);
- if (fmtp) env->ReleaseStringUTFChars(jfmtp,fmtp);
+ ReleaseStringUTFChars(env, jfmtp, fmtp);
}
/*
@@ -6770,14 +6767,17 @@ static void _eof_callback(LinphonePlayer *player, void *user_data) {
extern "C" jint Java_org_linphone_core_LinphonePlayerImpl_open(JNIEnv *env, jobject jPlayer, jlong ptr, jstring filename, jobject listener) {
LinphonePlayerData *data = NULL;
LinphonePlayerEofCallback cb = NULL;
+ const char *cfilename = GetStringUTFChars(env, filename);
if(listener) {
data = new LinphonePlayerData(env, listener, jPlayer);
cb = _eof_callback;
}
- if(linphone_player_open((LinphonePlayer *)ptr, env->GetStringUTFChars(filename, NULL), cb, data) == -1) {
+ if(linphone_player_open((LinphonePlayer *)ptr, cfilename, cb, data) == -1) {
if(data) delete data;
+ ReleaseStringUTFChars(env, filename, cfilename);
return -1;
}
+ ReleaseStringUTFChars(env, filename, cfilename);
return 0;
}
@@ -6850,10 +6850,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createLocalPlayer(JNIEn
*/
extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_setAudioMulticastAddr
(JNIEnv * env , jobject, jlong ptr, jstring value) {
- const char *char_value = value ? env->GetStringUTFChars(value, NULL) : NULL;
+ const char *char_value = GetStringUTFChars(env, value);
LinphoneCore *lc=(LinphoneCore*)ptr;
int result = linphone_core_set_audio_multicast_addr(lc,char_value);
- if (char_value) env->ReleaseStringUTFChars(value, char_value);
+ ReleaseStringUTFChars(env, value, char_value);
return result;
}
@@ -6864,10 +6864,10 @@ extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_setAudioMulticas
*/
extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoMulticastAddr
(JNIEnv * env, jobject, jlong ptr, jstring value) {
- const char *char_value = value ? env->GetStringUTFChars(value, NULL) : NULL;
+ const char *char_value = GetStringUTFChars(env, value);
LinphoneCore *lc=(LinphoneCore*)ptr;
int result = linphone_core_set_video_multicast_addr(lc,char_value);
- if (char_value) env->ReleaseStringUTFChars(value, char_value);
+ ReleaseStringUTFChars(env, value, char_value);
return result;
}
@@ -6981,10 +6981,10 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setDnsServers(JNI
for (int i=0; i < count; i++) {
jstring server = (jstring) env->GetObjectArrayElement(servers, i);
- const char *str = env->GetStringUTFChars(server, NULL);
+ const char *str = GetStringUTFChars(env, server);
if (str){
l = ms_list_append(l, ms_strdup(str));
- env->ReleaseStringUTFChars(server, str);
+ ReleaseStringUTFChars(env, server, str);
}
}
}
@@ -7001,9 +7001,9 @@ JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_dnsSrvEnabled
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoPreset(JNIEnv *env, jobject thiz, jlong lc, jstring preset) {
- const char *char_preset = preset ? env->GetStringUTFChars(preset, NULL) : NULL;
+ const char *char_preset = GetStringUTFChars(env, preset);
linphone_core_set_video_preset((LinphoneCore *)lc, char_preset);
- if (char_preset) env->ReleaseStringUTFChars(preset, char_preset);
+ ReleaseStringUTFChars(env, preset, char_preset);
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneCoreImpl_getVideoPreset(JNIEnv *env, jobject thiz, jlong lc) {
@@ -7118,9 +7118,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_TunnelConfigImpl_getHost(JNIEnv
*/
JNIEXPORT void JNICALL Java_org_linphone_core_TunnelConfigImpl_setHost(JNIEnv *env, jobject obj, jlong ptr, jstring jstr){
LinphoneTunnelConfig *cfg = (LinphoneTunnelConfig *)ptr;
- const char* host = jstr ? env->GetStringUTFChars(jstr, NULL) : NULL;
+ const char* host = GetStringUTFChars(env, jstr);
linphone_tunnel_config_set_host(cfg, host);
- if (jstr) env->ReleaseStringUTFChars(jstr, host);
+ ReleaseStringUTFChars(env, jstr, host);
}
/*
@@ -7211,9 +7211,9 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneCallLogImpl_getCallId(J
* Signature: (JLjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setHttpProxyHost(JNIEnv *env, jobject jobj, jlong core, jstring jhost){
- const char *host = jhost ? env->GetStringUTFChars(jhost, NULL) : NULL;
+ const char *host = GetStringUTFChars(env, jhost);
linphone_core_set_http_proxy_host((LinphoneCore*)core, host);
- if (host) env->ReleaseStringUTFChars(jhost, host);
+ ReleaseStringUTFChars(env, jhost, host);
}
/*
@@ -7352,13 +7352,13 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setMediaNetworkRe
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setUserCertificatesPath(JNIEnv *env, jobject jobj, jlong pcore, jstring jpath){
- const char *path = jpath ? env->GetStringUTFChars(jpath, NULL) : NULL;
+ const char *path = GetStringUTFChars(env, jpath);
linphone_core_set_user_certificates_path((LinphoneCore*)pcore, path);
- if (path) env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_reloadMsPlugins(JNIEnv *env, jobject jobj, jlong pcore, jstring jpath) {
- const char *path = jpath ? env->GetStringUTFChars(jpath, NULL) : NULL;
+ const char *path = GetStringUTFChars(env, jpath);
linphone_core_reload_ms_plugins((LinphoneCore*)pcore, path);
- if (path) env->ReleaseStringUTFChars(jpath, path);
+ ReleaseStringUTFChars(env, jpath, path);
}
diff --git a/coreapi/linphonefriend.h b/coreapi/linphonefriend.h
index 1d52fc212..8067c8706 100644
--- a/coreapi/linphonefriend.h
+++ b/coreapi/linphonefriend.h
@@ -176,7 +176,7 @@ LINPHONE_PUBLIC void linphone_friend_add_address(LinphoneFriend *lf, const Linph
* @param lf #LinphoneFriend object
* @return \mslist{LinphoneAddress}
*/
-LINPHONE_PUBLIC MSList* linphone_friend_get_addresses(LinphoneFriend *lf);
+LINPHONE_PUBLIC bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf);
/**
* Removes an address in this friend
@@ -197,7 +197,7 @@ LINPHONE_PUBLIC void linphone_friend_add_phone_number(LinphoneFriend *lf, const
* @param lf #LinphoneFriend object
* @return \mslist{const char *}
*/
-LINPHONE_PUBLIC MSList* linphone_friend_get_phone_numbers(LinphoneFriend *lf);
+LINPHONE_PUBLIC bctbx_list_t* linphone_friend_get_phone_numbers(LinphoneFriend *lf);
/**
* Removes a phone number in this friend
@@ -430,7 +430,7 @@ LINPHONE_PUBLIC void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneF
* @return \mslist{LinphoneFriend}
* @deprecated use linphone_core_get_friends_lists() or linphone_friend_list_get_friends() instead.
*/
-LINPHONE_PUBLIC const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
+LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_friend_list(const LinphoneCore *lc);
/**
* Notify all friends that have subscribed
diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c
index b5c547b1f..7b13a0c67 100644
--- a/coreapi/lpconfig.c
+++ b/coreapi/lpconfig.c
@@ -74,8 +74,8 @@ typedef struct _LpSectionParam{
typedef struct _LpSection{
char *name;
- MSList *items;
- MSList *params;
+ bctbx_list_t *items;
+ bctbx_list_t *params;
bool_t overwrite; // If set to true, will add overwrite=true to all items of this section when converted to xml
bool_t skip; // If set to true, won't be dumped when converted to xml
} LpSection;
@@ -85,7 +85,7 @@ struct _LpConfig{
bctbx_vfs_file_t* pFile;
char *filename;
char *tmpfilename;
- MSList *sections;
+ bctbx_list_t *sections;
int modified;
int readonly;
bctbx_vfs_t* g_bctbx_vfs;
@@ -156,31 +156,31 @@ void lp_section_param_destroy(void *section_param){
void lp_section_destroy(LpSection *sec){
ortp_free(sec->name);
- ms_list_for_each(sec->items,lp_item_destroy);
- ms_list_for_each(sec->params,lp_section_param_destroy);
- ms_list_free(sec->items);
+ bctbx_list_for_each(sec->items,lp_item_destroy);
+ bctbx_list_for_each(sec->params,lp_section_param_destroy);
+ bctbx_list_free(sec->items);
free(sec);
}
void lp_section_add_item(LpSection *sec,LpItem *item){
- sec->items=ms_list_append(sec->items,(void *)item);
+ sec->items=bctbx_list_append(sec->items,(void *)item);
}
void lp_config_add_section(LpConfig *lpconfig, LpSection *section){
- lpconfig->sections=ms_list_append(lpconfig->sections,(void *)section);
+ lpconfig->sections=bctbx_list_append(lpconfig->sections,(void *)section);
}
void lp_config_add_section_param(LpSection *section, LpSectionParam *param){
- section->params = ms_list_append(section->params, (void *)param);
+ section->params = bctbx_list_append(section->params, (void *)param);
}
void lp_config_remove_section(LpConfig *lpconfig, LpSection *section){
- lpconfig->sections=ms_list_remove(lpconfig->sections,(void *)section);
+ lpconfig->sections=bctbx_list_remove(lpconfig->sections,(void *)section);
lp_section_destroy(section);
}
void lp_section_remove_item(LpSection *sec, LpItem *item){
- sec->items=ms_list_remove(sec->items,(void *)item);
+ sec->items=bctbx_list_remove(sec->items,(void *)item);
lp_item_destroy(item);
}
@@ -202,9 +202,9 @@ static int is_a_comment(const char *str){
LpSection *lp_config_find_section(const LpConfig *lpconfig, const char *name){
LpSection *sec;
- MSList *elem;
+ bctbx_list_t *elem;
/*printf("Looking for section %s\n",name);*/
- for (elem=lpconfig->sections;elem!=NULL;elem=ms_list_next(elem)){
+ for (elem=lpconfig->sections;elem!=NULL;elem=bctbx_list_next(elem)){
sec=(LpSection*)elem->data;
if (strcmp(sec->name,name)==0){
/*printf("Section %s found\n",name);*/
@@ -215,9 +215,9 @@ LpSection *lp_config_find_section(const LpConfig *lpconfig, const char *name){
}
LpSectionParam *lp_section_find_param(const LpSection *sec, const char *key){
- MSList *elem;
+ bctbx_list_t *elem;
LpSectionParam *param;
- for (elem = sec->params; elem != NULL; elem = ms_list_next(elem)){
+ for (elem = sec->params; elem != NULL; elem = bctbx_list_next(elem)){
param = (LpSectionParam*)elem->data;
if (strcmp(param->key, key) == 0) {
return param;
@@ -227,10 +227,10 @@ LpSectionParam *lp_section_find_param(const LpSection *sec, const char *key){
}
LpItem *lp_section_find_comment(const LpSection *sec, const char *comment){
- MSList *elem;
+ bctbx_list_t *elem;
LpItem *item;
/*printf("Looking for item %s\n",name);*/
- for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){
+ for (elem=sec->items;elem!=NULL;elem=bctbx_list_next(elem)){
item=(LpItem*)elem->data;
if (item->is_comment && strcmp(item->value,comment)==0) {
/*printf("Item %s found\n",name);*/
@@ -241,10 +241,10 @@ LpItem *lp_section_find_comment(const LpSection *sec, const char *comment){
}
LpItem *lp_section_find_item(const LpSection *sec, const char *name){
- MSList *elem;
+ bctbx_list_t *elem;
LpItem *item;
/*printf("Looking for item %s\n",name);*/
- for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){
+ for (elem=sec->items;elem!=NULL;elem=bctbx_list_next(elem)){
item=(LpItem*)elem->data;
if (!item->is_comment && strcmp(item->key,name)==0) {
/*printf("Item %s found\n",name);*/
@@ -488,8 +488,8 @@ void lp_item_set_value(LpItem *item, const char *value){
static void _lp_config_destroy(LpConfig *lpconfig){
if (lpconfig->filename!=NULL) ortp_free(lpconfig->filename);
if (lpconfig->tmpfilename) ortp_free(lpconfig->tmpfilename);
- ms_list_for_each(lpconfig->sections,(void (*)(void*))lp_section_destroy);
- ms_list_free(lpconfig->sections);
+ bctbx_list_for_each(lpconfig->sections,(void (*)(void*))lp_section_destroy);
+ bctbx_list_free(lpconfig->sections);
free(lpconfig);
}
@@ -530,6 +530,31 @@ const char *lp_config_get_string(const LpConfig *lpconfig, const char *section,
return default_string;
}
+bctbx_list_t * lp_config_get_string_list(const LpConfig *lpconfig, const char *section, const char *key, bctbx_list_t *default_list) {
+ LpItem *item;
+ LpSection *sec = lp_config_find_section(lpconfig, section);
+ if (sec != NULL) {
+ item = lp_section_find_item(sec, key);
+ if (item != NULL) {
+ bctbx_list_t *l = NULL;
+ char *str;
+ char *ptr;
+ str = ptr = ms_strdup(item->value);
+ while (ptr != NULL) {
+ char *next = strstr(ptr, ",");
+ if (next != NULL) {
+ *(next++) = '\0';
+ }
+ l = bctbx_list_append(l, ms_strdup(ptr));
+ ptr = next;
+ }
+ ms_free(str);
+ return l;
+ }
+ }
+ return default_list;
+}
+
bool_t lp_config_get_range(const LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max) {
const char *str = lp_config_get_string(lpconfig, section, key, NULL);
if (str != NULL) {
@@ -645,6 +670,22 @@ void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *ke
lpconfig->modified++;
}
+void lp_config_set_string_list(LpConfig *lpconfig, const char *section, const char *key, const bctbx_list_t *value) {
+ char *strvalue = NULL;
+ char *tmp = NULL;
+ const bctbx_list_t *elem;
+ for (elem = value; elem != NULL; elem = elem->next) {
+ if (strvalue) {
+ tmp = ms_strdup_printf("%s,%s", strvalue, (const char *)elem->data);
+ ms_free(strvalue);
+ strvalue = tmp;
+ }
+ else strvalue = ms_strdup((const char *)elem->data);
+ }
+ lp_config_set_string(lpconfig, section, key, strvalue);
+ if (strvalue) ms_free(strvalue);
+}
+
void lp_config_set_range(LpConfig *lpconfig, const char *section, const char *key, int min_value, int max_value) {
char tmp[30];
snprintf(tmp, sizeof(tmp), "%i-%i", min_value, max_value);
@@ -742,10 +783,10 @@ void lp_section_param_write(LpSectionParam *param, LpConfig *lpconfig){
void lp_section_write(LpSection *sec,LpConfig *lpconfig){
if (bctbx_file_fprintf(lpconfig->pFile, 0, "[%s",sec->name) < 0) ms_error("lp_section_write : write error on %s", sec->name);
- ms_list_for_each2(sec->params, (void (*)(void*, void*))lp_section_param_write, (void *)lpconfig);
+ bctbx_list_for_each2(sec->params, (void (*)(void*, void*))lp_section_param_write, (void *)lpconfig);
if (bctbx_file_fprintf(lpconfig->pFile, 0, "]\n")< 0) ms_error("lp_section_write : write error ");
- ms_list_for_each2(sec->items, (void (*)(void*, void*))lp_item_write, (void *)lpconfig);
+ bctbx_list_for_each2(sec->items, (void (*)(void*, void*))lp_item_write, (void *)lpconfig);
if (bctbx_file_fprintf(lpconfig->pFile, 0, "\n")< 0) ms_error("lp_section_write : write error");
@@ -770,7 +811,7 @@ int lp_config_sync(LpConfig *lpconfig){
return -1;
}
- ms_list_for_each2(lpconfig->sections,(void (*)(void *,void*))lp_section_write,(void *)lpconfig);
+ bctbx_list_for_each2(lpconfig->sections,(void (*)(void *,void*))lp_section_write,(void *)lpconfig);
bctbx_file_close(pFile);
#ifdef RENAME_REQUIRES_NONEXISTENT_NEW_PATH
@@ -794,8 +835,8 @@ int lp_config_has_section(const LpConfig *lpconfig, const char *section){
void lp_config_for_each_section(const LpConfig *lpconfig, void (*callback)(const char *section, void *ctx), void *ctx) {
LpSection *sec;
- MSList *elem;
- for (elem=lpconfig->sections;elem!=NULL;elem=ms_list_next(elem)){
+ bctbx_list_t *elem;
+ for (elem=lpconfig->sections;elem!=NULL;elem=bctbx_list_next(elem)){
sec=(LpSection*)elem->data;
callback(sec->name, ctx);
}
@@ -803,10 +844,10 @@ void lp_config_for_each_section(const LpConfig *lpconfig, void (*callback)(const
void lp_config_for_each_entry(const LpConfig *lpconfig, const char *section, void (*callback)(const char *entry, void *ctx), void *ctx) {
LpItem *item;
- MSList *elem;
+ bctbx_list_t *elem;
LpSection *sec=lp_config_find_section(lpconfig,section);
if (sec!=NULL){
- for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){
+ for (elem=sec->items;elem!=NULL;elem=bctbx_list_next(elem)){
item=(LpItem*)elem->data;
if (!item->is_comment)
callback(item->key, ctx);
@@ -1003,11 +1044,11 @@ err:
const char** lp_config_get_sections_names(LpConfig *lpconfig) {
const char **sections_names;
- const MSList *sections = lpconfig->sections;
+ const bctbx_list_t *sections = lpconfig->sections;
int ndev;
int i;
- ndev = ms_list_size(sections);
+ ndev = bctbx_list_size(sections);
sections_names = ms_malloc((ndev + 1) * sizeof(const char *));
for (i = 0; sections != NULL; sections = sections->next, i++) {
diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h
index 86c1089a9..59269098e 100644
--- a/coreapi/lpconfig.h
+++ b/coreapi/lpconfig.h
@@ -104,6 +104,18 @@ LINPHONE_PUBLIC int lp_config_read_file(LpConfig *lpconfig, const char *filename
**/
LINPHONE_PUBLIC const char *lp_config_get_string(const LpConfig *lpconfig, const char *section, const char *key, const char *default_string);
+/**
+ * Retrieves a configuration item as a list of strings, given its section, key, and default value.
+ * The default value is returned if the config item is not found.
+ * @ingroup misc
+ * @param[in] lpconfig A LpConfig object
+ * @param[in] section The section from which to retrieve a configuration item
+ * @param[in] key The name of the configuration item to retrieve
+ * @param[in] default_list \mslist{const char *}
+ * @return \mslist{const char *}
+ */
+LINPHONE_PUBLIC bctbx_list_t * lp_config_get_string_list(const LpConfig *lpconfig, const char *section, const char *key, bctbx_list_t *default_list);
+
/**
* Retrieves a configuration item as a range, given its section, key, and default min and max values.
*
@@ -144,6 +156,16 @@ LINPHONE_PUBLIC float lp_config_get_float(const LpConfig *lpconfig,const char *s
**/
LINPHONE_PUBLIC void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *key, const char *value);
+/**
+ * Sets a string list config item
+ * @ingroup misc
+ * @param[in] lpconfig A LpConfig object
+ * @param[in] section The name of the section to put the configuration item into
+ * @param[in] key The name of the configuration item to set
+ * @param[in] value \mslist{const char *} The value to set
+ */
+LINPHONE_PUBLIC void lp_config_set_string_list(LpConfig *lpconfig, const char *section, const char *key, const bctbx_list_t *value);
+
/**
* Sets a range config item
*
diff --git a/coreapi/message_storage.c b/coreapi/message_storage.c
index 8af587b7b..161a9f322 100644
--- a/coreapi/message_storage.c
+++ b/coreapi/message_storage.c
@@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "sqlite3.h"
#include
+
static char *utf8_convert(const char *filename){
char db_file_utf8[MAX_PATH_SIZE] = "";
#if defined(_WIN32)
@@ -79,8 +80,11 @@ int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
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);
- ret = sqlite3_open_v2(utf8_filename, db, flags, LINPHONE_SQLITE3_VFS);
+ //ret = sqlite3_open_v2(utf8_filename, db, flags, LINPHONE_SQLITE3_VFS);
+ ret = sqlite3_open_v2(utf8_filename, db, flags, NULL); // Do not use VFS until all issues are resolved
ms_free(utf8_filename);
if (ret != SQLITE_OK) return ret;
@@ -109,7 +113,7 @@ int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
static ORTP_INLINE LinphoneChatMessage* get_transient_message(LinphoneChatRoom* cr, unsigned int storage_id){
- MSList* transients = cr->transient_messages;
+ bctbx_list_t* transients = cr->transient_messages;
LinphoneChatMessage* chat;
while( transients ){
chat = (LinphoneChatMessage*)transients->data;
@@ -195,7 +199,7 @@ static int callback_all(void *data, int argc, char **argv, char **colName){
*/
static int create_chat_message(void *data, int argc, char **argv, char **colName){
LinphoneChatRoom *cr = (LinphoneChatRoom *)data;
- unsigned int storage_id = atoi(argv[0]);
+ unsigned int storage_id = (unsigned int)atoi(argv[0]);
// 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);
@@ -227,7 +231,7 @@ static int create_chat_message(void *data, int argc, char **argv, char **colName
}
}
}
- cr->messages_hist=ms_list_prepend(cr->messages_hist,new_message);
+ cr->messages_hist=bctbx_list_prepend(cr->messages_hist,new_message);
return 0;
}
@@ -326,7 +330,7 @@ unsigned int linphone_chat_message_store(LinphoneChatMessage *msg){
void linphone_chat_message_store_state(LinphoneChatMessage *msg){
LinphoneCore *lc=msg->chat_room->lc;
if (lc->db){
- char *buf=sqlite3_mprintf("UPDATE history SET status=%i WHERE (id = %i);",
+ char *buf=sqlite3_mprintf("UPDATE history SET status=%i WHERE (id = %u);",
msg->state,msg->storage_id);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
@@ -336,7 +340,7 @@ void linphone_chat_message_store_state(LinphoneChatMessage *msg){
void linphone_chat_message_store_appdata(LinphoneChatMessage* msg){
LinphoneCore *lc=msg->chat_room->lc;
if (lc->db){
- char *buf=sqlite3_mprintf("UPDATE history SET appdata=%Q WHERE id=%i;",
+ char *buf=sqlite3_mprintf("UPDATE history SET appdata=%Q WHERE id=%u;",
msg->appdata,msg->storage_id);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
@@ -370,7 +374,7 @@ void linphone_chat_room_update_url(LinphoneChatRoom *cr, LinphoneChatMessage *ms
if (lc->db==NULL) return ;
- buf=sqlite3_mprintf("UPDATE history SET url=%Q WHERE id=%i;",msg->external_body_url,msg->storage_id);
+ buf=sqlite3_mprintf("UPDATE history SET url=%Q WHERE id=%u;",msg->external_body_url,msg->storage_id);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
}
@@ -421,7 +425,7 @@ void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage
if (lc->db==NULL) return ;
- buf=sqlite3_mprintf("DELETE FROM history WHERE id = %i;", msg->storage_id);
+ buf=sqlite3_mprintf("DELETE FROM history WHERE id = %u;", msg->storage_id);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
@@ -446,9 +450,9 @@ void linphone_chat_room_delete_history(LinphoneChatRoom *cr){
if(cr->unread_count > 0) cr->unread_count = 0;
}
-MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, int endm){
+bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, int endm){
LinphoneCore *lc=linphone_chat_room_get_core(cr);
- MSList *ret;
+ bctbx_list_t *ret;
char *buf,*buf2;
char *peer;
uint64_t begin,end;
@@ -498,7 +502,7 @@ MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, i
return ret;
}
-MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
+bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
return linphone_chat_room_get_history_range(cr, 0, nb_message-1);
}
@@ -735,11 +739,11 @@ void linphone_chat_message_store_appdata(LinphoneChatMessage *msg){
void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr){
}
-MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
+bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
return NULL;
}
-LINPHONE_PUBLIC MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end){
+LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end){
return NULL;
}
diff --git a/coreapi/misc.c b/coreapi/misc.c
index 835acb6e9..111a1828d 100644
--- a/coreapi/misc.c
+++ b/coreapi/misc.c
@@ -62,7 +62,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void clear_ice_check_list(LinphoneCall *call, IceCheckList *removed);
bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const LinphonePayloadType *pt){
- if (ms_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || ms_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt) || ms_list_find(lc->codecs_conf.text_codecs, (PayloadType*)pt)){
+ if (bctbx_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || bctbx_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt) || bctbx_list_find(lc->codecs_conf.text_codecs, (PayloadType*)pt)){
return payload_type_enabled(pt);
}
ms_error("Getting enablement status of codec not in audio or video list of PayloadType !");
@@ -75,7 +75,7 @@ bool_t linphone_core_payload_type_is_vbr(LinphoneCore *lc, const LinphonePayload
}
int linphone_core_enable_payload_type(LinphoneCore *lc, LinphonePayloadType *pt, bool_t enabled){
- if (ms_list_find(lc->codecs_conf.audio_codecs,pt) || ms_list_find(lc->codecs_conf.video_codecs,pt) || ms_list_find(lc->codecs_conf.text_codecs,pt)){
+ if (bctbx_list_find(lc->codecs_conf.audio_codecs,pt) || bctbx_list_find(lc->codecs_conf.video_codecs,pt) || bctbx_list_find(lc->codecs_conf.text_codecs,pt)){
payload_type_set_enable(pt,enabled);
_linphone_core_codec_config_write(lc);
linphone_core_update_allocated_audio_bandwidth(lc);
@@ -107,7 +107,7 @@ const char *linphone_core_get_payload_type_description(LinphoneCore *lc, Payload
}
void linphone_core_set_payload_type_bitrate(LinphoneCore *lc, LinphonePayloadType *pt, int bitrate){
- if (ms_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || ms_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt) || ms_list_find(lc->codecs_conf.text_codecs, (PayloadType*)pt)){
+ if (bctbx_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || bctbx_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt) || bctbx_list_find(lc->codecs_conf.text_codecs, (PayloadType*)pt)){
if (pt->type==PAYLOAD_VIDEO || pt->flags & PAYLOAD_TYPE_IS_VBR){
pt->normal_bitrate=bitrate*1000;
pt->flags|=PAYLOAD_TYPE_BITRATE_OVERRIDE;
@@ -204,7 +204,7 @@ void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call,
}
void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc){
- const MSList *elem;
+ const bctbx_list_t *elem;
int maxbw=get_min_bandwidth(linphone_core_get_download_bandwidth(lc),
linphone_core_get_upload_bandwidth(lc));
int max_codec_bitrate=0;
@@ -317,28 +317,30 @@ static ortp_socket_t create_socket(int local_port){
return sock;
}
-static int sendStunRequest(int sock, const struct sockaddr *server, socklen_t addrlen, int id, bool_t changeAddr){
- char buf[STUN_MAX_MESSAGE_SIZE];
- int len = STUN_MAX_MESSAGE_SIZE;
- StunAtrString username;
- StunAtrString password;
- StunMessage req;
- int err;
- memset(&req, 0, sizeof(StunMessage));
- memset(&username,0,sizeof(username));
- memset(&password,0,sizeof(password));
- stunBuildReqSimple( &req, &username, changeAddr , changeAddr , id);
- len = stunEncodeMessage( &req, buf, len, &password);
- if (len<=0){
+static int send_stun_request(int sock, const struct sockaddr *server, socklen_t addrlen, int id, bool_t change_addr){
+ char *buf = NULL;
+ int len;
+ int err = 0;
+ MSStunMessage *req = ms_stun_binding_request_create();
+ UInt96 tr_id = ms_stun_message_get_tr_id(req);
+ tr_id.octet[0] = id;
+ ms_stun_message_set_tr_id(req, tr_id);
+ ms_stun_message_enable_change_ip(req, change_addr);
+ ms_stun_message_enable_change_port(req, change_addr);
+ len = ms_stun_message_encode(req, &buf);
+ if (len <= 0) {
ms_error("Fail to encode stun message.");
- return -1;
+ err = -1;
+ } else {
+ err = sendto(sock, buf, len, 0, server, addrlen);
+ if (err < 0) {
+ ms_error("sendto failed: %s",strerror(errno));
+ err = -1;
+ }
}
- err=sendto(sock,buf,len,0,server,addrlen);
- if (err<0){
- ms_error("sendto failed: %s",strerror(errno));
- return -1;
- }
- return 0;
+ if (buf != NULL) ms_free(buf);
+ ms_free(req);
+ return err;
}
int linphone_parse_host_port(const char *input, char *host, size_t hostlen, int *port){
@@ -387,23 +389,32 @@ int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, sock
return 0;
}
-static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port, int *id){
- char buf[STUN_MAX_MESSAGE_SIZE];
- int len = STUN_MAX_MESSAGE_SIZE;
- StunMessage resp;
- len=recv(sock,buf,len,0);
- if (len>0){
+static int recv_stun_response(ortp_socket_t sock, char *ipaddr, int *port, int *id) {
+ char buf[MS_STUN_MAX_MESSAGE_SIZE];
+ int len = MS_STUN_MAX_MESSAGE_SIZE;
+ MSStunMessage *resp;
+
+ len = recv(sock, buf, len, 0);
+ if (len > 0) {
struct in_addr ia;
- stunParseMessage(buf,len, &resp );
- *id=resp.msgHdr.tr_id.octet[0];
- if (resp.hasXorMappedAddress){
- *port = resp.xorMappedAddress.ipv4.port;
- ia.s_addr=htonl(resp.xorMappedAddress.ipv4.addr);
- }else if (resp.hasMappedAddress){
- *port = resp.mappedAddress.ipv4.port;
- ia.s_addr=htonl(resp.mappedAddress.ipv4.addr);
- }else return -1;
- strncpy(ipaddr,inet_ntoa(ia),LINPHONE_IPADDR_SIZE);
+ resp = ms_stun_message_create_from_buffer_parsing((uint8_t *)buf, (ssize_t)len);
+ if (resp != NULL) {
+ const MSStunAddress *stun_addr;
+ UInt96 tr_id = ms_stun_message_get_tr_id(resp);
+ *id = tr_id.octet[0];
+ stun_addr = ms_stun_message_get_xor_mapped_address(resp);
+ if (stun_addr != NULL) {
+ *port = stun_addr->ip.v4.port;
+ ia.s_addr = htonl(stun_addr->ip.v4.addr);
+ } else {
+ stun_addr = ms_stun_message_get_mapped_address(resp);
+ if (stun_addr != NULL) {
+ *port = stun_addr->ip.v4.port;
+ ia.s_addr = htonl(stun_addr->ip.v4.addr);
+ } else len = -1;
+ }
+ if (len > 0) strncpy(ipaddr, inet_ntoa(ia), LINPHONE_IPADDR_SIZE);
+ }
}
return len;
}
@@ -459,44 +470,32 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
int id;
if (loops%20==0){
ms_message("Sending stun requests...");
- sendStunRequest((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,11,TRUE);
- sendStunRequest((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,1,FALSE);
+ send_stun_request((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,11,TRUE);
+ send_stun_request((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,1,FALSE);
if (sock2!=-1){
- sendStunRequest((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,22,TRUE);
- sendStunRequest((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,2,FALSE);
+ send_stun_request((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,22,TRUE);
+ send_stun_request((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,2,FALSE);
}
if (sock3!=-1){
- sendStunRequest((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,33,TRUE);
- sendStunRequest((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,3,FALSE);
+ send_stun_request((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,33,TRUE);
+ send_stun_request((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,3,FALSE);
}
}
ms_usleep(10000);
- if (recvStunResponse(sock1,ac->addr,
- &ac->port,&id)>0){
- ms_message("STUN test result: local audio port maps to %s:%i",
- ac->addr,
- ac->port);
- if (id==11)
- cone_audio=TRUE;
+ if (recv_stun_response(sock1, ac->addr, &ac->port, &id) > 0) {
+ ms_message("STUN test result: local audio port maps to %s:%i", ac->addr, ac->port);
+ if (id==11) cone_audio=TRUE;
got_audio=TRUE;
}
- if (recvStunResponse(sock2,vc->addr,
- &vc->port,&id)>0){
- ms_message("STUN test result: local video port maps to %s:%i",
- vc->addr,
- vc->port);
- if (id==22)
- cone_video=TRUE;
+ if (recv_stun_response(sock2, vc->addr, &vc->port, &id) > 0) {
+ ms_message("STUN test result: local video port maps to %s:%i", vc->addr, vc->port);
+ if (id==22) cone_video=TRUE;
got_video=TRUE;
}
- if (recvStunResponse(sock3,tc->addr,
- &tc->port,&id)>0){
- ms_message("STUN test result: local text port maps to %s:%i",
- tc->addr,
- tc->port);
- if (id==33)
- cone_text=TRUE;
+ if (recv_stun_response(sock3, tc->addr, &tc->port, &id)>0) {
+ ms_message("STUN test result: local text port maps to %s:%i", tc->addr, tc->port);
+ if (id==33) cone_text=TRUE;
got_text=TRUE;
}
ortp_gettimeofday(&cur,NULL);
@@ -585,16 +584,20 @@ static void stun_server_resolved(LinphoneCore *lc, const char *name, struct addr
}
void linphone_core_resolve_stun_server(LinphoneCore *lc){
- /*
- * 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=lc->net_conf.stun_server;
- if (lc->sal && server && !lc->net_conf.stun_res){
- char host[NI_MAXHOST];
- int port=3478;
- 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 (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){
+ char host[NI_MAXHOST];
+ int port=3478;
+ 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);
+ }
}
}
@@ -610,31 +613,87 @@ void linphone_core_resolve_stun_server(LinphoneCore *lc){
* changed.
**/
const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc){
- const char *server=linphone_core_get_stun_server(lc);
- if (server){
- int wait_ms=0;
- int wait_limit=1000;
- linphone_core_resolve_stun_server(lc);
- while (!lc->net_conf.stun_addrinfo && lc->net_conf.stun_res!=NULL && wait_mssal);
- ms_usleep(50000);
- wait_ms+=50;
+ if (lc->nat_policy != NULL) {
+ return linphone_nat_policy_get_stun_server_addrinfo(lc->nat_policy);
+ } else {
+ const char *server=linphone_core_get_stun_server(lc);
+ if (server){
+ int wait_ms=0;
+ int wait_limit=1000;
+ linphone_core_resolve_stun_server(lc);
+ while (!lc->net_conf.stun_addrinfo && lc->net_conf.stun_res!=NULL && wait_mssal);
+ ms_usleep(50000);
+ wait_ms+=50;
+ }
}
+ return lc->net_conf.stun_addrinfo;
}
- return lc->net_conf.stun_addrinfo;
}
void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable) {
lc->forced_ice_relay = enable;
}
+void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable) {
+ lc->short_turn_refresh = enable;
+}
+
+static void stun_auth_requested_cb(LinphoneCall *call, const char *realm, const char *nonce, const char **username, const char **password, const char **ha1) {
+ LinphoneProxyConfig *proxy = NULL;
+ const LinphoneNatPolicy *nat_policy = NULL;
+ const LinphoneAddress *addr = NULL;
+ const LinphoneAuthInfo *auth_info = NULL;
+ LinphoneCore *lc = call->core;
+ const char *user = NULL;
+
+ // Get the username from the nat policy or the proxy config
+ if (call->dest_proxy != NULL) proxy = call->dest_proxy;
+ else proxy = linphone_core_get_default_proxy_config(call->core);
+ if (proxy == NULL) return;
+ nat_policy = linphone_proxy_config_get_nat_policy(proxy);
+ if (nat_policy != NULL) {
+ user = linphone_nat_policy_get_stun_server_username(nat_policy);
+ } else {
+ nat_policy = linphone_core_get_nat_policy(call->core);
+ if (nat_policy != NULL) {
+ user = linphone_nat_policy_get_stun_server_username(nat_policy);
+ }
+ }
+ if (user == NULL) {
+ /* If the username has not been found in the nat_policy, take the username from the currently used proxy config. */
+ addr = linphone_proxy_config_get_identity_address(proxy);
+ if (addr == NULL) return;
+ user = linphone_address_get_username(addr);
+ }
+ if (user == NULL) return;
+
+ auth_info = linphone_core_find_auth_info(lc, realm, user, NULL);
+ if (auth_info != NULL) {
+ const char *hash = linphone_auth_info_get_ha1(auth_info);
+ if (hash != NULL) {
+ *ha1 = hash;
+ } else {
+ *password = linphone_auth_info_get_passwd(auth_info);
+ }
+ *username = user;
+ } else {
+ ms_warning("No auth info found for STUN auth request");
+ }
+}
+
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;
- const char *server = linphone_core_get_stun_server(lc);
+ LinphoneNatPolicy *nat_policy = NULL;
+ const char *server = NULL;
+
+ if (call->dest_proxy != NULL) nat_policy = linphone_proxy_config_get_nat_policy(call->dest_proxy);
+ if (nat_policy == NULL) nat_policy = linphone_core_get_nat_policy(lc);
+ 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);
@@ -646,8 +705,8 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){
ms_warning("Ice gathering is not implemented for ipv6");
return -1;
}
- if (server){
- ai=linphone_core_get_stun_server_addrinfo(lc);
+ 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.");
}
@@ -657,32 +716,37 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){
linphone_core_notify_display_status(lc, _("ICE local candidates gathering in progress..."));
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 (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", local_addr, call->media_ports[call->main_audio_stream_index].rtp_port, 1, NULL);
- ice_add_local_candidate(audio_check_list, "host", local_addr, call->media_ports[call->main_audio_stream_index].rtcp_port, 2, NULL);
+ 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", local_addr, call->media_ports[call->main_video_stream_index].rtp_port, 1, NULL);
- ice_add_local_candidate(video_check_list, "host", local_addr, call->media_ports[call->main_video_stream_index].rtcp_port, 2, NULL);
+ 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", local_addr, call->media_ports[call->main_text_stream_index].rtp_port, 1, NULL);
- ice_add_local_candidate(text_check_list, "host", local_addr, call->media_ports[call->main_text_stream_index].rtcp_port, 2, NULL);
+ 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){
- ms_message("ICE: gathering candidate from [%s]",server);
+ if ((ai != NULL) && (nat_policy != NULL)
+ && (linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy))) {
+ ms_message("ICE: gathering candidate from [%s] using %s", server, linphone_nat_policy_turn_enabled(nat_policy) ? "TURN" : "STUN");
/* Gather local srflx candidates. */
+ ice_session_enable_turn(call->ice_session, linphone_nat_policy_turn_enabled(nat_policy));
+ ice_session_set_stun_auth_requested_cb(call->ice_session, (MSStunAuthRequestedCb)stun_auth_requested_cb, call);
ice_session_gather_candidates(call->ice_session, ai->ai_addr, (socklen_t)ai->ai_addrlen);
return 1;
} else {
@@ -835,19 +899,21 @@ void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDes
}
void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session, bool_t use_nortpproxy) {
- const char *rtp_addr, *rtcp_addr;
+ IceCandidate *rtp_candidate = NULL;
+ IceCandidate *rtcp_candidate = NULL;
IceSessionState session_state = ice_session_state(session);
int nb_candidates;
- int i, j;
+ int i;
+ size_t j;
bool_t result;
if (session_state == IS_Completed) {
if (use_nortpproxy) desc->set_nortpproxy = TRUE;
- result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, 0), &rtp_addr, NULL, NULL, NULL);
+ result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, 0), &rtp_candidate, NULL);
if (result == TRUE) {
- strncpy(desc->addr, rtp_addr, sizeof(desc->addr));
+ strncpy(desc->addr, rtp_candidate->taddr.ip, sizeof(desc->addr));
} else {
- ms_warning("If ICE has completed successfully, rtp_addr should be set!");
+ ms_warning("If ICE has completed successfully, rtp_candidate should be set!");
}
}
else {
@@ -859,17 +925,20 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess
SalStreamDescription *stream = &desc->streams[i];
IceCheckList *cl = ice_session_check_list(session, i);
nb_candidates = 0;
+ rtp_candidate = rtcp_candidate = NULL;
if (!sal_stream_description_active(stream) || (cl == NULL)) continue;
if (ice_check_list_state(cl) == ICL_Completed) {
if (use_nortpproxy) stream->set_nortpproxy = TRUE;
- result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port);
+ result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_candidate, &rtcp_candidate);
} else {
stream->set_nortpproxy = FALSE;
- result = ice_check_list_default_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port);
+ result = ice_check_list_default_local_candidate(ice_session_check_list(session, i), &rtp_candidate, &rtcp_candidate);
}
if (result == TRUE) {
- strncpy(stream->rtp_addr, rtp_addr, sizeof(stream->rtp_addr));
- strncpy(stream->rtcp_addr, rtcp_addr, sizeof(stream->rtcp_addr));
+ strncpy(stream->rtp_addr, rtp_candidate->taddr.ip, sizeof(stream->rtp_addr));
+ strncpy(stream->rtcp_addr, rtcp_candidate->taddr.ip, sizeof(stream->rtcp_addr));
+ stream->rtp_port = rtp_candidate->taddr.port;
+ stream->rtcp_port = rtcp_candidate->taddr.port;
} else {
memset(stream->rtp_addr, 0, sizeof(stream->rtp_addr));
memset(stream->rtcp_addr, 0, sizeof(stream->rtcp_addr));
@@ -885,9 +954,9 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess
stream->ice_mismatch = ice_check_list_is_mismatch(cl);
if ((ice_check_list_state(cl) == ICL_Running) || (ice_check_list_state(cl) == ICL_Completed)) {
memset(stream->ice_candidates, 0, sizeof(stream->ice_candidates));
- for (j = 0; j < MIN(ms_list_size(cl->local_candidates), SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES); j++) {
+ for (j = 0; j < MIN(bctbx_list_size(cl->local_candidates), SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES); j++) {
SalIceCandidate *sal_candidate = &stream->ice_candidates[nb_candidates];
- IceCandidate *ice_candidate = ms_list_nth_data(cl->local_candidates, j);
+ IceCandidate *ice_candidate = bctbx_list_nth_data(cl->local_candidates, j);
const char *default_addr = NULL;
int default_port = 0;
if (ice_candidate->componentID == 1) {
@@ -916,13 +985,12 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess
}
}
if ((ice_check_list_state(cl) == ICL_Completed) && (ice_session_role(session) == IR_Controlling)) {
- int rtp_port, rtcp_port;
memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates));
- if (ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port) == TRUE) {
- strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr));
- stream->ice_remote_candidates[0].port = rtp_port;
- strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr));
- stream->ice_remote_candidates[1].port = rtcp_port;
+ if (ice_check_list_selected_valid_remote_candidate(cl, &rtp_candidate, &rtcp_candidate) == TRUE) {
+ strncpy(stream->ice_remote_candidates[0].addr, rtp_candidate->taddr.ip, sizeof(stream->ice_remote_candidates[0].addr));
+ stream->ice_remote_candidates[0].port = rtp_candidate->taddr.port;
+ strncpy(stream->ice_remote_candidates[1].addr, rtcp_candidate->taddr.ip, sizeof(stream->ice_remote_candidates[1].addr));
+ stream->ice_remote_candidates[1].port = rtcp_candidate->taddr.port;
} else {
ms_error("ice: Selected valid remote candidates should be present if the check list is in the Completed state");
}
@@ -1066,7 +1134,8 @@ 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;
- ice_add_remote_candidate(cl, candidate->type, candidate->addr, candidate->port, candidate->componentID,
+ // TODO: Handle IPv6
+ ice_add_remote_candidate(cl, candidate->type, AF_INET, candidate->addr, candidate->port, candidate->componentID,
candidate->priority, candidate->foundation, default_candidate);
}
if (ice_restarted == FALSE) {
@@ -1082,7 +1151,8 @@ 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);
}
- ice_add_losing_pair(cl, j + 1, remote_candidate->addr, remote_candidate->port, addr, port);
+ // TODO: Handle IPv6
+ ice_add_losing_pair(cl, j + 1, AF_INET, remote_candidate->addr, remote_candidate->port, addr, port);
losing_pairs_added = TRUE;
}
if (losing_pairs_added == TRUE) ice_check_list_check_completed(cl);
@@ -1555,7 +1625,7 @@ static int get_unique_transport(LinphoneCore *lc, LinphoneTransportType *type, i
}
static void linphone_core_migrate_proxy_config(LinphoneCore *lc, LinphoneTransportType type){
- const MSList *elem;
+ const bctbx_list_t *elem;
for(elem=linphone_core_get_proxy_config_list(lc);elem!=NULL;elem=elem->next){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
const char *proxy=linphone_proxy_config_get_addr(cfg);
@@ -1627,7 +1697,7 @@ void linphone_tone_description_destroy(LinphoneToneDescription *obj){
}
LinphoneToneDescription *linphone_core_get_call_error_tone(const LinphoneCore *lc, LinphoneReason reason){
- const MSList *elem;
+ const bctbx_list_t *elem;
for (elem=lc->tones;elem!=NULL;elem=elem->next){
LinphoneToneDescription *tone=(LinphoneToneDescription*)elem->data;
if (tone->reason==reason) return tone;
@@ -1636,7 +1706,7 @@ LinphoneToneDescription *linphone_core_get_call_error_tone(const LinphoneCore *l
}
const char *linphone_core_get_tone_file(const LinphoneCore *lc, LinphoneToneID id){
- const MSList *elem;
+ const bctbx_list_t *elem;
for (elem=lc->tones;elem!=NULL;elem=elem->next){
LinphoneToneDescription *tone=(LinphoneToneDescription*)elem->data;
if (tone->toneid==id && tone->reason==LinphoneReasonNone && tone->audiofile!=NULL) return tone->audiofile;
@@ -1647,11 +1717,11 @@ const char *linphone_core_get_tone_file(const LinphoneCore *lc, LinphoneToneID i
void _linphone_core_set_tone(LinphoneCore *lc, LinphoneReason reason, LinphoneToneID id, const char *audiofile){
LinphoneToneDescription *tone=linphone_core_get_call_error_tone(lc,reason);
if (tone){
- lc->tones=ms_list_remove(lc->tones,tone);
+ lc->tones=bctbx_list_remove(lc->tones,tone);
linphone_tone_description_destroy(tone);
}
tone=linphone_tone_description_new(reason,id,audiofile);
- lc->tones=ms_list_append(lc->tones,tone);
+ lc->tones=bctbx_list_append(lc->tones,tone);
}
/**
@@ -1940,15 +2010,15 @@ static void hook_invoke(Hook *h){
}
void linphone_task_list_add(LinphoneTaskList *t, LinphoneCoreIterateHook hook, void *hook_data){
- t->hooks = ms_list_append(t->hooks,hook_new(hook,hook_data));
+ t->hooks = bctbx_list_append(t->hooks,hook_new(hook,hook_data));
}
void linphone_task_list_remove(LinphoneTaskList *t, LinphoneCoreIterateHook hook, void *hook_data){
- MSList *elem;
+ bctbx_list_t *elem;
for(elem=t->hooks;elem!=NULL;elem=elem->next){
Hook *h=(Hook*)elem->data;
if (h->fun==hook && h->data==hook_data){
- t->hooks = ms_list_remove_link(t->hooks,elem);
+ t->hooks = bctbx_list_remove_link(t->hooks,elem);
ms_free(h);
return;
}
@@ -1957,9 +2027,9 @@ void linphone_task_list_remove(LinphoneTaskList *t, LinphoneCoreIterateHook hook
}
void linphone_task_list_run(LinphoneTaskList *t){
- ms_list_for_each(t->hooks,(void (*)(void*))hook_invoke);
+ bctbx_list_for_each(t->hooks,(void (*)(void*))hook_invoke);
}
void linphone_task_list_free(LinphoneTaskList *t){
- t->hooks = ms_list_free_with_data(t->hooks, (void (*)(void*))ms_free);
+ t->hooks = bctbx_list_free_with_data(t->hooks, (void (*)(void*))ms_free);
}
diff --git a/coreapi/nat_policy.c b/coreapi/nat_policy.c
new file mode 100644
index 000000000..cf3e11b9d
--- /dev/null
+++ b/coreapi/nat_policy.c
@@ -0,0 +1,305 @@
+/*
+linphone
+Copyright (C) 2010-2016 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, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "linphonecore.h"
+#include "private.h"
+
+
+static LinphoneNatPolicy * _linphone_nat_policy_new_with_ref(LinphoneCore *lc, const char *ref) {
+ LinphoneNatPolicy *policy = belle_sip_object_new(LinphoneNatPolicy);
+ belle_sip_object_ref(policy);
+ policy->lc = lc;
+ policy->ref = belle_sip_strdup(ref);
+ return policy;
+}
+
+static LinphoneNatPolicy * linphone_nat_policy_new(LinphoneCore *lc) {
+ char ref[17] = { 0 };
+ belle_sip_random_token(ref, 16);
+ return _linphone_nat_policy_new_with_ref(lc, ref);
+}
+
+static void linphone_nat_policy_destroy(LinphoneNatPolicy *policy) {
+ if (policy->ref) belle_sip_free(policy->ref);
+ if (policy->stun_server) belle_sip_free(policy->stun_server);
+ if (policy->stun_server_username) belle_sip_free(policy->stun_server_username);
+ if (policy->stun_addrinfo) bctbx_freeaddrinfo(policy->stun_addrinfo);
+ //if (policy->stun_resolver_context) sal_resolve_cancel(policy->stun_resolver_context);
+}
+
+static bool_t linphone_nat_policy_stun_server_activated(LinphoneNatPolicy *policy) {
+ const char *server = linphone_nat_policy_get_stun_server(policy);
+ return (server != NULL) && (server[0] != '\0')
+ && ((linphone_nat_policy_stun_enabled(policy) == TRUE) || (linphone_nat_policy_turn_enabled(policy) == TRUE));
+}
+
+
+
+BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneNatPolicy);
+
+BELLE_SIP_INSTANCIATE_VPTR(LinphoneNatPolicy, belle_sip_object_t,
+ (belle_sip_object_destroy_t)linphone_nat_policy_destroy,
+ NULL, // clone
+ NULL, // marshal
+ TRUE
+);
+
+
+static void _linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy, LpConfig *config, int index) {
+ char *section;
+ bctbx_list_t *l = NULL;
+
+ section = belle_sip_strdup_printf("nat_policy_%i", index);
+ lp_config_set_string(config, section, "ref", policy->ref);
+ lp_config_set_string(config, section, "stun_server", policy->stun_server);
+ lp_config_set_string(config, section, "stun_server_username", policy->stun_server_username);
+ if (linphone_nat_policy_upnp_enabled(policy)) {
+ l = bctbx_list_append(l, "upnp");
+ } else {
+ if (linphone_nat_policy_stun_enabled(policy)) l = bctbx_list_append(l, "stun");
+ if (linphone_nat_policy_turn_enabled(policy)) l = bctbx_list_append(l, "turn");
+ if (linphone_nat_policy_ice_enabled(policy)) l = bctbx_list_append(l, "ice");
+ }
+ lp_config_set_string_list(config, section, "protocols", l);
+ belle_sip_free(section);
+ bctbx_list_free(l);
+}
+
+void linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy) {
+ LpConfig *config = policy->lc->config;
+ char *section;
+ int index;
+ bool_t finished = FALSE;
+
+ for (index = 0; finished != TRUE; index++) {
+ section = belle_sip_strdup_printf("nat_policy_%i", index);
+ if (lp_config_has_section(config, section)) {
+ const char *config_ref = lp_config_get_string(config, section, "ref", NULL);
+ if ((config_ref != NULL) && (strcmp(config_ref, policy->ref) == 0)) {
+ _linphone_nat_policy_save_to_config(policy, config, index);
+ finished = TRUE;
+ }
+ } else {
+ _linphone_nat_policy_save_to_config(policy, config, index);
+ finished = TRUE;
+ }
+ belle_sip_free(section);
+ }
+}
+
+LinphoneNatPolicy * linphone_nat_policy_ref(LinphoneNatPolicy *policy) {
+ belle_sip_object_ref(policy);
+ return policy;
+}
+
+void linphone_nat_policy_unref(LinphoneNatPolicy *policy) {
+ belle_sip_object_unref(policy);
+}
+
+void *linphone_nat_policy_get_user_data(const LinphoneNatPolicy *policy) {
+ return policy->user_data;
+}
+
+void linphone_nat_policy_set_user_data(LinphoneNatPolicy *policy, void *ud) {
+ policy->user_data = ud;
+}
+
+
+void linphone_nat_policy_clear(LinphoneNatPolicy *policy) {
+ linphone_nat_policy_enable_stun(policy, FALSE);
+ linphone_nat_policy_enable_turn(policy, FALSE);
+ linphone_nat_policy_enable_ice(policy, FALSE);
+ linphone_nat_policy_enable_upnp(policy, FALSE);
+ linphone_nat_policy_set_stun_server(policy, NULL);
+ linphone_nat_policy_set_stun_server_username(policy, NULL);
+}
+
+bool_t linphone_nat_policy_stun_enabled(const LinphoneNatPolicy *policy) {
+ return policy->stun_enabled;
+}
+
+void linphone_nat_policy_enable_stun(LinphoneNatPolicy *policy, bool_t enable) {
+ policy->stun_enabled = enable;
+}
+
+bool_t linphone_nat_policy_turn_enabled(const LinphoneNatPolicy *policy) {
+ return policy->turn_enabled;
+}
+
+void linphone_nat_policy_enable_turn(LinphoneNatPolicy *policy, bool_t enable) {
+ policy->turn_enabled = enable;
+}
+
+bool_t linphone_nat_policy_ice_enabled(const LinphoneNatPolicy *policy) {
+ return policy->ice_enabled;
+}
+
+void linphone_nat_policy_enable_ice(LinphoneNatPolicy *policy, bool_t enable) {
+ policy->ice_enabled = enable;
+}
+
+bool_t linphone_nat_policy_upnp_enabled(const LinphoneNatPolicy *policy) {
+ return policy->upnp_enabled;
+}
+
+void linphone_nat_policy_enable_upnp(LinphoneNatPolicy *policy, bool_t enable) {
+ policy->upnp_enabled = enable;
+ if (enable) {
+#ifdef BUILD_UPNP
+ policy->stun_enabled = policy->turn_enabled = policy->ice_enabled = FALSE;
+ ms_warning("Enabling uPnP NAT policy has disabled any other previously enabled policies");
+#else
+ ms_warning("Cannot enable the uPnP NAT policy because the uPnP support is not compiled in");
+#endif
+ }
+}
+
+const char * linphone_nat_policy_get_stun_server(const LinphoneNatPolicy *policy) {
+ return policy->stun_server;
+}
+
+void linphone_nat_policy_set_stun_server(LinphoneNatPolicy *policy, const char *stun_server) {
+ char *new_stun_server = NULL;
+
+ if (stun_server != NULL) new_stun_server = belle_sip_strdup(stun_server);
+ if (policy->stun_server != NULL) {
+ belle_sip_free(policy->stun_server);
+ policy->stun_server = NULL;
+ }
+ if (new_stun_server != NULL) {
+ policy->stun_server = new_stun_server;
+ linphone_nat_policy_resolve_stun_server(policy);
+ }
+}
+
+const char * linphone_nat_policy_get_stun_server_username(const LinphoneNatPolicy *policy) {
+ return policy->stun_server_username;
+}
+
+void linphone_nat_policy_set_stun_server_username(LinphoneNatPolicy *policy, const char *username) {
+ char *new_username = NULL;
+
+ if (username != NULL) new_username = belle_sip_strdup(username);
+ if (policy->stun_server_username != NULL) {
+ belle_sip_free(policy->stun_server_username);
+ policy->stun_server_username = NULL;
+ }
+ if (new_username != NULL) policy->stun_server_username = new_username;
+}
+
+static void stun_server_resolved(LinphoneNatPolicy *policy, const char *name, struct addrinfo *addrinfo) {
+ if (policy->stun_addrinfo) {
+ bctbx_freeaddrinfo(policy->stun_addrinfo);
+ policy->stun_addrinfo = NULL;
+ }
+ if (addrinfo) {
+ ms_message("Stun server resolution successful.");
+ } else {
+ ms_warning("Stun server resolution failed.");
+ }
+ policy->stun_addrinfo = addrinfo;
+ policy->stun_resolver_context = NULL;
+}
+
+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) {
+ 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);
+ }
+ }
+}
+
+const struct addrinfo * linphone_nat_policy_get_stun_server_addrinfo(LinphoneNatPolicy *policy) {
+ /*
+ * It is critical not to block for a long time if it can't be resolved, otherwise this stucks the main thread when making a call.
+ * On the contrary, a fully asynchronous call initiation is complex to develop.
+ * The compromise is then:
+ * - have a cache of the stun server addrinfo
+ * - this cached value is returned when it is non-null
+ * - an asynchronous resolution is asked each time this function is called to ensure frequent refreshes of the cached value.
+ * - if no cached value exists, block for a short time; this case must be unprobable because the resolution will be asked each
+ * time the stun server value is changed.
+ */
+ if (linphone_nat_policy_stun_server_activated(policy)) {
+ int wait_ms = 0;
+ int wait_limit = 1000;
+ linphone_nat_policy_resolve_stun_server(policy);
+ while ((policy->stun_addrinfo == NULL) && (policy->stun_resolver_context != NULL) && (wait_ms < wait_limit)) {
+ sal_iterate(policy->lc->sal);
+ ms_usleep(50000);
+ wait_ms += 50;
+ }
+ }
+ return policy->stun_addrinfo;
+}
+
+LinphoneNatPolicy * linphone_core_create_nat_policy(LinphoneCore *lc) {
+ return linphone_nat_policy_new(lc);
+}
+
+LinphoneNatPolicy * linphone_core_create_nat_policy_from_config(LinphoneCore *lc, const char *ref) {
+ LpConfig *config = lc->config;
+ LinphoneNatPolicy *policy = NULL;
+ char *section;
+ int index;
+ bool_t finished = FALSE;
+
+ for (index = 0; finished != TRUE; index++) {
+ section = belle_sip_strdup_printf("nat_policy_%i", index);
+ if (lp_config_has_section(config, section)) {
+ const char *config_ref = lp_config_get_string(config, section, "ref", NULL);
+ if ((config_ref != NULL) && (strcmp(config_ref, ref) == 0)) {
+ const char *server = lp_config_get_string(config, section, "stun_server", NULL);
+ const char *username = lp_config_get_string(config, section, "stun_server_username", NULL);
+ bctbx_list_t *l = lp_config_get_string_list(config, section, "protocols", NULL);
+ policy = _linphone_nat_policy_new_with_ref(lc, ref);
+ if (server != NULL) linphone_nat_policy_set_stun_server(policy, server);
+ if (username != NULL) linphone_nat_policy_set_stun_server_username(policy, username);
+ if (l != NULL) {
+ bool_t upnp_enabled = FALSE;
+ bctbx_list_t *elem;
+ for (elem = l; elem != NULL; elem = elem->next) {
+ const char *value = (const char *)elem->data;
+ if (strcmp(value, "stun") == 0) linphone_nat_policy_enable_stun(policy, TRUE);
+ else if (strcmp(value, "turn") == 0) linphone_nat_policy_enable_turn(policy, TRUE);
+ else if (strcmp(value, "ice") == 0) linphone_nat_policy_enable_ice(policy, TRUE);
+ else if (strcmp(value, "upnp") == 0) upnp_enabled = TRUE;
+ }
+ if (upnp_enabled) linphone_nat_policy_enable_upnp(policy, TRUE);
+ }
+ finished = TRUE;
+ }
+ } else finished = TRUE;
+ belle_sip_free(section);
+ }
+ return policy;
+}
diff --git a/coreapi/nat_policy.h b/coreapi/nat_policy.h
new file mode 100644
index 000000000..e122508aa
--- /dev/null
+++ b/coreapi/nat_policy.h
@@ -0,0 +1,205 @@
+/*
+nat_policy.h
+Copyright (C) 2010-2016 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, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef LINPHONE_NAT_POLICY_H_
+#define LINPHONE_NAT_POLICY_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @addtogroup network_parameters
+ * @{
+ */
+
+/**
+ * Policy to use to pass through NATs/firewalls.
+ */
+typedef struct _LinphoneNatPolicy LinphoneNatPolicy;
+
+
+/**
+ * Acquire a reference to the LinphoneNatPolicy object.
+ * @param[in] policy LinphoneNatPolicy object.
+ * @return The same LinphoneNatPolicy object.
+**/
+LINPHONE_PUBLIC LinphoneNatPolicy * linphone_nat_policy_ref(LinphoneNatPolicy *policy);
+
+/**
+ * Release reference to the LinphoneNatPolicy object.
+ * @param[in] policy LinphoneNatPolicy object.
+**/
+LINPHONE_PUBLIC void linphone_nat_policy_unref(LinphoneNatPolicy *policy);
+
+/**
+ * Retrieve the user pointer associated with the LinphoneNatPolicy object.
+ * @param[in] policy LinphoneNatPolicy object.
+ * @return The user pointer associated with the LinphoneNatPolicy object.
+**/
+LINPHONE_PUBLIC void *linphone_nat_policy_get_user_data(const LinphoneNatPolicy *policy);
+
+/**
+ * Assign a user pointer to the LinphoneNatPolicy object.
+ * @param[in] policy LinphoneNatPolicy object.
+ * @param[in] ud The user pointer to associate with the LinphoneNatPolicy object.
+**/
+LINPHONE_PUBLIC void linphone_nat_policy_set_user_data(LinphoneNatPolicy *policy, void *ud);
+
+/**
+ * Clear a NAT policy (deactivate all protocols and unset the STUN server).
+ * @param[in] policy LinphoneNatPolicy object.
+ */
+LINPHONE_PUBLIC void linphone_nat_policy_clear(LinphoneNatPolicy *policy);
+
+/**
+ * Tell whether STUN is enabled.
+ * @param[in] policy LinphoneNatPolicy object
+ * @return Boolean value telling whether STUN is enabled.
+ */
+LINPHONE_PUBLIC bool_t linphone_nat_policy_stun_enabled(const LinphoneNatPolicy *policy);
+
+/**
+ * Enable STUN.
+ * If TURN is also enabled, TURN will be used instead of STUN.
+ * @param[in] policy LinphoneNatPolicy object
+ * @param[in] enable Boolean value telling whether to enable STUN.
+ */
+LINPHONE_PUBLIC void linphone_nat_policy_enable_stun(LinphoneNatPolicy *policy, bool_t enable);
+
+/**
+ * Tell whether TURN is enabled.
+ * @param[in] policy LinphoneNatPolicy object
+ * @return Boolean value telling whether TURN is enabled.
+ */
+LINPHONE_PUBLIC bool_t linphone_nat_policy_turn_enabled(const LinphoneNatPolicy *policy);
+
+/**
+ * Enable TURN.
+ * If STUN is also enabled, it is ignored and TURN is used.
+ * @param[in] policy LinphoneNatPolicy object
+ * @param[in] enable Boolean value telling whether to enable TURN.
+ */
+LINPHONE_PUBLIC void linphone_nat_policy_enable_turn(LinphoneNatPolicy *policy, bool_t enable);
+
+/**
+ * Tell whether ICE is enabled.
+ * @param[in] policy LinphoneNatPolicy object
+ * @return Boolean value telling whether ICE is enabled.
+ */
+LINPHONE_PUBLIC bool_t linphone_nat_policy_ice_enabled(const LinphoneNatPolicy *policy);
+
+/**
+ * Enable ICE.
+ * ICE can be enabled without STUN/TURN, in which case only the local candidates will be used.
+ * @param[in] policy LinphoneNatPolicy object
+ * @param[in] enable Boolean value telling whether to enable ICE.
+ */
+LINPHONE_PUBLIC void linphone_nat_policy_enable_ice(LinphoneNatPolicy *policy, bool_t enable);
+
+/**
+ * Tell whether uPnP is enabled.
+ * @param[in] policy LinphoneNatPolicy object
+ * @return Boolean value telling whether uPnP is enabled.
+ */
+LINPHONE_PUBLIC bool_t linphone_nat_policy_upnp_enabled(const LinphoneNatPolicy *policy);
+
+/**
+ * Enable uPnP.
+ * This has the effect to disable every other policies (ICE, STUN and TURN).
+ * @param[in] policy LinphoneNatPolicy object
+ * @param[in] enable Boolean value telling whether to enable uPnP.
+ */
+LINPHONE_PUBLIC void linphone_nat_policy_enable_upnp(LinphoneNatPolicy *policy, bool_t enable);
+
+/**
+ * Get the STUN/TURN server to use with this NAT policy.
+ * Used when STUN or TURN are enabled.
+ * @param[in] policy LinphoneNatPolicy object
+ * @return The STUN server used by this NAT policy.
+ */
+LINPHONE_PUBLIC const char * linphone_nat_policy_get_stun_server(const LinphoneNatPolicy *policy);
+
+/**
+ * Set the STUN/TURN server to use with this NAT policy.
+ * Used when STUN or TURN are enabled.
+ * @param[in] policy LinphoneNatPolicy object
+ * @param[in] stun_server The STUN server to use with this NAT policy.
+ */
+LINPHONE_PUBLIC void linphone_nat_policy_set_stun_server(LinphoneNatPolicy *policy, const char *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.
+ * @param[in] policy LinphoneNatPolicy object
+ * @return The username used to authenticate with the STUN/TURN server.
+ */
+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.
+ * 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
+ * @param[in] username The username used to authenticate with the STUN/TURN server.
+ */
+LINPHONE_PUBLIC void linphone_nat_policy_set_stun_server_username(LinphoneNatPolicy *policy, const char *username);
+
+/**
+ * Start a STUN server DNS resolution.
+ * @param[in] policy LinphoneNatPolicy object
+ */
+LINPHONE_PUBLIC void linphone_nat_policy_resolve_stun_server(LinphoneNatPolicy *policy);
+
+/**
+ * Get the addrinfo representation of the STUN server address.
+ * WARNING: This function may block for up to 1 second.
+ * @param[in] policy LinphoneNatPolicy object
+ * @return addrinfo representation of the STUN server address.
+ */
+LINPHONE_PUBLIC const struct addrinfo * linphone_nat_policy_get_stun_server_addrinfo(LinphoneNatPolicy *policy);
+
+/**
+ * Create a new LinphoneNatPolicy object with every policies being disabled.
+ * @param[in] lc LinphoneCore object
+ * @return A new LinphoneNatPolicy object.
+ */
+LINPHONE_PUBLIC LinphoneNatPolicy * linphone_core_create_nat_policy(LinphoneCore *lc);
+
+/**
+ * Create a new LinphoneNatPolicy by reading the config of a LinphoneCore according to the passed ref.
+ * @param[in] lc LinphoneCore object
+ * @param[in] ref The reference of a NAT policy in the config of the LinphoneCore
+ * @return A new LinphoneNatPolicy object.
+ */
+LINPHONE_PUBLIC LinphoneNatPolicy * linphone_core_create_nat_policy_from_config(LinphoneCore *lc, const char *ref);
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LINPHONE_NAT_POLICY_H_ */
diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c
index 08f3505d5..ede4f99e9 100644
--- a/coreapi/offeranswer.c
+++ b/coreapi/offeranswer.c
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "offeranswer.h"
#include "private.h"
-static bool_t only_telephone_event(const MSList *l){
+static bool_t only_telephone_event(const bctbx_list_t *l){
for(;l!=NULL;l=l->next){
PayloadType *p=(PayloadType*)l->data;
if (strcasecmp(p->mime_type,"telephone-event")!=0){
@@ -32,9 +32,9 @@ static bool_t only_telephone_event(const MSList *l){
}
-static PayloadType * opus_match(MSOfferAnswerContext *ctx, const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads, bool_t reading_response){
+static PayloadType * opus_match(MSOfferAnswerContext *ctx, const bctbx_list_t *local_payloads, const PayloadType *refpt, const bctbx_list_t *remote_payloads, bool_t reading_response){
PayloadType *pt;
- const MSList *elem;
+ const bctbx_list_t *elem;
PayloadType *legacy_opus=NULL;
for (elem=local_payloads;elem!=NULL;elem=elem->next){
@@ -68,9 +68,9 @@ MSOfferAnswerProvider opus_offer_answer_provider={
};
/* the reason for this matcher is for some stupid uncompliant phone that offer G729a mime type !*/
-static PayloadType * g729A_match(MSOfferAnswerContext *ctx, const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads, bool_t reading_response){
+static PayloadType * g729A_match(MSOfferAnswerContext *ctx, const bctbx_list_t *local_payloads, const PayloadType *refpt, const bctbx_list_t *remote_payloads, bool_t reading_response){
PayloadType *pt;
- const MSList *elem;
+ const bctbx_list_t *elem;
PayloadType *candidate=NULL;
for (elem=local_payloads;elem!=NULL;elem=elem->next){
@@ -93,8 +93,8 @@ MSOfferAnswerProvider g729a_offer_answer_provider={
g729a_offer_answer_create_context
};
-static PayloadType * red_match(MSOfferAnswerContext *ctx, const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads, bool_t reading_response) {
- const MSList *elem_local, *elem_remote;
+static PayloadType * red_match(MSOfferAnswerContext *ctx, const bctbx_list_t *local_payloads, const PayloadType *refpt, const bctbx_list_t *remote_payloads, bool_t reading_response) {
+ const bctbx_list_t *elem_local, *elem_remote;
PayloadType *red = NULL;
for (elem_local = local_payloads; elem_local != NULL; elem_local = elem_local->next) {
@@ -131,9 +131,9 @@ MSOfferAnswerProvider red_offer_answer_provider={
red_offer_answer_create_context
};
-static PayloadType * generic_match(const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads){
+static PayloadType * generic_match(const bctbx_list_t *local_payloads, const PayloadType *refpt, const bctbx_list_t *remote_payloads){
PayloadType *pt;
- const MSList *elem;
+ const bctbx_list_t *elem;
for (elem=local_payloads;elem!=NULL;elem=elem->next){
pt=(PayloadType*)elem->data;
@@ -158,8 +158,8 @@ void linphone_core_register_offer_answer_providers(LinphoneCore *lc){
/*
* Returns a PayloadType from the local list that matches a PayloadType offered or answered in the remote list
*/
-static PayloadType * find_payload_type_best_match(MSFactory *factory, const MSList *local_payloads, const PayloadType *refpt,
- const MSList *remote_payloads, bool_t reading_response){
+static PayloadType * find_payload_type_best_match(MSFactory *factory, const bctbx_list_t *local_payloads, const PayloadType *refpt,
+ const bctbx_list_t *remote_payloads, bool_t reading_response){
PayloadType *ret = NULL;
MSOfferAnswerContext *ctx = NULL;
@@ -174,9 +174,9 @@ static PayloadType * find_payload_type_best_match(MSFactory *factory, const MSLi
}
-static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSList *remote, bool_t reading_response, bool_t one_matching_codec){
- const MSList *e2,*e1;
- MSList *res=NULL;
+static bctbx_list_t *match_payloads(MSFactory *factory, const bctbx_list_t *local, const bctbx_list_t *remote, bool_t reading_response, bool_t one_matching_codec){
+ const bctbx_list_t *e2,*e1;
+ bctbx_list_t *res=NULL;
PayloadType *matched;
bool_t found_codec=FALSE;
@@ -211,7 +211,7 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL
}else{
payload_type_unset_flag(matched, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
}
- res=ms_list_append(res,matched);
+ res=bctbx_list_append(res,matched);
/* we should use the remote numbering even when parsing a response */
payload_type_set_number(matched,remote_number);
payload_type_set_flag(matched, PAYLOAD_TYPE_FROZEN_NUMBER);
@@ -227,7 +227,7 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL
payload_type_set_number(matched,local_number);
payload_type_set_flag(matched, PAYLOAD_TYPE_FLAG_CAN_RECV);
payload_type_set_flag(matched, PAYLOAD_TYPE_FROZEN_NUMBER);
- res=ms_list_append(res,matched);
+ res=bctbx_list_append(res,matched);
}
}else{
if (p2->channels>0)
@@ -252,7 +252,7 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL
p1=payload_type_clone(p1);
payload_type_set_flag(p1, PAYLOAD_TYPE_FLAG_CAN_RECV);
payload_type_set_flag(p1, PAYLOAD_TYPE_FROZEN_NUMBER);
- res=ms_list_append(res,p1);
+ res=bctbx_list_append(res,p1);
}
}
}
diff --git a/coreapi/plugins/buddylookup/src/lookup.c b/coreapi/plugins/buddylookup/src/lookup.c
index 736e7aa35..094da0dce 100644
--- a/coreapi/plugins/buddylookup/src/lookup.c
+++ b/coreapi/plugins/buddylookup/src/lookup.c
@@ -108,8 +108,8 @@ static void fill_buddy_info(BLReq *blreq, BuddyInfo *bi, GHashTable *ht){
}
-static MSList * make_buddy_list(BLReq *blreq, GValue *retval){
- MSList *ret=NULL;
+static bctbx_list_t * make_buddy_list(BLReq *blreq, GValue *retval){
+ bctbx_list_t *ret=NULL;
if (G_VALUE_TYPE(retval)==G_TYPE_VALUE_ARRAY){
GValueArray *array=(GValueArray*)g_value_get_boxed(retval);
GValue *gelem;
@@ -120,7 +120,7 @@ static MSList * make_buddy_list(BLReq *blreq, GValue *retval){
GHashTable *ht=(GHashTable*)g_value_get_boxed(gelem);
BuddyInfo *bi=buddy_info_new();
fill_buddy_info(blreq,bi,ht);
- ret=ms_list_append(ret,bi);
+ ret=bctbx_list_append(ret,bi);
}else{
ms_error("Element is not a hash table");
}
diff --git a/coreapi/presence.c b/coreapi/presence.c
index 5986a988d..306fc9a1f 100644
--- a/coreapi/presence.c
+++ b/coreapi/presence.c
@@ -41,7 +41,7 @@ struct _LinphonePresenceService {
char *id;
LinphonePresenceBasicStatus status;
char *contact;
- MSList *notes; /**< A list of _LinphonePresenceNote structures. */
+ bctbx_list_t *notes; /**< A list of _LinphonePresenceNote structures. */
time_t timestamp;
};
@@ -56,9 +56,9 @@ struct _LinphonePresencePerson {
void *user_data;
int refcnt;
char *id;
- MSList *activities; /**< A list of _LinphonePresenceActivity structures. */
- MSList *activities_notes; /**< A list of _LinphonePresenceNote structures. */
- MSList *notes; /**< A list of _LinphonePresenceNote structures. */
+ bctbx_list_t *activities; /**< A list of _LinphonePresenceActivity structures. */
+ bctbx_list_t *activities_notes; /**< A list of _LinphonePresenceNote structures. */
+ bctbx_list_t *notes; /**< A list of _LinphonePresenceNote structures. */
time_t timestamp;
};
@@ -70,9 +70,9 @@ struct _LinphonePresenceModel {
LinphoneAddress *presentity; /* "The model seeks to describe the presentity, identified by a presentity URI.*/
void *user_data;
int refcnt;
- MSList *services; /**< A list of _LinphonePresenceService structures. Also named tuples in the RFC. */
- MSList *persons; /**< A list of _LinphonePresencePerson structures. */
- MSList *notes; /**< A list of _LinphonePresenceNote structures. */
+ bctbx_list_t *services; /**< A list of _LinphonePresenceService structures. Also named tuples in the RFC. */
+ bctbx_list_t *persons; /**< A list of _LinphonePresencePerson structures. */
+ bctbx_list_t *notes; /**< A list of _LinphonePresenceNote structures. */
};
@@ -137,8 +137,8 @@ static void presence_service_delete(LinphonePresenceService *service) {
if (service->contact != NULL) {
ms_free(service->contact);
}
- ms_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(service->notes);
+ bctbx_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(service->notes);
ms_free(service);
};
@@ -147,7 +147,7 @@ static void presence_service_set_timestamp(LinphonePresenceService *service, tim
}
static void presence_service_add_note(LinphonePresenceService *service, LinphonePresenceNote *note) {
- service->notes = ms_list_append(service->notes, note);
+ service->notes = bctbx_list_append(service->notes, note);
}
static void presence_activity_delete(LinphonePresenceActivity *activity) {
@@ -216,21 +216,21 @@ static void presence_person_delete(LinphonePresencePerson *person) {
if (person->id != NULL) {
ms_free(person->id);
}
- ms_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
- ms_list_free(person->activities);
- ms_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(person->activities_notes);
- ms_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(person->notes);
+ bctbx_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
+ bctbx_list_free(person->activities);
+ bctbx_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(person->activities_notes);
+ bctbx_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(person->notes);
ms_free(person);
}
static void presence_person_add_activities_note(LinphonePresencePerson *person, LinphonePresenceNote *note) {
- person->activities_notes = ms_list_append(person->activities_notes, note);
+ person->activities_notes = bctbx_list_append(person->activities_notes, note);
}
static void presence_person_add_note(LinphonePresencePerson *person, LinphonePresenceNote *note) {
- person->notes = ms_list_append(person->notes, note);
+ person->notes = bctbx_list_append(person->notes, note);
}
static int presence_model_insert_person_by_timestamp(LinphonePresencePerson *current, LinphonePresencePerson *to_insert) {
@@ -238,11 +238,11 @@ static int presence_model_insert_person_by_timestamp(LinphonePresencePerson *cur
}
static void presence_model_add_person(LinphonePresenceModel *model, LinphonePresencePerson *person) {
- model->persons = ms_list_insert_sorted(model->persons, linphone_presence_person_ref(person), (MSCompareFunc)presence_model_insert_person_by_timestamp);
+ model->persons = bctbx_list_insert_sorted(model->persons, linphone_presence_person_ref(person), (bctbx_compare_func)presence_model_insert_person_by_timestamp);
}
static void presence_model_add_note(LinphonePresenceModel *model, LinphonePresenceNote *note) {
- model->notes = ms_list_append(model->notes, note);
+ model->notes = bctbx_list_append(model->notes, note);
}
static void presence_model_find_open_basic_status(LinphonePresenceService *service, LinphonePresenceBasicStatus *status) {
@@ -255,12 +255,12 @@ static void presence_model_delete(LinphonePresenceModel *model) {
if (model == NULL) return;
if (model->presentity)
linphone_address_unref(model->presentity);
- ms_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
- ms_list_free(model->services);
- ms_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
- ms_list_free(model->persons);
- ms_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(model->notes);
+ bctbx_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
+ bctbx_list_free(model->services);
+ bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
+ bctbx_list_free(model->persons);
+ bctbx_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(model->notes);
ms_free(model);
}
@@ -291,7 +291,7 @@ LinphonePresenceModel * linphone_presence_model_new_with_activity_and_note(Linph
LinphonePresenceBasicStatus linphone_presence_model_get_basic_status(const LinphonePresenceModel *model) {
LinphonePresenceBasicStatus status = LinphonePresenceBasicStatusClosed;
if (model != NULL) {
- ms_list_for_each2(model->services, (MSIterate2Func)presence_model_find_open_basic_status, &status);
+ bctbx_list_for_each2(model->services, (MSIterate2Func)presence_model_find_open_basic_status, &status);
}
return status;
}
@@ -327,8 +327,8 @@ time_t linphone_presence_model_get_timestamp(const LinphonePresenceModel *model)
if (model == NULL)
return timestamp;
- ms_list_for_each2(model->services, (MSIterate2Func)presence_service_find_newer_timestamp, ×tamp);
- ms_list_for_each2(model->persons, (MSIterate2Func)presence_person_find_newer_timestamp, ×tamp);
+ bctbx_list_for_each2(model->services, (MSIterate2Func)presence_service_find_newer_timestamp, ×tamp);
+ bctbx_list_for_each2(model->persons, (MSIterate2Func)presence_person_find_newer_timestamp, ×tamp);
return timestamp;
}
@@ -340,7 +340,7 @@ static void presence_model_find_contact(LinphonePresenceService *service, char *
char * linphone_presence_model_get_contact(const LinphonePresenceModel *model) {
char *contact = NULL;
- ms_list_for_each2(model->services, (MSIterate2Func)presence_model_find_contact, &contact);
+ bctbx_list_for_each2(model->services, (MSIterate2Func)presence_model_find_contact, &contact);
if (contact == NULL) return NULL;
return ms_strdup(contact);
}
@@ -360,7 +360,7 @@ int linphone_presence_model_set_contact(LinphonePresenceModel *model, const char
}
static void presence_model_count_activities(const LinphonePresencePerson *person, unsigned int *nb) {
- *nb += ms_list_size(person->activities);
+ *nb += bctbx_list_size(person->activities);
}
struct _get_activity_st {
@@ -371,9 +371,9 @@ struct _get_activity_st {
static void presence_model_get_activity(const LinphonePresencePerson *person, struct _get_activity_st *st) {
if (st->current_idx != (unsigned)-1) {
- unsigned int size = ms_list_size(person->activities);
+ unsigned int size = bctbx_list_size(person->activities);
if (st->requested_idx < (st->current_idx + size)) {
- st->activity = (LinphonePresenceActivity *)ms_list_nth_data(person->activities, st->requested_idx - st->current_idx);
+ st->activity = (LinphonePresenceActivity *)bctbx_list_nth_data(person->activities, st->requested_idx - st->current_idx);
st->current_idx = (unsigned)-1;
} else {
st->current_idx += size;
@@ -416,7 +416,7 @@ int linphone_presence_model_set_activity(LinphonePresenceModel *model, LinphoneP
unsigned int linphone_presence_model_get_nb_activities(const LinphonePresenceModel *model) {
unsigned int nb = 0;
- ms_list_for_each2(model->persons, (MSIterate2Func)presence_model_count_activities, &nb);
+ bctbx_list_for_each2(model->persons, (MSIterate2Func)presence_model_count_activities, &nb);
return nb;
}
@@ -428,7 +428,7 @@ LinphonePresenceActivity * linphone_presence_model_get_nth_activity(const Linpho
memset(&st, 0, sizeof(st));
st.requested_idx = idx;
- ms_list_for_each2(model->persons, (MSIterate2Func)presence_model_get_activity, &st);
+ bctbx_list_for_each2(model->persons, (MSIterate2Func)presence_model_get_activity, &st);
return st.activity;
}
@@ -439,7 +439,7 @@ int linphone_presence_model_add_activity(LinphonePresenceModel *model, LinphoneP
if ((model == NULL) || (activity == NULL)) return -1;
- if (ms_list_size(model->persons) == 0) {
+ if (bctbx_list_size(model->persons) == 0) {
/* There is no person in the presence model, add one. */
id = generate_presence_id();
person = presence_person_new(id, time(NULL));
@@ -448,9 +448,10 @@ int linphone_presence_model_add_activity(LinphonePresenceModel *model, LinphoneP
return -1;
presence_model_add_person(model, person);
+ linphone_presence_person_unref(person);
} else {
/* Add the activity to the first person in the model. */
- person = (LinphonePresencePerson *)ms_list_nth_data(model->persons, 0);
+ person = (LinphonePresencePerson *)bctbx_list_nth_data(model->persons, 0);
}
linphone_presence_person_add_activity(person, activity);
@@ -460,7 +461,7 @@ int linphone_presence_model_add_activity(LinphonePresenceModel *model, LinphoneP
int linphone_presence_model_clear_activities(LinphonePresenceModel *model) {
if (model == NULL) return -1;
- ms_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_clear_activities);
+ bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_clear_activities);
return 0;
}
@@ -469,13 +470,13 @@ struct _find_note_st {
LinphonePresenceNote *note;
};
-static LinphonePresenceNote * find_presence_note_in_list(MSList *list, const char *lang) {
+static LinphonePresenceNote * find_presence_note_in_list(bctbx_list_t *list, const char *lang) {
int nb;
int i;
- nb = ms_list_size(list);
+ nb = bctbx_list_size(list);
for (i = 0; i < nb; i++) {
- LinphonePresenceNote *note = (LinphonePresenceNote *)ms_list_nth_data(list, i);
+ LinphonePresenceNote *note = (LinphonePresenceNote *)bctbx_list_nth_data(list, i);
if (lang == NULL) {
if (note->lang == NULL) {
return note;
@@ -503,8 +504,8 @@ static void find_presence_service_note(LinphonePresenceService *service, struct
st->note = find_presence_note_in_list(service->notes, st->lang);
}
-static LinphonePresenceNote * get_first_presence_note_in_list(MSList *list) {
- return (LinphonePresenceNote *)ms_list_nth_data(list, 0);
+static LinphonePresenceNote * get_first_presence_note_in_list(bctbx_list_t *list) {
+ return (LinphonePresenceNote *)bctbx_list_nth_data(list, 0);
}
static void get_first_presence_person_note(LinphonePresencePerson *person, struct _find_note_st *st) {
@@ -526,9 +527,9 @@ LinphonePresenceNote * linphone_presence_model_get_note(const LinphonePresenceMo
if (lang != NULL) {
/* First try to find a note in the specified language exactly. */
st.lang = lang;
- ms_list_for_each2(model->persons, (MSIterate2Func)find_presence_person_note, &st);
+ bctbx_list_for_each2(model->persons, (MSIterate2Func)find_presence_person_note, &st);
if (st.note == NULL) {
- ms_list_for_each2(model->services, (MSIterate2Func)find_presence_service_note, &st);
+ bctbx_list_for_each2(model->services, (MSIterate2Func)find_presence_service_note, &st);
}
if (st.note == NULL) {
st.note = find_presence_note_in_list(model->notes, lang);
@@ -538,9 +539,9 @@ LinphonePresenceNote * linphone_presence_model_get_note(const LinphonePresenceMo
if (st.note == NULL) {
/* No notes in the specified language has been found, try to find one without language. */
st.lang = NULL;
- ms_list_for_each2(model->persons, (MSIterate2Func)find_presence_person_note, &st);
+ bctbx_list_for_each2(model->persons, (MSIterate2Func)find_presence_person_note, &st);
if (st.note == NULL) {
- ms_list_for_each2(model->services, (MSIterate2Func)find_presence_service_note, &st);
+ bctbx_list_for_each2(model->services, (MSIterate2Func)find_presence_service_note, &st);
}
if (st.note == NULL) {
st.note = find_presence_note_in_list(model->notes, NULL);
@@ -549,9 +550,9 @@ LinphonePresenceNote * linphone_presence_model_get_note(const LinphonePresenceMo
if (st.note == NULL) {
/* Still no result, so get the first note even if it is not in the specified language. */
- ms_list_for_each2(model->persons, (MSIterate2Func)get_first_presence_person_note, &st);
+ bctbx_list_for_each2(model->persons, (MSIterate2Func)get_first_presence_person_note, &st);
if (st.note == NULL) {
- ms_list_for_each2(model->services, (MSIterate2Func)get_first_presence_service_note, &st);
+ bctbx_list_for_each2(model->services, (MSIterate2Func)get_first_presence_service_note, &st);
}
if (st.note == NULL) {
st.note = get_first_presence_note_in_list(model->notes);
@@ -569,7 +570,7 @@ int linphone_presence_model_add_note(LinphonePresenceModel *model, const char *n
return -1;
/* Will put the note in the first service. */
- service = ms_list_nth_data(model->services, 0);
+ service = bctbx_list_nth_data(model->services, 0);
if (service == NULL) {
/* If no service exists, create one. */
service = presence_service_new(generate_presence_id(), LinphonePresenceBasicStatusClosed);
@@ -593,17 +594,17 @@ int linphone_presence_model_add_note(LinphonePresenceModel *model, const char *n
}
static void clear_presence_person_notes(LinphonePresencePerson *person) {
- ms_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(person->activities_notes);
+ bctbx_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(person->activities_notes);
person->activities_notes = NULL;
- ms_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(person->notes);
+ bctbx_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(person->notes);
person->notes = NULL;
}
static void clear_presence_service_notes(LinphonePresenceService *service) {
- ms_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(service->notes);
+ bctbx_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(service->notes);
service->notes = NULL;
}
@@ -611,10 +612,10 @@ int linphone_presence_model_clear_notes(LinphonePresenceModel *model) {
if (model == NULL)
return -1;
- ms_list_for_each(model->persons, (MSIterateFunc)clear_presence_person_notes);
- ms_list_for_each(model->services, (MSIterateFunc)clear_presence_service_notes);
- ms_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(model->notes);
+ bctbx_list_for_each(model->persons, (MSIterateFunc)clear_presence_person_notes);
+ bctbx_list_for_each(model->services, (MSIterateFunc)clear_presence_service_notes);
+ bctbx_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(model->notes);
model->notes = NULL;
return 0;
@@ -631,40 +632,40 @@ LinphonePresenceModel * linphone_presence_model_new(void) {
}
unsigned int linphone_presence_model_get_nb_services(const LinphonePresenceModel *model) {
- return ms_list_size(model->services);
+ return bctbx_list_size(model->services);
}
LinphonePresenceService * linphone_presence_model_get_nth_service(const LinphonePresenceModel *model, unsigned int idx) {
if ((model == NULL) || (idx >= linphone_presence_model_get_nb_services(model)))
return NULL;
- return (LinphonePresenceService *)ms_list_nth_data(model->services, idx);
+ return (LinphonePresenceService *)bctbx_list_nth_data(model->services, idx);
}
int linphone_presence_model_add_service(LinphonePresenceModel *model, LinphonePresenceService *service) {
if ((model == NULL) || (service == NULL)) return -1;
- model->services = ms_list_append(model->services, linphone_presence_service_ref(service));
+ model->services = bctbx_list_append(model->services, linphone_presence_service_ref(service));
return 0;
}
int linphone_presence_model_clear_services(LinphonePresenceModel *model) {
if (model == NULL) return -1;
- ms_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
- ms_list_free(model->services);
+ bctbx_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
+ bctbx_list_free(model->services);
model->services = NULL;
return 0;
}
unsigned int linphone_presence_model_get_nb_persons(const LinphonePresenceModel *model) {
- return ms_list_size(model->persons);
+ return bctbx_list_size(model->persons);
}
LinphonePresencePerson * linphone_presence_model_get_nth_person(const LinphonePresenceModel *model, unsigned int idx) {
if ((model == NULL) || (idx >= linphone_presence_model_get_nb_persons(model)))
return NULL;
- return (LinphonePresencePerson *)ms_list_nth_data(model->persons, idx);
+ return (LinphonePresencePerson *)bctbx_list_nth_data(model->persons, idx);
}
int linphone_presence_model_add_person(LinphonePresenceModel *model, LinphonePresencePerson *person) {
@@ -676,8 +677,8 @@ int linphone_presence_model_add_person(LinphonePresenceModel *model, LinphonePre
int linphone_presence_model_clear_persons(LinphonePresenceModel *model) {
if (model == NULL) return -1;
- ms_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
- ms_list_free(model->persons);
+ bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
+ bctbx_list_free(model->persons);
model->persons = NULL;
return 0;
}
@@ -761,27 +762,27 @@ int linphone_presence_service_set_contact(LinphonePresenceService *service, cons
}
unsigned int linphone_presence_service_get_nb_notes(const LinphonePresenceService *service) {
- return ms_list_size(service->notes);
+ return bctbx_list_size(service->notes);
}
LinphonePresenceNote * linphone_presence_service_get_nth_note(const LinphonePresenceService *service, unsigned int idx) {
if ((service == NULL) || (idx >= linphone_presence_service_get_nb_notes(service)))
return NULL;
- return (LinphonePresenceNote *)ms_list_nth_data(service->notes, idx);
+ return (LinphonePresenceNote *)bctbx_list_nth_data(service->notes, idx);
}
int linphone_presence_service_add_note(LinphonePresenceService *service, LinphonePresenceNote *note) {
if ((service == NULL) || (note == NULL)) return -1;
- service->notes = ms_list_append(service->notes, linphone_presence_note_ref(note));
+ service->notes = bctbx_list_append(service->notes, linphone_presence_note_ref(note));
return 0;
}
int linphone_presence_service_clear_notes(LinphonePresenceService *service) {
if (service == NULL) return -1;
- ms_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(service->notes);
+ bctbx_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(service->notes);
service->notes = NULL;
return 0;
}
@@ -814,76 +815,76 @@ int linphone_presence_person_set_id(LinphonePresencePerson *person, const char *
unsigned int linphone_presence_person_get_nb_activities(const LinphonePresencePerson *person) {
if (person == NULL) return 0;
- return ms_list_size(person->activities);
+ return bctbx_list_size(person->activities);
}
LinphonePresenceActivity * linphone_presence_person_get_nth_activity(const LinphonePresencePerson *person, unsigned int idx) {
if ((person == NULL) || (idx >= linphone_presence_person_get_nb_activities(person)))
return NULL;
- return (LinphonePresenceActivity *)ms_list_nth_data(person->activities, idx);
+ return (LinphonePresenceActivity *)bctbx_list_nth_data(person->activities, idx);
}
int linphone_presence_person_add_activity(LinphonePresencePerson *person, LinphonePresenceActivity *activity) {
if ((person == NULL) || (activity == NULL)) return -1;
// insert in first position since its the most recent activity!
- person->activities = ms_list_prepend(person->activities, linphone_presence_activity_ref(activity));
+ person->activities = bctbx_list_prepend(person->activities, linphone_presence_activity_ref(activity));
return 0;
}
int linphone_presence_person_clear_activities(LinphonePresencePerson *person) {
if (person == NULL) return -1;
- ms_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
- ms_list_free(person->activities);
+ bctbx_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
+ bctbx_list_free(person->activities);
person->activities = NULL;
return 0;
}
unsigned int linphone_presence_person_get_nb_notes(const LinphonePresencePerson *person) {
if (person == NULL) return 0;
- return ms_list_size(person->notes);
+ return bctbx_list_size(person->notes);
}
LinphonePresenceNote * linphone_presence_person_get_nth_note(const LinphonePresencePerson *person, unsigned int idx) {
if ((person == NULL) || (idx >= linphone_presence_person_get_nb_notes(person)))
return NULL;
- return (LinphonePresenceNote *)ms_list_nth_data(person->notes, idx);
+ return (LinphonePresenceNote *)bctbx_list_nth_data(person->notes, idx);
}
int linphone_presence_person_add_note(LinphonePresencePerson *person, LinphonePresenceNote *note) {
if ((person == NULL) || (note == NULL)) return -1;
- person->notes = ms_list_append(person->notes, linphone_presence_note_ref(note));
+ person->notes = bctbx_list_append(person->notes, linphone_presence_note_ref(note));
return 0;
}
int linphone_presence_person_clear_notes(LinphonePresencePerson *person) {
if (person == NULL) return -1;
- ms_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(person->notes);
+ bctbx_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(person->notes);
person->notes = NULL;
return 0;
}
unsigned int linphone_presence_person_get_nb_activities_notes(const LinphonePresencePerson *person) {
if (person == NULL) return 0;
- return ms_list_size(person->activities_notes);
+ return bctbx_list_size(person->activities_notes);
}
LinphonePresenceNote * linphone_presence_person_get_nth_activities_note(const LinphonePresencePerson *person, unsigned int idx) {
if ((person == NULL) || (idx >= linphone_presence_person_get_nb_activities_notes(person)))
return NULL;
- return (LinphonePresenceNote *)ms_list_nth_data(person->activities_notes, idx);
+ return (LinphonePresenceNote *)bctbx_list_nth_data(person->activities_notes, idx);
}
int linphone_presence_person_add_activities_note(LinphonePresencePerson *person, LinphonePresenceNote *note) {
if ((person == NULL) || (note == NULL)) return -1;
- person->notes = ms_list_append(person->activities_notes, linphone_presence_note_ref(note));
+ person->notes = bctbx_list_append(person->activities_notes, linphone_presence_note_ref(note));
return 0;
}
int linphone_presence_person_clear_activities_notes(LinphonePresencePerson *person) {
if (person == NULL) return -1;
- ms_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
- ms_list_free(person->activities_notes);
+ bctbx_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
+ bctbx_list_free(person->activities_notes);
person->activities_notes = NULL;
return 0;
}
@@ -1407,7 +1408,7 @@ static int process_pidf_xml_presence_persons(xmlparsing_context_t *xml_ctx, Linp
if (err < 0) {
/* Remove all the persons added since there was an error. */
- ms_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
+ bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
}
return err;
}
@@ -1480,7 +1481,7 @@ void linphone_core_add_subscriber(LinphoneCore *lc, const char *subscriber, SalO
linphone_friend_set_inc_subscribe_policy(fl,LinphoneSPAccept);
fl->inc_subscribe_pending=TRUE;
/* the newly created "not yet" friend ownership is transfered to the lc->subscribers list*/
- lc->subscribers=ms_list_append(lc->subscribers,fl);
+ lc->subscribers=bctbx_list_append(lc->subscribers,fl);
tmp = linphone_address_as_string(fl->uri);
linphone_core_notify_new_subscription_requested(lc,fl,tmp);
@@ -1495,9 +1496,15 @@ void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf){
void linphone_core_notify_all_friends(LinphoneCore *lc, LinphonePresenceModel *presence){
LinphonePresenceActivity *activity = linphone_presence_model_get_activity(presence);
char *activity_str = linphone_presence_activity_to_string(activity);
+ LinphoneFriendList *lfl = linphone_core_get_default_friend_list(lc);
ms_message("Notifying all friends that we are [%s]", activity_str);
if (activity_str != NULL) ms_free(activity_str);
- linphone_friend_list_notify_presence(linphone_core_get_default_friend_list(lc), presence);
+
+ if (lfl) {
+ linphone_friend_list_notify_presence(lfl, presence);
+ } else {
+ ms_error("Default friend list is null, skipping...");
+ }
}
void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
@@ -1687,7 +1694,7 @@ static int write_xml_presence_service(xmlTextWriterPtr writer, LinphonePresenceS
st.writer = writer;
st.ns = NULL;
st.err = &err;
- ms_list_for_each2(service->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
+ bctbx_list_for_each2(service->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
}
if (err >= 0) {
if (service == NULL)
@@ -1735,7 +1742,7 @@ static void person_has_valid_activity(LinphonePresenceActivity *activity, bool_t
static bool_t person_has_valid_activities(LinphonePresencePerson *person) {
bool_t has_valid_activities = FALSE;
- ms_list_for_each2(person->activities, (MSIterate2Func)person_has_valid_activity, &has_valid_activities);
+ bctbx_list_for_each2(person->activities, (MSIterate2Func)person_has_valid_activity, &has_valid_activities);
return has_valid_activities;
}
@@ -1761,13 +1768,13 @@ static int write_xml_presence_person(xmlTextWriterPtr writer, LinphonePresencePe
st.writer = writer;
st.ns = "rpid";
st.err = &err;
- ms_list_for_each2(person->activities_notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
+ bctbx_list_for_each2(person->activities_notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
}
if ((err >= 0) && (person->activities != NULL)) {
struct _presence_activity_obj_st st;
st.writer = writer;
st.err = &err;
- ms_list_for_each2(person->activities, (MSIterate2Func)write_xml_presence_activity_obj, &st);
+ bctbx_list_for_each2(person->activities, (MSIterate2Func)write_xml_presence_activity_obj, &st);
}
if (err >= 0) {
/* Close the "activities" element. */
@@ -1779,7 +1786,7 @@ static int write_xml_presence_person(xmlTextWriterPtr writer, LinphonePresencePe
st.writer = writer;
st.ns = "dm";
st.err = &err;
- ms_list_for_each2(person->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
+ bctbx_list_for_each2(person->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
}
if (err >= 0) {
write_xml_presence_timestamp(writer, person->timestamp);
@@ -1850,21 +1857,21 @@ char *linphone_presence_model_to_xml(LinphonePresenceModel *model) {
st.writer = writer;
st.contact = contact; /*default value*/
st.err = &err;
- ms_list_for_each2(model->services, (MSIterate2Func)write_xml_presence_service_obj, &st);
+ bctbx_list_for_each2(model->services, (MSIterate2Func)write_xml_presence_service_obj, &st);
}
}
if ((err >= 0) && (model != NULL)) {
struct _presence_person_obj_st st={0};
st.writer = writer;
st.err = &err;
- ms_list_for_each2(model->persons, (MSIterate2Func)write_xml_presence_person_obj, &st);
+ bctbx_list_for_each2(model->persons, (MSIterate2Func)write_xml_presence_person_obj, &st);
}
if ((err >= 0) && (model != NULL)) {
struct _presence_note_obj_st st={0};
st.writer = writer;
st.ns = NULL;
st.err = &err;
- ms_list_for_each2(model->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
+ bctbx_list_for_each2(model->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
}
if (err >= 0) {
/* Close the "presence" element. */
diff --git a/coreapi/private.h b/coreapi/private.h
index c073baab6..67fa3ea4f 100644
--- a/coreapi/private.h
+++ b/coreapi/private.h
@@ -255,12 +255,17 @@ struct _LinphoneChatMessage {
belle_http_request_listener_t *http_listener; /* our listener, only owned by us*/
char *file_transfer_filepath;
-#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
+#if defined(__clang__) || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+#ifdef _MSC_VER
+#pragma deprecated(message_state_changed_cb)
+#endif
LinphoneChatMessageStateChangedCb message_state_changed_cb;
-#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
+#if defined(__clang__) || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
};
@@ -440,6 +445,7 @@ LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, Li
LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc);
LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize);
+int linphone_parse_host_port(const char *input, char *host, size_t hostlen, int *port);
int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen, int default_port);
bool_t host_has_ipv6_network(void);
@@ -504,6 +510,7 @@ LINPHONE_PUBLIC const struct addrinfo *linphone_core_get_stun_server_addrinfo(Li
void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params);
int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call);
LINPHONE_PUBLIC void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable);
+LINPHONE_PUBLIC void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable);
void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call);
void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev);
void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDescription *result);
@@ -616,6 +623,7 @@ struct _LinphoneProxyConfig
char *dial_prefix;
LinphoneRegistrationState state;
LinphoneAVPFMode avpf_mode;
+ LinphoneNatPolicy *nat_policy;
bool_t commit;
bool_t reg_sendregister;
@@ -800,7 +808,6 @@ typedef struct net_config
{
char *nat_address; /* may be IP or host name */
char *nat_address_ip; /* ip translated from nat_address */
- char *stun_server;
struct addrinfo *stun_addrinfo;
SalResolverContext * stun_res;
int download_bw;
@@ -933,7 +940,7 @@ struct _LinphoneCore
MSList *queued_calls; /* used by the autoreplier */
MSList *call_logs;
MSList *chatrooms;
- int max_call_logs;
+ unsigned int max_call_logs;
int missed_calls;
VideoPreview *previewstream;
struct _MSEventQueue *msevq;
@@ -959,6 +966,7 @@ struct _LinphoneCore
char* user_certificates_path;
LinphoneVideoPolicy video_policy;
time_t network_last_check;
+ LinphoneNatPolicy *nat_policy;
bool_t use_files;
bool_t apply_nat_settings;
@@ -978,7 +986,7 @@ struct _LinphoneCore
bool_t vtables_running;
bool_t send_call_stats_periodical_updates;
bool_t forced_ice_relay;
- bool_t pad;
+ bool_t short_turn_refresh;
char localip[LINPHONE_IPADDR_SIZE];
int device_rotation;
int max_calls;
@@ -1187,6 +1195,25 @@ struct _LinphoneBuffer {
BELLE_SIP_DECLARE_VPTR(LinphoneBuffer);
+struct _LinphoneNatPolicy {
+ belle_sip_object_t base;
+ void *user_data;
+ LinphoneCore *lc;
+ SalResolverContext *stun_resolver_context;
+ struct addrinfo *stun_addrinfo;
+ char *stun_server;
+ char *stun_server_username;
+ char *ref;
+ bool_t stun_enabled;
+ bool_t turn_enabled;
+ bool_t ice_enabled;
+ bool_t upnp_enabled;
+};
+
+BELLE_SIP_DECLARE_VPTR(LinphoneNatPolicy);
+
+void linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy);
+
/*****************************************************************************
* XML-RPC interface *
@@ -1407,7 +1434,8 @@ BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequestCbs),
BELLE_SIP_TYPE_ID(LinphoneXmlRpcSession),
BELLE_SIP_TYPE_ID(LinphoneTunnelConfig),
BELLE_SIP_TYPE_ID(LinphoneFriendListCbs),
-BELLE_SIP_TYPE_ID(LinphoneEvent)
+BELLE_SIP_TYPE_ID(LinphoneEvent),
+BELLE_SIP_TYPE_ID(LinphoneNatPolicy)
BELLE_SIP_DECLARE_TYPES_END
@@ -1524,6 +1552,8 @@ char *linphone_presence_model_to_xml(LinphonePresenceModel *model) ;
#define LINPHONE_SQLITE3_VFS "sqlite3bctbx_vfs"
+void linphone_call_check_ice_session(LinphoneCall *call, IceRole role, bool_t is_reinvite);
+
#ifdef __cplusplus
}
#endif
diff --git a/coreapi/proxy.c b/coreapi/proxy.c
index 6cd24c61f..4c39c24a7 100644
--- a/coreapi/proxy.c
+++ b/coreapi/proxy.c
@@ -83,11 +83,11 @@ LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_confi
}
void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc){
- MSList *elem;
+ bctbx_list_t *elem;
int i;
if (!linphone_core_ready(lc)) return;
- for(elem=lc->sip_conf.proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
+ for(elem=lc->sip_conf.proxies,i=0;elem!=NULL;elem=bctbx_list_next(elem),i++){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
linphone_proxy_config_write_to_config_file(lc->config,cfg,i);
}
@@ -221,6 +221,9 @@ void _linphone_proxy_config_destroy(LinphoneProxyConfig *cfg){
if (cfg->sent_headers!=NULL) sal_custom_header_free(cfg->sent_headers);
if (cfg->pending_contact) linphone_address_unref(cfg->pending_contact);
if (cfg->refkey) ms_free(cfg->refkey);
+ if (cfg->nat_policy != NULL) {
+ linphone_nat_policy_unref(cfg->nat_policy);
+ }
_linphone_proxy_config_release_ops(cfg);
}
@@ -1224,24 +1227,24 @@ int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cfg){
if (!linphone_proxy_config_check(lc,cfg)) {
return -1;
}
- if (ms_list_find(lc->sip_conf.proxies,cfg)!=NULL){
+ if (bctbx_list_find(lc->sip_conf.proxies,cfg)!=NULL){
ms_warning("ProxyConfig already entered, ignored.");
return 0;
}
- lc->sip_conf.proxies=ms_list_append(lc->sip_conf.proxies,(void *)linphone_proxy_config_ref(cfg));
+ lc->sip_conf.proxies=bctbx_list_append(lc->sip_conf.proxies,(void *)linphone_proxy_config_ref(cfg));
linphone_proxy_config_apply(cfg,lc);
return 0;
}
void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cfg){
/* check this proxy config is in the list before doing more*/
- if (ms_list_find(lc->sip_conf.proxies,cfg)==NULL){
+ if (bctbx_list_find(lc->sip_conf.proxies,cfg)==NULL){
ms_error("linphone_core_remove_proxy_config: LinphoneProxyConfig [%p] is not known by LinphoneCore (programming error?)",cfg);
return;
}
- lc->sip_conf.proxies=ms_list_remove(lc->sip_conf.proxies,cfg);
+ lc->sip_conf.proxies=bctbx_list_remove(lc->sip_conf.proxies,cfg);
/* add to the list of destroyed proxies, so that the possible unREGISTER request can succeed authentication */
- lc->sip_conf.deleted_proxies=ms_list_append(lc->sip_conf.deleted_proxies,cfg);
+ lc->sip_conf.deleted_proxies=bctbx_list_append(lc->sip_conf.deleted_proxies,cfg);
if (lc->default_proxy==cfg){
lc->default_proxy=NULL;
@@ -1261,19 +1264,19 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
}
void linphone_core_clear_proxy_config(LinphoneCore *lc){
- MSList* list=ms_list_copy(linphone_core_get_proxy_config_list((const LinphoneCore*)lc));
- MSList* copy=list;
+ bctbx_list_t* list=bctbx_list_copy(linphone_core_get_proxy_config_list((const LinphoneCore*)lc));
+ bctbx_list_t* copy=list;
for(;list!=NULL;list=list->next){
linphone_core_remove_proxy_config(lc,(LinphoneProxyConfig *)list->data);
}
- ms_list_free(copy);
+ bctbx_list_free(copy);
linphone_proxy_config_write_all_to_config_file(lc);
}
int linphone_core_get_default_proxy_config_index(LinphoneCore *lc) {
int pos = -1;
if (lc->default_proxy != NULL) {
- pos = ms_list_position(lc->sip_conf.proxies, ms_list_find(lc->sip_conf.proxies, (void *)lc->default_proxy));
+ pos = bctbx_list_position(lc->sip_conf.proxies, bctbx_list_find(lc->sip_conf.proxies, (void *)lc->default_proxy));
}
return pos;
}
@@ -1281,7 +1284,7 @@ int linphone_core_get_default_proxy_config_index(LinphoneCore *lc) {
void linphone_core_set_default_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config){
/* check if this proxy is in our list */
if (config!=NULL){
- if (ms_list_find(lc->sip_conf.proxies,config)==NULL){
+ if (bctbx_list_find(lc->sip_conf.proxies,config)==NULL){
ms_warning("Bad proxy address: it is not in the list !");
lc->default_proxy=NULL;
return ;
@@ -1294,7 +1297,7 @@ void linphone_core_set_default_proxy_config(LinphoneCore *lc, LinphoneProxyConfi
void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index){
if (index<0) linphone_core_set_default_proxy(lc,NULL);
- else linphone_core_set_default_proxy(lc,ms_list_nth_data(lc->sip_conf.proxies,index));
+ else linphone_core_set_default_proxy(lc,bctbx_list_nth_data(lc->sip_conf.proxies,index));
}
int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config){
@@ -1306,7 +1309,7 @@ LinphoneProxyConfig * linphone_core_get_default_proxy_config(LinphoneCore *lc) {
return lc->default_proxy;
}
-const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc){
+const bctbx_list_t *linphone_core_get_proxy_config_list(const LinphoneCore *lc){
return lc->sip_conf.proxies;
}
@@ -1355,6 +1358,11 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC
lp_config_set_int(config,key,"privacy",cfg->privacy);
if (cfg->refkey) lp_config_set_string(config,key,"refkey",cfg->refkey);
lp_config_set_int(config, key, "publish_expires", cfg->publish_expires);
+
+ if (cfg->nat_policy != NULL) {
+ lp_config_set_string(config, key, "nat_policy_ref", cfg->nat_policy->ref);
+ linphone_nat_policy_save_to_config(cfg->nat_policy);
+ }
}
@@ -1377,6 +1385,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc
LinphoneProxyConfig *cfg;
char key[50];
LpConfig *config=lc->config;
+ const char *nat_policy_ref;
sprintf(key,"proxy_%i",index);
@@ -1415,6 +1424,11 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc
CONFIGURE_STRING_VALUE(cfg,config,key,ref_key,"refkey")
CONFIGURE_INT_VALUE(cfg,config,key,publish_expires,"publish_expires")
+ nat_policy_ref = lp_config_get_string(config, key, "nat_policy_ref", NULL);
+ if (nat_policy_ref != NULL) {
+ cfg->nat_policy = linphone_core_create_nat_policy_from_config(lc, nat_policy_ref);
+ }
+
return cfg;
}
@@ -1677,3 +1691,13 @@ void linphone_proxy_config_set_ref_key(LinphoneProxyConfig *cfg, const char *ref
}
if (refkey) cfg->refkey=ms_strdup(refkey);
}
+
+LinphoneNatPolicy * linphone_proxy_config_get_nat_policy(const LinphoneProxyConfig *cfg) {
+ return cfg->nat_policy;
+}
+
+void linphone_proxy_config_set_nat_policy(LinphoneProxyConfig *cfg, LinphoneNatPolicy *policy) {
+ if (policy != NULL) policy = linphone_nat_policy_ref(policy); /* Prevent object destruction if the same policy is used */
+ if (cfg->nat_policy != NULL) linphone_nat_policy_unref(cfg->nat_policy);
+ if (policy != NULL) cfg->nat_policy = policy;
+}
diff --git a/coreapi/sal.c b/coreapi/sal.c
index 0f43d1a1d..a54df1611 100644
--- a/coreapi/sal.c
+++ b/coreapi/sal.c
@@ -69,8 +69,8 @@ SalMediaDescription *sal_media_description_new(){
static void sal_media_description_destroy(SalMediaDescription *md){
int i;
for(i=0;istreams[i].payloads,(void (*)(void *))payload_type_destroy);
- ms_list_free_with_data(md->streams[i].already_assigned_payloads,(void (*)(void *))payload_type_destroy);
+ bctbx_list_free_with_data(md->streams[i].payloads,(void (*)(void *))payload_type_destroy);
+ bctbx_list_free_with_data(md->streams[i].already_assigned_payloads,(void (*)(void *))payload_type_destroy);
md->streams[i].payloads=NULL;
md->streams[i].already_assigned_payloads=NULL;
sal_custom_sdp_attribute_free(md->streams[i].custom_sdp_attributes);
@@ -356,8 +356,8 @@ static bool_t is_recv_only(PayloadType *p){
return (p->flags & PAYLOAD_TYPE_FLAG_CAN_RECV) && ! (p->flags & PAYLOAD_TYPE_FLAG_CAN_SEND);
}
-static bool_t payload_list_equals(const MSList *l1, const MSList *l2){
- const MSList *e1,*e2;
+static bool_t payload_list_equals(const bctbx_list_t *l1, const bctbx_list_t *l2){
+ const bctbx_list_t *e1,*e2;
for(e1=l1,e2=l2;e1!=NULL && e2!=NULL; e1=e1->next,e2=e2->next){
PayloadType *p1=(PayloadType*)e1->data;
PayloadType *p2=(PayloadType*)e2->data;
@@ -527,18 +527,18 @@ void sal_op_set_route(SalOp *op, const char *route){
char* route_string=(void *)0;
SalOpBase* op_base = (SalOpBase*)op;
if (op_base->route_addresses) {
- ms_list_for_each(op_base->route_addresses,(void (*)(void *))sal_address_destroy);
- op_base->route_addresses=ms_list_free(op_base->route_addresses);
+ bctbx_list_for_each(op_base->route_addresses,(void (*)(void *))sal_address_destroy);
+ op_base->route_addresses=bctbx_list_free(op_base->route_addresses);
}
if (route) {
- op_base->route_addresses=ms_list_append(NULL,NULL);
+ op_base->route_addresses=bctbx_list_append(NULL,NULL);
assign_address((SalAddress**)&(op_base->route_addresses->data),route);
route_string=sal_address_as_string((SalAddress*)op_base->route_addresses->data); \
}
assign_string(&op_base->route,route_string); \
if(route_string) ms_free(route_string);
}
-const MSList* sal_op_get_route_addresses(const SalOp *op) {
+const bctbx_list_t* sal_op_get_route_addresses(const SalOp *op) {
return ((SalOpBase*)op)->route_addresses;
}
void sal_op_set_route_address(SalOp *op, const SalAddress *address){
@@ -549,7 +549,7 @@ void sal_op_set_route_address(SalOp *op, const SalAddress *address){
void sal_op_add_route_address(SalOp *op, const SalAddress *address){
SalOpBase* op_base = (SalOpBase*)op;
if (op_base->route_addresses) {
- op_base->route_addresses=ms_list_append(op_base->route_addresses,(void*)sal_address_clone(address));
+ op_base->route_addresses=bctbx_list_append(op_base->route_addresses,(void*)sal_address_clone(address));
} else {
sal_op_set_route_address(op,address);
}
@@ -713,8 +713,8 @@ void __sal_op_free(SalOp *op){
sal_address_destroy(b->service_route);
}
if (b->route_addresses){
- ms_list_for_each(b->route_addresses,(void (*)(void*)) sal_address_destroy);
- b->route_addresses=ms_list_free(b->route_addresses);
+ bctbx_list_for_each(b->route_addresses,(void (*)(void*)) sal_address_destroy);
+ b->route_addresses=bctbx_list_free(b->route_addresses);
}
if (b->recv_custom_headers)
sal_custom_header_free(b->recv_custom_headers);
diff --git a/coreapi/sipsetup.c b/coreapi/sipsetup.c
index 8a5aea58c..cb9a6fddf 100644
--- a/coreapi/sipsetup.c
+++ b/coreapi/sipsetup.c
@@ -29,10 +29,10 @@ static SipSetup *all_sip_setups[]={
NULL
};
-static MSList *registered_sip_setups=NULL;
+static bctbx_list_t *registered_sip_setups=NULL;
void sip_setup_register(SipSetup *ss){
- registered_sip_setups=ms_list_append(registered_sip_setups,ss);
+ registered_sip_setups=bctbx_list_append(registered_sip_setups,ss);
}
void sip_setup_register_all(MSFactory *factory){
@@ -45,12 +45,12 @@ void sip_setup_register_all(MSFactory *factory){
}
}
-const MSList * linphone_core_get_sip_setups(LinphoneCore *lc){
+const bctbx_list_t * linphone_core_get_sip_setups(LinphoneCore *lc){
return registered_sip_setups;
}
SipSetup *sip_setup_lookup(const char *type_name){
- MSList *elem;
+ bctbx_list_t *elem;
for(elem=registered_sip_setups;elem!=NULL;elem=elem->next){
SipSetup *ss=(SipSetup*)elem->data;
if ( strcasecmp(ss->name,type_name)==0){
@@ -69,7 +69,7 @@ SipSetup *sip_setup_lookup(const char *type_name){
}
void sip_setup_unregister_all(void){
- MSList *elem;
+ bctbx_list_t *elem;
for(elem=registered_sip_setups;elem!=NULL;elem=elem->next){
SipSetup *ss=(SipSetup*)elem->data;
if (ss->initialized){
@@ -77,7 +77,7 @@ void sip_setup_unregister_all(void){
ss->initialized=FALSE;
}
}
- registered_sip_setups = ms_list_free(registered_sip_setups);
+ registered_sip_setups = bctbx_list_free(registered_sip_setups);
}
void buddy_lookup_request_set_key(BuddyLookupRequest *req, const char *key){
@@ -95,8 +95,8 @@ void buddy_lookup_request_set_max_results(BuddyLookupRequest *req, int ncount){
void buddy_lookup_request_free(BuddyLookupRequest *req){
if (req->key) ms_free(req->key);
if (req->results){
- ms_list_for_each(req->results,(void (*)(void*))buddy_info_free);
- ms_list_free(req->results);
+ bctbx_list_for_each(req->results,(void (*)(void*))buddy_info_free);
+ bctbx_list_free(req->results);
}
ms_free(req);
}
diff --git a/coreapi/sqlite3_bctbx_vfs.c b/coreapi/sqlite3_bctbx_vfs.c
old mode 100644
new mode 100755
index ae9d4e869..d9abfad10
--- a/coreapi/sqlite3_bctbx_vfs.c
+++ b/coreapi/sqlite3_bctbx_vfs.c
@@ -28,6 +28,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif /*_WIN32_WCE*/
+#ifndef _WIN32
+#if !defined(__QNXNTO__)
+# include
+# include
+# include
+# include
+#endif
+
+#endif
+
/**
* Closes the file whose file descriptor is stored in the file handle p.
@@ -51,32 +61,32 @@ static int sqlite3bctbx_Close(sqlite3_file *p){
/**
- * Read count bytes from the open file given by p, starting at offset and puts them in
+ * Read count bytes from the open file given by p, starting at offset and puts them in
* the buffer pointed by buf.
* Calls bctbx_file_read.
- *
+ *
* @param p sqlite3_file file handle pointer.
* @param buf buffer to write the read bytes to.
* @param count number of bytes to read
* @param offset file offset where to start reading
- * @return SQLITE_OK if read bytes equals count,
+ * @return SQLITE_OK if read bytes equals count,
* SQLITE_IOERR_SHORT_READ if the number of bytes read is inferior to count
- * SQLITE_IOERR_READ if an error occurred.
+ * SQLITE_IOERR_READ if an error occurred.
*/
static int sqlite3bctbx_Read(sqlite3_file *p, void *buf, int count, sqlite_int64 offset){
int ret;
sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*) p;
if (pFile){
- ret = bctbx_file_read(pFile->pbctbx_file, buf, count, offset);
+ ret = bctbx_file_read(pFile->pbctbx_file, buf, count, (off_t)offset);
if( ret==count ){
return SQLITE_OK;
}
else if( ret >= 0 ){
/*fill in unread portion of buffer, as requested by sqlite3 documentation*/
- memset(((uint8_t*)buf) + ret, 0, count-ret);
+ memset(((uint8_t*)buf) + ret, 0, count-ret);
return SQLITE_IOERR_SHORT_READ;
}else {
-
+
return SQLITE_IOERR_READ;
}
}
@@ -96,7 +106,7 @@ static int sqlite3bctbx_Write(sqlite3_file *p, const void *buf, int count, sqlit
sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*) p;
int ret;
if (pFile ){
- ret = bctbx_file_write(pFile->pbctbx_file, buf, count, offset);
+ ret = bctbx_file_write(pFile->pbctbx_file, buf, count, (off_t)offset);
if(ret > 0 ) return SQLITE_OK;
else {
return SQLITE_IOERR_WRITE;
@@ -104,18 +114,18 @@ static int sqlite3bctbx_Write(sqlite3_file *p, const void *buf, int count, sqlit
}
return SQLITE_IOERR_WRITE;
}
-
+
/**
* Saves the file size associated with the file handle p into the argument pSize.
* @param p sqlite3_file file handle pointer.
- * @return SQLITE_OK if read bytes equals count,
- * SQLITE_IOERR_FSTAT if the file size returned is negative
- * SQLITE_ERROR if an error occurred.
+ * @return SQLITE_OK if read bytes equals count,
+ * SQLITE_IOERR_FSTAT if the file size returned is negative
+ * SQLITE_ERROR if an error occurred.
*/
static int sqlite3bctbx_FileSize(sqlite3_file *p, sqlite_int64 *pSize){
- int rc; /* Return code from fstat() call */
+ int64_t rc; /* Return code from fstat() call */
sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*) p;
if (pFile->pbctbx_file){
rc = bctbx_file_size(pFile->pbctbx_file);
@@ -125,7 +135,7 @@ static int sqlite3bctbx_FileSize(sqlite3_file *p, sqlite_int64 *pSize){
if (pSize){
*pSize = rc;
return SQLITE_OK;
- }
+ }
}
return SQLITE_ERROR;
@@ -134,7 +144,7 @@ static int sqlite3bctbx_FileSize(sqlite3_file *p, sqlite_int64 *pSize){
/************************ PLACE HOLDER FUNCTIONS ***********************/
-/** These functions were implemented to please the SQLite VFS
+/** These functions were implemented to please the SQLite VFS
implementation. Some of them are just stubs, some do a very limited job. */
@@ -177,7 +187,7 @@ static int sqlite3bctbx_nolockCheckReservedLock(sqlite3_file *pUnused, int *pRes
}
/**
- * The lock file mechanism is not used with this VFS : locking the file
+ * The lock file mechanism is not used with this VFS : locking the file
* is always OK.
* @param pUnused sqlite3_file file handle pointer.
* @param unused unused
@@ -209,7 +219,9 @@ static int sqlite3bctbx_nolockUnlock(sqlite3_file *pUnused, int unused){
static int sqlite3bctbx_Sync(sqlite3_file *p, int flags){
sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*)p;
#if _WIN32
- return (FlushFileBuffers(pFile->pbctbx_file->fd) ? SQLITE_OK : SQLITE_IOERR_FSYNC);
+ int ret;
+ ret = FlushFileBuffers((HANDLE)_get_osfhandle(pFile->pbctbx_file->fd));
+ return (ret!=0 ? SQLITE_OK : SQLITE_IOERR_FSYNC);
#else
int rc = fsync(pFile->pbctbx_file->fd);
return (rc==0 ? SQLITE_OK : SQLITE_IOERR_FSYNC);
@@ -218,6 +230,57 @@ static int sqlite3bctbx_Sync(sqlite3_file *p, int flags){
/************************ END OF PLACE HOLDER FUNCTIONS ***********************/
+
+
+static char* ConvertFromUtf8Filename(const char* fName){
+#if _WIN32
+ char* convertedFilename;
+ int nChar, nb_byte;
+ LPWSTR wideFilename;
+
+ nChar = MultiByteToWideChar(CP_UTF8, 0, fName, -1, NULL, 0);
+ if (nChar == 0) return NULL;
+ wideFilename = bctbx_malloc(nChar*sizeof(wideFilename[0]));
+ if (wideFilename == NULL) return NULL;
+ nChar = MultiByteToWideChar(CP_UTF8, 0, fName, -1, wideFilename, nChar);
+ if (nChar == 0) {
+ bctbx_free(wideFilename);
+ wideFilename = 0;
+ }
+
+ nb_byte = WideCharToMultiByte(CP_ACP, 0, wideFilename, -1, 0, 0, 0, 0);
+ if (nb_byte == 0) return NULL;
+ convertedFilename = bctbx_malloc(nb_byte);
+ if (convertedFilename == NULL) return NULL;
+ nb_byte = WideCharToMultiByte(CP_ACP, 0, wideFilename, -1, convertedFilename, nb_byte, 0, 0);
+ if (nb_byte == 0) {
+ bctbx_free(convertedFilename);
+ convertedFilename = 0;
+ }
+ bctbx_free(wideFilename);
+ return convertedFilename;
+#else
+ #define MAX_PATH_SIZE 1024
+ char db_file_utf8[MAX_PATH_SIZE] = {'\0'};
+ char db_file_locale[MAX_PATH_SIZE] = "";
+ char *outbuf=db_file_locale, *inbuf=db_file_utf8;
+ size_t inbyteleft = MAX_PATH_SIZE, outbyteleft = MAX_PATH_SIZE;
+ iconv_t cb;
+
+ strncpy(db_file_utf8, fName, MAX_PATH_SIZE-1);
+ cb = iconv_open(nl_langinfo(CODESET), "UTF-8");
+ if(cb != (iconv_t)-1) {
+ int ret;
+ ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
+ if(ret == -1) db_file_locale[0] = '\0';
+ iconv_close(cb);
+ }
+ return bctbx_strdup(db_file_locale);
+#endif
+
+
+}
+#endif
/**
* Opens the file fName and populates the structure pointed by p
* with the necessary io_methods
@@ -227,7 +290,7 @@ static int sqlite3bctbx_Sync(sqlite3_file *p, int flags){
* @param pVfs sqlite3_vfs VFS pointer.
* @param fName filename
* @param p file handle pointer
- * @param flags db file access flags
+ * @param flags db file access flags
* @param pOutFlags flags used by SQLite
* @return SQLITE_CANTOPEN on error, SQLITE_OK on success.
*/
@@ -239,7 +302,7 @@ static int sqlite3bctbx_Open(sqlite3_vfs *pVfs, const char *fName, sqlite3_file
sqlite3bctbx_Write, /* xWrite */
0, /*xTruncate*/
sqlite3bctbx_Sync,
- sqlite3bctbx_FileSize,
+ sqlite3bctbx_FileSize,
sqlite3bctbx_nolockLock,
sqlite3bctbx_nolockUnlock,
sqlite3bctbx_nolockCheckReservedLock,
@@ -249,21 +312,31 @@ static int sqlite3bctbx_Open(sqlite3_vfs *pVfs, const char *fName, sqlite3_file
};
sqlite3_bctbx_file_t * pFile = (sqlite3_bctbx_file_t*)p; /*File handle sqlite3_bctbx_file_t*/
-
int openFlags = 0;
+ char* wFname;
/*returns error if filename is empty or file handle not initialized*/
if (pFile == NULL || fName == NULL){
return SQLITE_IOERR;
}
-
+
/* Set flags to open the file with */
if( flags&SQLITE_OPEN_EXCLUSIVE ) openFlags |= O_EXCL;
if( flags&SQLITE_OPEN_CREATE ) openFlags |= O_CREAT;
if( flags&SQLITE_OPEN_READONLY ) openFlags |= O_RDONLY;
if( flags&SQLITE_OPEN_READWRITE ) openFlags |= O_RDWR;
- pFile->pbctbx_file = bctbx_file_open2(bctbx_vfs_get_default(), fName, openFlags);
+#if defined(_WIN32)
+ openFlags |= O_BINARY;
+#endif
+ wFname = ConvertFromUtf8Filename(fName);
+ if (wFname != NULL) {
+ pFile->pbctbx_file = bctbx_file_open2(bctbx_vfs_get_default(), wFname, openFlags);
+ bctbx_free(wFname);
+ } else {
+ pFile->pbctbx_file = NULL;
+ }
+
if( pFile->pbctbx_file == NULL){
return SQLITE_CANTOPEN;
}
@@ -301,6 +374,48 @@ sqlite3_vfs *sqlite3_bctbx_vfs_create(void){
return &bctbx_vfs;
}
+/*static int sqlite3bctbx_winFullPathname(
+ sqlite3_vfs *pVfs, // Pointer to vfs object
+ const char *zRelative, // Possibly relative input path
+ int nFull, // Size of output buffer in bytes
+ char *zFull){
+ //LPWSTR zTemp;
+ //DWORD nByte;
+ // If this path name begins with "/X:", where "X" is any alphabetic
+ // character, discard the initial "/" from the pathname.
+ //
+ //if (zRelative[0] == '/' && sqlite3Isalpha(zRelative[1]) && zRelative[2] == ':'){
+ // zRelative++;
+ //}
+
+ nByte = GetFullPathNameW((LPCWSTR)zRelative, 0, 0, 0);
+ if (nByte == 0){
+ return SQLITE_CANTOPEN_FULLPATH;
+ }
+ nByte += 3;
+ zTemp = bctbx_malloc(nByte*sizeof(zTemp[0]));
+ memset(zTemp, 0, nByte*sizeof(zTemp[0]));
+ if (zTemp == 0){
+ return SQLITE_IOERR_NOMEM;
+ }
+ nByte = GetFullPathNameW((LPCWSTR)zRelative, nByte, zTemp, 0);
+ if (nByte == 0){
+ bctbx_free(zTemp);
+ return SQLITE_CANTOPEN_FULLPATH;
+ }
+ if (zTemp){
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zTemp);
+ bctbx_free(zTemp);
+ return SQLITE_OK;
+ }
+ else{
+ return SQLITE_IOERR_NOMEM;
+ }
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative);
+ return SQLITE_OK;
+}*/
+
+
void sqlite3_bctbx_vfs_register( int makeDefault){
sqlite3_vfs* pVfsToUse = sqlite3_bctbx_vfs_create();
@@ -309,20 +424,21 @@ void sqlite3_bctbx_vfs_register( int makeDefault){
#else
sqlite3_vfs* pDefault = sqlite3_vfs_find("unix-none");
#endif
- pVfsToUse->xAccess = pDefault->xAccess;
pVfsToUse->xCurrentTime = pDefault->xCurrentTime;
-
+
+ pVfsToUse->xAccess = pDefault->xAccess;
pVfsToUse->xFullPathname = pDefault->xFullPathname;
+
pVfsToUse->xDelete = pDefault->xDelete;
pVfsToUse->xSleep = pDefault->xSleep;
pVfsToUse->xRandomness = pDefault->xRandomness;
pVfsToUse->xGetLastError = pDefault->xGetLastError; /* Not implemented by sqlite3 :place holder */
/*Functions below should not be a problem sincve we are declaring ourselves
in version 1 */
-
- /* used in version 2
+
+ /* used in version 2
xCurrentTimeInt64;*/
- /* used in version 3
+ /* used in version 3
xGetSystemCall
xSetSystemCall
xNextSystemCall*/
@@ -338,6 +454,3 @@ void sqlite3_bctbx_vfs_unregister(void)
sqlite3_vfs_unregister(pVfs);
}
-#endif
-
-
diff --git a/coreapi/upnp.c b/coreapi/upnp.c
index b41b8292c..35397ba96 100644
--- a/coreapi/upnp.c
+++ b/coreapi/upnp.c
@@ -73,9 +73,9 @@ struct _UpnpContext {
UpnpPortBinding *sip_tls;
UpnpPortBinding *sip_udp;
LinphoneUpnpState state;
- MSList *removing_configs;
- MSList *adding_configs;
- MSList *pending_bindings;
+ bctbx_list_t *removing_configs;
+ bctbx_list_t *adding_configs;
+ bctbx_list_t *pending_bindings;
ms_mutex_t mutex;
ms_cond_t empty_cond;
@@ -91,11 +91,11 @@ bool_t linphone_upnp_is_blacklisted(UpnpContext *ctx);
UpnpPortBinding *linphone_upnp_port_binding_new(void);
UpnpPortBinding *linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_protocol protocol, int local_port, int external_port);
-UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port);
+UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(bctbx_list_t *list, upnp_igd_ip_protocol protocol, int local_port, int external_port);
UpnpPortBinding *linphone_upnp_port_binding_copy(const UpnpPortBinding *port);
void linphone_upnp_port_binding_set_device_id(UpnpPortBinding *port, const char * device_id);
bool_t linphone_upnp_port_binding_equal(const UpnpPortBinding *port1, const UpnpPortBinding *port2);
-UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(MSList *list, const UpnpPortBinding *port);
+UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(bctbx_list_t *list, const UpnpPortBinding *port);
UpnpPortBinding *linphone_upnp_port_binding_retain(UpnpPortBinding *port);
void linphone_upnp_update_port_binding(UpnpContext *lupnp, UpnpPortBinding **port_mapping, upnp_igd_ip_protocol protocol, int port, int retry_delay);
void linphone_upnp_port_binding_log(int level, const char *msg, const UpnpPortBinding *port);
@@ -104,7 +104,7 @@ void linphone_upnp_update_config(UpnpContext *lupnp);
void linphone_upnp_update_proxy(UpnpContext *lupnp, bool_t force);
// Configuration
-MSList *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const char *device_id);
+bctbx_list_t *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const char *device_id);
void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port);
void linphone_upnp_config_remove_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port);
@@ -302,7 +302,7 @@ void linphone_upnp_igd_callback(void *cookie, upnp_igd_event event, void *arg) {
}
}
- lupnp->pending_bindings = ms_list_remove(lupnp->pending_bindings, port_mapping);
+ lupnp->pending_bindings = bctbx_list_remove(lupnp->pending_bindings, port_mapping);
linphone_upnp_port_binding_release(port_mapping);
}
@@ -413,12 +413,12 @@ void linphone_upnp_context_destroy(UpnpContext *lupnp) {
}
/* Release lists */
- ms_list_for_each(lupnp->adding_configs,(void (*)(void*))linphone_upnp_port_binding_release);
- lupnp->adding_configs = ms_list_free(lupnp->adding_configs);
- ms_list_for_each(lupnp->removing_configs,(void (*)(void*))linphone_upnp_port_binding_release);
- lupnp->removing_configs = ms_list_free(lupnp->removing_configs);
- ms_list_for_each(lupnp->pending_bindings,(void (*)(void*))linphone_upnp_port_binding_release);
- lupnp->pending_bindings = ms_list_free(lupnp->pending_bindings);
+ bctbx_list_for_each(lupnp->adding_configs,(void (*)(void*))linphone_upnp_port_binding_release);
+ lupnp->adding_configs = bctbx_list_free(lupnp->adding_configs);
+ bctbx_list_for_each(lupnp->removing_configs,(void (*)(void*))linphone_upnp_port_binding_release);
+ lupnp->removing_configs = bctbx_list_free(lupnp->removing_configs);
+ bctbx_list_for_each(lupnp->pending_bindings,(void (*)(void*))linphone_upnp_port_binding_release);
+ lupnp->pending_bindings = bctbx_list_free(lupnp->pending_bindings);
ms_mutex_destroy(&lupnp->mutex);
ms_cond_destroy(&lupnp->empty_cond);
@@ -598,7 +598,7 @@ int linphone_upnp_context_send_add_port_binding(UpnpContext *lupnp, UpnpPortBind
} else {
linphone_upnp_port_binding_set_device_id(port, upnp_igd_get_device_id(lupnp->upnp_igd_ctxt));
mapping.cookie = linphone_upnp_port_binding_retain(port);
- lupnp->pending_bindings = ms_list_append(lupnp->pending_bindings, mapping.cookie);
+ lupnp->pending_bindings = bctbx_list_append(lupnp->pending_bindings, mapping.cookie);
mapping.local_port = port->local_port;
mapping.local_host = port->local_addr;
@@ -660,7 +660,7 @@ int linphone_upnp_context_send_remove_port_binding(UpnpContext *lupnp, UpnpPortB
} else {
linphone_upnp_port_binding_set_device_id(port, upnp_igd_get_device_id(lupnp->upnp_igd_ctxt));
mapping.cookie = linphone_upnp_port_binding_retain(port);
- lupnp->pending_bindings = ms_list_append(lupnp->pending_bindings, mapping.cookie);
+ lupnp->pending_bindings = bctbx_list_append(lupnp->pending_bindings, mapping.cookie);
mapping.remote_port = port->external_port;
mapping.remote_host = "";
@@ -861,9 +861,9 @@ static const char *linphone_core_upnp_get_charptr_null(const char *str) {
}
void linphone_upnp_update(UpnpContext *lupnp) {
- MSList *global_list = NULL;
- MSList *list = NULL;
- MSList *item;
+ bctbx_list_t *global_list = NULL;
+ bctbx_list_t *list = NULL;
+ bctbx_list_t *item;
LinphoneCall *call;
UpnpPortBinding *port_mapping, *port_mapping2;
@@ -874,13 +874,13 @@ void linphone_upnp_update(UpnpContext *lupnp) {
ms_message("uPnP IGD: Refresh mappings");
if(lupnp->sip_udp != NULL) {
- global_list = ms_list_append(global_list, lupnp->sip_udp);
+ global_list = bctbx_list_append(global_list, lupnp->sip_udp);
}
if(lupnp->sip_tcp != NULL) {
- global_list = ms_list_append(global_list, lupnp->sip_tcp);
+ global_list = bctbx_list_append(global_list, lupnp->sip_tcp);
}
if(lupnp->sip_tls != NULL) {
- global_list = ms_list_append(global_list, lupnp->sip_tls);
+ global_list = bctbx_list_append(global_list, lupnp->sip_tls);
}
list = lupnp->lc->calls;
@@ -888,16 +888,16 @@ void linphone_upnp_update(UpnpContext *lupnp) {
call = (LinphoneCall *)list->data;
if(call->upnp_session != NULL) {
if(call->upnp_session->audio->rtp != NULL) {
- global_list = ms_list_append(global_list, call->upnp_session->audio->rtp);
+ global_list = bctbx_list_append(global_list, call->upnp_session->audio->rtp);
}
if(call->upnp_session->audio->rtcp != NULL) {
- global_list = ms_list_append(global_list, call->upnp_session->audio->rtcp);
+ global_list = bctbx_list_append(global_list, call->upnp_session->audio->rtcp);
}
if(call->upnp_session->video->rtp != NULL) {
- global_list = ms_list_append(global_list, call->upnp_session->video->rtp);
+ global_list = bctbx_list_append(global_list, call->upnp_session->video->rtp);
}
if(call->upnp_session->video->rtcp != NULL) {
- global_list = ms_list_append(global_list, call->upnp_session->video->rtcp);
+ global_list = bctbx_list_append(global_list, call->upnp_session->video->rtcp);
}
}
list = list->next;
@@ -914,8 +914,8 @@ void linphone_upnp_update(UpnpContext *lupnp) {
port_mapping2->state = LinphoneUpnpStateOk;
}
}
- ms_list_for_each(list, (void (*)(void*))linphone_upnp_port_binding_release);
- list = ms_list_free(list);
+ bctbx_list_for_each(list, (void (*)(void*))linphone_upnp_port_binding_release);
+ list = bctbx_list_free(list);
// (Re)Add removed port bindings
@@ -926,7 +926,7 @@ void linphone_upnp_update(UpnpContext *lupnp) {
linphone_upnp_context_send_add_port_binding(lupnp, port_mapping, TRUE);
list = list->next;
}
- global_list = ms_list_free(global_list);
+ global_list = bctbx_list_free(global_list);
}
void linphone_upnp_update_port_binding(UpnpContext *lupnp, UpnpPortBinding **port_mapping, upnp_igd_ip_protocol protocol, int port, int retry_delay) {
@@ -973,7 +973,7 @@ void linphone_upnp_update_port_binding(UpnpContext *lupnp, UpnpPortBinding **por
void linphone_upnp_update_config(UpnpContext* lupnp) {
char key[64];
- const MSList *item;
+ const bctbx_list_t *item;
UpnpPortBinding *port_mapping;
/* Add configs */
@@ -987,8 +987,8 @@ void linphone_upnp_update_config(UpnpContext* lupnp) {
lp_config_set_string(lupnp->lc->config, UPNP_SECTION_NAME, key, "uPnP");
linphone_upnp_port_binding_log(ORTP_DEBUG, "Configuration: Added port binding", port_mapping);
}
- ms_list_for_each(lupnp->adding_configs,(void (*)(void*))linphone_upnp_port_binding_release);
- lupnp->adding_configs = ms_list_free(lupnp->adding_configs);
+ bctbx_list_for_each(lupnp->adding_configs,(void (*)(void*))linphone_upnp_port_binding_release);
+ lupnp->adding_configs = bctbx_list_free(lupnp->adding_configs);
/* Remove configs */
for(item = lupnp->removing_configs;item!=NULL;item=item->next) {
@@ -1001,13 +1001,13 @@ void linphone_upnp_update_config(UpnpContext* lupnp) {
lp_config_set_string(lupnp->lc->config, UPNP_SECTION_NAME, key, NULL);
linphone_upnp_port_binding_log(ORTP_DEBUG, "Configuration: Removed port binding", port_mapping);
}
- ms_list_for_each(lupnp->removing_configs,(void (*)(void*))linphone_upnp_port_binding_release);
- lupnp->removing_configs = ms_list_free(lupnp->removing_configs);
+ bctbx_list_for_each(lupnp->removing_configs,(void (*)(void*))linphone_upnp_port_binding_release);
+ lupnp->removing_configs = bctbx_list_free(lupnp->removing_configs);
}
void linphone_upnp_update_proxy(UpnpContext* lupnp, bool_t force) {
LinphoneUpnpState ready_state;
- const MSList *item;
+ const bctbx_list_t *item;
time_t now = (force)? (lupnp->last_ready_check + UPNP_CORE_READY_CHECK) : time(NULL);
/* Refresh registers if we are ready */
@@ -1115,7 +1115,7 @@ UpnpPortBinding *linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_prot
return port_binding;
}
-UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port) {
+UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(bctbx_list_t *list, upnp_igd_ip_protocol protocol, int local_port, int external_port) {
UpnpPortBinding *tmp_binding;
UpnpPortBinding *end_binding;
@@ -1182,7 +1182,7 @@ bool_t linphone_upnp_port_binding_equal(const UpnpPortBinding *port1, const Upnp
(port1->external_port == -1 || port2->external_port == -1 || port1->external_port == port2->external_port);
}
-UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(MSList *list, const UpnpPortBinding *port) {
+UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(bctbx_list_t *list, const UpnpPortBinding *port) {
UpnpPortBinding *port_mapping;
while(list != NULL) {
port_mapping = (UpnpPortBinding *)list->data;
@@ -1293,7 +1293,7 @@ LinphoneUpnpState linphone_upnp_session_get_state(UpnpSession *session) {
struct linphone_upnp_config_list_port_bindings_struct {
struct _LpConfig *lpc;
- MSList *retList;
+ bctbx_list_t *retList;
const char *device_id;
};
@@ -1327,7 +1327,7 @@ static void linphone_upnp_config_list_port_bindings_cb(const char *entry, struct
port->protocol = protocol;
port->external_port = external_port;
port->local_port = local_port;
- cookie->retList = ms_list_append(cookie->retList, port);
+ cookie->retList = bctbx_list_append(cookie->retList, port);
}
} else {
valid = FALSE;
@@ -1337,7 +1337,7 @@ static void linphone_upnp_config_list_port_bindings_cb(const char *entry, struct
}
}
-MSList *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const char *device_id) {
+bctbx_list_t *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const char *device_id) {
char *formated_device_id = linphone_upnp_format_device_id(device_id);
struct linphone_upnp_config_list_port_bindings_struct cookie = {lpc, NULL, formated_device_id};
lp_config_for_each_entry(lpc, UPNP_SECTION_NAME, (void(*)(const char *, void*))linphone_upnp_config_list_port_bindings_cb, &cookie);
@@ -1346,7 +1346,7 @@ MSList *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const cha
}
void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port) {
- MSList *list;
+ bctbx_list_t *list;
UpnpPortBinding *list_port;
if(port->device_id == NULL) {
@@ -1358,11 +1358,11 @@ void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBin
while(list != NULL) {
list_port = (UpnpPortBinding *)list->data;
if(linphone_upnp_port_binding_equal(list_port, port) == TRUE) {
- lupnp->removing_configs = ms_list_remove(lupnp->removing_configs, list_port);
+ lupnp->removing_configs = bctbx_list_remove(lupnp->removing_configs, list_port);
linphone_upnp_port_binding_release(list_port);
return;
}
- list = ms_list_next(list);
+ list = bctbx_list_next(list);
}
list = lupnp->adding_configs;
@@ -1371,15 +1371,15 @@ void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBin
if(linphone_upnp_port_binding_equal(list_port, port) == TRUE) {
return;
}
- list = ms_list_next(list);
+ list = bctbx_list_next(list);
}
list_port = linphone_upnp_port_binding_copy(port);
- lupnp->adding_configs = ms_list_append(lupnp->adding_configs, list_port);
+ lupnp->adding_configs = bctbx_list_append(lupnp->adding_configs, list_port);
}
void linphone_upnp_config_remove_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port) {
- MSList *list;
+ bctbx_list_t *list;
UpnpPortBinding *list_port;
if(port->device_id == NULL) {
@@ -1391,11 +1391,11 @@ void linphone_upnp_config_remove_port_binding(UpnpContext *lupnp, const UpnpPort
while(list != NULL) {
list_port = (UpnpPortBinding *)list->data;
if(linphone_upnp_port_binding_equal(list_port, port) == TRUE) {
- lupnp->adding_configs = ms_list_remove(lupnp->adding_configs, list_port);
+ lupnp->adding_configs = bctbx_list_remove(lupnp->adding_configs, list_port);
linphone_upnp_port_binding_release(list_port);
return;
}
- list = ms_list_next(list);
+ list = bctbx_list_next(list);
}
list = lupnp->removing_configs;
@@ -1404,9 +1404,9 @@ void linphone_upnp_config_remove_port_binding(UpnpContext *lupnp, const UpnpPort
if(linphone_upnp_port_binding_equal(list_port, port) == TRUE) {
return;
}
- list = ms_list_next(list);
+ list = bctbx_list_next(list);
}
list_port = linphone_upnp_port_binding_copy(port);
- lupnp->removing_configs = ms_list_append(lupnp->removing_configs, list_port);
+ lupnp->removing_configs = bctbx_list_append(lupnp->removing_configs, list_port);
}
diff --git a/coreapi/vcard.cc b/coreapi/vcard.cc
index 4dea0875e..cb0f88381 100644
--- a/coreapi/vcard.cc
+++ b/coreapi/vcard.cc
@@ -40,6 +40,12 @@ LinphoneVcard* linphone_vcard_new(void) {
return vCard;
}
+static LinphoneVcard* linphone_vcard_new_from_belcard(shared_ptr belcard) {
+ LinphoneVcard* vCard = (LinphoneVcard*) ms_new0(LinphoneVcard, 1);
+ vCard->belCard = belcard;
+ return vCard;
+}
+
void linphone_vcard_free(LinphoneVcard *vCard) {
if (!vCard) return;
@@ -47,34 +53,32 @@ void linphone_vcard_free(LinphoneVcard *vCard) {
ms_free(vCard);
}
-MSList* linphone_vcard_list_from_vcard4_file(const char *filename) {
- MSList *result = NULL;
- if (filename && ortp_file_exist(filename) == 0) {
+bctbx_list_t* linphone_vcard_list_from_vcard4_file(const char *filename) {
+ bctbx_list_t *result = NULL;
+ if (filename) {
belcard::BelCardParser parser = belcard::BelCardParser::getInstance();
shared_ptr belCards = parser.parseFile(filename);
if (belCards) {
for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) {
- shared_ptr belcard = (*it);
- LinphoneVcard *vCard = linphone_vcard_new();
- vCard->belCard = belcard;
- result = ms_list_append(result, vCard);
+ shared_ptr belCard = (*it);
+ LinphoneVcard *vCard = linphone_vcard_new_from_belcard(belCard);
+ result = bctbx_list_append(result, vCard);
}
}
}
return result;
}
-MSList* linphone_vcard_list_from_vcard4_buffer(const char *buffer) {
- MSList *result = NULL;
+bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(const char *buffer) {
+ bctbx_list_t *result = NULL;
if (buffer) {
belcard::BelCardParser parser = belcard::BelCardParser::getInstance();
shared_ptr belCards = parser.parse(buffer);
if (belCards) {
for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) {
shared_ptr belCard = (*it);
- LinphoneVcard *vCard = linphone_vcard_new();
- vCard->belCard = belCard;
- result = ms_list_append(result, vCard);
+ LinphoneVcard *vCard = linphone_vcard_new_from_belcard(belCard);
+ result = bctbx_list_append(result, vCard);
}
}
}
@@ -87,8 +91,7 @@ LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(const char *buffer) {
belcard::BelCardParser parser = belcard::BelCardParser::getInstance();
shared_ptr belCard = parser.parseOne(buffer);
if (belCard) {
- vCard = linphone_vcard_new();
- vCard->belCard = belCard;
+ vCard = linphone_vcard_new_from_belcard(belCard);
} else {
ms_error("Couldn't parse buffer %s", buffer);
}
@@ -150,14 +153,14 @@ void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_
}
}
-MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard) {
- MSList *result = NULL;
+bctbx_list_t* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard) {
+ bctbx_list_t *result = NULL;
if (!vCard) return NULL;
for (auto it = vCard->belCard->getImpp().begin(); it != vCard->belCard->getImpp().end(); ++it) {
const char *value = (*it)->getValue().c_str();
if (strncmp(value, "sip:", 4) == 0) {
- result = ms_list_append(result, (char *)value);
+ result = bctbx_list_append(result, (char *)value);
}
}
return result;
@@ -183,13 +186,13 @@ void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone)
}
}
-MSList* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard) {
- MSList *result = NULL;
+bctbx_list_t* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard) {
+ bctbx_list_t *result = NULL;
if (!vCard) return NULL;
for (auto it = vCard->belCard->getPhoneNumbers().begin(); it != vCard->belCard->getPhoneNumbers().end(); ++it) {
const char *value = (*it)->getValue().c_str();
- result = ms_list_append(result, (char *)value);
+ result = bctbx_list_append(result, (char *)value);
}
return result;
}
diff --git a/coreapi/vcard.h b/coreapi/vcard.h
index eb15ead51..dc0e6db3b 100644
--- a/coreapi/vcard.h
+++ b/coreapi/vcard.h
@@ -57,14 +57,14 @@ LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard);
* @param[in] file the path to the file to parse
* @return \mslist{LinphoneVcard}
*/
-LINPHONE_PUBLIC MSList* linphone_vcard_list_from_vcard4_file(const char *file);
+LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_file(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] buffer the buffer to parse
* @return \mslist{LinphoneVcard}
*/
-LINPHONE_PUBLIC MSList* linphone_vcard_list_from_vcard4_buffer(const char *buffer);
+LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(const char *buffer);
/**
* Uses belcard to parse the content of a buffer and returns one vCard if possible, or NULL otherwise.
@@ -120,7 +120,7 @@ void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_
* @param[in] vCard the LinphoneVcard
* @return \mslist{const char *}
*/
-LINPHONE_PUBLIC MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard);
+LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard);
/**
* Adds a phone number in the vCard, using the TEL property
@@ -141,14 +141,14 @@ void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone)
* @param[in] vCard the LinphoneVcard
* @return \mslist{const char *}
*/
-LINPHONE_PUBLIC MSList* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard);
+LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard);
/**
* Returns the list of SIP addresses (as string) in the vCard (all the IMPP attributes that has an URI value starting by "sip:") or NULL
* @param[in] vCard the LinphoneVcard
* @return \mslist{const char *}
*/
-LINPHONE_PUBLIC MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard);
+LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard);
/**
* Fills the Organization field of the vCard
diff --git a/coreapi/vtables.c b/coreapi/vtables.c
index 292d698d9..6ba451918 100644
--- a/coreapi/vtables.c
+++ b/coreapi/vtables.c
@@ -42,13 +42,13 @@ LinphoneCoreVTable *linphone_core_get_current_vtable(LinphoneCore *lc) {
}
static void cleanup_dead_vtable_refs(LinphoneCore *lc){
- MSList *it,*next_it;
+ bctbx_list_t *it,*next_it;
for(it=lc->vtable_refs; it!=NULL; ){
VTableReference *ref=(VTableReference*)it->data;
next_it=it->next;
if (ref->valid==0){
ref->valid=0;
- lc->vtable_refs=ms_list_remove_link(lc->vtable_refs, it);
+ lc->vtable_refs=bctbx_list_remove_link(lc->vtable_refs, it);
ms_free(ref);
}
it=next_it;
@@ -56,7 +56,7 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
}
#define NOTIFY_IF_EXIST(function_name, ...) \
- MSList* iterator; \
+ bctbx_list_t* iterator; \
VTableReference *ref; \
bool_t has_cb = FALSE; \
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next)\
@@ -67,7 +67,7 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
if (has_cb) ms_message("Linphone core [%p] notifying [%s]",lc,#function_name)
#define NOTIFY_IF_EXIST_INTERNAL(function_name, internal_val, ...) \
- MSList* iterator; \
+ bctbx_list_t* iterator; \
VTableReference *ref; \
bool_t has_cb = FALSE; \
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next)\
@@ -99,7 +99,11 @@ void linphone_core_notify_registration_state_changed(LinphoneCore *lc, LinphoneP
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
void linphone_core_notify_show_interface(LinphoneCore *lc){
NOTIFY_IF_EXIST(show, lc);
cleanup_dead_vtable_refs(lc);
@@ -149,7 +153,11 @@ void linphone_core_notify_call_log_updated(LinphoneCore *lc, LinphoneCallLog *ne
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
void linphone_core_notify_text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message){
NOTIFY_IF_EXIST(text_received, lc,room,from,message);
@@ -166,7 +174,11 @@ void linphone_core_notify_message_received(LinphoneCore *lc, LinphoneChatRoom *r
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
void linphone_core_notify_file_transfer_recv(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size) {
NOTIFY_IF_EXIST(file_transfer_recv, lc,message,content,buff,size);
cleanup_dead_vtable_refs(lc);
@@ -195,7 +207,7 @@ void linphone_core_notify_dtmf_received(LinphoneCore* lc, LinphoneCall *call, in
}
bool_t linphone_core_dtmf_received_has_listener(const LinphoneCore* lc) {
- MSList* iterator;
+ bctbx_list_t* iterator;
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next){
VTableReference *ref=(VTableReference*)iterator->data;
if (ref->valid && ref->vtable->dtmf_received)
@@ -290,7 +302,7 @@ void v_table_reference_destroy(VTableReference *ref){
void _linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable, bool_t autorelease, bool_t internal) {
ms_message("Vtable [%p] registered on core [%p]",vtable, lc);
- lc->vtable_refs=ms_list_append(lc->vtable_refs,v_table_reference_new(vtable, autorelease, internal));
+ lc->vtable_refs=bctbx_list_append(lc->vtable_refs,v_table_reference_new(vtable, autorelease, internal));
}
void linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable){
@@ -298,7 +310,7 @@ void linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable){
}
void linphone_core_remove_listener(LinphoneCore *lc, const LinphoneCoreVTable *vtable) {
- MSList *it;
+ bctbx_list_t *it;
ms_message("Vtable [%p] unregistered on core [%p]",lc,vtable);
for(it=lc->vtable_refs; it!=NULL; it=it->next){
VTableReference *ref=(VTableReference*)it->data;
diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
new file mode 100644
index 000000000..bdd7f6d6f
--- /dev/null
+++ b/daemon/CMakeLists.txt
@@ -0,0 +1,129 @@
+############################################################################
+# CMakeLists.txt
+# 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.
+#
+############################################################################
+
+set(DAEMON_SOURCE_FILES
+ commands/adaptive-jitter-compensation.cc
+ commands/adaptive-jitter-compensation.h
+ commands/answer.cc
+ commands/answer.h
+ commands/audio-codec-get.cc
+ commands/audio-codec-get.h
+ commands/audio-codec-move.cc
+ commands/audio-codec-move.h
+ commands/audio-codec-set.cc
+ commands/audio-codec-set.h
+ commands/audio-codec-toggle.cc
+ commands/audio-codec-toggle.h
+ commands/audio-stream-start.cc
+ commands/audio-stream-start.h
+ commands/audio-stream-stats.cc
+ commands/audio-stream-stats.h
+ commands/audio-stream-stop.cc
+ commands/audio-stream-stop.h
+ commands/auth-infos-clear.cc
+ commands/auth-infos-clear.h
+ commands/call.cc
+ commands/call.h
+ commands/call-mute.cc
+ commands/call-mute.h
+ commands/call-pause.cc
+ commands/call-pause.h
+ commands/call-resume.cc
+ commands/call-resume.h
+ commands/call-stats.cc
+ commands/call-stats.h
+ commands/call-status.cc
+ commands/call-status.h
+ commands/call-transfer.cc
+ commands/call-transfer.h
+ commands/cn.cc
+ commands/cn.h
+ commands/conference.cc
+ commands/conference.h
+ commands/config.cc
+ commands/configcommand.h
+ commands/contact.cc
+ commands/contact.h
+ commands/dtmf.cc
+ commands/dtmf.h
+ commands/firewall-policy.cc
+ commands/firewall-policy.h
+ commands/help.cc
+ commands/help.h
+ commands/ipv6.cc
+ commands/ipv6.h
+ commands/jitterbuffer.cc
+ commands/jitterbuffer.h
+ commands/media-encryption.cc
+ commands/media-encryption.h
+ commands/msfilter-add-fmtp.cc
+ commands/msfilter-add-fmtp.h
+ commands/netsim.cc
+ commands/netsim.h
+ commands/play-wav.cc
+ commands/play-wav.h
+ commands/pop-event.cc
+ commands/pop-event.h
+ commands/port.cc
+ commands/port.h
+ commands/ptime.cc
+ commands/ptime.h
+ commands/quit.cc
+ commands/quit.h
+ commands/register.cc
+ commands/register.h
+ commands/register-status.cc
+ commands/register-status.h
+ commands/terminate.cc
+ commands/terminate.h
+ commands/unregister.cc
+ commands/unregister.h
+ commands/version.cc
+ commands/version.h
+ commands/video.cc
+ commands/video.h
+ daemon.cc
+ daemon.h
+)
+
+set(DAEMON_PIPETEST_SOURCE_FILES
+ daemon-pipetest.c
+)
+
+apply_compile_flags(DAEMON_SOURCE_FILES "CPP" "CXX")
+apply_compile_flags(DAEMON_PIPETEST_SOURCE_FILES "CPP" "C")
+
+add_executable(linphone-daemon ${DAEMON_SOURCE_FILES})
+target_include_directories(linphone-daemon PRIVATE ${CMAKE_CURRENT_LIST_DIR})
+target_link_libraries(linphone-daemon linphone ${MEDIASTREAMER2_LIBRARIES})
+
+add_executable(linphone-daemon-pipetest ${DAEMON_PIPETEST_SOURCE_FILES})
+target_link_libraries(linphone-daemon-pipetest linphone ${ORTP_LIBRARIES})
+
+set(INSTALL_TARGETS linphone-daemon linphone-daemon-pipetest)
+
+install(TARGETS ${INSTALL_TARGETS}
+ 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
+)
diff --git a/daemon/commands/adaptive-jitter-compensation.cc b/daemon/commands/adaptive-jitter-compensation.cc
index 949aa792d..8985a782e 100644
--- a/daemon/commands/adaptive-jitter-compensation.cc
+++ b/daemon/commands/adaptive-jitter-compensation.cc
@@ -1,3 +1,22 @@
+/*
+adaptive-jitter-compensation.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "adaptive-jitter-compensation.h"
using namespace std;
diff --git a/daemon/commands/adaptive-jitter-compensation.h b/daemon/commands/adaptive-jitter-compensation.h
index dc319b7c5..cfbe070dd 100644
--- a/daemon/commands/adaptive-jitter-compensation.h
+++ b/daemon/commands/adaptive-jitter-compensation.h
@@ -1,3 +1,22 @@
+/*
+adaptive-jitter-compensation.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_
#define COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_
diff --git a/daemon/commands/answer.cc b/daemon/commands/answer.cc
index 943aa26fc..9c5da9f74 100644
--- a/daemon/commands/answer.cc
+++ b/daemon/commands/answer.cc
@@ -1,3 +1,22 @@
+/*
+answer.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "answer.h"
using namespace std;
diff --git a/daemon/commands/answer.h b/daemon/commands/answer.h
index 38e7e5e7a..a65c1bac7 100644
--- a/daemon/commands/answer.h
+++ b/daemon/commands/answer.h
@@ -1,3 +1,22 @@
+/*
+answer.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_ANSWER_H_
#define COMMAND_ANSWER_H_
diff --git a/daemon/commands/audio-codec-get.cc b/daemon/commands/audio-codec-get.cc
index 48bd25f05..01372da2c 100644
--- a/daemon/commands/audio-codec-get.cc
+++ b/daemon/commands/audio-codec-get.cc
@@ -1,3 +1,22 @@
+/*
+audio-codec-get.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "audio-codec-get.h"
using namespace std;
@@ -54,7 +73,7 @@ void AudioCodecGetCommand::exec(Daemon *app, const char *args) {
}
int index = 0;
- for (const MSList *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = ms_list_next(node)) {
+ for (const bctbx_list_t *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast(node->data);
if (list) {
ost << PayloadTypeResponse(app->getCore(), payload, index).getBody() << "\n";
diff --git a/daemon/commands/audio-codec-get.h b/daemon/commands/audio-codec-get.h
index 14ff63d66..d298e6cf5 100644
--- a/daemon/commands/audio-codec-get.h
+++ b/daemon/commands/audio-codec-get.h
@@ -1,3 +1,22 @@
+/*
+audio-codec-get.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_AUDIO_CODEC_GET_H_
#define COMMAND_AUDIO_CODEC_GET_H_
diff --git a/daemon/commands/audio-codec-move.cc b/daemon/commands/audio-codec-move.cc
index 3d65f9113..23f28b4ad 100644
--- a/daemon/commands/audio-codec-move.cc
+++ b/daemon/commands/audio-codec-move.cc
@@ -1,3 +1,22 @@
+/*
+audio-codec-move.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "audio-codec-move.h"
using namespace std;
@@ -65,21 +84,21 @@ void AudioCodecMoveCommand::exec(Daemon *app, const char *args) {
}
int i = 0;
- MSList *mslist = NULL;
- for (const MSList *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = ms_list_next(node)) {
+ bctbx_list_t *mslist = NULL;
+ for (const bctbx_list_t *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast(node->data);
if (i == index) {
- mslist = ms_list_append(mslist, selected_payload);
+ mslist = bctbx_list_append(mslist, selected_payload);
++i;
}
if (selected_payload != payload) {
- mslist = ms_list_append(mslist, payload);
+ mslist = bctbx_list_append(mslist, payload);
++i;
}
}
if (i <= index) {
index = i;
- mslist = ms_list_append(mslist, selected_payload);
+ mslist = bctbx_list_append(mslist, selected_payload);
}
linphone_core_set_audio_codecs(app->getCore(), mslist);
diff --git a/daemon/commands/audio-codec-move.h b/daemon/commands/audio-codec-move.h
index ce299dd9b..eab54d677 100644
--- a/daemon/commands/audio-codec-move.h
+++ b/daemon/commands/audio-codec-move.h
@@ -1,3 +1,22 @@
+/*
+audio-codec-move.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_AUDIO_CODEC_MOVE_H_
#define COMMAND_AUDIO_CODEC_MOVE_H_
diff --git a/daemon/commands/audio-codec-set.cc b/daemon/commands/audio-codec-set.cc
index 5e9d2935a..3b893d4ef 100644
--- a/daemon/commands/audio-codec-set.cc
+++ b/daemon/commands/audio-codec-set.cc
@@ -1,3 +1,22 @@
+/*
+audio-codec-set.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "audio-codec-set.h"
#include "private.h"
@@ -49,7 +68,7 @@ AudioCodecSetCommand::AudioCodecSetCommand() :
static PayloadType *findPayload(LinphoneCore *lc, int payload_type, int *index){
if (index) *index=0;
- for (const MSList *node = linphone_core_get_audio_codecs(lc); node != NULL; node = ms_list_next(node)) {
+ for (const bctbx_list_t *node = linphone_core_get_audio_codecs(lc); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast(node->data);
if (index) (*index)++;
if (payload_type == linphone_core_get_payload_type_number(lc, payload)) {
diff --git a/daemon/commands/audio-codec-set.h b/daemon/commands/audio-codec-set.h
index 1f5a07369..54025fb18 100644
--- a/daemon/commands/audio-codec-set.h
+++ b/daemon/commands/audio-codec-set.h
@@ -1,3 +1,22 @@
+/*
+audio-codec-set.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_AUDIO_CODEC_SET_H_
#define COMMAND_AUDIO_CODEC_SET_H_
diff --git a/daemon/commands/audio-codec-toggle.cc b/daemon/commands/audio-codec-toggle.cc
index 4f782abe7..ed5949b00 100644
--- a/daemon/commands/audio-codec-toggle.cc
+++ b/daemon/commands/audio-codec-toggle.cc
@@ -1,3 +1,22 @@
+/*
+audio-codec-toggle.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "audio-codec-toggle.h"
#include "audio-codec-get.h"
@@ -24,7 +43,7 @@ void AudioCodecToggleCommand::exec(Daemon *app, const char *args) {
if (!parser.all()) pt = parser.getPayloadType();
int index = 0;
- for (const MSList *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = ms_list_next(node)) {
+ for (const bctbx_list_t *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast(node->data);
if (parser.all()) {
linphone_core_enable_payload_type(app->getCore(), payload, mEnable);
diff --git a/daemon/commands/audio-codec-toggle.h b/daemon/commands/audio-codec-toggle.h
index bce36dfa2..47c196e41 100644
--- a/daemon/commands/audio-codec-toggle.h
+++ b/daemon/commands/audio-codec-toggle.h
@@ -1,3 +1,22 @@
+/*
+audio-codec-toggle.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_AUDIO_CODEC_TOGGLE_H_
#define COMMAND_AUDIO_CODEC_TOGGLE_H_
diff --git a/daemon/commands/audio-stream-start.cc b/daemon/commands/audio-stream-start.cc
index e6b8bf8ba..a961d742e 100644
--- a/daemon/commands/audio-stream-start.cc
+++ b/daemon/commands/audio-stream-start.cc
@@ -1,3 +1,22 @@
+/*
+audio-stream-start.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "audio-stream-start.h"
#include "private.h"
diff --git a/daemon/commands/audio-stream-start.h b/daemon/commands/audio-stream-start.h
index e32f9192f..29372681d 100644
--- a/daemon/commands/audio-stream-start.h
+++ b/daemon/commands/audio-stream-start.h
@@ -1,3 +1,22 @@
+/*
+audio-stream-start.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_AUDIO_STREAM_START_H_
#define COMMAND_AUDIO_STREAM_START_H_
diff --git a/daemon/commands/audio-stream-stats.cc b/daemon/commands/audio-stream-stats.cc
index 8ec208301..93e51c36e 100644
--- a/daemon/commands/audio-stream-stats.cc
+++ b/daemon/commands/audio-stream-stats.cc
@@ -1,3 +1,22 @@
+/*
+audio-stream-stats.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "audio-stream-stats.h"
using namespace std;
diff --git a/daemon/commands/audio-stream-stats.h b/daemon/commands/audio-stream-stats.h
index c25746cd0..6e27e8d52 100644
--- a/daemon/commands/audio-stream-stats.h
+++ b/daemon/commands/audio-stream-stats.h
@@ -1,3 +1,22 @@
+/*
+audio-stream-stats.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_AUDIO_STREAM_STATS_H_
#define COMMAND_AUDIO_STREAM_STATS_H_
diff --git a/daemon/commands/audio-stream-stop.cc b/daemon/commands/audio-stream-stop.cc
index 69a1ec862..a1290a852 100644
--- a/daemon/commands/audio-stream-stop.cc
+++ b/daemon/commands/audio-stream-stop.cc
@@ -1,3 +1,22 @@
+/*
+audio-stream-stop.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "audio-stream-stop.h"
using namespace std;
diff --git a/daemon/commands/audio-stream-stop.h b/daemon/commands/audio-stream-stop.h
index 395e8d7c6..b885b0ff4 100644
--- a/daemon/commands/audio-stream-stop.h
+++ b/daemon/commands/audio-stream-stop.h
@@ -1,3 +1,22 @@
+/*
+audio-stream-stop.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_AUDIO_STREAM_STOP_H_
#define COMMAND_AUDIO_STREAM_STOP_H_
diff --git a/daemon/commands/auth-infos-clear.cc b/daemon/commands/auth-infos-clear.cc
index b39fe51e9..ec247daee 100644
--- a/daemon/commands/auth-infos-clear.cc
+++ b/daemon/commands/auth-infos-clear.cc
@@ -1,3 +1,22 @@
+/*
+auth-infos-clear.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "auth-infos-clear.h"
using namespace std;
diff --git a/daemon/commands/auth-infos-clear.h b/daemon/commands/auth-infos-clear.h
index a15861cd7..20a27afcd 100644
--- a/daemon/commands/auth-infos-clear.h
+++ b/daemon/commands/auth-infos-clear.h
@@ -1,3 +1,22 @@
+/*
+auth-infos-clear.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_AUTH_INFOS_CLEAR_H_
#define COMMAND_AUTH_INFOS_CLEAR_H_
diff --git a/daemon/commands/call-mute.cc b/daemon/commands/call-mute.cc
index 918552159..a244b4cf4 100644
--- a/daemon/commands/call-mute.cc
+++ b/daemon/commands/call-mute.cc
@@ -1,3 +1,22 @@
+/*
+call-mute.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "call-mute.h"
CallMute::CallMute() :
diff --git a/daemon/commands/call-mute.h b/daemon/commands/call-mute.h
index 193b59996..772c6cd0b 100644
--- a/daemon/commands/call-mute.h
+++ b/daemon/commands/call-mute.h
@@ -1,3 +1,22 @@
+/*
+call-mute.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef CALLMUTE_H
#define CALLMUTE_H
diff --git a/daemon/commands/call-pause.cc b/daemon/commands/call-pause.cc
index 24d722cdd..9bceb0ffc 100644
--- a/daemon/commands/call-pause.cc
+++ b/daemon/commands/call-pause.cc
@@ -1,3 +1,22 @@
+/*
+call-pause.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "call-pause.h"
CallPause::CallPause() :
diff --git a/daemon/commands/call-pause.h b/daemon/commands/call-pause.h
index 598eac2d5..0a52a0fb1 100644
--- a/daemon/commands/call-pause.h
+++ b/daemon/commands/call-pause.h
@@ -1,3 +1,22 @@
+/*
+call-pause.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef CALLPAUSE_H
#define CALLPAUSE_H
diff --git a/daemon/commands/call-resume.cc b/daemon/commands/call-resume.cc
index 31849fa42..43ceda8fd 100644
--- a/daemon/commands/call-resume.cc
+++ b/daemon/commands/call-resume.cc
@@ -1,3 +1,22 @@
+/*
+call-resume.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "call-resume.h"
CallResume::CallResume():
diff --git a/daemon/commands/call-resume.h b/daemon/commands/call-resume.h
index e716d94d1..13824d584 100644
--- a/daemon/commands/call-resume.h
+++ b/daemon/commands/call-resume.h
@@ -1,3 +1,22 @@
+/*
+call-resume.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef CALLRESUME_H
#define CALLRESUME_H
diff --git a/daemon/commands/call-stats.cc b/daemon/commands/call-stats.cc
index 854e1714b..b239dfd75 100644
--- a/daemon/commands/call-stats.cc
+++ b/daemon/commands/call-stats.cc
@@ -1,3 +1,22 @@
+/*
+call-stats.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "call-stats.h"
using namespace std;
diff --git a/daemon/commands/call-stats.h b/daemon/commands/call-stats.h
index d03a3bcee..13b4370a3 100644
--- a/daemon/commands/call-stats.h
+++ b/daemon/commands/call-stats.h
@@ -1,3 +1,22 @@
+/*
+call-stats.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_CALL_STATS_H_
#define COMMAND_CALL_STATS_H_
diff --git a/daemon/commands/call-status.cc b/daemon/commands/call-status.cc
index 8587d99bd..675b160d8 100644
--- a/daemon/commands/call-status.cc
+++ b/daemon/commands/call-status.cc
@@ -1,3 +1,22 @@
+/*
+call-status.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "call-status.h"
using namespace std;
diff --git a/daemon/commands/call-status.h b/daemon/commands/call-status.h
index c59344939..b97551a93 100644
--- a/daemon/commands/call-status.h
+++ b/daemon/commands/call-status.h
@@ -1,3 +1,22 @@
+/*
+call-status.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_CALL_STATUS_H_
#define COMMAND_CALL_STATUS_H_
diff --git a/daemon/commands/call-transfer.cc b/daemon/commands/call-transfer.cc
index 2fdf7773e..17558f00d 100644
--- a/daemon/commands/call-transfer.cc
+++ b/daemon/commands/call-transfer.cc
@@ -1,3 +1,22 @@
+/*
+call-transfer.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "call-transfer.h"
CallTransfer::CallTransfer() :
diff --git a/daemon/commands/call-transfer.h b/daemon/commands/call-transfer.h
index 089a14fa9..1ff37952c 100644
--- a/daemon/commands/call-transfer.h
+++ b/daemon/commands/call-transfer.h
@@ -1,3 +1,22 @@
+/*
+call-transfer.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef CALLTRANSFER_H
#define CALLTRANSFER_H
diff --git a/daemon/commands/call.cc b/daemon/commands/call.cc
index 262dee8f5..f908b7f0b 100644
--- a/daemon/commands/call.cc
+++ b/daemon/commands/call.cc
@@ -1,3 +1,22 @@
+/*
+call.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "call.h"
using namespace std;
diff --git a/daemon/commands/call.h b/daemon/commands/call.h
index e46c409b4..5f0ea6b49 100644
--- a/daemon/commands/call.h
+++ b/daemon/commands/call.h
@@ -1,3 +1,22 @@
+/*
+call.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_CALL_H_
#define COMMAND_CALL_H_
diff --git a/daemon/commands/cn.cc b/daemon/commands/cn.cc
index 8f267fe78..d2eabad30 100644
--- a/daemon/commands/cn.cc
+++ b/daemon/commands/cn.cc
@@ -1,3 +1,22 @@
+/*
+cn.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "cn.h"
using namespace std;
diff --git a/daemon/commands/cn.h b/daemon/commands/cn.h
index 4e88e7899..b8ca19b88 100644
--- a/daemon/commands/cn.h
+++ b/daemon/commands/cn.h
@@ -1,3 +1,22 @@
+/*
+cn.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_CN_H_
#define COMMAND_CN_H_
diff --git a/daemon/commands/conference.cc b/daemon/commands/conference.cc
index c9664f598..c39c8515a 100644
--- a/daemon/commands/conference.cc
+++ b/daemon/commands/conference.cc
@@ -1,3 +1,22 @@
+/*
+conference.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "conference.h"
Conference::Conference() :
diff --git a/daemon/commands/conference.h b/daemon/commands/conference.h
index c430f43e5..e904e8792 100644
--- a/daemon/commands/conference.h
+++ b/daemon/commands/conference.h
@@ -1,3 +1,22 @@
+/*
+conference.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMANDS_CONFERENCE_H
#define COMMANDS_CONFERENCE_H
diff --git a/daemon/commands/config.cc b/daemon/commands/config.cc
index fa89bc8c3..385823256 100644
--- a/daemon/commands/config.cc
+++ b/daemon/commands/config.cc
@@ -1,3 +1,22 @@
+/*
+config.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "configcommand.h"
using namespace std;
diff --git a/daemon/commands/configcommand.h b/daemon/commands/configcommand.h
index 70327dbfc..5813f6735 100644
--- a/daemon/commands/configcommand.h
+++ b/daemon/commands/configcommand.h
@@ -1,3 +1,22 @@
+/*
+configcommand.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_CONFIG_H_
#define COMMAND_CONFIG_H_
diff --git a/daemon/commands/contact.cc b/daemon/commands/contact.cc
index 81872f579..b0b97f162 100644
--- a/daemon/commands/contact.cc
+++ b/daemon/commands/contact.cc
@@ -1,3 +1,22 @@
+/*
+contact.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "contact.h"
using namespace std;
diff --git a/daemon/commands/contact.h b/daemon/commands/contact.h
index 34879ae48..79a609bc8 100644
--- a/daemon/commands/contact.h
+++ b/daemon/commands/contact.h
@@ -1,3 +1,22 @@
+/*
+contact.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_CONTACT_H_
#define COMMAND_CONTACT_H_
diff --git a/daemon/commands/dtmf.cc b/daemon/commands/dtmf.cc
index d5b0a9103..7d464f4de 100644
--- a/daemon/commands/dtmf.cc
+++ b/daemon/commands/dtmf.cc
@@ -1,3 +1,22 @@
+/*
+dtmf.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "dtmf.h"
using namespace std;
@@ -20,10 +39,13 @@ void DtmfCommand::exec(Daemon *app, const char *args) {
if (ist.fail()) {
app->sendResponse(Response("Missing digit parameter.", Response::Error));
} else {
- digit = digit_str.at(0);
+ digit = digit_str.at(0);
if (isdigit(digit) || (digit == 'A') || (digit == 'B') || (digit == 'C') || (digit == 'D') || (digit == '*') || (digit == '#')) {
+ LinphoneCall *call = linphone_core_get_current_call(app->getCore());
linphone_core_play_dtmf(app->getCore(), digit, 100);
- linphone_core_send_dtmf(app->getCore(), digit);
+ if (call == NULL) {
+ linphone_call_send_dtmf(call, digit);
+ }
app->sendResponse(Response());
} else {
app->sendResponse(Response("Incorrect digit parameter.", Response::Error));
diff --git a/daemon/commands/dtmf.h b/daemon/commands/dtmf.h
index d1b6fc8cd..1af629457 100644
--- a/daemon/commands/dtmf.h
+++ b/daemon/commands/dtmf.h
@@ -1,3 +1,22 @@
+/*
+dtmf.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_DTMF_H_
#define COMMAND_DTMF_H_
diff --git a/daemon/commands/firewall-policy.cc b/daemon/commands/firewall-policy.cc
index e9bde0a9b..ae3a912b3 100644
--- a/daemon/commands/firewall-policy.cc
+++ b/daemon/commands/firewall-policy.cc
@@ -1,3 +1,22 @@
+/*
+firewall-policy.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "firewall-policy.h"
using namespace std;
diff --git a/daemon/commands/firewall-policy.h b/daemon/commands/firewall-policy.h
index 07fb63298..d90c78ecf 100644
--- a/daemon/commands/firewall-policy.h
+++ b/daemon/commands/firewall-policy.h
@@ -1,3 +1,22 @@
+/*
+firewall-policy.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_FIREWALL_POLICY_H_
#define COMMAND_FIREWALL_POLICY_H_
diff --git a/daemon/commands/help.cc b/daemon/commands/help.cc
index 23c08f523..329a96359 100644
--- a/daemon/commands/help.cc
+++ b/daemon/commands/help.cc
@@ -1,3 +1,22 @@
+/*
+help.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "help.h"
using namespace std;
diff --git a/daemon/commands/help.h b/daemon/commands/help.h
index 205240397..b6e1f966d 100644
--- a/daemon/commands/help.h
+++ b/daemon/commands/help.h
@@ -1,3 +1,22 @@
+/*
+help.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_HELP_H_
#define COMMAND_HELP_H_
diff --git a/daemon/commands/ipv6.cc b/daemon/commands/ipv6.cc
index 7682794a5..fc57cb531 100644
--- a/daemon/commands/ipv6.cc
+++ b/daemon/commands/ipv6.cc
@@ -1,3 +1,22 @@
+/*
+ipv6.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "ipv6.h"
using namespace std;
diff --git a/daemon/commands/ipv6.h b/daemon/commands/ipv6.h
index 591a3d7cb..61247cfc3 100644
--- a/daemon/commands/ipv6.h
+++ b/daemon/commands/ipv6.h
@@ -1,3 +1,22 @@
+/*
+ipv6.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_IPV6_H_
#define COMMAND_IPV6_H_
diff --git a/daemon/commands/jitterbuffer.cc b/daemon/commands/jitterbuffer.cc
index 155b6b234..be627a053 100644
--- a/daemon/commands/jitterbuffer.cc
+++ b/daemon/commands/jitterbuffer.cc
@@ -1,3 +1,22 @@
+/*
+jitterbuffer.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "jitterbuffer.h"
#include
diff --git a/daemon/commands/jitterbuffer.h b/daemon/commands/jitterbuffer.h
index 29e1ec03b..f63484b87 100644
--- a/daemon/commands/jitterbuffer.h
+++ b/daemon/commands/jitterbuffer.h
@@ -1,3 +1,22 @@
+/*
+jitterbuffer.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_JITTER_SIZE_H_
#define COMMAND_JITTER_SIZE_H_
diff --git a/daemon/commands/media-encryption.cc b/daemon/commands/media-encryption.cc
index 6180790e4..f055053ce 100644
--- a/daemon/commands/media-encryption.cc
+++ b/daemon/commands/media-encryption.cc
@@ -1,3 +1,22 @@
+/*
+media-encryption.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "media-encryption.h"
using namespace std;
diff --git a/daemon/commands/media-encryption.h b/daemon/commands/media-encryption.h
index 09a13d88b..a15163829 100644
--- a/daemon/commands/media-encryption.h
+++ b/daemon/commands/media-encryption.h
@@ -1,3 +1,22 @@
+/*
+media-encryption.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_MEDIA_ENCRYPTION_H_
#define COMMAND_MEDIA_ENCRYPTION_H_
diff --git a/daemon/commands/msfilter-add-fmtp.cc b/daemon/commands/msfilter-add-fmtp.cc
index beb8aa84d..961aee825 100644
--- a/daemon/commands/msfilter-add-fmtp.cc
+++ b/daemon/commands/msfilter-add-fmtp.cc
@@ -1,3 +1,22 @@
+/*
+msfilter-add-fmtp.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "msfilter-add-fmtp.h"
#include
#include
diff --git a/daemon/commands/msfilter-add-fmtp.h b/daemon/commands/msfilter-add-fmtp.h
index c7a5b01b5..0e92f7e21 100644
--- a/daemon/commands/msfilter-add-fmtp.h
+++ b/daemon/commands/msfilter-add-fmtp.h
@@ -1,3 +1,22 @@
+/*
+msfilter-add-fmtp.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_MSFILTER_ADD_FMTP
#define COMMAND_MSFILTER_ADD_FMTP
diff --git a/daemon/commands/netsim.cc b/daemon/commands/netsim.cc
index 6d0255317..204289ba4 100644
--- a/daemon/commands/netsim.cc
+++ b/daemon/commands/netsim.cc
@@ -1,3 +1,22 @@
+/*
+netsim.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "netsim.h"
using namespace std;
diff --git a/daemon/commands/netsim.h b/daemon/commands/netsim.h
index 55cfcbc76..b883b93dd 100644
--- a/daemon/commands/netsim.h
+++ b/daemon/commands/netsim.h
@@ -1,3 +1,22 @@
+/*
+netsim.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_NETSIM_H_
#define COMMAND_NETSIM_H_
diff --git a/daemon/commands/play-wav.cc b/daemon/commands/play-wav.cc
index 266341d65..18eae73e5 100644
--- a/daemon/commands/play-wav.cc
+++ b/daemon/commands/play-wav.cc
@@ -1,3 +1,22 @@
+/*
+play-wav.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "play-wav.h"
using namespace std;
diff --git a/daemon/commands/play-wav.h b/daemon/commands/play-wav.h
index a51832a71..30e947033 100644
--- a/daemon/commands/play-wav.h
+++ b/daemon/commands/play-wav.h
@@ -1,3 +1,22 @@
+/*
+play-wav.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_PLAY_WAV_H_
#define COMMAND_PLAY_WAV_H_
diff --git a/daemon/commands/pop-event.cc b/daemon/commands/pop-event.cc
index e9228a67d..2d2075497 100644
--- a/daemon/commands/pop-event.cc
+++ b/daemon/commands/pop-event.cc
@@ -1,3 +1,22 @@
+/*
+pop-event.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "pop-event.h"
using namespace std;
diff --git a/daemon/commands/pop-event.h b/daemon/commands/pop-event.h
index 17922803d..1a5fd581d 100644
--- a/daemon/commands/pop-event.h
+++ b/daemon/commands/pop-event.h
@@ -1,3 +1,22 @@
+/*
+pop-event.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_POP_EVENT_H_
#define COMMAND_POP_EVENT_H_
diff --git a/daemon/commands/port.cc b/daemon/commands/port.cc
index 0fd5f8e6f..1452c6157 100644
--- a/daemon/commands/port.cc
+++ b/daemon/commands/port.cc
@@ -1,3 +1,22 @@
+/*
+port.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "port.h"
using namespace std;
diff --git a/daemon/commands/port.h b/daemon/commands/port.h
index e2813970c..3618971dd 100644
--- a/daemon/commands/port.h
+++ b/daemon/commands/port.h
@@ -1,3 +1,22 @@
+/*
+port.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_PORT_H_
#define COMMAND_PORT_H_
diff --git a/daemon/commands/ptime.cc b/daemon/commands/ptime.cc
index 3931a7ccd..234bb8e46 100644
--- a/daemon/commands/ptime.cc
+++ b/daemon/commands/ptime.cc
@@ -1,3 +1,22 @@
+/*
+ptime.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "ptime.h"
using namespace std;
diff --git a/daemon/commands/ptime.h b/daemon/commands/ptime.h
index e07140296..18c59825b 100644
--- a/daemon/commands/ptime.h
+++ b/daemon/commands/ptime.h
@@ -1,3 +1,22 @@
+/*
+ptime.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_PTIME_H_
#define COMMAND_PTIME_H_
diff --git a/daemon/commands/quit.cc b/daemon/commands/quit.cc
index db07610df..8876e096d 100644
--- a/daemon/commands/quit.cc
+++ b/daemon/commands/quit.cc
@@ -1,3 +1,22 @@
+/*
+quit.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "quit.h"
using namespace std;
diff --git a/daemon/commands/quit.h b/daemon/commands/quit.h
index 7c0211fae..78e323e1f 100644
--- a/daemon/commands/quit.h
+++ b/daemon/commands/quit.h
@@ -1,3 +1,22 @@
+/*
+quit.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_QUIT_H_
#define COMMAND_QUIT_H_
diff --git a/daemon/commands/register-status.cc b/daemon/commands/register-status.cc
index 0c21eaac7..c50e49acb 100644
--- a/daemon/commands/register-status.cc
+++ b/daemon/commands/register-status.cc
@@ -1,3 +1,22 @@
+/*
+register-status.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "register-status.h"
using namespace std;
diff --git a/daemon/commands/register-status.h b/daemon/commands/register-status.h
index 31ce2a782..9af479580 100644
--- a/daemon/commands/register-status.h
+++ b/daemon/commands/register-status.h
@@ -1,3 +1,22 @@
+/*
+register-status.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_REGISTER_STATUS_H_
#define COMMAND_REGISTER_STATUS_H_
diff --git a/daemon/commands/register.cc b/daemon/commands/register.cc
index 7b99f4370..5ef151d73 100644
--- a/daemon/commands/register.cc
+++ b/daemon/commands/register.cc
@@ -1,3 +1,22 @@
+/*
+register.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "register.h"
#include "linphonecore.h"
#include "private.h"
diff --git a/daemon/commands/register.h b/daemon/commands/register.h
index 916c0ab3e..73b990576 100644
--- a/daemon/commands/register.h
+++ b/daemon/commands/register.h
@@ -1,3 +1,22 @@
+/*
+register.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_REGISTER_H_
#define COMMAND_REGISTER_H_
diff --git a/daemon/commands/terminate.cc b/daemon/commands/terminate.cc
index eaea16cce..20630ed56 100644
--- a/daemon/commands/terminate.cc
+++ b/daemon/commands/terminate.cc
@@ -1,3 +1,22 @@
+/*
+terminate.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "terminate.h"
using namespace std;
diff --git a/daemon/commands/terminate.h b/daemon/commands/terminate.h
index cfa5556a7..93096acd6 100644
--- a/daemon/commands/terminate.h
+++ b/daemon/commands/terminate.h
@@ -1,3 +1,22 @@
+/*
+terminate.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_TERMINATE_H_
#define COMMAND_TERMINATE_H_
diff --git a/daemon/commands/unregister.cc b/daemon/commands/unregister.cc
index 60acb6b02..2b0852ece 100644
--- a/daemon/commands/unregister.cc
+++ b/daemon/commands/unregister.cc
@@ -1,3 +1,22 @@
+/*
+unregister.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "unregister.h"
using namespace std;
diff --git a/daemon/commands/unregister.h b/daemon/commands/unregister.h
index 85145c197..2c83c9137 100644
--- a/daemon/commands/unregister.h
+++ b/daemon/commands/unregister.h
@@ -1,3 +1,22 @@
+/*
+unregister.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_UNREGISTER_H_
#define COMMAND_UNREGISTER_H_
diff --git a/daemon/commands/version.cc b/daemon/commands/version.cc
index 285ee4167..f080a7dbd 100644
--- a/daemon/commands/version.cc
+++ b/daemon/commands/version.cc
@@ -1,3 +1,22 @@
+/*
+version.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "version.h"
using namespace std;
diff --git a/daemon/commands/version.h b/daemon/commands/version.h
index 492147448..f9cc7fee8 100644
--- a/daemon/commands/version.h
+++ b/daemon/commands/version.h
@@ -1,3 +1,22 @@
+/*
+version.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMAND_VERSION_H_
#define COMMAND_VERSION_H_
diff --git a/daemon/commands/video.cc b/daemon/commands/video.cc
index a0e1dce61..78d5d50fd 100644
--- a/daemon/commands/video.cc
+++ b/daemon/commands/video.cc
@@ -1,3 +1,22 @@
+/*
+video.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "commands/video.h"
Video::Video() :
diff --git a/daemon/commands/video.h b/daemon/commands/video.h
index 05cd7e1eb..3fe9b07e9 100644
--- a/daemon/commands/video.h
+++ b/daemon/commands/video.h
@@ -1,3 +1,22 @@
+/*
+video.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef CALLCAMERA_H
#define CALLCAMERA_H
diff --git a/daemon/daemon-pipetest.c b/daemon/daemon-pipetest.c
index dde0bb3b0..970413662 100644
--- a/daemon/daemon-pipetest.c
+++ b/daemon/daemon-pipetest.c
@@ -1,3 +1,22 @@
+/*
+daemon-pipetest.c
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#define _GNU_SOURCE
#include
@@ -10,15 +29,17 @@
static int running=1;
int main(int argc, char *argv[]){
+ struct pollfd pfds[2]={{0}};
+ char buf[4096];
+ int fd;
+
/* handle args */
if (argc < 2) {
ortp_error("Usage: %s pipename", argv[0]);
return 1;
}
- int fd=ortp_client_pipe_connect(argv[1]);
- struct pollfd pfds[2]={{0}};
- char buf[4096];
+ fd=ortp_client_pipe_connect(argv[1]);
ortp_init();
ortp_set_log_level_mask(NULL,ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
diff --git a/daemon/daemon.cc b/daemon/daemon.cc
index 47f820ab0..4d86cca35 100644
--- a/daemon/daemon.cc
+++ b/daemon/daemon.cc
@@ -1,3 +1,22 @@
+/*
+daemon.cc
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include
#include
#include
@@ -251,9 +270,9 @@ PayloadTypeParser::PayloadTypeParser(LinphoneCore *core, const string &mime_type
return;
}
mPayloadType = linphone_core_find_payload_type(core, type, rate, channels);
- if (mPayloadType) mPosition=ms_list_index(linphone_core_get_audio_codecs(core), mPayloadType);
+ if (mPayloadType) mPosition=bctbx_list_index(linphone_core_get_audio_codecs(core), mPayloadType);
}else if (number!=-1){
- const MSList *elem;
+ const bctbx_list_t *elem;
for(elem=linphone_core_get_audio_codecs(core);elem!=NULL;elem=elem->next){
if (number==linphone_core_get_payload_type_number(core,(PayloadType*)elem->data)){
mPayloadType=(PayloadType*)elem->data;
@@ -355,7 +374,7 @@ int Daemon::updateCallId(LinphoneCall *call) {
}
LinphoneCall *Daemon::findCall(int id) {
- const MSList *elem = linphone_core_get_calls(mLc);
+ const bctbx_list_t *elem = linphone_core_get_calls(mLc);
for (; elem != NULL; elem = elem->next) {
LinphoneCall *call = (LinphoneCall *) elem->data;
if (linphone_call_get_user_pointer(call) == (void*) (long) id)
@@ -374,7 +393,7 @@ int Daemon::updateProxyId(LinphoneProxyConfig *cfg) {
}
LinphoneProxyConfig *Daemon::findProxy(int id) {
- const MSList *elem = linphone_core_get_proxy_config_list(mLc);
+ const bctbx_list_t *elem = linphone_core_get_proxy_config_list(mLc);
for (; elem != NULL; elem = elem->next) {
LinphoneProxyConfig *proxy = (LinphoneProxyConfig *) elem->data;
if (linphone_proxy_config_get_user_data(proxy) == (void*) (long) id)
@@ -384,8 +403,8 @@ LinphoneProxyConfig *Daemon::findProxy(int id) {
}
LinphoneAuthInfo *Daemon::findAuthInfo(int id) {
- const MSList *elem = linphone_core_get_auth_info_list(mLc);
- if (elem == NULL || id < 1 || id > ms_list_size(elem)) {
+ const bctbx_list_t *elem = linphone_core_get_auth_info_list(mLc);
+ if (elem == NULL || id < 1 || (unsigned int)id > bctbx_list_size(elem)) {
return NULL;
}
while (id > 1) {
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 564cb7994..153c33c03 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -1,3 +1,22 @@
+/*
+daemon.h
+Copyright (C) 2016 Belledonne Communications, Grenoble, France
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef DAEMON_H_
#define DAEMON_H_
@@ -5,6 +24,7 @@
#include
#include
#include
+#include
#include
#include
@@ -212,7 +232,7 @@ public:
int updateCallId(LinphoneCall *call);
int updateProxyId(LinphoneProxyConfig *proxy);
inline int maxProxyId() { return mProxyIds; }
- inline int maxAuthInfoId() { return ms_list_size(linphone_core_get_auth_info_list(mLc)); }
+ inline int maxAuthInfoId() { return bctbx_list_size(linphone_core_get_auth_info_list(mLc)); }
int updateAudioStreamId(AudioStream *audio_stream);
void dumpCommandsHelp();
void dumpCommandsHelpHtml();
diff --git a/gtk/CMakeLists.txt b/gtk/CMakeLists.txt
index aa04fdcce..75064ea28 100644
--- a/gtk/CMakeLists.txt
+++ b/gtk/CMakeLists.txt
@@ -94,7 +94,7 @@ else()
endif()
set_target_properties(linphone-gtk PROPERTIES OUTPUT_NAME linphone LINKER_LANGUAGE CXX)
target_include_directories(linphone-gtk PUBLIC ${GTK2_INCLUDE_DIRS} ${INTL_INCLUDE_DIRS})
-target_link_libraries(linphone-gtk linphone ${GTK2_LIBRARIES})
+target_link_libraries(linphone-gtk linphone ${GTK2_LIBRARIES} ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
if(INTL_FOUND)
target_link_libraries(linphone-gtk ${INTL_LIBRARIES})
endif()
diff --git a/gtk/buddylookup.c b/gtk/buddylookup.c
index ef3044a1d..3ec5e2402 100644
--- a/gtk/buddylookup.c
+++ b/gtk/buddylookup.c
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphone.h"
#include "sipsetup.h"
-static void linphone_gtk_display_lookup_results(GtkWidget *w, const MSList *results);
+static void linphone_gtk_display_lookup_results(GtkWidget *w, const bctbx_list_t *results);
enum {
LOOKUP_RESULT_NAME,
@@ -136,7 +136,7 @@ static gboolean linphone_gtk_process_buddy_lookup(GtkWidget *w){
SipSetupContext *ctx;
int last_state;
gchar *tmp;
- MSList *results=NULL;
+ bctbx_list_t *results=NULL;
GtkProgressBar *pb=GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar"));
BuddyLookupRequest *req=(BuddyLookupRequest*)g_object_get_data(G_OBJECT(w),"buddylookup_request");
@@ -177,9 +177,8 @@ static gboolean linphone_gtk_process_buddy_lookup(GtkWidget *w){
linphone_gtk_get_widget(w,"search_results"),
results);
gtk_progress_bar_set_fraction(pb,1);
- tmp=g_strdup_printf(ngettext("Found %i contact",
- "Found %i contacts", ms_list_size(results)),
- ms_list_size(results));
+ tmp=g_strdup_printf(ngettext("Found %u contact", "Found %u contacts",
+ (unsigned int)bctbx_list_size(results)), (unsigned int)bctbx_list_size(results));
gtk_progress_bar_set_text(pb,tmp);
g_free(tmp);
sip_setup_context_buddy_lookup_free(ctx,req);
@@ -228,11 +227,11 @@ void linphone_gtk_keyword_changed(GtkEditable *e){
g_object_set_data(G_OBJECT(w),"typing_timeout",GINT_TO_POINTER(tid));
}
-static void linphone_gtk_display_lookup_results(GtkWidget *w, const MSList *results){
+static void linphone_gtk_display_lookup_results(GtkWidget *w, const bctbx_list_t *results){
GtkTreeStore *store;
GtkTreeIter iter;
gchar *tmp;
- const MSList *elem;
+ const bctbx_list_t *elem;
store=GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(w)));
gtk_tree_store_clear(store);
disable_add_buddy_button(gtk_widget_get_toplevel(w));
diff --git a/gtk/calllogs.c b/gtk/calllogs.c
index bd87a61dc..6705b6cff 100644
--- a/gtk/calllogs.c
+++ b/gtk/calllogs.c
@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
+#include
#define CONFIG_FILE ".linphone-call-history.db"
@@ -28,7 +29,7 @@ char *linphone_gtk_call_logs_storage_get_db_file(const char *filename){
db_file=(char *)g_malloc(path_max*sizeof(char));
if (filename==NULL) filename=CONFIG_FILE;
/*try accessing a local file first if exists*/
- if (access(CONFIG_FILE,F_OK)==0){
+ if (bctbx_file_exist(CONFIG_FILE)==0){
snprintf(db_file,path_max,"%s",filename);
}else{
#ifdef _WIN32
diff --git a/gtk/chat.c b/gtk/chat.c
index 2a2287b2c..820c656c6 100644
--- a/gtk/chat.c
+++ b/gtk/chat.c
@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
+#include
#ifdef HAVE_GTK_OSX
#include
@@ -62,7 +63,7 @@ char *linphone_gtk_message_storage_get_db_file(const char *filename){
db_file=(char *)g_malloc(path_max*sizeof(char));
if (filename==NULL) filename=CONFIG_FILE;
/*try accessing a local file first if exists*/
- if (access(CONFIG_FILE,F_OK)==0){
+ if (bctbx_file_exist(CONFIG_FILE)==0){
snprintf(db_file,path_max,"%s",filename);
}else{
#ifdef _WIN32
@@ -196,7 +197,7 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
pos = end;
g_match_info_next(match_info, NULL);
}
- if(pos < strlen(message)) write_body(buffer, &iter, &message[pos], -1, me, FALSE);
+ if((size_t)pos < strlen(message)) write_body(buffer, &iter, &message[pos], -1, me, FALSE);
gtk_text_buffer_insert(buffer,&iter,"\n",-1);
g_match_info_free(match_info);
}
@@ -327,14 +328,14 @@ static void linphone_gtk_chat_message_destroy(LinphoneChatMessage *msg){
linphone_chat_message_destroy(msg);
}
-void linphone_gtk_free_list(MSList *messages){
- ms_list_for_each(messages,(void (*)(void*))linphone_gtk_chat_message_destroy);
- ms_list_free(messages);
+void linphone_gtk_free_list(bctbx_list_t *messages){
+ bctbx_list_for_each(messages,(void (*)(void*))linphone_gtk_chat_message_destroy);
+ bctbx_list_free(messages);
}
-void display_history_message(GtkWidget *chat_view,MSList *messages,const LinphoneAddress *with){
+void display_history_message(GtkWidget *chat_view,bctbx_list_t *messages,const LinphoneAddress *with){
if (messages != NULL){
- MSList *it;
+ bctbx_list_t *it;
char *from_str;
char *with_str;
gchar *tmp;
@@ -441,8 +442,8 @@ static gboolean chatroom_event(GtkWidget *widget, GdkEvent *event, gpointer user
GtkTextIter iter;
if(event->type == GDK_MOTION_NOTIFY) {
GdkEventMotion *motion_ev = (GdkEventMotion *)event;
- wx = motion_ev->x;
- wy = motion_ev->y;
+ wx = (gint)motion_ev->x;
+ wy = (gint)motion_ev->y;
gtk_text_view_window_to_buffer_coords(chatroom, GTK_TEXT_WINDOW_TEXT, wx, wy, &bx, &by);
gtk_text_view_get_iter_at_location(chatroom, &iter, bx, by);
if(gtk_text_iter_has_tag(&iter, link_tag)) {
@@ -501,7 +502,7 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
int idx;
GtkWidget *button;
GtkWidget *entry = linphone_gtk_get_widget(chat_view,"text_entry");
- MSList *messages;
+ bctbx_list_t *messages;
GHashTable *table;
GtkTextTag *tmp_tag;
GtkWidget *link_ctx_menu = gtk_menu_new();
@@ -587,7 +588,7 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
char *from_str=linphone_address_as_string_uri_only(from);
char *uri_str=linphone_address_as_string(uri);
char *uri_only=linphone_address_as_string_uri_only(uri);
- MSList *messages=NULL;
+ bctbx_list_t *messages=NULL;
if(g_strcmp0(from_str,uri_only)!=0){
GtkTextView *text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview"));
diff --git a/gtk/friendlist.c b/gtk/friendlist.c
index d722f8389..0ef089c6a 100644
--- a/gtk/friendlist.c
+++ b/gtk/friendlist.c
@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
+#include
static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list);
@@ -570,14 +571,14 @@ static int friend_compare_func(const LinphoneFriend *lf1, const LinphoneFriend *
return w2-w1;
}
-static MSList *sort_friend_list(const MSList *friends){
- MSList *ret=NULL;
- const MSList *elem;
+static bctbx_list_t *sort_friend_list(const bctbx_list_t *friends){
+ bctbx_list_t *ret=NULL;
+ const bctbx_list_t *elem;
LinphoneFriend *lf;
for(elem=friends;elem!=NULL;elem=elem->next){
lf=(LinphoneFriend*)elem->data;
- ret=ms_list_insert_sorted(ret,lf,(MSCompareFunc)friend_compare_func);
+ ret=bctbx_list_insert_sorted(ret,lf,(bctbx_compare_func)friend_compare_func);
}
return ret;
}
@@ -668,9 +669,9 @@ void linphone_gtk_show_friends(void){
GtkWidget *friendlist=linphone_gtk_get_widget(mw,"contact_list");
GtkListStore *store=NULL;
GtkTreeIter iter;
- const MSList *itf;
+ const bctbx_list_t *itf;
LinphoneCore *core=linphone_gtk_get_core();
- MSList *sorted;
+ bctbx_list_t *sorted;
LinphoneChatRoom *cr=NULL;
linphone_gtk_show_directory_search();
@@ -683,7 +684,7 @@ void linphone_gtk_show_friends(void){
sorted=sort_friend_list(linphone_core_get_friend_list(core));
- for(itf=sorted;itf!=NULL;itf=ms_list_next(itf)){
+ for(itf=sorted;itf!=NULL;itf=bctbx_list_next(itf)){
LinphoneFriend *lf=(LinphoneFriend*)itf->data;
const LinphoneAddress *f_uri=linphone_friend_get_address(lf);
char *uri=linphone_address_as_string(f_uri);
@@ -712,7 +713,7 @@ void linphone_gtk_show_friends(void){
g_free(escaped);
ms_free(uri);
}
- ms_list_free(sorted);
+ bctbx_list_free(sorted);
}
void linphone_gtk_show_contact(LinphoneFriend *lf, GtkWidget *parent){
@@ -919,7 +920,7 @@ gboolean linphone_gtk_contact_list_button_pressed(GtkTreeView *friendlist, GdkEv
GtkTreeViewColumn *column;
GtkTreeSelection *selection = gtk_tree_view_get_selection(friendlist);
- gtk_tree_view_convert_widget_to_bin_window_coords(friendlist, event->x, event->y, &x_bin, &y_bin);
+ gtk_tree_view_convert_widget_to_bin_window_coords(friendlist, (gint)event->x, (gint)event->y, &x_bin, &y_bin);
gtk_tree_view_get_path_at_pos(friendlist, x_bin, y_bin, &path, &column, NULL, NULL);
if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
@@ -964,7 +965,7 @@ static gboolean update_hovered_row_path(GtkTreeView *friendlist, int x_window, i
}
gboolean linphone_gtk_friend_list_enter_event_handler(GtkTreeView *friendlist, GdkEventCrossing *event) {
- gboolean path_has_changed = update_hovered_row_path(friendlist, event->x, event->y);
+ gboolean path_has_changed = update_hovered_row_path(friendlist, (int)event->x, (int)event->y);
if(path_has_changed) linphone_gtk_friend_list_update_button_display(friendlist);
return FALSE;
}
@@ -979,7 +980,7 @@ gboolean linphone_gtk_friend_list_leave_event_handler(GtkTreeView *friendlist, G
}
gboolean linphone_gtk_friend_list_motion_event_handler(GtkTreeView *friendlist, GdkEventMotion *event) {
- gboolean path_has_changed = update_hovered_row_path(friendlist, event->x, event->y);
+ gboolean path_has_changed = update_hovered_row_path(friendlist, (int)event->x, (int)event->y);
if(path_has_changed) linphone_gtk_friend_list_update_button_display(friendlist);
return FALSE;
}
@@ -993,7 +994,7 @@ char *linphone_gtk_friends_storage_get_db_file(const char *filename){
db_file=(char *)g_malloc(path_max*sizeof(char));
if (filename==NULL) filename=CONFIG_FILE;
/*try accessing a local file first if exists*/
- if (access(CONFIG_FILE,F_OK)==0){
+ if (bctbx_file_exist(CONFIG_FILE)==0){
snprintf(db_file,path_max,"%s",filename);
}else{
#ifdef _WIN32
diff --git a/gtk/incall_view.c b/gtk/incall_view.c
index ba90f7560..34a90120e 100644
--- a/gtk/incall_view.c
+++ b/gtk/incall_view.c
@@ -39,9 +39,9 @@ LinphoneCall *linphone_gtk_get_currently_displayed_call(gboolean *is_conf){
LinphoneCore *lc=linphone_gtk_get_core();
GtkWidget *main_window=linphone_gtk_get_main_window ();
GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch");
- const MSList *calls=linphone_core_get_calls(lc);
+ const bctbx_list_t *calls=linphone_core_get_calls(lc);
if (is_conf) *is_conf=FALSE;
- if (!linphone_gtk_use_in_call_view() || ms_list_size(calls)==1){
+ if (!linphone_gtk_use_in_call_view() || bctbx_list_size(calls)==1){
if (calls) return (LinphoneCall*)calls->data;
}else{
int idx=gtk_notebook_get_current_page (notebook);
@@ -134,7 +134,7 @@ void transfer_button_clicked(GtkWidget *button, gpointer call_ref){
GtkWidget *menu=gtk_menu_new();
LinphoneCall *call=(LinphoneCall*)call_ref;
LinphoneCore *lc=linphone_gtk_get_core();
- const MSList *elem=linphone_core_get_calls(lc);
+ const bctbx_list_t *elem=linphone_core_get_calls(lc);
for(;elem!=NULL;elem=elem->next){
LinphoneCall *other_call=(LinphoneCall*)elem->data;
@@ -158,7 +158,7 @@ void transfer_button_clicked(GtkWidget *button, gpointer call_ref){
}
void linphone_gtk_enable_transfer_button(LinphoneCore *lc, gboolean value){
- const MSList *elem=linphone_core_get_calls(lc);
+ const bctbx_list_t *elem=linphone_core_get_calls(lc);
for(;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall*)elem->data;
GtkWidget *call_view=(GtkWidget*)linphone_call_get_user_pointer(call);
@@ -177,7 +177,7 @@ static void conference_button_clicked(GtkWidget *button, gpointer call_ref){
}
void linphone_gtk_enable_conference_button(LinphoneCore *lc, gboolean value){
- const MSList *elem=linphone_core_get_calls(lc);
+ const bctbx_list_t *elem=linphone_core_get_calls(lc);
for(;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall*)elem->data;
GtkWidget *call_view=(GtkWidget*)linphone_call_get_user_pointer(call);
@@ -359,9 +359,9 @@ static void volume_control_value_changed(GtkScaleButton *button, gdouble value,
VolumeControlType type = (VolumeControlType)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "type"));
if(type == VOLUME_CTRL_PLAYBACK) {
- linphone_call_set_speaker_volume_gain(call, value);
+ linphone_call_set_speaker_volume_gain(call, (float)value);
} else if(type == VOLUME_CTRL_RECORD) {
- linphone_call_set_microphone_volume_gain(call, value);
+ linphone_call_set_microphone_volume_gain(call, (float)value);
}
}
@@ -413,7 +413,7 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){
GtkWidget *button;
GtkWidget *image;
- if (ms_list_size(linphone_core_get_calls(linphone_gtk_get_core()))==1){
+ if (bctbx_list_size(linphone_core_get_calls(linphone_gtk_get_core()))==1){
/*this is the only call at this time */
call_index=1;
}
@@ -641,7 +641,7 @@ static gboolean linphone_gtk_in_call_view_refresh(LinphoneCall *call){
}
#define UNSIGNIFICANT_VOLUME (-23)
-#define SMOOTH 0.15
+#define SMOOTH 0.15f
static gboolean update_audio_meter(volume_ctx_t *ctx){
float volume_db=ctx->get_volume(ctx->data);
diff --git a/gtk/linphone.h b/gtk/linphone.h
index 8be2e47f3..9692af836 100644
--- a/gtk/linphone.h
+++ b/gtk/linphone.h
@@ -24,7 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifndef _MSC_VER
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#endif
#include
diff --git a/gtk/logging.c b/gtk/logging.c
index e97ca75f8..c702e437d 100644
--- a/gtk/logging.c
+++ b/gtk/logging.c
@@ -19,11 +19,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphone.h"
-#ifndef _WIN32
+#ifdef _WIN32
+#include
+#define mkdir _mkdir
+#else
#include
#include
#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
extern gchar *linphone_logfile;
diff --git a/gtk/main.c b/gtk/main.c
index 1eba60ed3..3fe532cd1 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
@@ -36,8 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#ifdef _WIN32
-#define chdir _chdir
#include "direct.h"
+#define chdir _chdir
#ifndef F_OK
#define F_OK 00 /*visual studio does not define F_OK*/
#endif
@@ -186,7 +186,7 @@ static char _factory_config_file[1024];
static const char *linphone_gtk_get_factory_config_file(void){
char* path = NULL;
/*try accessing a local file first if exists*/
- if (access(FACTORY_CONFIG_FILE,F_OK)==0){
+ if (bctbx_file_exist(FACTORY_CONFIG_FILE)==0){
path = ms_strdup(FACTORY_CONFIG_FILE);
} else {
char *progdir;
@@ -216,7 +216,7 @@ static const char *linphone_gtk_get_factory_config_file(void){
}
if (path) {
//use factory file only if it exists
- if (access(path,F_OK)==0){
+ if (bctbx_file_exist(path)==0){
snprintf(_factory_config_file, sizeof(_factory_config_file), "%s", path);
ms_free(path);
return _factory_config_file;
@@ -332,9 +332,9 @@ static void linphone_gtk_configure_window(GtkWidget *w, const char *window_name)
static int get_ui_file(const char *name, char *path, int pathsize){
snprintf(path,pathsize,"%s/%s.ui",BUILD_TREE_XML_DIR,name);
- if (access(path,F_OK)!=0){
+ if (bctbx_file_exist(path)!=0){
snprintf(path,pathsize,"%s/%s.ui",INSTALLED_XML_DIR,name);
- if (access(path,F_OK)!=0){
+ if (bctbx_file_exist(path)!=0){
g_error("Could not locate neither %s/%s.ui nor %s/%s.ui",BUILD_TREE_XML_DIR,name,
INSTALLED_XML_DIR,name);
return -1;
@@ -645,7 +645,7 @@ static void completion_add_text(GtkEntry *entry, const char *text){
save_uri_history();
}
-void on_contact_provider_search_results( LinphoneContactSearch* req, MSList* friends, void* data )
+void on_contact_provider_search_results( LinphoneContactSearch* req, bctbx_list_t* friends, void* data )
{
GtkTreeIter iter;
GtkEntry* uribar = GTK_ENTRY(data);
@@ -793,10 +793,10 @@ void linphone_gtk_call_terminated(LinphoneCall *call, const char *error){
static void linphone_gtk_update_call_buttons(LinphoneCall *call){
LinphoneCore *lc=linphone_gtk_get_core();
GtkWidget *mw=linphone_gtk_get_main_window();
- const MSList *calls=linphone_core_get_calls(lc);
+ const bctbx_list_t *calls=linphone_core_get_calls(lc);
GtkWidget *button;
bool_t add_call=(calls!=NULL);
- int call_list_size=ms_list_size(calls);
+ int call_list_size=bctbx_list_size(calls);
GtkWidget *conf_frame;
button=linphone_gtk_get_widget(mw,"start_call");
@@ -1022,7 +1022,7 @@ void linphone_gtk_used_identity_changed(GtkWidget *w){
void on_proxy_refresh_button_clicked(GtkWidget *w){
LinphoneCore *lc=linphone_gtk_get_core();
- MSList const *item=linphone_core_get_proxy_config_list(lc);
+ bctbx_list_t const *item=linphone_core_get_proxy_config_list(lc);
while (item != NULL) {
LinphoneProxyConfig *lpc=(LinphoneProxyConfig*)item->data;
linphone_proxy_config_edit(lpc);
@@ -1605,7 +1605,7 @@ static void init_identity_combo(GtkComboBox *box){
}
void linphone_gtk_load_identities(void){
- const MSList *elem;
+ const bctbx_list_t *elem;
GtkComboBox *box=GTK_COMBO_BOX(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"identities"));
char *def_identity;
LinphoneProxyConfig *def=NULL;
@@ -1627,7 +1627,7 @@ void linphone_gtk_load_identities(void){
g_free(def_identity);
for(i=1,elem=linphone_core_get_proxy_config_list(linphone_gtk_get_core());
elem!=NULL;
- elem=ms_list_next(elem),i++){
+ elem=bctbx_list_next(elem),i++){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
gtk_list_store_append(store,&iter);
gtk_list_store_set(store,&iter,0,linphone_proxy_config_get_identity(cfg),1,
@@ -1679,7 +1679,7 @@ static void linphone_gtk_check_menu_items(void){
static gboolean linphone_gtk_can_manage_accounts(void){
LinphoneCore *lc=linphone_gtk_get_core();
- const MSList *elem;
+ const bctbx_list_t *elem;
for(elem=linphone_core_get_sip_setups(lc);elem!=NULL;elem=elem->next){
SipSetup *ss=(SipSetup*)elem->data;
if (sip_setup_get_capabilities(ss) & SIP_SETUP_CAP_ACCOUNT_MANAGER){
diff --git a/gtk/propertybox.c b/gtk/propertybox.c
index e3271cf2a..05512a4bb 100644
--- a/gtk/propertybox.c
+++ b/gtk/propertybox.c
@@ -228,10 +228,10 @@ void linphone_gtk_ldap_save(GtkWidget *button)
linphone_dictionary_set_int(dict, "deref_aliases", gtk_toggle_button_get_active(toggle));
spin = GTK_SPIN_BUTTON(linphone_gtk_get_widget(ldap_widget,"ldap_max_results"));
- linphone_dictionary_set_int(dict, "max_results", gtk_spin_button_get_value(spin) );
+ linphone_dictionary_set_int(dict, "max_results", (int)gtk_spin_button_get_value(spin) );
spin = GTK_SPIN_BUTTON(linphone_gtk_get_widget(ldap_widget,"ldap_timeout"));
- linphone_dictionary_set_int(dict, "timeout", gtk_spin_button_get_value(spin) );
+ linphone_dictionary_set_int(dict, "timeout", (int)gtk_spin_button_get_value(spin) );
ms_message("Create LDAP from config");
// create new LDAP according to the validated config
@@ -324,8 +324,8 @@ void linphone_gtk_min_audio_port_changed(GtkWidget *w){
linphone_core_set_audio_port(linphone_gtk_get_core(), (gint) gtk_spin_button_get_value(min_button));
gtk_spin_button_set_value(max_button, gtk_spin_button_get_value(min_button));
} else {
- gint min_port = gtk_spin_button_get_value(min_button);
- gint max_port = gtk_spin_button_get_value(max_button);
+ gint min_port = (gint)gtk_spin_button_get_value(min_button);
+ gint max_port = (gint)gtk_spin_button_get_value(max_button);
if (min_port > max_port) {
gtk_spin_button_set_value(max_button, min_port);
max_port = min_port;
@@ -339,8 +339,8 @@ void linphone_gtk_max_audio_port_changed(GtkWidget *w){
GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters");
GtkSpinButton *min_button = GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port"));
GtkSpinButton *max_button = GTK_SPIN_BUTTON(w);
- gint min_port = gtk_spin_button_get_value(min_button);
- gint max_port = gtk_spin_button_get_value(max_button);
+ gint min_port = (gint)gtk_spin_button_get_value(min_button);
+ gint max_port = (gint)gtk_spin_button_get_value(max_button);
if (max_port < min_port) {
gtk_spin_button_set_value(min_button, max_port);
min_port = max_port;
@@ -359,8 +359,8 @@ void linphone_gtk_min_video_port_changed(GtkWidget *w){
linphone_core_set_video_port(linphone_gtk_get_core(), (gint) gtk_spin_button_get_value(min_button));
gtk_spin_button_set_value(max_button, gtk_spin_button_get_value(min_button));
} else {
- gint min_port = gtk_spin_button_get_value(min_button);
- gint max_port = gtk_spin_button_get_value(max_button);
+ gint min_port = (gint)gtk_spin_button_get_value(min_button);
+ gint max_port = (gint)gtk_spin_button_get_value(max_button);
if (min_port > max_port) {
gtk_spin_button_set_value(max_button, min_port);
max_port = min_port;
@@ -374,8 +374,8 @@ void linphone_gtk_max_video_port_changed(GtkWidget *w){
GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters");
GtkSpinButton *min_button = GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_min_rtp_port"));
GtkSpinButton *max_button = GTK_SPIN_BUTTON(w);
- gint min_port = gtk_spin_button_get_value(min_button);
- gint max_port = gtk_spin_button_get_value(max_button);
+ gint min_port = (gint)gtk_spin_button_get_value(min_button);
+ gint max_port = (gint)gtk_spin_button_get_value(max_button);
if (max_port < min_port) {
gtk_spin_button_set_value(min_button, max_port);
min_port = max_port;
@@ -420,7 +420,7 @@ void linphone_gtk_use_upnp_toggled(GtkWidget *w){
void linphone_gtk_mtu_changed(GtkWidget *w){
if (GTK_WIDGET_SENSITIVE(w))
- linphone_core_set_mtu(linphone_gtk_get_core(),gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)));
+ linphone_core_set_mtu(linphone_gtk_get_core(),(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)));
}
void linphone_gtk_use_sip_info_dtmf_toggled(GtkWidget *w){
@@ -648,9 +648,9 @@ const char *get_codec_color(LinphoneCore *lc, PayloadType *pt){
return color;
}
-static void linphone_gtk_show_codecs(GtkTreeView *listview, const MSList *codeclist)
+static void linphone_gtk_show_codecs(GtkTreeView *listview, const bctbx_list_t *codeclist)
{
- const MSList *elem;
+ const bctbx_list_t *elem;
GtkTreeIter iter;
GtkListStore *store=GTK_LIST_STORE(gtk_tree_view_get_model(listview));
// GtkTreeSelection *selection;
@@ -673,7 +673,7 @@ static void linphone_gtk_show_codecs(GtkTreeView *listview, const MSList *codecl
}
/* get an iterator */
gtk_list_store_append(store,&iter);
- bitrate=linphone_core_get_payload_type_bitrate(linphone_gtk_get_core(),pt);
+ bitrate=(gfloat)linphone_core_get_payload_type_bitrate(linphone_gtk_get_core(),pt);
rate=payload_type_get_rate(pt);
if (pt->recv_fmtp!=NULL) params=pt->recv_fmtp;
gtk_list_store_set(store,&iter, CODEC_NAME,payload_type_get_mime(pt),
@@ -709,7 +709,7 @@ static void linphone_gtk_check_codec_bandwidth(GtkTreeView *v){
gfloat bitrate;
gtk_tree_model_get(model,&iter,CODEC_PRIVDATA,&pt,-1);
- bitrate=linphone_core_get_payload_type_bitrate(linphone_gtk_get_core(),pt);
+ bitrate=(gfloat)linphone_core_get_payload_type_bitrate(linphone_gtk_get_core(),pt);
gtk_list_store_set(GTK_LIST_STORE(model),&iter,CODEC_COLOR, (gpointer)get_codec_color(linphone_gtk_get_core(),pt),
CODEC_BITRATE, bitrate,-1);
}while(gtk_tree_model_iter_next(model,&iter));
@@ -733,7 +733,7 @@ static void linphone_gtk_select_codec(GtkTreeView *v, PayloadType *ref){
}
static void linphone_gtk_draw_codec_list(GtkTreeView *v, int type){ /* 0=audio, 1=video*/
- const MSList *list;
+ const bctbx_list_t *list;
if (type==0) list=linphone_core_get_audio_codecs(linphone_gtk_get_core());
else list=linphone_core_get_video_codecs(linphone_gtk_get_core());
linphone_gtk_show_codecs(v,list);
@@ -759,7 +759,7 @@ void linphone_gtk_upload_bw_changed(GtkWidget *w){
void linphone_gtk_video_framerate_changed(GtkWidget *w) {
linphone_core_set_preferred_framerate(linphone_gtk_get_core(),
- (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)));
+ (float)(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)));
}
void linphone_gtk_adaptive_rate_control_toggled(GtkToggleButton *button){
@@ -784,8 +784,8 @@ static void linphone_gtk_codec_move(GtkWidget *button, int dir, int type){ /* 0=
else v=GTK_TREE_VIEW(linphone_gtk_get_widget(gtk_widget_get_toplevel(button),"video_codec_list"));
sel=gtk_tree_view_get_selection(v);
if (gtk_tree_selection_count_selected_rows(sel) == 1){
- MSList *sel_elem,*before;
- MSList *codec_list;
+ bctbx_list_t *sel_elem,*before;
+ bctbx_list_t *codec_list;
GList *selected_rows = gtk_tree_selection_get_selected_rows(sel, &mod);
gtk_tree_model_get_iter(mod, &iter, (GtkTreePath *)g_list_nth_data(selected_rows, 0));
@@ -794,20 +794,20 @@ static void linphone_gtk_codec_move(GtkWidget *button, int dir, int type){ /* 0=
g_list_free(selected_rows);
if (pt->type==PAYLOAD_VIDEO)
- codec_list=ms_list_copy(linphone_core_get_video_codecs(lc));
- else codec_list=ms_list_copy(linphone_core_get_audio_codecs(lc));
- sel_elem=ms_list_find(codec_list,pt);
+ codec_list=bctbx_list_copy(linphone_core_get_video_codecs(lc));
+ else codec_list=bctbx_list_copy(linphone_core_get_audio_codecs(lc));
+ sel_elem=bctbx_list_find(codec_list,pt);
if (dir>0) {
if (sel_elem->prev) before=sel_elem->prev;
else before=sel_elem;
- codec_list=ms_list_insert(codec_list,before,pt);
+ codec_list=bctbx_list_insert(codec_list,before,pt);
}
else{
if (sel_elem->next) before=sel_elem->next->next;
else before=sel_elem;
- codec_list=ms_list_insert(codec_list,before,pt);
+ codec_list=bctbx_list_insert(codec_list,before,pt);
}
- codec_list=ms_list_remove_link(codec_list,sel_elem);
+ codec_list=bctbx_list_remove_link(codec_list,sel_elem);
if (pt->type==PAYLOAD_VIDEO)
linphone_core_set_video_codecs(lc,codec_list);
else linphone_core_set_audio_codecs(lc,codec_list);
@@ -889,7 +889,7 @@ void linphone_gtk_show_sip_accounts(GtkWidget *w){
const LinphoneProxyConfig *default_pc = linphone_core_get_default_proxy_config(linphone_gtk_get_core());
GtkTreePath *default_pc_path = NULL;
- const MSList *elem;
+ const bctbx_list_t *elem;
if (!model){
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
@@ -912,7 +912,7 @@ void linphone_gtk_show_sip_accounts(GtkWidget *w){
store=GTK_LIST_STORE(model);
}
gtk_list_store_clear(store);
- for(elem=linphone_core_get_proxy_config_list(linphone_gtk_get_core());elem!=NULL;elem=ms_list_next(elem)){
+ for(elem=linphone_core_get_proxy_config_list(linphone_gtk_get_core());elem!=NULL;elem=bctbx_list_next(elem)){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
GtkTreeIter iter;
gtk_list_store_append(store,&iter);
@@ -1429,8 +1429,8 @@ void linphone_gtk_fill_video_renderers(GtkWidget *pb){
LinphoneCore *lc=linphone_gtk_get_core();
MSFactory *factory = linphone_core_get_ms_factory(lc);
GtkWidget *combo=linphone_gtk_get_widget(pb,"renderers");
- MSList *l=ms_factory_lookup_filter_by_interface(factory, MSFilterVideoDisplayInterface);
- MSList *elem;
+ bctbx_list_t *l=ms_factory_lookup_filter_by_interface(factory, MSFilterVideoDisplayInterface);
+ bctbx_list_t *elem;
int i;
int active=-1;
const char *current_renderer=linphone_core_get_video_display_filter(lc);
@@ -1460,7 +1460,7 @@ void linphone_gtk_fill_video_renderers(GtkWidget *pb){
i++;
}
- ms_list_free(l);
+ bctbx_list_free(l);
if (active!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(combo),active);
#endif
}
@@ -1748,8 +1748,8 @@ void linphone_gtk_fixed_audio_port_toggle(void) {
GtkWidget *mw = linphone_gtk_get_main_window();
GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters");
gboolean fixed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_audio_port")));
- gint min_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port")));
- gint max_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_max_rtp_port")));
+ gint min_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port")));
+ gint max_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_max_rtp_port")));
gtk_widget_set_sensitive(GTK_WIDGET(linphone_gtk_get_widget(pb, "audio_max_rtp_port")), !fixed);
if (fixed) {
linphone_core_set_audio_port(linphone_gtk_get_core(), min_port);
@@ -1763,8 +1763,8 @@ void linphone_gtk_fixed_video_port_toggle(void) {
GtkWidget *mw = linphone_gtk_get_main_window();
GtkWidget *pb = (GtkWidget *) g_object_get_data(G_OBJECT(mw), "parameters");
gboolean fixed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb, "fixed_video_port")));
- gint min_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_min_rtp_port")));
- gint max_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_max_rtp_port")));
+ gint min_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_min_rtp_port")));
+ gint max_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "video_max_rtp_port")));
gtk_widget_set_sensitive(GTK_WIDGET(linphone_gtk_get_widget(pb, "video_max_rtp_port")), !fixed);
if (fixed) {
linphone_core_set_video_port(linphone_gtk_get_core(), min_port);
@@ -1783,7 +1783,7 @@ void linphone_gtk_edit_tunnel(GtkButton *button){
GtkWidget *w=linphone_gtk_create_window("tunnel_config", gtk_widget_get_toplevel(GTK_WIDGET(button)));
LinphoneCore *lc=linphone_gtk_get_core();
LinphoneTunnel *tunnel=linphone_core_get_tunnel(lc);
- const MSList *configs;
+ const bctbx_list_t *configs;
const char *host = NULL;
int port=0;
@@ -1916,7 +1916,7 @@ gboolean linphone_gtk_auto_answer_enabled(void) {
}
void linphone_gtk_auto_answer_delay_changed(GtkSpinButton *spinbutton, gpointer user_data) {
- int delay = gtk_spin_button_get_value(spinbutton);
+ int delay = (int)gtk_spin_button_get_value(spinbutton);
linphone_gtk_set_ui_config_int("auto_answer_delay", delay);
}
diff --git a/gtk/status_icon.h b/gtk/status_icon.h
index 2e4455659..edaa8794a 100644
--- a/gtk/status_icon.h
+++ b/gtk/status_icon.h
@@ -25,7 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifndef _MSC_VER
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#endif
#include
#include
diff --git a/include/sal/sal.h b/include/sal/sal.h
index 11b86d93b..b885cf6a1 100644
--- a/include/sal/sal.h
+++ b/include/sal/sal.h
@@ -811,6 +811,7 @@ typedef void (*SalResolverCallback)(void *data, const char *name, struct addrinf
typedef struct SalResolverContext SalResolverContext;
LINPHONE_PUBLIC SalResolverContext * sal_resolve_a(Sal* sal, const char *name, int port, int family, SalResolverCallback cb, void *data);
+LINPHONE_PUBLIC SalResolverContext * sal_resolve(Sal *sal, const char *service, const char *transport, const char *name, int port, int family, SalResolverCallback cb, void *data);
//void sal_resolve_cancel(Sal *sal, SalResolverContext *ctx);
SalCustomHeader *sal_custom_header_append(SalCustomHeader *ch, const char *name, const char *value);
diff --git a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java
index 1dd6a937e..078a61c1c 100644
--- a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java
+++ b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java
@@ -53,6 +53,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
List cpuabis=Version.getCpuAbis();
boolean libLoaded=false;
Throwable firstException=null;
+ System.loadLibrary("gnustl_shared");
for (String abi : cpuabis){
//android.util.Log.i("LinphoneCoreFactoryImpl","Trying to load liblinphone for " + abi);
loadOptionalLibrary("ffmpeg-linphone-" + abi);
diff --git a/mediastreamer2 b/mediastreamer2
index 05c196459..417a1bb88 160000
--- a/mediastreamer2
+++ b/mediastreamer2
@@ -1 +1 @@
-Subproject commit 05c1964597789d17219ed01d6749fd95bf81d54e
+Subproject commit 417a1bb884dfb54758c82a5f642977ee99b1ba7b
diff --git a/oRTP b/oRTP
index 171c441fa..6a8d5ab7c 160000
--- a/oRTP
+++ b/oRTP
@@ -1 +1 @@
-Subproject commit 171c441fa7aa4cdc616461a88cad74fd842c6145
+Subproject commit 6a8d5ab7cb5de50c76b5b06478b1594f28b6119f
diff --git a/scripts/mk-ca-bundle.pl b/scripts/mk-ca-bundle.pl
index 283ebd13c..b397b2541 100755
--- a/scripts/mk-ca-bundle.pl
+++ b/scripts/mk-ca-bundle.pl
@@ -222,6 +222,11 @@ while () {
}
close(TXT) or die "Couldn't close $txt: $!\n";
close(CRT) or die "Couldn't close $crt.~: $!\n";
+
+# this may happen if website is in maintenance - 200 OK is returned but it returns
+# a HTML maintenance page instead of expected file
+die "No certs processed (invalid input file?)!" if ($certnum == 0 and $skipnum == 0);
+
unless( $stdout ) {
if ($opt_b && -e $crt) {
my $bk = 1;
diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt
index 39643bfba..401d1185e 100644
--- a/tester/CMakeLists.txt
+++ b/tester/CMakeLists.txt
@@ -20,37 +20,51 @@
#
############################################################################
-set(SOURCE_FILES
- accountmanager.c
- audio_bypass_tester.c
- call_tester.c
- complex_sip_call_tester.c
- dtmf_tester.c
- eventapi_tester.c
- flexisip_tester.c
- liblinphone_tester.c
- log_collection_tester.c
- message_tester.c
- multi_call_tester.c
- multicast_call_tester.c
- offeranswer_tester.c
- player_tester.c
- presence_tester.c
- presence_server_tester.c
- proxy_config_tester.c
- quality_reporting_tester.c
- register_tester.c
- remote_provisioning_tester.c
- setup_tester.c
- stun_tester.c
- tester.c
- tunnel_tester.c
- upnp_tester.c
- video_tester.c
- vcard_tester.c
+set(OTHER_LIBS_FOR_TESTER ${BCTOOLBOX_LIBRARIES} ${BCTOOLBOX_TESTER_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES} ${XML2_LIBRARIES})
+if(INTL_FOUND)
+ list(APPEND OTHER_LIBS_FOR_TESTER ${INTL_LIBRARIES})
+endif()
+if(SQLITE3_FOUND)
+ list(APPEND OTHER_LIBS_FOR_TESTER ${SQLITE3_LIBRARIES})
+endif()
+if(ZLIB_FOUND)
+ list(APPEND OTHER_LIBS_FOR_TESTER ${ZLIB_LIBRARIES})
+endif()
+
+set(RESOURCES_FILES
+ certificates
+ flexisip
+ images
+ local_tester_hosts
+ messages.db
+ rcfiles
+ sipp
+ sounds
+ tester_hosts
+ vcards
)
-apply_compile_flags(SOURCE_FILES "CPP" "C")
+file(GLOB SOURCE_FILES_C "*_tester.c")
+list(APPEND SOURCE_FILES_C accountmanager.c tester.c)
+
+set(SOURCE_FILES_OBJC )
+if(APPLE)
+ if (IOS)
+ list(APPEND SOURCE_FILES_OBJC liblinphone_tester_ios.m)
+ endif()
+endif()
+
+apply_compile_flags(SOURCE_FILES_C "CPP" "C")
+apply_compile_flags(SOURCE_FILES_OBJC "CPP" "OBJC")
+
+if(MSVC)
+ get_source_file_property(MESSAGE_TESTER_C_COMPILE_FLAGS message_tester.c COMPILE_FLAGS)
+ set(MESSAGE_TESTER_C_COMPILE_FLAGS "${MESSAGE_TESTER_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings
+ set_source_files_properties(message_tester.c PROPERTY COMPILE_FLAGS "${MESSAGE_TESTER_C_COMPILE_FLAGS}")
+ get_source_file_property(VCARD_TESTER_C_COMPILE_FLAGS vcard_tester.c COMPILE_FLAGS)
+ set(VCARD_TESTER_C_COMPILE_FLAGS "${VCARD_TESTER_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings
+ set_source_files_properties(vcard_tester.c PROPERTY COMPILE_FLAGS "${VCARD_TESTER_C_COMPILE_FLAGS}")
+endif()
if(NOT IOS OR NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
# Executable must be available on root path, not host one
@@ -61,16 +75,17 @@ if(NOT IOS OR NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
endif()
endif()
+# on mobile platforms, we compile the tester as a library so that we can link with it directly from native applications
if(ANDROID OR IOS)
if(ANDROID)
- add_library(linphonetester SHARED ${SOURCE_FILES})
+ add_library(linphonetester SHARED ${SOURCE_FILES_C})
set_target_properties(linphonetester PROPERTIES OUTPUT_NAME "linphonetester-${CMAKE_SYSTEM_PROCESSOR}")
endif()
if(IOS)
- add_library(linphonetester STATIC ${SOURCE_FILES})
+ add_library(linphonetester STATIC ${SOURCE_FILES_C})
endif()
target_include_directories(linphonetester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
- target_link_libraries(linphonetester linphone ${BCTOOLBOX_TESTER_LIBRARIES})
+ target_link_libraries(linphonetester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
install(TARGETS linphonetester
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -82,9 +97,9 @@ if(ANDROID OR IOS)
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
- add_library(linphone_tester_static STATIC ${SOURCE_FILES})
+ add_library(linphone_tester_static STATIC ${SOURCE_FILES_C})
target_include_directories(linphone_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
- target_link_libraries(linphone_tester_static linphone ${BCTOOLBOX_TESTER_LIBRARIES})
+ target_link_libraries(linphone_tester_static ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
set(RUNTIME_COMPONENT_SOURCES
liblinphone_tester_windows.cpp
@@ -110,15 +125,24 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
-else()
- add_executable(liblinphone_tester ${SOURCE_FILES})
+endif()
+
+# on iOS though, we also build the exectuable so that one can compile it from Xcode and run it directly
+if (NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ if (IOS)
+ set_source_files_properties(${RESOURCES_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+ add_executable(liblinphone_tester MACOSX_BUNDLE ${RESOURCES_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
+ set_target_properties(liblinphone_tester PROPERTIES LINK_FLAGS "${MEDIASTREAMER2_LDFLAGS}")
+ else()
+ add_executable(liblinphone_tester ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
+ endif()
set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(liblinphone_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
- target_link_libraries(liblinphone_tester linphone ${BCTOOLBOX_TESTER_LIBRARIES})
+ target_link_libraries(liblinphone_tester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
if (GTK2_FOUND)
target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
- target_link_libraries(liblinphone_tester linphone ${GTK2_LIBRARIES})
+ target_link_libraries(liblinphone_tester ${GTK2_LIBRARIES})
if(GTKMACINTEGRATION_FOUND)
target_include_directories(liblinphone_tester PUBLIC ${GTKMACINTEGRATION_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester ${GTKMACINTEGRATION_LIBRARIES})
diff --git a/tester/Makefile.am b/tester/Makefile.am
index 59b61fd66..75bc3ce2c 100644
--- a/tester/Makefile.am
+++ b/tester/Makefile.am
@@ -116,30 +116,31 @@ liblinphonetester_la_HEADERS = audio_bypass_wav_header.h
liblinphonetester_la_SOURCES = \
accountmanager.c \
audio_bypass_tester.c \
- call_tester.c \
- complex_sip_call_tester.c \
+ call_multi_tester.c \
+ call_multicast_tester.c \
+ call_single_tester.c \
+ call_video_tester.c \
+ complex_sip_case_tester.c \
dtmf_tester.c \
eventapi_tester.c \
flexisip_tester.c \
log_collection_tester.c \
message_tester.c \
- multi_call_tester.c \
- multicast_call_tester.c \
offeranswer_tester.c \
player_tester.c \
- presence_tester.c \
presence_server_tester.c \
+ presence_tester.c \
proxy_config_tester.c \
quality_reporting_tester.c \
register_tester.c \
remote_provisioning_tester.c \
setup_tester.c \
stun_tester.c \
- tunnel_tester.c \
tester.c \
+ tunnel_tester.c \
upnp_tester.c \
- video_tester.c \
- vcard_tester.c
+ vcard_tester.c \
+ video_tester.c
liblinphonetester_ladir = $(includedir)/linphone
diff --git a/tester/accountmanager.c b/tester/accountmanager.c
index 52973682c..06ca07ee2 100644
--- a/tester/accountmanager.c
+++ b/tester/accountmanager.c
@@ -55,7 +55,7 @@ void account_destroy(Account *obj){
struct _AccountManager{
char *unique_id;
- MSList *accounts;
+ bctbx_list_t *accounts;
};
typedef struct _AccountManager AccountManager;
@@ -73,7 +73,7 @@ AccountManager *account_manager_get(void){
void account_manager_destroy(void){
if (the_am){
ms_free(the_am->unique_id);
- ms_list_free_with_data(the_am->accounts,(void(*)(void*))account_destroy);
+ bctbx_list_free_with_data(the_am->accounts,(void(*)(void*))account_destroy);
ms_free(the_am);
}
the_am=NULL;
@@ -81,7 +81,7 @@ void account_manager_destroy(void){
}
Account *account_manager_get_account(AccountManager *m, const LinphoneAddress *identity){
- MSList *it;
+ bctbx_list_t *it;
for(it=m->accounts;it!=NULL;it=it->next){
Account *a=(Account*)it->data;
@@ -160,8 +160,9 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
linphone_proxy_config_set_expires(cfg,3*3600); //accounts are valid 3 hours
linphone_core_add_proxy_config(lc,cfg);
- /*wait 15 seconds, since the DNS SRV resolution make time a while*/
- if (wait_for_until(lc,NULL,&account->created,1,15000)==FALSE){
+ /*wait 25 seconds, since the DNS SRV resolution may take a while - and
+ especially if router does NOT support DNS SRV and we have to wait its timeout*/
+ if (wait_for_until(lc,NULL,&account->created,1,25000)==FALSE){
ms_fatal("Account for %s could not be created on server.", linphone_proxy_config_get_identity(refcfg));
}
linphone_proxy_config_edit(cfg);
@@ -207,7 +208,7 @@ LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyC
account=account_new(id_addr,m->unique_id);
ms_message("No account for %s exists, going to create one.",identity);
create_account=TRUE;
- m->accounts=ms_list_append(m->accounts,account);
+ m->accounts=bctbx_list_append(m->accounts,account);
}
/*modify the username of the identity of the proxy config*/
linphone_address_set_username(id_addr, linphone_address_get_username(account->modified_identity));
@@ -234,7 +235,7 @@ LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyC
}
void linphone_core_manager_check_accounts(LinphoneCoreManager *m){
- const MSList *it;
+ const bctbx_list_t *it;
AccountManager *am=account_manager_get();
for(it=linphone_core_get_proxy_config_list(m->lc);it!=NULL;it=it->next){
diff --git a/tester/multi_call_tester.c b/tester/call_multi_tester.c
similarity index 94%
rename from tester/multi_call_tester.c
rename to tester/call_multi_tester.c
index e1f2ebef3..fbece53c6 100644
--- a/tester/multi_call_tester.c
+++ b/tester/call_multi_tester.c
@@ -35,8 +35,8 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCoreManager* laure = linphone_core_manager_new( "laure_rc_udp");
- MSList *iterator;
- MSList* lcs;
+ bctbx_list_t *iterator;
+ bctbx_list_t* lcs;
LinphoneCall* pauline_called_by_marie;
LinphoneCall* pauline_called_by_laure=NULL;
LinphoneCallParams *laure_params=linphone_core_create_call_params(laure->lc, NULL);
@@ -45,9 +45,9 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
if (enable_caller_privacy)
linphone_call_params_set_privacy(marie_params,LinphonePrivacyId);
- lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,laure->lc);
+ lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
BC_ASSERT_TRUE(call_with_caller_params(marie,pauline,marie_params));
linphone_call_params_destroy(marie_params);
@@ -72,7 +72,7 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
,&laure->stat.number_of_LinphoneCallOutgoingRinging
,1));
- for (iterator=(MSList *)linphone_core_get_calls(pauline->lc);iterator!=NULL;iterator=iterator->next) {
+ for (iterator=(bctbx_list_t *)linphone_core_get_calls(pauline->lc);iterator!=NULL;iterator=iterator->next) {
LinphoneCall *call=(LinphoneCall *)iterator->data;
if (call != pauline_called_by_marie) {
/*fine, this is the call waiting*/
@@ -104,7 +104,7 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void call_waiting_indication(void) {
call_waiting_indication_with_param(FALSE);
@@ -177,13 +177,13 @@ static void incoming_call_accepted_when_outgoing_call_in_state(LinphoneCallState
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCoreManager* laure = linphone_core_manager_new( "laure_rc_udp");
- MSList* lcs;
+ bctbx_list_t* lcs;
LinphoneCallParams *laure_params=linphone_core_create_call_params(laure->lc, NULL);
LinphoneCallParams *marie_params=linphone_core_create_call_params(marie->lc, NULL);
- lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,laure->lc);
+ lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
if (state==LinphoneCallOutgoingRinging || state==LinphoneCallOutgoingEarlyMedia) {
@@ -229,7 +229,7 @@ static void incoming_call_accepted_when_outgoing_call_in_state(LinphoneCallState
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void incoming_call_accepted_when_outgoing_call_in_progress(void) {
incoming_call_accepted_when_outgoing_call_in_state(LinphoneCallOutgoingProgress);
@@ -250,13 +250,13 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
LinphoneCall* pauline_called_by_marie;
LinphoneCall* marie_call_laure;
LinphoneConference *conference;
- const MSList* calls;
+ const bctbx_list_t* calls;
bool_t is_remote_conf;
bool_t focus_is_up = (focus && ((LinphoneConferenceServer *)focus)->reg_state == LinphoneRegistrationOk);
- MSList* lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,laure->lc);
- if(focus) lcs=ms_list_append(lcs,focus->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
+ if(focus) lcs=bctbx_list_append(lcs,focus->lc);
is_remote_conf = (strcmp(lp_config_get_string(marie->lc->config, "misc", "conference_type", "local"), "remote") == 0);
if(is_remote_conf) BC_ASSERT_PTR_NOT_NULL(focus);
@@ -341,9 +341,9 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
BC_ASSERT_PTR_NOT_NULL(conference = linphone_core_get_conference(marie->lc));
if(conference) {
- MSList *participants = linphone_conference_get_participants(conference);
- BC_ASSERT_EQUAL(ms_list_size(participants), 2, int, "%d");
- ms_list_free_with_data(participants, (void(*)(void *))linphone_address_destroy);
+ bctbx_list_t *participants = linphone_conference_get_participants(conference);
+ BC_ASSERT_EQUAL(bctbx_list_size(participants), 2, int, "%d");
+ bctbx_list_free_with_data(participants, (void(*)(void *))linphone_address_destroy);
}
linphone_core_terminate_conference(marie->lc);
@@ -358,7 +358,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
if(is_remote_conf) BC_ASSERT_TRUE(wait_for_list(lcs,&focus->stat.number_of_LinphoneCallReleased,3,10000));
end:
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void simple_conference(void) {
@@ -415,9 +415,9 @@ static void simple_call_transfer(void) {
LinphoneCall *marie_calling_laure;
char* laure_identity=linphone_address_as_string(laure->identity);
- MSList* lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,laure->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
BC_ASSERT_TRUE(call(marie,pauline));
@@ -467,7 +467,7 @@ end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void unattended_call_transfer(void) {
@@ -477,9 +477,9 @@ static void unattended_call_transfer(void) {
LinphoneCall* pauline_called_by_marie;
char* laure_identity=linphone_address_as_string(laure->identity);
- MSList* lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,laure->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
BC_ASSERT_TRUE(call(marie,pauline));
@@ -514,7 +514,7 @@ static void unattended_call_transfer(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void unattended_call_transfer_with_error(void) {
@@ -522,9 +522,9 @@ static void unattended_call_transfer_with_error(void) {
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCall* pauline_called_by_marie;
bool_t call_ok=TRUE;
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
BC_ASSERT_TRUE((call_ok=call(marie,pauline)));
if (call_ok){
@@ -555,7 +555,7 @@ static void unattended_call_transfer_with_error(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
@@ -569,10 +569,10 @@ static void call_transfer_existing_call_outgoing_call(void) {
LinphoneCall* laure_called_by_marie;
LinphoneCall* lcall;
bool_t call_ok=TRUE;
- const MSList* calls;
- MSList* lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,laure->lc);
+ const bctbx_list_t* calls;
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
/*marie call pauline*/
BC_ASSERT_TRUE((call_ok=call(marie,pauline)));
@@ -639,7 +639,7 @@ end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(pauline);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void eject_from_3_participants_conference(LinphoneCoreManager *marie, LinphoneCoreManager *pauline, LinphoneCoreManager *laure, LinphoneCoreManager *focus) {
@@ -651,10 +651,10 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin
LinphoneCall* pauline_called_by_marie;
LinphoneCall* marie_call_laure;
bool_t is_remote_conf;
- MSList* lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,laure->lc);
- if(focus) lcs=ms_list_append(lcs,focus->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
+ if(focus) lcs=bctbx_list_append(lcs,focus->lc);
is_remote_conf = (strcmp(lp_config_get_string(marie->lc->config, "misc", "conference_type", "local"), "remote") == 0);
if(is_remote_conf) BC_ASSERT_PTR_NOT_NULL(focus);
@@ -716,7 +716,7 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,3,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,5,10000));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(marie->lc));
- BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_calls(marie->lc)), 2, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_calls(marie->lc)), 2, int, "%d");
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(laure->lc));
} else {
@@ -736,7 +736,7 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,initial_marie_stat.number_of_LinphoneCallEnd+3,3000));
}
end:
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void eject_from_3_participants_local_conference(void) {
@@ -765,10 +765,10 @@ static void eject_from_4_participants_conference(void) {
LinphoneCall* marie_call_laure;
LinphoneCall* marie_call_michelle;
LinphoneCall* michelle_called_by_marie;
- MSList* lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,laure->lc);
- lcs=ms_list_append(lcs,michelle->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
+ lcs=bctbx_list_append(lcs,michelle->lc);
BC_ASSERT_TRUE(call(marie,pauline));
marie_call_pauline=linphone_core_get_current_call(marie->lc);
@@ -811,7 +811,7 @@ static void eject_from_4_participants_conference(void) {
BC_ASSERT_PTR_NULL(linphone_core_get_current_call(marie->lc));
BC_ASSERT_TRUE(linphone_core_is_in_conference(marie->lc));
BC_ASSERT_EQUAL(linphone_core_get_conference_size(marie->lc),3, int, "%d");
- BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_calls(marie->lc)), 3, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_calls(marie->lc)), 3, int, "%d");
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(laure->lc));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(michelle->lc));
@@ -837,7 +837,7 @@ end:
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(michelle);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
@@ -852,7 +852,7 @@ void simple_remote_conference(void) {
const char *laure_proxy_uri = linphone_proxy_config_get_server_addr(laure_proxy_config);
const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config);
int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
lp_config_set_string(marie_config, "misc", "conference_type", "remote");
lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri);
@@ -860,9 +860,9 @@ void simple_remote_conference(void) {
linphone_proxy_config_edit(laure_proxy_config);
linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri);
linphone_proxy_config_done(laure_proxy_config);
- lcs = ms_list_append(lcs, laure->lc);
+ lcs = bctbx_list_append(lcs, laure->lc);
BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneRegistrationOk, laure_n_register+1, 5000));
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
simple_conference_base(marie, pauline, laure, (LinphoneCoreManager *)focus);
@@ -883,7 +883,7 @@ void simple_remote_conference_shut_down_focus(void) {
const char *laure_proxy_uri = linphone_proxy_config_get_server_addr(laure_proxy_config);
const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config);
int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
lp_config_set_string(marie_config, "misc", "conference_type", "remote");
lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri);
@@ -891,9 +891,9 @@ void simple_remote_conference_shut_down_focus(void) {
linphone_proxy_config_edit(laure_proxy_config);
linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri);
linphone_proxy_config_done(laure_proxy_config);
- lcs = ms_list_append(lcs, laure->lc);
+ lcs = bctbx_list_append(lcs, laure->lc);
BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneRegistrationOk, laure_n_register+1, 5000));
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
simple_conference_base(marie, pauline, laure, (LinphoneCoreManager *)focus);
@@ -914,7 +914,7 @@ void eject_from_3_participants_remote_conference(void) {
const char *laure_proxy_uri = linphone_proxy_config_get_server_addr(laure_proxy_config);
const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config);
int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
lp_config_set_string(marie_config, "misc", "conference_type", "remote");
lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri);
@@ -922,9 +922,9 @@ void eject_from_3_participants_remote_conference(void) {
linphone_proxy_config_edit(laure_proxy_config);
linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri);
linphone_proxy_config_done(laure_proxy_config);
- lcs = ms_list_append(lcs, laure->lc);
+ lcs = bctbx_list_append(lcs, laure->lc);
BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneRegistrationOk, laure_n_register+1, 5000));
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
eject_from_3_participants_conference(marie, pauline, laure, (LinphoneCoreManager *)focus);
diff --git a/tester/multicast_call_tester.c b/tester/call_multicast_tester.c
similarity index 95%
rename from tester/multicast_call_tester.c
rename to tester/call_multicast_tester.c
index bd70bd8d5..566256ab9 100644
--- a/tester/multicast_call_tester.c
+++ b/tester/call_multicast_tester.c
@@ -78,7 +78,7 @@ static void call_multicast_video(void) {
#endif
static void early_media_with_multicast_base(bool_t video) {
LinphoneCoreManager *marie, *pauline, *pauline2;
- MSList* lcs = NULL;
+ bctbx_list_t* lcs = NULL;
int dummy=0;
LinphoneVideoPolicy marie_policy, pauline_policy;
LpConfig *marie_lp;
@@ -98,11 +98,19 @@ static void early_media_with_multicast_base(bool_t video) {
linphone_core_enable_video_display(pauline2->lc, TRUE);
linphone_core_enable_video_capture(marie->lc, TRUE);
linphone_core_enable_video_display(marie->lc, FALSE);
-
+
+ // important: VP8 has really poor performances with the mire camera, at least
+ // on iOS - so when ever h264 is available, let's use it instead
+ if (linphone_core_find_payload_type(pauline->lc,"h264", -1, -1)!=NULL) {
+ disable_all_video_codecs_except_one(pauline->lc,"h264");
+ disable_all_video_codecs_except_one(pauline2->lc,"h264");
+ disable_all_video_codecs_except_one(marie->lc,"h264");
+ }
+
linphone_core_set_video_device(pauline->lc, liblinphone_tester_mire_id);
linphone_core_set_video_device(pauline2->lc, liblinphone_tester_mire_id);
linphone_core_set_video_device(marie->lc, liblinphone_tester_mire_id);
-
+
linphone_core_set_avpf_mode(pauline->lc, LinphoneAVPFEnabled);
linphone_core_set_avpf_mode(pauline2->lc, LinphoneAVPFEnabled);
linphone_core_set_avpf_mode(marie->lc, LinphoneAVPFEnabled);
@@ -122,9 +130,9 @@ static void early_media_with_multicast_base(bool_t video) {
linphone_core_enable_audio_multicast(marie->lc,TRUE);
- lcs = ms_list_append(lcs,marie->lc);
- lcs = ms_list_append(lcs,pauline->lc);
- lcs = ms_list_append(lcs,pauline2->lc);
+ lcs = bctbx_list_append(lcs,marie->lc);
+ lcs = bctbx_list_append(lcs,pauline->lc);
+ lcs = bctbx_list_append(lcs,pauline2->lc);
/*
Marie calls Pauline, and after the call has rung, transitions to an early_media session
*/
diff --git a/tester/call_tester.c b/tester/call_single_tester.c
similarity index 71%
rename from tester/call_tester.c
rename to tester/call_single_tester.c
index 3d894f6e4..97cb65a32 100644
--- a/tester/call_tester.c
+++ b/tester/call_single_tester.c
@@ -34,7 +34,6 @@
#endif
static void srtp_call(void);
-static char *create_filepath(const char *dir, const char *filename, const char *ext);
// prototype definition for call_recording()
#ifdef ANDROID
@@ -202,23 +201,23 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana
}
} else {
if (linphone_core_rtcp_enabled(caller->lc)) {
- BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c1)->rtp_stats.sent_rtcp_packets, 0, int, "%i");
- BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c2)->rtp_stats.recv_rtcp_packets, 0, int, "%i");
+ BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c1)->rtp_stats.sent_rtcp_packets, 0, unsigned long long, "%llu");
+ BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c2)->rtp_stats.recv_rtcp_packets, 0, unsigned long long, "%llu");
if (linphone_call_log_video_enabled(linphone_call_get_call_log(c1))) {
- BC_ASSERT_EQUAL(linphone_call_get_video_stats(c1)->rtp_stats.sent_rtcp_packets, 0, int, "%i");
+ BC_ASSERT_EQUAL(linphone_call_get_video_stats(c1)->rtp_stats.sent_rtcp_packets, 0, unsigned long long, "%llu");
}
if (linphone_call_log_video_enabled(linphone_call_get_call_log(c2))) {
- BC_ASSERT_EQUAL(linphone_call_get_video_stats(c2)->rtp_stats.recv_rtcp_packets, 0, int, "%i");
+ BC_ASSERT_EQUAL(linphone_call_get_video_stats(c2)->rtp_stats.recv_rtcp_packets, 0, unsigned long long, "%llu");
}
}
if (linphone_core_rtcp_enabled(callee->lc)) {
- BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c2)->rtp_stats.sent_rtcp_packets, 0, int, "%i");
- BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c1)->rtp_stats.recv_rtcp_packets, 0, int, "%i");
+ BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c2)->rtp_stats.sent_rtcp_packets, 0, unsigned long long, "%llu");
+ BC_ASSERT_EQUAL(linphone_call_get_audio_stats(c1)->rtp_stats.recv_rtcp_packets, 0, unsigned long long, "%llu");
if (linphone_call_log_video_enabled(linphone_call_get_call_log(c1))) {
- BC_ASSERT_EQUAL(linphone_call_get_video_stats(c1)->rtp_stats.recv_rtcp_packets, 0, int, "%i");
+ BC_ASSERT_EQUAL(linphone_call_get_video_stats(c1)->rtp_stats.recv_rtcp_packets, 0, unsigned long long, "%llu");
}
if (linphone_call_log_video_enabled(linphone_call_get_call_log(c2))) {
- BC_ASSERT_EQUAL(linphone_call_get_video_stats(c2)->rtp_stats.sent_rtcp_packets, 0, int, "%i");
+ BC_ASSERT_EQUAL(linphone_call_get_video_stats(c2)->rtp_stats.sent_rtcp_packets, 0, unsigned long long, "%llu");
}
}
@@ -696,9 +695,9 @@ static void multiple_answers_call(void) {
LinphoneCall* call1, *call2;
- MSList* lcs = ms_list_append(NULL,pauline->lc);
- lcs = ms_list_append(lcs,marie1->lc);
- lcs = ms_list_append(lcs,marie2->lc);
+ bctbx_list_t* lcs = bctbx_list_append(NULL,pauline->lc);
+ lcs = bctbx_list_append(lcs,marie1->lc);
+ lcs = bctbx_list_append(lcs,marie2->lc);
BC_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 2000));
@@ -741,9 +740,9 @@ static void multiple_answers_call_with_media_relay(void) {
LinphoneCall* call1, *call2;
- MSList* lcs = ms_list_append(NULL,pauline->lc);
- lcs = ms_list_append(lcs,marie1->lc);
- lcs = ms_list_append(lcs,marie2->lc);
+ bctbx_list_t* lcs = bctbx_list_append(NULL,pauline->lc);
+ lcs = bctbx_list_append(lcs,marie1->lc);
+ lcs = bctbx_list_append(lcs,marie2->lc);
linphone_core_set_user_agent(pauline->lc, "Natted Linphone", NULL);
linphone_core_set_user_agent(marie1->lc, "Natted Linphone", NULL);
@@ -777,7 +776,7 @@ static void multiple_answers_call_with_media_relay(void) {
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie1);
linphone_core_manager_destroy(marie2);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void call_with_specified_codec_bitrate(void) {
@@ -838,14 +837,14 @@ end:
}
-static void disable_all_codecs(const MSList* elem, LinphoneCoreManager* call){
+void disable_all_codecs(const bctbx_list_t* elem, LinphoneCoreManager* call){
- PayloadType *pt;
+ PayloadType *pt;
- for(;elem!=NULL;elem=elem->next){
- pt=(PayloadType*)elem->data;
- linphone_core_enable_payload_type(call->lc,pt,FALSE);
- }
+ for(;elem!=NULL;elem=elem->next){
+ pt=(PayloadType*)elem->data;
+ linphone_core_enable_payload_type(call->lc,pt,FALSE);
+ }
}
/***
Disable all audio codecs , sends an INVITE with RTP port 0 and payload 0.
@@ -857,7 +856,7 @@ static void call_with_no_audio_codec(void){
LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCall* out_call ;
- const MSList* elem =linphone_core_get_audio_codecs(caller->lc);
+ const bctbx_list_t* elem =linphone_core_get_audio_codecs(caller->lc);
disable_all_codecs(elem, caller);
@@ -877,59 +876,6 @@ static void call_with_no_audio_codec(void){
}
-static void video_call_with_no_audio_and_no_video_codec(void){
-
- LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
- LinphoneCall* out_call ;
- LinphoneVideoPolicy callee_policy, caller_policy;
- LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
-
- const MSList* elem_video =linphone_core_get_video_codecs(caller->lc);
-
- const MSList* elem_audio =linphone_core_get_audio_codecs(caller->lc);
-
- disable_all_codecs(elem_audio, caller);
- disable_all_codecs(elem_video, caller);
-
- callee_policy.automatically_initiate=FALSE;
- callee_policy.automatically_accept=TRUE;
- caller_policy.automatically_initiate=TRUE;
- caller_policy.automatically_accept=FALSE;
-
- linphone_core_set_video_policy(callee->lc,&callee_policy);
- linphone_core_set_video_policy(caller->lc,&caller_policy);
-
-
- linphone_core_enable_video_display(callee->lc, TRUE);
- linphone_core_enable_video_capture(callee->lc, TRUE);
-
- linphone_core_enable_video_display(caller->lc, TRUE);
- linphone_core_enable_video_capture(caller->lc, TRUE);
-
- /* Create call params */
- caller_test_params.base = linphone_core_create_call_params(caller->lc, NULL);
-
-
- out_call = linphone_core_invite_address_with_params(caller->lc, callee->identity,caller_test_params.base);
- linphone_call_ref(out_call);
-
- linphone_call_params_destroy(caller_test_params.base);
- if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
-
-
- BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallOutgoingInit, 1));
-
- BC_ASSERT_TRUE(wait_for_until(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallError, 1, 6000));
- BC_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable, int, "%d");
- BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived, 0, int, "%d");
-
- linphone_call_unref(out_call);
- linphone_core_manager_destroy(callee);
- linphone_core_manager_destroy(caller);
-
-}
-
static void simple_call_compatibility_mode(void) {
char route[256];
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
@@ -1015,7 +961,7 @@ static void cancelled_call(void) {
}
void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime, int rate){
- const MSList *elem=linphone_core_get_audio_codecs(lc);
+ const bctbx_list_t *elem=linphone_core_get_audio_codecs(lc);
PayloadType *pt;
for(;elem!=NULL;elem=elem->next){
@@ -1028,10 +974,10 @@ void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime, int
}
}
-#ifdef VIDEO_ENABLED
void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime) {
- const MSList *codecs = linphone_core_get_video_codecs(lc);
- const MSList *it = NULL;
+#ifdef VIDEO_ENABLED
+ const bctbx_list_t *codecs = linphone_core_get_video_codecs(lc);
+ const bctbx_list_t *it = NULL;
PayloadType *pt = NULL;
for(it = codecs; it != NULL; it = it->next) {
@@ -1041,8 +987,8 @@ void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime) {
if (BC_ASSERT_PTR_NOT_NULL(pt)) {
linphone_core_enable_payload_type(lc, pt, TRUE);
}
-}
#endif
+}
static void call_with_dns_time_out(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2( "empty_rc", FALSE);
@@ -1126,7 +1072,7 @@ static void early_declined_call(void) {
BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonBusy, int, "%d");
*/
- if (ms_list_size(linphone_core_get_call_logs(pauline->lc))>0) {
+ if (bctbx_list_size(linphone_core_get_call_logs(pauline->lc))>0) {
BC_ASSERT_PTR_NOT_NULL(out_call_log=(LinphoneCallLog*)(linphone_core_get_call_logs(pauline->lc)->data));
BC_ASSERT_EQUAL(linphone_call_log_get_status(out_call_log),LinphoneCallAborted, int, "%d");
}
@@ -1222,7 +1168,7 @@ static void call_with_no_sdp_ack_without_sdp(void){
linphone_core_manager_destroy(pauline);
}
-static void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts) {
+void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts) {
LinphoneCall *c1 = linphone_core_get_current_call(caller->lc);
LinphoneCall *c2 = linphone_core_get_current_call(callee->lc);
BC_ASSERT_PTR_NOT_NULL(c1);
@@ -1235,7 +1181,7 @@ static void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManag
}
}
-static void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay) {
+void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay) {
linphone_core_set_user_agent(pauline->lc, "Natted Linphone", NULL);
linphone_core_set_user_agent(marie->lc, "Natted Linphone", NULL);
@@ -1304,7 +1250,7 @@ static void call_with_ice_no_sdp(void){
linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
- call(pauline,marie);
+ BC_ASSERT_TRUE(call(pauline,marie));
liblinphone_tester_check_rtcp(marie,pauline);
@@ -1329,6 +1275,55 @@ static void not_ice_to_ice(void){
_call_with_ice(FALSE,TRUE,FALSE,FALSE);
}
+static void ice_added_by_reinvite(void){
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneNatPolicy *pol;
+ LinphoneCallParams *params;
+ LinphoneCall *c;
+ bool_t call_ok;
+
+ lp_config_set_int(linphone_core_get_config(marie->lc), "net", "allow_late_ice", 1);
+ lp_config_set_int(linphone_core_get_config(pauline->lc), "net", "allow_late_ice", 1);
+
+ BC_ASSERT_TRUE((call_ok=call(pauline,marie)));
+ if (!call_ok) goto end;
+ liblinphone_tester_check_rtcp(marie,pauline);
+
+ /*enable ICE on both ends*/
+ pol = linphone_core_get_nat_policy(marie->lc);
+ linphone_nat_policy_enable_ice(pol, TRUE);
+ linphone_nat_policy_enable_stun(pol, TRUE);
+ linphone_core_set_nat_policy(marie->lc, pol);
+
+ pol = linphone_core_get_nat_policy(pauline->lc);
+ linphone_nat_policy_enable_ice(pol, TRUE);
+ linphone_nat_policy_enable_stun(pol, TRUE);
+ linphone_core_set_nat_policy(pauline->lc, pol);
+
+ c = linphone_core_get_current_call(marie->lc);
+ params = linphone_core_create_call_params(marie->lc, c);
+ linphone_core_update_call(marie->lc, c, params);
+ 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));
+
+
+ end_call(pauline, marie);
+
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
static void call_with_custom_headers(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
@@ -1553,11 +1548,11 @@ static void call_paused_by_both(void) {
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCall* call_pauline, *call_marie;
const rtp_stats_t * stats;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
bool_t call_ok;
- lcs = ms_list_append(lcs, pauline->lc);
- lcs = ms_list_append(lcs, marie->lc);
+ lcs = bctbx_list_append(lcs, pauline->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
BC_ASSERT_TRUE((call_ok=call(pauline,marie)));
if (!call_ok) goto end;
@@ -1611,135 +1606,9 @@ static void call_paused_by_both(void) {
end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
-#ifdef VIDEO_ENABLED
-static void call_paused_resumed_with_video_base_call_cb(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message) {
- if (cstate == LinphoneCallUpdatedByRemote) {
- LinphoneCallParams *params = linphone_core_create_call_params(lc, call);
- linphone_call_params_enable_video(params, TRUE);
- ms_message (" New state LinphoneCallUpdatedByRemote on call [%p], accepting with video on",call);
- BC_ASSERT_NOT_EQUAL(linphone_core_accept_call_update(lc, call, params), 0, int, "%i");
- linphone_call_params_destroy(params);
- }
-}
-/*this test makes sure that pause/resume will not bring up video by accident*/
-static void call_paused_resumed_with_video_base(bool_t sdp_200_ack
- ,bool_t use_video_policy_for_re_invite_sdp_200
- ,bool_t resume_in_audio_send_only_video_inactive_first
- ,bool_t with_call_accept){
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- LinphoneCall* call_pauline, *call_marie;
- MSList *lcs = NULL;
- LinphoneVideoPolicy vpol;
- bool_t call_ok;
- LinphoneCoreVTable *vtable = linphone_core_v_table_new();
- vtable->call_state_changed = call_paused_resumed_with_video_base_call_cb;
- lcs = ms_list_append(lcs, pauline->lc);
- lcs = ms_list_append(lcs, marie->lc);
-
- vpol.automatically_accept = FALSE;
- vpol.automatically_initiate = TRUE; /* needed to present a video mline*/
-
- linphone_core_set_video_policy(marie->lc, &vpol);
- linphone_core_enable_video_capture(marie->lc, TRUE);
- linphone_core_enable_video_display(marie->lc, TRUE);
-
- vpol.automatically_accept = FALSE;
- vpol.automatically_initiate = TRUE;
-
- linphone_core_set_video_policy(pauline->lc, &vpol);
- linphone_core_enable_video_capture(pauline->lc, TRUE);
- linphone_core_enable_video_display(pauline->lc, TRUE);
-
- BC_ASSERT_TRUE((call_ok=call(marie, pauline)));
-
- if (!call_ok) goto end;
-
- call_pauline = linphone_core_get_current_call(pauline->lc);
- call_marie = linphone_core_get_current_call(marie->lc);
-
- wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
-
- linphone_core_pause_call(pauline->lc,call_pauline);
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1));
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1));
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_remote_params(call_marie)));
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1));
-
- /*stay in pause a little while in order to generate traffic*/
- wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
-
- /*check if video stream is still offered even if disabled*/
-
- BC_ASSERT_EQUAL(call_pauline->localdesc->nb_streams, 2, int, "%i");
- BC_ASSERT_EQUAL(call_marie->localdesc->nb_streams, 2, int, "%i");
-
- linphone_core_enable_sdp_200_ack(pauline->lc,sdp_200_ack);
-
- if (use_video_policy_for_re_invite_sdp_200) {
- LpConfig *marie_lp;
- marie_lp = linphone_core_get_config(marie->lc);
- lp_config_set_int(marie_lp,"sip","sdp_200_ack_follow_video_policy",1);
- }
- /*now pauline wants to resume*/
- if (resume_in_audio_send_only_video_inactive_first) {
- LinphoneCallParams *params = linphone_core_create_call_params(pauline->lc, call_pauline);
- linphone_call_params_set_video_direction(params,LinphoneMediaDirectionInactive);
- linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionSendOnly);
- linphone_core_update_call(pauline->lc,call_pauline,params);
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,2));
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdating,1));
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
- linphone_call_params_set_video_direction(params,LinphoneMediaDirectionSendRecv);
- linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionSendRecv);
- if (with_call_accept) {
- linphone_core_add_listener(marie->lc, vtable);
- }
- linphone_core_update_call(pauline->lc,call_pauline,params);
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,3));
- linphone_call_params_destroy(params);
- } else {
- linphone_core_resume_call(pauline->lc, call_pauline);
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallResuming,1));
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
- }
-
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
-
- if (use_video_policy_for_re_invite_sdp_200) {
- /*make sure video was offered*/
- BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_remote_params(call_pauline)));
- } else {
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline)));
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_marie)));
- }
- end_call(marie, pauline);
-
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
- ms_list_free(lcs);
-}
-static void call_paused_resumed_with_video(void){
- call_paused_resumed_with_video_base(FALSE, FALSE,FALSE,FALSE);
-}
-
-static void call_paused_resumed_with_no_sdp_ack(void){
- call_paused_resumed_with_video_base(TRUE, FALSE,FALSE,FALSE);
-}
-static void call_paused_resumed_with_no_sdp_ack_using_video_policy(void){
- call_paused_resumed_with_video_base(TRUE, TRUE,FALSE,FALSE);
-}
-static void call_paused_updated_resumed_with_no_sdp_ack_using_video_policy(void){
- call_paused_resumed_with_video_base(TRUE, TRUE,TRUE,FALSE);
-}
-static void call_paused_updated_resumed_with_no_sdp_ack_using_video_policy_and_accept_call_update(void){
- call_paused_resumed_with_video_base(TRUE, TRUE,TRUE,TRUE);
-}
-#endif
#define CHECK_CURRENT_LOSS_RATE() \
rtcp_count_current = pauline->stat.number_of_rtcp_sent; \
/*wait for an RTCP packet to have an accurate cumulative lost value*/ \
@@ -1910,921 +1779,6 @@ static void audio_call_with_ice_no_matching_audio_codecs(void) {
linphone_core_manager_destroy(pauline);
}
-#ifdef VIDEO_ENABLED
-static LinphoneCall* setup_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t change_video_policy) {
- LinphoneVideoPolicy caller_policy;
- LinphoneCallParams* callee_params;
- LinphoneCall* call_obj;
-
- if (!linphone_core_get_current_call(callee->lc) || linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning
- || !linphone_core_get_current_call(caller->lc) || linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning ) {
- ms_warning("bad state for adding video");
- return NULL;
- }
-
- if (change_video_policy) {
- caller_policy.automatically_accept=TRUE;
- caller_policy.automatically_initiate=TRUE;
- linphone_core_set_video_policy(caller->lc,&caller_policy);
- }
- linphone_core_enable_video_capture(callee->lc, TRUE);
- linphone_core_enable_video_display(callee->lc, TRUE);
- linphone_core_enable_video_capture(caller->lc, TRUE);
- linphone_core_enable_video_display(caller->lc, FALSE);
-
- if ((call_obj = linphone_core_get_current_call(callee->lc))) {
- callee_params = linphone_core_create_call_params(callee->lc, call_obj);
- /*add video*/
- linphone_call_params_enable_video(callee_params,TRUE);
- linphone_core_update_call(callee->lc,call_obj,callee_params);
- linphone_call_params_destroy(callee_params);
- }
- return call_obj;
-}
-
-bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t change_video_policy) {
- stats initial_caller_stat=caller->stat;
- stats initial_callee_stat=callee->stat;
- const LinphoneVideoPolicy *video_policy;
- LinphoneCall *call_obj;
- if ((call_obj=setup_video(caller, callee, change_video_policy))){
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning+1));
-
- video_policy = linphone_core_get_video_policy(caller->lc);
- if (video_policy->automatically_accept) {
- BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
- BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc))));
- } else {
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc))));
- }
- if (linphone_core_get_media_encryption(caller->lc) != LinphoneMediaEncryptionNone
- && linphone_core_get_media_encryption(callee->lc) != LinphoneMediaEncryptionNone) {
- const LinphoneCallParams* call_param;
-
- switch (linphone_core_get_media_encryption(caller->lc)) {
- case LinphoneMediaEncryptionZRTP:
- case LinphoneMediaEncryptionDTLS:
- /*wait for encryption to be on, in case of zrtp/dtls, it can take a few seconds*/
- wait_for(callee->lc,caller->lc,&caller->stat.number_of_LinphoneCallEncryptedOn,initial_caller_stat.number_of_LinphoneCallEncryptedOn+1);
- break;
- case LinphoneMediaEncryptionNone:
- case LinphoneMediaEncryptionSRTP:
- break;
- }
- switch (linphone_core_get_media_encryption(callee->lc)) {
- case LinphoneMediaEncryptionZRTP:
- case LinphoneMediaEncryptionDTLS:
- wait_for(callee->lc,caller->lc,&callee->stat.number_of_LinphoneCallEncryptedOn,initial_callee_stat.number_of_LinphoneCallEncryptedOn+1);
- break;
- case LinphoneMediaEncryptionNone:
- case LinphoneMediaEncryptionSRTP:
- break;
- }
-
- call_param = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc));
- BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc), int, "%d");
- call_param = linphone_call_get_current_params(linphone_core_get_current_call(caller->lc));
- BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc), int, "%d");
-
- }
-
- if (video_policy->automatically_accept) {
- linphone_call_set_next_video_frame_decoded_callback(call_obj,linphone_call_iframe_decoded_cb,callee->lc);
- /*send vfu*/
- linphone_call_send_vfu_request(call_obj);
- return wait_for(caller->lc,callee->lc,&callee->stat.number_of_IframeDecoded,initial_callee_stat.number_of_IframeDecoded+1);
- } else {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static bool_t remove_video(LinphoneCoreManager *caller, LinphoneCoreManager *callee) {
- LinphoneCallParams *callee_params;
- LinphoneCall *call_obj;
- stats initial_caller_stat = caller->stat;
- stats initial_callee_stat = callee->stat;
-
- if (!linphone_core_get_current_call(callee->lc)
- || (linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning)
- || !linphone_core_get_current_call(caller->lc)
- || (linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning)) {
- ms_warning("bad state for removing video");
- return FALSE;
- }
-
- if ((call_obj = linphone_core_get_current_call(callee->lc))) {
- callee_params = linphone_core_create_call_params(callee->lc, call_obj);
- /* Remove video. */
- linphone_call_params_enable_video(callee_params, FALSE);
- linphone_core_update_call(callee->lc, call_obj, callee_params);
- linphone_call_params_destroy(callee_params);
-
- BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallUpdatedByRemote, initial_caller_stat.number_of_LinphoneCallUpdatedByRemote + 1));
- BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallUpdating, initial_callee_stat.number_of_LinphoneCallUpdating + 1));
- BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallStreamsRunning, initial_callee_stat.number_of_LinphoneCallStreamsRunning + 1));
- BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallStreamsRunning, initial_caller_stat.number_of_LinphoneCallStreamsRunning + 1));
-
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc))));
-
- return TRUE;
- }
- return FALSE;
-}
-
-static void call_with_video_added(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- bool_t call_ok;
-
- BC_ASSERT_TRUE((call_ok=call(pauline,marie)));
- if (!call_ok) goto end;
-
- BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
-
- end_call(pauline, marie);
-
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void call_with_video_added_2(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- bool_t call_ok;
- /*in this variant marie is already in automatically accept*/
- LinphoneVideoPolicy marie_policy;
- marie_policy.automatically_accept=TRUE;
-
-
- linphone_core_set_video_policy(marie->lc,&marie_policy);
- linphone_core_enable_video_capture(marie->lc, TRUE);
- linphone_core_enable_video_display(marie->lc, FALSE);
-
- BC_ASSERT_TRUE(call_ok=call(pauline,marie));
- if (!call_ok) goto end;
-
- BC_ASSERT_TRUE(add_video(marie,pauline, TRUE));
-
- end_call(pauline, marie);
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void call_with_video_added_random_ports(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- bool_t call_ok;
-
- linphone_core_set_audio_port(marie->lc,-1);
- linphone_core_set_video_port(marie->lc,-1);
- linphone_core_set_audio_port(pauline->lc,-1);
- linphone_core_set_video_port(pauline->lc,-1);
-
- BC_ASSERT_TRUE(call_ok=call(pauline,marie));
- if (!call_ok) goto end;
-
- BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
- end_call(pauline, marie);
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void call_with_several_video_switches(void) {
- int dummy = 0;
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- bool_t call_ok;
- BC_ASSERT_TRUE(call_ok=call(pauline,marie));
-
- if (!call_ok) goto end;
-
- BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
- wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
- BC_ASSERT_TRUE(remove_video(pauline,marie));
- BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
- wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
- BC_ASSERT_TRUE(remove_video(pauline,marie));
- /**/
- end_call(pauline, marie);
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void srtp_call_with_several_video_switches(void) {
- int dummy = 0;
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- bool_t call_ok;
-
- if (linphone_core_media_encryption_supported(marie->lc, LinphoneMediaEncryptionSRTP)) {
- linphone_core_set_media_encryption(marie->lc, LinphoneMediaEncryptionSRTP);
- linphone_core_set_media_encryption(pauline->lc, LinphoneMediaEncryptionSRTP);
-
- BC_ASSERT_TRUE(call_ok=call(pauline,marie));
- if (!call_ok) goto end;
-
- BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
- wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
- BC_ASSERT_TRUE(remove_video(pauline,marie));
- BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
- wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
- BC_ASSERT_TRUE(remove_video(pauline,marie));
- /**/
- end_call(pauline, marie);
- } else {
- ms_warning("Not tested because SRTP is not available.");
- }
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void call_with_declined_video_base(bool_t using_policy) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- LinphoneCall* marie_call;
- LinphoneCall* pauline_call;
- LinphoneVideoPolicy marie_policy, pauline_policy;
- LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
- bool_t call_ok;
-
- linphone_core_enable_video_capture(marie->lc, TRUE);
- linphone_core_enable_video_display(marie->lc, TRUE);
- linphone_core_enable_video_capture(pauline->lc, TRUE);
- linphone_core_enable_video_display(pauline->lc, FALSE);
-
- if (using_policy) {
- pauline_policy.automatically_initiate=TRUE;
- pauline_policy.automatically_accept=FALSE;
- marie_policy.automatically_initiate=FALSE;
- marie_policy.automatically_accept=FALSE;
-
- linphone_core_set_video_policy(marie->lc,&marie_policy);
- linphone_core_set_video_policy(pauline->lc,&pauline_policy);
- }
-
- caller_test_params.base=linphone_core_create_call_params(pauline->lc, NULL);
- if (!using_policy)
- linphone_call_params_enable_video(caller_test_params.base,TRUE);
-
- if (!using_policy){
- callee_test_params.base=linphone_core_create_call_params(marie->lc, NULL);
- linphone_call_params_enable_video(callee_test_params.base,FALSE);
- }
-
- BC_ASSERT_TRUE((call_ok=call_with_params2(pauline,marie,&caller_test_params,&callee_test_params,using_policy)));
- if (!call_ok) goto end;
-
- linphone_call_params_destroy(caller_test_params.base);
- if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
- marie_call=linphone_core_get_current_call(marie->lc);
- pauline_call=linphone_core_get_current_call(pauline->lc);
-
- BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call)));
- BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call)));
-
- end_call(pauline, marie);
-
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-static void call_with_declined_video(void) {
- call_with_declined_video_base(FALSE);
-}
-
-static void call_with_declined_video_despite_policy(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- LinphoneCall* marie_call;
- LinphoneCall* pauline_call;
- LinphoneVideoPolicy marie_policy, pauline_policy;
- LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
- bool_t call_ok;
-
- linphone_core_enable_video_capture(marie->lc, TRUE);
- linphone_core_enable_video_display(marie->lc, TRUE);
- linphone_core_enable_video_capture(pauline->lc, TRUE);
- linphone_core_enable_video_display(pauline->lc, FALSE);
-
- pauline_policy.automatically_initiate=TRUE;
- pauline_policy.automatically_accept=TRUE;
- marie_policy.automatically_initiate=TRUE;
- marie_policy.automatically_accept=TRUE;
-
- linphone_core_set_video_policy(marie->lc,&marie_policy);
- linphone_core_set_video_policy(pauline->lc,&pauline_policy);
-
- caller_test_params.base=linphone_core_create_call_params(pauline->lc, NULL);
-
- callee_test_params.base=linphone_core_create_call_params(marie->lc, NULL);
- linphone_call_params_enable_video(callee_test_params.base,FALSE);
-
- BC_ASSERT_TRUE((call_ok=call_with_params2(pauline,marie,&caller_test_params,&callee_test_params,FALSE)));
- if (!call_ok) goto end;
-
- linphone_call_params_destroy(caller_test_params.base);
- if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
- marie_call=linphone_core_get_current_call(marie->lc);
- pauline_call=linphone_core_get_current_call(pauline->lc);
-
- BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call)));
- BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call)));
-
- end_call(pauline, marie);
-
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void call_with_declined_video_using_policy(void) {
- call_with_declined_video_base(TRUE);
-}
-
-
-void video_call_base_2(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
- LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
- LinphoneCall* callee_call;
- LinphoneCall* caller_call;
- LinphoneVideoPolicy callee_policy, caller_policy;
-
- if (using_policy) {
- callee_policy.automatically_initiate=FALSE;
- callee_policy.automatically_accept=TRUE;
- caller_policy.automatically_initiate=TRUE;
- caller_policy.automatically_accept=FALSE;
-
- linphone_core_set_video_policy(callee->lc,&callee_policy);
- linphone_core_set_video_policy(caller->lc,&caller_policy);
- }
-
- linphone_core_enable_video_display(callee->lc, callee_video_enabled);
- linphone_core_enable_video_capture(callee->lc, callee_video_enabled);
-
- linphone_core_enable_video_display(caller->lc, caller_video_enabled);
- linphone_core_enable_video_capture(caller->lc, caller_video_enabled);
-
- if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
- char *path = bc_tester_file("certificates-marie");
- callee->lc->user_certificates_path = ms_strdup(path);
- bc_free(path);
- path = bc_tester_file("certificates-pauline");
- caller->lc->user_certificates_path = ms_strdup(path);
- bc_free(path);
- belle_sip_mkdir(callee->lc->user_certificates_path);
- belle_sip_mkdir(caller->lc->user_certificates_path);
- }
-
- linphone_core_set_media_encryption(callee->lc,mode);
- linphone_core_set_media_encryption(caller->lc,mode);
-
- caller_test_params.base=linphone_core_create_call_params(caller->lc, NULL);
- if (!using_policy)
- linphone_call_params_enable_video(caller_test_params.base,TRUE);
-
- if (!using_policy){
- callee_test_params.base=linphone_core_create_call_params(callee->lc, NULL);
- linphone_call_params_enable_video(callee_test_params.base,TRUE);
- }
-
- BC_ASSERT_TRUE(call_with_params2(caller,callee,&caller_test_params,&callee_test_params,using_policy));
- callee_call=linphone_core_get_current_call(callee->lc);
- caller_call=linphone_core_get_current_call(caller->lc);
-
- linphone_call_params_destroy(caller_test_params.base);
- if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
-
- if (callee_call && caller_call ) {
- if (callee_video_enabled && caller_video_enabled) {
- BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(callee_call)));
- BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(caller_call)));
-
- /*check video path*/
- linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc);
- linphone_call_send_vfu_request(callee_call);
- BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1));
- } else {
- BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(callee_call)));
- BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(caller_call)));
- }
- liblinphone_tester_check_rtcp(callee,caller);
- }
-}
-
-
-static void check_fir(LinphoneCoreManager* caller,LinphoneCoreManager* callee ){
- LinphoneCall* callee_call;
- LinphoneCall* caller_call;
-
- callee_call=linphone_core_get_current_call(callee->lc);
- caller_call=linphone_core_get_current_call(caller->lc);
-
- /*check video path is established in both directions.
- Indeed, FIR are ignored until the first RTP packet is received, because SSRC is not known.*/
- linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc);
- linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc);
-
- BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1));
- BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1));
-
- linphone_call_send_vfu_request(callee_call);
-
- if (rtp_session_avpf_enabled(callee_call->sessions->rtp_session)){
- BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&caller_call->videostream->ms_video_stat.counter_rcvd_fir, 1));
- }else{
- BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&caller_call->videostream->ms_video_stat.counter_rcvd_fir, 0));
- }
- ms_message ("check_fir : [%p] received %d FIR ",&caller_call ,caller_call->videostream->ms_video_stat.counter_rcvd_fir);
- ms_message ("check_fir : [%p] stat number of iframe decoded %d ",&callee_call, callee->stat.number_of_IframeDecoded);
-
- linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc);
- linphone_call_send_vfu_request(caller_call);
- BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1));
-
- if (rtp_session_avpf_enabled(caller_call->sessions->rtp_session)) {
- if (rtp_session_avpf_enabled(callee_call->sessions->rtp_session)){
- BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&callee_call->videostream->ms_video_stat.counter_rcvd_fir, 1));
- }
- }else{
- BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&callee_call->videostream->ms_video_stat.counter_rcvd_fir, 0));
- }
- ms_message ("check_fir : [%p] received %d FIR ",&callee_call ,callee_call->videostream->ms_video_stat.counter_rcvd_fir);
- ms_message ("check_fir : [%p] stat number of iframe decoded %d ",&caller_call, caller->stat.number_of_IframeDecoded);
-
-}
-
-void video_call_base_3(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
- LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
-
- LinphoneCall* callee_call;
- LinphoneCall* caller_call;
- LinphoneVideoPolicy callee_policy, caller_policy;
-
- if (using_policy) {
- callee_policy.automatically_initiate=FALSE;
- callee_policy.automatically_accept=TRUE;
- caller_policy.automatically_initiate=TRUE;
- caller_policy.automatically_accept=FALSE;
-
- linphone_core_set_video_policy(callee->lc,&callee_policy);
- linphone_core_set_video_policy(caller->lc,&caller_policy);
- }
-
- linphone_core_enable_video_display(callee->lc, callee_video_enabled);
- linphone_core_enable_video_capture(callee->lc, callee_video_enabled);
-
- linphone_core_enable_video_display(caller->lc, caller_video_enabled);
- linphone_core_enable_video_capture(caller->lc, caller_video_enabled);
-
- if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
- char *path = bc_tester_file("certificates-marie");
- callee->lc->user_certificates_path = ms_strdup(path);
- bc_free(path);
- path = bc_tester_file("certificates-pauline");
- caller->lc->user_certificates_path = ms_strdup(path);
- bc_free(path);
- belle_sip_mkdir(callee->lc->user_certificates_path);
- belle_sip_mkdir(caller->lc->user_certificates_path);
- }
-
- linphone_core_set_media_encryption(callee->lc,mode);
- linphone_core_set_media_encryption(caller->lc,mode);
- /* Create call params */
- caller_test_params.base=linphone_core_create_call_params(caller->lc, NULL);
-
- if (!using_policy)
- linphone_call_params_enable_video(caller_test_params.base,TRUE);
-
- if (!using_policy){
- callee_test_params.base=linphone_core_create_call_params(callee->lc, NULL);
- linphone_call_params_enable_video(callee_test_params.base,TRUE);
- }
-
- BC_ASSERT_TRUE(call_with_params2(caller,callee,&caller_test_params,&callee_test_params,using_policy));
- callee_call=linphone_core_get_current_call(callee->lc);
- caller_call=linphone_core_get_current_call(caller->lc);
-
- linphone_call_params_destroy(caller_test_params.base);
- if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
-
- if (callee_call && caller_call ) {
- if (callee_video_enabled && caller_video_enabled) {
- check_fir(caller,callee);
- } else {
- BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(callee_call)));
- BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(caller_call)));
- }
- liblinphone_tester_check_rtcp(callee,caller);
- }
-}
-
-
-
-static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
- video_call_base_2(pauline,marie,using_policy,mode,callee_video_enabled,caller_video_enabled);
- end_call(pauline, marie);
-}
-
-static void video_call(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void video_call_without_rtcp(void) {
- LpConfig *lp;
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
-
- lp = linphone_core_get_config(marie->lc);
- lp_config_set_int(lp,"rtp","rtcp_enabled",0);
-
- lp = linphone_core_get_config(pauline->lc);
- lp_config_set_int(lp,"rtp","rtcp_enabled",0);
-
- video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void video_call_disable_implicit_AVPF_on_callee(void) {
- LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
- LpConfig *callee_lp;
- const LinphoneCallParams *params, *params2;
-
- callee_lp = linphone_core_get_config(callee->lc);
- lp_config_set_int(callee_lp,"rtp","rtcp_fb_implicit_rtcp_fb",0);
-
- video_call_base_3(caller,callee,TRUE,LinphoneMediaEncryptionNone,TRUE,TRUE);
- if(BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(callee->lc))) {
- params = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc));
- BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), "RTP/AVP");
- }
- if(BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(caller->lc))) {
- params2 =linphone_call_get_current_params(linphone_core_get_current_call(caller->lc));
- BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params2), "RTP/AVP");
- }
- end_call(caller, callee);
- linphone_core_manager_destroy(callee);
- linphone_core_manager_destroy(caller);
-}
-
-
-static void video_call_disable_implicit_AVPF_on_caller(void) {
- LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
- LpConfig *caller_lp;
- const LinphoneCallParams *params, *params2;
-
- caller_lp = linphone_core_get_config(caller->lc);
- lp_config_set_int(caller_lp, "rtp", "rtcp_fb_implicit_rtcp_fb", 0);
-
- video_call_base_3(caller, callee, TRUE, LinphoneMediaEncryptionNone, TRUE, TRUE);
- params = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc));
- BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), "RTP/AVP");
- params2 = linphone_call_get_current_params(linphone_core_get_current_call(caller->lc));
- BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params2), "RTP/AVP");
- end_call(caller, callee);
- linphone_core_manager_destroy(callee);
- linphone_core_manager_destroy(caller);
-
-}
-
-static void video_call_AVPF_to_implicit_AVPF(void) {
- LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
-
- linphone_core_set_avpf_mode(caller->lc, LinphoneAVPFEnabled);
- video_call_base_3(caller, callee, TRUE, LinphoneMediaEncryptionNone, TRUE, TRUE);
- end_call(caller, callee);
-
- linphone_core_manager_destroy(callee);
- linphone_core_manager_destroy(caller);
-
-}
-
-static void video_call_implicit_AVPF_to_AVPF(void) {
- LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
-
- linphone_core_set_avpf_mode(callee->lc, LinphoneAVPFEnabled);
- video_call_base_3(caller, callee, TRUE, LinphoneMediaEncryptionNone, TRUE, TRUE);
- end_call(caller, callee);
-
- linphone_core_manager_destroy(callee);
- linphone_core_manager_destroy(caller);
-
-}
-
-static void video_call_using_policy_AVPF_implicit_caller_and_callee(void) {
- LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
- video_call_base_3(caller, callee, FALSE, LinphoneMediaEncryptionNone, TRUE, TRUE);
- end_call(caller, callee);
- linphone_core_manager_destroy(callee);
- linphone_core_manager_destroy(caller);
-}
-
-static void video_call_base_avpf(LinphoneCoreManager *caller, LinphoneCoreManager *callee, bool_t using_policy, LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
- linphone_core_set_avpf_mode(caller->lc, LinphoneAVPFEnabled);
- linphone_core_set_avpf_mode(callee->lc, LinphoneAVPFEnabled);
- video_call_base_3(caller, callee, using_policy, mode, callee_video_enabled, caller_video_enabled);
- end_call(caller, callee);
-}
-
-static void video_call_avpf(void) {
- LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
-
- video_call_base_avpf(caller, callee, FALSE, LinphoneMediaEncryptionNone, TRUE, TRUE);
- linphone_core_manager_destroy(callee);
- linphone_core_manager_destroy(caller);
-
-}
-
-static void video_call_zrtp(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- if (linphone_core_media_encryption_supported(marie->lc,LinphoneMediaEncryptionZRTP)) {
- video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionZRTP,TRUE,TRUE);
- } else
- ms_message("Skipping video_call_zrtp");
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void video_call_dtls(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- if (linphone_core_media_encryption_supported(pauline->lc,LinphoneMediaEncryptionDTLS)) {
- video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionDTLS,TRUE,TRUE);
- } else
- ms_message("Skipping video_call_dtls");
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-
-}
-
-
-
-static void video_call_using_policy(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
- video_call_base(pauline,marie,TRUE,LinphoneMediaEncryptionNone,TRUE,TRUE);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void video_call_using_policy_with_callee_video_disabled(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- video_call_base(marie,pauline,TRUE,LinphoneMediaEncryptionNone,FALSE,TRUE);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void video_call_using_policy_with_caller_video_disabled(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- video_call_base(marie,pauline,TRUE,LinphoneMediaEncryptionNone,TRUE,FALSE);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void video_call_no_sdp(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- linphone_core_enable_sdp_200_ack(pauline->lc,TRUE);
- video_call_base(pauline,marie,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void call_with_ice_video_to_novideo(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- LinphoneVideoPolicy vpol={0};
- vpol.automatically_initiate=TRUE;
- linphone_core_set_video_policy(pauline->lc,&vpol);
- vpol.automatically_initiate=FALSE;
- linphone_core_set_video_policy(marie->lc,&vpol);
- _call_with_ice_base(pauline,marie,TRUE,TRUE,TRUE,FALSE);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVideoPolicy callee_policy,
- bool_t video_added_by_caller, bool_t video_added_by_callee, bool_t video_removed_by_caller, bool_t video_removed_by_callee) {
- LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- bool_t call_ok;
- unsigned int nb_media_starts = 1;
-
- linphone_core_set_video_policy(pauline->lc, &caller_policy);
- linphone_core_set_video_policy(marie->lc, &callee_policy);
- linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
- linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
-
- linphone_core_set_audio_port(marie->lc, -1);
- linphone_core_set_video_port(marie->lc, -1);
- linphone_core_set_audio_port(pauline->lc, -1);
- linphone_core_set_video_port(pauline->lc, -1);
-
- 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));
- check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts);
- nb_media_starts++;
-
- if (video_added_by_caller) {
- BC_ASSERT_TRUE(add_video(marie, pauline, FALSE));
- } else if (video_added_by_callee) {
- BC_ASSERT_TRUE(add_video(pauline, marie, FALSE));
- }
- if (video_added_by_caller || video_added_by_callee) {
- BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection));
- if (linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))){
- /* Wait for ICE reINVITEs to complete if video was really added */
- BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 4)
- && wait_for(pauline->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 4));
- check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts);
- nb_media_starts++;
- }
- }
-
- if (video_removed_by_caller) {
- BC_ASSERT_TRUE(remove_video(marie, pauline));
- } else if (video_removed_by_callee) {
- BC_ASSERT_TRUE(remove_video(pauline, marie));
- }
- if (video_removed_by_caller || video_removed_by_callee) {
- BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection));
- check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts);
- nb_media_starts++;
- }
-
- end_call(pauline, marie);
-
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void call_with_ice_video_added(void) {
- LinphoneVideoPolicy vpol = { TRUE, TRUE };
- _call_with_ice_video(vpol, vpol, TRUE, FALSE, TRUE, FALSE);
-}
-
-static void call_with_ice_video_added_2(void) {
- LinphoneVideoPolicy vpol = { TRUE, TRUE };
- _call_with_ice_video(vpol, vpol, TRUE, FALSE, FALSE, TRUE);
-}
-
-static void call_with_ice_video_added_3(void) {
- LinphoneVideoPolicy vpol = { TRUE, TRUE };
- _call_with_ice_video(vpol, vpol, FALSE, TRUE, TRUE, FALSE);
-}
-
-static void call_with_ice_video_added_and_refused(void) {
- LinphoneVideoPolicy caller_policy = { TRUE, TRUE };
- LinphoneVideoPolicy callee_policy = { FALSE, FALSE };
- _call_with_ice_video(caller_policy, callee_policy, TRUE, FALSE, FALSE, FALSE);
-}
-
-static void call_with_ice_video_added_with_video_policies_to_false(void) {
- LinphoneVideoPolicy vpol = { FALSE, FALSE };
- _call_with_ice_video(vpol, vpol, FALSE, TRUE, FALSE, FALSE);
-}
-
-#if ICE_WAS_WORKING_WITH_REAL_TIME_TEXT /*which is not the case at the moment*/
-
-static void call_with_ice_video_and_rtt(void) {
- LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- bool_t call_ok;
- LinphoneVideoPolicy policy = { TRUE, TRUE };
- LinphoneCallParams *params = NULL;
- LinphoneCall *marie_call = NULL;
-
- linphone_core_set_video_policy(pauline->lc, &policy);
- linphone_core_set_video_policy(marie->lc, &policy);
- linphone_core_enable_video_capture(marie->lc, TRUE);
- linphone_core_enable_video_display(marie->lc, FALSE);
- linphone_core_enable_video_capture(pauline->lc, FALSE);
- linphone_core_enable_video_display(pauline->lc, TRUE);
- linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
- linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
-
- linphone_core_set_audio_port(marie->lc, -1);
- linphone_core_set_video_port(marie->lc, -1);
- linphone_core_set_text_port(marie->lc, -1);
- linphone_core_set_audio_port(pauline->lc, -1);
- linphone_core_set_video_port(pauline->lc, -1);
- linphone_core_set_text_port(pauline->lc, -1);
-
- params = linphone_core_create_default_call_parameters(pauline->lc);
- linphone_call_params_enable_realtime_text(params, TRUE);
- BC_ASSERT_TRUE(call_ok = call_with_caller_params(pauline, marie, params));
- if (!call_ok) goto end;
- BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection));
-
- marie_call = linphone_core_get_current_call(marie->lc);
- BC_ASSERT_TRUE(linphone_call_params_audio_enabled(linphone_call_get_current_params(marie_call)));
- BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(marie_call)));
- BC_ASSERT_TRUE(linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(marie_call)));
-
- end_call(pauline, marie);
-end:
- linphone_call_params_destroy(params);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-#endif
-
-static void video_call_with_early_media_no_matching_audio_codecs(void) {
- LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- LinphoneCall *out_call, *pauline_call;
- LinphoneVideoPolicy vpol={0};
-
- linphone_core_enable_video_capture(marie->lc, TRUE);
- linphone_core_enable_video_display(marie->lc, TRUE);
- linphone_core_enable_video_capture(pauline->lc, TRUE);
- linphone_core_enable_video_display(pauline->lc, FALSE);
-
- vpol.automatically_initiate=TRUE;
- vpol.automatically_accept=TRUE;
- linphone_core_set_video_policy(pauline->lc,&vpol);
- linphone_core_set_video_policy(marie->lc,&vpol);
-
- linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMU", 8000, 1), FALSE); /* Disable PCMU */
- linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMA", 8000, 1), TRUE); /* Enable PCMA */
-
- out_call = linphone_core_invite_address(marie->lc, pauline->identity);
- linphone_call_ref(out_call);
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1));
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingReceived, 1));
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging, 1));
-
- pauline_call = linphone_core_get_current_call(pauline->lc);
- if (!pauline_call) goto end;
-
- linphone_core_accept_early_media(pauline->lc, pauline_call);
-
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia, 1));
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1));
- /*audio stream shall not have been requested to start*/
- BC_ASSERT_PTR_NULL(pauline_call->audiostream->soundread);
-
- BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(out_call)));
- BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(pauline_call)));
-
- linphone_core_accept_call(pauline->lc, pauline_call);
-
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
-
- end_call(marie, pauline);
-
-end:
- linphone_call_unref(out_call);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void video_call_limited_bandwidth(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
-
- linphone_core_set_download_bandwidth(pauline->lc, 100);
- video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
-
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-#endif /*VIDEO_ENABLED*/
-
static void _call_with_media_relay(bool_t random_ports) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
@@ -2991,9 +1945,7 @@ static void zrtp_cipher_call(void) {
call_base_with_configfile(LinphoneMediaEncryptionZRTP,FALSE,FALSE,LinphonePolicyNoFirewall,FALSE, "marie_zrtp_aes256_rc", "pauline_tcp_rc");
}
-static void zrtp_video_call(void) {
- call_base(LinphoneMediaEncryptionZRTP,TRUE,FALSE,LinphonePolicyNoFirewall,FALSE);
-}
+
static void dtls_srtp_call(void) {
call_base(LinphoneMediaEncryptionDTLS,FALSE,FALSE,LinphonePolicyNoFirewall,FALSE);
@@ -3006,18 +1958,7 @@ static void dtls_srtp_call_with_media_realy(void) {
static void dtls_srtp_ice_call(void) {
call_base(LinphoneMediaEncryptionDTLS,FALSE,FALSE,LinphonePolicyUseIce,FALSE);
}
-#ifdef VIDEO_ENABLED
-static void dtls_srtp_video_call(void) {
- call_base(LinphoneMediaEncryptionDTLS,TRUE,FALSE,LinphonePolicyNoFirewall,FALSE);
-}
-static void dtls_srtp_ice_video_call(void) {
- call_base(LinphoneMediaEncryptionDTLS,TRUE,FALSE,LinphonePolicyUseIce,FALSE);
-}
-static void dtls_srtp_ice_video_call_with_relay(void) {
- call_base(LinphoneMediaEncryptionDTLS,TRUE,TRUE,LinphonePolicyUseIce,FALSE);
-}
-#endif
static void call_with_declined_srtp(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
@@ -3087,7 +2028,7 @@ static void call_with_file_player(void) {
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphonePlayer *player;
char *hellopath = bc_tester_res("sounds/ahbahouaismaisbon.wav");
- char *recordpath = create_filepath(bc_tester_get_writable_dir_prefix(), "record-call_with_file_player", "wav");
+ char *recordpath = bc_tester_file("record-call_with_file_player.wav");
bool_t call_ok;
int attempts;
double similar=1;
@@ -3162,7 +2103,7 @@ static void call_with_mkv_file_player(void) {
ms_warning("Test skipped, no mkv support.");
goto end;
}
- recordpath = create_filepath(bc_tester_get_writable_dir_prefix(), "record-call_with_mkv_file_player", "wav");
+ recordpath = bc_tester_file("record-call_with_mkv_file_player.wav");
/*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/
unlink(recordpath);
@@ -3220,6 +2161,12 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video
LinphoneCoreManager* pauline = linphone_core_manager_new(pauline_rc);
bool_t call_ok;
+ // important: VP8 has really poor performances with the mire camera, at least
+ // on iOS - so when ever h264 is available, let's use it instead
+ if (linphone_core_find_payload_type(pauline->lc,"h264", -1, -1)!=NULL) {
+ disable_all_video_codecs_except_one(pauline->lc,"h264");
+ disable_all_video_codecs_except_one(marie->lc,"h264");
+ }
linphone_core_set_video_device(pauline->lc,liblinphone_tester_mire_id);
linphone_core_set_video_device(marie->lc,liblinphone_tester_mire_id);
@@ -3328,15 +2275,6 @@ void call_base(LinphoneMediaEncryption mode, bool_t enable_video,bool_t enable_r
call_base_with_configfile(mode, enable_video, enable_relay, policy, enable_tunnel, "marie_rc", "pauline_tcp_rc");
}
-#ifdef VIDEO_ENABLED
-static void srtp_video_ice_call(void) {
- call_base(LinphoneMediaEncryptionSRTP,TRUE,FALSE,LinphonePolicyUseIce,FALSE);
-}
-static void zrtp_video_ice_call(void) {
- call_base(LinphoneMediaEncryptionZRTP,TRUE,FALSE,LinphonePolicyUseIce,FALSE);
-}
-#endif
-
static void srtp_ice_call(void) {
call_base(LinphoneMediaEncryptionSRTP,FALSE,FALSE,LinphonePolicyUseIce,FALSE);
}
@@ -3378,10 +2316,10 @@ static void early_media_call_with_ice(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_early_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCall *marie_call;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
- lcs = ms_list_append(lcs, marie->lc);
- lcs = ms_list_append(lcs, pauline->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
+ lcs = bctbx_list_append(lcs, pauline->lc);
/*in this test, pauline has ICE activated, marie not, but marie proposes early media.
* We want to check that ICE processing is not disturbing early media*/
@@ -3407,7 +2345,7 @@ static void early_media_call_with_ice(void) {
end_call(marie, pauline);
end:
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@@ -3415,15 +2353,15 @@ end:
static void early_media_call_with_ringing(void){
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_tcp_rc");
- MSList* lcs = NULL;
+ bctbx_list_t* lcs = NULL;
LinphoneCall* marie_call;
LinphoneCallLog *marie_call_log;
uint64_t connected_time=0;
uint64_t ended_time=0;
int dummy=0;
- lcs = ms_list_append(lcs,marie->lc);
- lcs = ms_list_append(lcs,pauline->lc);
+ lcs = bctbx_list_append(lcs,marie->lc);
+ lcs = bctbx_list_append(lcs,pauline->lc);
/*
Marie calls Pauline, and after the call has rung, transitions to an early_media session
*/
@@ -3460,7 +2398,7 @@ static void early_media_call_with_ringing(void){
end_call(pauline, marie);
ended_time=ms_get_cur_time_ms();
BC_ASSERT_LOWER( labs((long)((linphone_call_log_get_duration(marie_call_log)*1000) - (int64_t)(ended_time - connected_time))), 1000, long, "%ld");
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
linphone_core_manager_destroy(marie);
@@ -3470,12 +2408,12 @@ static void early_media_call_with_ringing(void){
static void early_media_call_with_update_base(bool_t media_change){
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- MSList* lcs = NULL;
+ bctbx_list_t* lcs = NULL;
LinphoneCall *marie_call, *pauline_call;
LinphoneCallParams *pauline_params;
- lcs = ms_list_append(lcs,marie->lc);
- lcs = ms_list_append(lcs,pauline->lc);
+ lcs = bctbx_list_append(lcs,marie->lc);
+ lcs = bctbx_list_append(lcs,pauline->lc);
if (media_change) {
disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1);
disable_all_audio_codecs_except_one(pauline->lc,"pcmu",-1);
@@ -3532,7 +2470,7 @@ static void early_media_call_with_update_base(bool_t media_change){
end:
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@@ -3776,13 +2714,13 @@ static void call_redirect(void){
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* laure = linphone_core_manager_new("laure_rc_udp");
- MSList* lcs = NULL;
+ bctbx_list_t* lcs = NULL;
char *laure_url = NULL;
LinphoneCall* marie_call;
- lcs = ms_list_append(lcs,marie->lc);
- lcs = ms_list_append(lcs,pauline->lc);
- lcs = ms_list_append(lcs,laure->lc);
+ lcs = bctbx_list_append(lcs,marie->lc);
+ lcs = bctbx_list_append(lcs,pauline->lc);
+ lcs = bctbx_list_append(lcs,laure->lc);
/*
Marie calls Pauline, which will redirect the call to Laure via a 302
*/
@@ -3815,7 +2753,7 @@ static void call_redirect(void){
end_call(laure, marie);
}
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@@ -3926,114 +2864,7 @@ static void call_rejected_without_403_because_wrong_credentials_no_auth_req_cb(v
call_rejected_because_wrong_credentials_with_params("tester-no-403",FALSE);
}
-#ifdef VIDEO_ENABLED
-static void video_early_media_call(void) {
- LinphoneCoreManager *marie = linphone_core_manager_new("marie_early_rc");
- LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc");
- LinphoneCall *pauline_to_marie;
-
- linphone_core_set_video_device(pauline->lc, "Mire: Mire (synthetic moving picture)");
-
- video_call_base_3(pauline, marie, TRUE, LinphoneMediaEncryptionNone, TRUE, TRUE);
-
- BC_ASSERT_PTR_NOT_NULL(pauline_to_marie = linphone_core_get_current_call(pauline->lc));
- if(pauline_to_marie) {
- BC_ASSERT_EQUAL(pauline_to_marie->videostream->source->desc->id, MS_MIRE_ID, int, "%d");
- }
-
- end_call(pauline, marie);
-
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-/*this is call forking with early media managed at client side (not by flexisip server)*/
-static void multiple_early_media(void) {
- LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_tcp_rc");
- LinphoneCoreManager* marie1 = linphone_core_manager_new("marie_early_rc");
- LinphoneCoreManager* marie2 = linphone_core_manager_new("marie_early_rc");
- MSList *lcs=NULL;
- LinphoneCallParams *params=linphone_core_create_call_params(pauline->lc, NULL);
- LinphoneVideoPolicy pol;
- LinphoneCall *marie1_call;
- LinphoneCall *marie2_call;
- LinphoneCall *pauline_call;
- LinphoneInfoMessage *info;
- int dummy=0;
- pol.automatically_accept=1;
- pol.automatically_initiate=1;
-
- linphone_core_enable_video_capture(pauline->lc, TRUE);
- linphone_core_enable_video_display(pauline->lc, TRUE);
-
- linphone_core_enable_video_capture(marie1->lc, TRUE);
- linphone_core_enable_video_display(marie1->lc, TRUE);
- linphone_core_set_video_policy(marie1->lc,&pol);
-
- linphone_core_enable_video_capture(marie2->lc, TRUE);
- linphone_core_enable_video_display(marie2->lc, TRUE);
- linphone_core_set_video_policy(marie2->lc,&pol);
- linphone_core_set_audio_port_range(marie2->lc,40200,40300);
- linphone_core_set_video_port_range(marie2->lc,40400,40500);
-
- lcs=ms_list_append(lcs,marie1->lc);
- lcs=ms_list_append(lcs,marie2->lc);
- lcs=ms_list_append(lcs,pauline->lc);
-
- linphone_call_params_enable_early_media_sending(params,TRUE);
- linphone_call_params_enable_video(params,TRUE);
-
- linphone_core_invite_address_with_params(pauline->lc,marie1->identity,params);
- linphone_call_params_destroy(params);
-
- BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000));
- BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000));
- BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,3000));
-
- pauline_call=linphone_core_get_current_call(pauline->lc);
- marie1_call=linphone_core_get_current_call(marie1->lc);
- marie2_call=linphone_core_get_current_call(marie2->lc);
-
- BC_ASSERT_PTR_NOT_NULL(pauline_call);
- BC_ASSERT_PTR_NOT_NULL(marie1_call);
- BC_ASSERT_PTR_NOT_NULL(marie2_call);
-
- if (pauline_call && marie1_call && marie2_call){
-
- /*wait a bit that streams are established*/
- wait_for_list(lcs,&dummy,1,6000);
- BC_ASSERT_GREATER(linphone_core_manager_get_max_audio_down_bw(pauline),70,int,"%i");
- BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie1), 70, int, "%i");
- BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie2), 70, int, "%i");
-
- linphone_core_accept_call(marie1->lc,linphone_core_get_current_call(marie1->lc));
- BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000));
- BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,3000));
-
- /*marie2 should get her call terminated*/
- BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
-
- /*wait a bit that streams are established*/
- wait_for_list(lcs,&dummy,1,3000);
- BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(pauline), 71, int, "%i");
- BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie1), 71, int, "%i");
-
- /*send an INFO in reverse side to check that dialogs are properly established*/
- info=linphone_core_create_info_message(marie1->lc);
- linphone_call_send_info_message(marie1_call,info);
- BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_inforeceived,1,3000));
- }
-
- end_call(pauline, marie1);
-
- ms_list_free(lcs);
- linphone_core_manager_destroy(marie1);
- linphone_core_manager_destroy(marie2);
- linphone_core_manager_destroy(pauline);
-}
-#endif
-
-void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList* lcs,LinphoneMediaDirection audio_dir, LinphoneMediaDirection video_dir) {
+void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, bctbx_list_t* lcs,LinphoneMediaDirection audio_dir, LinphoneMediaDirection video_dir) {
BC_ASSERT_PTR_NOT_NULL(call);
if (call) {
const LinphoneCallParams *params;
@@ -4046,10 +2877,10 @@ void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList*
if (video_dir != LinphoneMediaDirectionInactive){
BC_ASSERT_TRUE(linphone_call_params_video_enabled(params));
+ BC_ASSERT_EQUAL(linphone_call_params_get_video_direction(params), video_dir, int, "%d");
+ linphone_call_set_next_video_frame_decoded_callback(call,linphone_call_iframe_decoded_cb,mgr->lc);
+ linphone_call_send_vfu_request(call);
}
- BC_ASSERT_EQUAL(linphone_call_params_get_video_direction(params), video_dir, int, "%d");
- linphone_call_set_next_video_frame_decoded_callback(call,linphone_call_iframe_decoded_cb,mgr->lc);
- linphone_call_send_vfu_request(call);
switch (video_dir) {
case LinphoneMediaDirectionInactive:
@@ -4095,121 +2926,8 @@ void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList*
}
}
-#ifdef VIDEO_ENABLED
-static void accept_call_in_send_only_base(LinphoneCoreManager* pauline, LinphoneCoreManager *marie, MSList *lcs) {
-#define DEFAULT_WAIT_FOR 10000
- LinphoneCallParams *params;
- LinphoneVideoPolicy pol;
- LinphoneCall *call;
- pol.automatically_accept=1;
- pol.automatically_initiate=1;
- linphone_core_enable_video_capture(pauline->lc, TRUE);
- linphone_core_enable_video_display(pauline->lc, TRUE);
- linphone_core_set_video_policy(pauline->lc,&pol);
- linphone_core_set_video_device(pauline->lc,liblinphone_tester_mire_id);
-
- linphone_core_enable_video_capture(marie->lc, TRUE);
- linphone_core_enable_video_display(marie->lc, TRUE);
- linphone_core_set_video_policy(marie->lc,&pol);
- linphone_core_set_video_device(marie->lc,liblinphone_tester_mire_id);
-
- linphone_call_set_next_video_frame_decoded_callback(linphone_core_invite_address(pauline->lc,marie->identity)
- ,linphone_call_iframe_decoded_cb
- ,pauline->lc);
-
-
- BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallIncomingReceived,1,DEFAULT_WAIT_FOR));
-
- {
- char* remote_uri = linphone_address_as_string_uri_only(pauline->identity);
- call = linphone_core_find_call_from_uri(marie->lc,remote_uri);
- ms_free(remote_uri);
- }
-
- if (call) {
- params=linphone_core_create_call_params(marie->lc, NULL);
- linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionSendOnly);
- linphone_call_params_set_video_direction(params,LinphoneMediaDirectionSendOnly);
- linphone_core_accept_call_with_params(marie->lc,call,params);
- linphone_call_params_destroy(params);
-
- BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning,1,DEFAULT_WAIT_FOR));
- BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallPausedByRemote,1,DEFAULT_WAIT_FOR));
-
- check_media_direction(marie,call,lcs,LinphoneMediaDirectionSendOnly,LinphoneMediaDirectionSendOnly);
- }
-
-
- call=linphone_core_get_current_call(pauline->lc);
- if (call) {
- check_media_direction(pauline,call,lcs,LinphoneMediaDirectionRecvOnly,LinphoneMediaDirectionRecvOnly);
- }
-
-}
-static void accept_call_in_send_base(bool_t caller_has_ice) {
- LinphoneCoreManager *pauline, *marie;
- MSList *lcs=NULL;;
-
- marie = linphone_core_manager_new("marie_rc");
- pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- if (caller_has_ice) {
- linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
- }
-
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
-
- accept_call_in_send_only_base(pauline,marie,lcs);
-
-
- end_call(marie,pauline);
- ms_list_free(lcs);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void accept_call_in_send_only(void) {
- accept_call_in_send_base(FALSE);
-}
-
-static void accept_call_in_send_only_with_ice(void) {
- accept_call_in_send_base(TRUE);
-}
-
-void two_accepted_call_in_send_only(void) {
- LinphoneCoreManager *pauline, *marie, *laure;
- MSList *lcs=NULL;
-
- marie = linphone_core_manager_new("marie_rc");
- linphone_core_use_files(marie->lc, TRUE);
- pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- laure = linphone_core_manager_new("laure_rc_udp");
-
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,laure->lc);
-
- accept_call_in_send_only_base(pauline,marie,lcs);
-
- reset_counters(&marie->stat);
- accept_call_in_send_only_base(laure,marie,lcs);
-
- end_call(pauline, marie);
- end_call(laure, marie);
-
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
- linphone_core_manager_destroy(laure);
- ms_list_free(lcs);
-}
-#endif
-
-static char *create_filepath(const char *dir, const char *filename, const char *ext) {
- return ms_strdup_printf("%s/%s.%s",dir,filename,ext);
-}
-
-static void record_call(const char *filename, bool_t enableVideo, const char *video_codec) {
+void record_call(const char *filename, bool_t enableVideo, const char *video_codec) {
LinphoneCoreManager *marie = NULL;
LinphoneCoreManager *pauline = NULL;
LinphoneCallParams *marieParams = NULL;
@@ -4223,6 +2941,13 @@ static void record_call(const char *filename, bool_t enableVideo, const char *vi
marie = linphone_core_manager_new("marie_h264_rc");
pauline = linphone_core_manager_new("pauline_h264_rc");
+ // important: VP8 has really poor performances with the mire camera, at least
+ // on iOS - so when ever h264 is available, let's use it instead
+ if (linphone_core_find_payload_type(pauline->lc,"h264", -1, -1)!=NULL) {
+ disable_all_video_codecs_except_one(pauline->lc,"h264");
+ disable_all_video_codecs_except_one(marie->lc,"h264");
+ }
+
#if defined(HAVE_OPENH264) && defined(ANDROID)
libmsopenh264_init(linphone_core_get_ms_factory(marie->lc));
linphone_core_reload_ms_plugins(marie->lc, NULL);
@@ -4250,7 +2975,9 @@ static void record_call(const char *filename, bool_t enableVideo, const char *vi
formats = linphone_core_get_supported_file_formats(marie->lc);
for(i=0, format = formats[0]; format != NULL; i++, format = formats[i]) {
- filepath = create_filepath(bc_tester_get_writable_dir_prefix(), filename, format);
+ char* totalname = ms_strdup_printf("%s.%s", filename, format);
+ filepath = bc_tester_file(totalname);
+ ms_free(totalname);
remove(filepath);
linphone_call_params_set_record_file(marieParams, filepath);
BC_ASSERT_TRUE(call_succeeded = call_with_params(marie, pauline, marieParams, paulineParams));
@@ -4276,54 +3003,6 @@ static void audio_call_recording_test(void) {
record_call("recording", FALSE, NULL);
}
-#ifdef VIDEO_ENABLED
-static void video_call_recording_h264_test(void) {
- record_call("recording", TRUE, "H264");
-}
-
-static void video_call_recording_vp8_test(void) {
- record_call("recording", TRUE, "VP8");
-}
-
-static void video_call_snapshot(void) {
- LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- LinphoneCallParams *marieParams = linphone_core_create_call_params(marie->lc, NULL);
- LinphoneCallParams *paulineParams = linphone_core_create_call_params(pauline->lc, NULL);
- LinphoneCall *callInst = NULL;
- char *filename = create_filepath(bc_tester_get_writable_dir_prefix(), "snapshot", "jpeg");
- int dummy = 0;
- bool_t call_succeeded = FALSE;
-
- linphone_core_enable_video_capture(marie->lc, TRUE);
- linphone_core_enable_video_display(marie->lc, TRUE);
- linphone_core_enable_video_capture(pauline->lc, TRUE);
- linphone_core_enable_video_display(pauline->lc, FALSE);
- linphone_call_params_enable_video(marieParams, TRUE);
- linphone_call_params_enable_video(paulineParams, TRUE);
-
- BC_ASSERT_TRUE(call_succeeded = call_with_params(marie, pauline, marieParams, paulineParams));
- BC_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc));
- if((call_succeeded == TRUE) && (callInst != NULL)) {
- int jpeg_support = linphone_call_take_video_snapshot(callInst, filename);
- if (jpeg_support < 0) {
- ms_warning("No jpegwriter support!");
- } else {
- wait_for_until(marie->lc, pauline->lc, &dummy, 1, 5000);
- BC_ASSERT_EQUAL(ortp_file_exist(filename), 0, int, "%d");
- remove(filename);
- }
- end_call(marie, pauline);
- }
- ms_free(filename);
- linphone_call_params_unref(marieParams);
- linphone_call_params_unref(paulineParams);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-#endif
-
static void call_with_in_dialog_update(void) {
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
@@ -4540,84 +3219,6 @@ static void outgoing_invite_with_invalid_sdp(void) {
linphone_core_manager_destroy(caller);
}
-static void incoming_reinvite_with_invalid_ack_sdp(void){
-#ifdef VIDEO_ENABLED
- LinphoneCoreManager* caller = linphone_core_manager_new( "pauline_tcp_rc");
- LinphoneCoreManager* callee = linphone_core_manager_new( "marie_rc");
- LinphoneCall * inc_call;
- BC_ASSERT_TRUE(call(caller,callee));
- inc_call = linphone_core_get_current_call(callee->lc);
-
- BC_ASSERT_PTR_NOT_NULL(inc_call);
- if (inc_call) {
- const LinphoneCallParams *caller_params;
- stats initial_caller_stat=caller->stat;
- stats initial_callee_stat=callee->stat;
- sal_call_set_sdp_handling(inc_call->op, SalOpSDPSimulateError); /* will force a parse error for the ACK SDP*/
- BC_ASSERT_PTR_NOT_NULL(setup_video(caller, callee, TRUE));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning));
- /*Basically the negotiation failed but since the call was already running, we expect it to restore to
- the previous state so error stats should not be changed*/
- BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,initial_callee_stat.number_of_LinphoneCallError, int, "%d");
- /*and remote should have received an update notification*/
- BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1, int, "%d");
-
-
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
- caller_params = linphone_call_get_current_params(linphone_core_get_current_call(caller->lc));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,(int*)&caller_params->has_video,FALSE));
-
- sal_call_set_sdp_handling(inc_call->op, SalOpSDPNormal);
- }
- end_call(caller, callee);
-
- linphone_core_manager_destroy(callee);
- linphone_core_manager_destroy(caller);
-#else
- ms_warning("not tested because video not available");
-#endif
-}
-
-static void outgoing_reinvite_with_invalid_ack_sdp(void) {
-#ifdef VIDEO_ENABLED
- LinphoneCoreManager* caller = linphone_core_manager_new( "pauline_tcp_rc");
- LinphoneCoreManager* callee = linphone_core_manager_new( "marie_rc");
- LinphoneCall * out_call;
- BC_ASSERT_TRUE(call(caller,callee));
- out_call = linphone_core_get_current_call(caller->lc);
-
- BC_ASSERT_PTR_NOT_NULL(out_call);
- if (out_call) {
- stats initial_caller_stat=caller->stat;
- stats initial_callee_stat=callee->stat;
- sal_call_set_sdp_handling(out_call->op, SalOpSDPSimulateError); /* will force a parse error for the ACK SDP*/
- BC_ASSERT_PTR_NOT_NULL(setup_video(caller, callee, TRUE));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1));
- BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning));
- /*Basically the negotiation failed but since the call was already running, we expect it to restore to
- the previous state so error stats should not be changed*/
- BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,initial_callee_stat.number_of_LinphoneCallError, int, "%d");
- /*and remote should not have received any update notification*/
- BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote, int, "%d");
-
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
- BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc))));
-
- sal_call_set_sdp_handling(out_call->op, SalOpSDPNormal);
- }
- end_call(caller, callee);
-
- linphone_core_manager_destroy(callee);
- linphone_core_manager_destroy(caller);
-#else
- ms_warning("not tested because video not available");
-#endif
-}
-
-
static void call_with_paused_no_sdp_on_resume(void) {
int dummy=0;
LinphoneCoreManager* marie;
@@ -4668,10 +3269,10 @@ end:
linphone_core_manager_destroy(pauline);
}
-static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ice ){
+void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ice ){
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- MSList* lcs = NULL;
+ bctbx_list_t* lcs = NULL;
LinphoneCall* marie_call;
LinphoneCallParams* params = NULL;
LinphoneCallLog *marie_call_log;
@@ -4679,8 +3280,8 @@ static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ic
uint64_t ended_time=0;
int dummy=0;
- lcs = ms_list_append(lcs,marie->lc);
- lcs = ms_list_append(lcs,pauline->lc);
+ lcs = bctbx_list_append(lcs,marie->lc);
+ lcs = bctbx_list_append(lcs,pauline->lc);
if (use_ice){
linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
}
@@ -4735,15 +3336,11 @@ static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ic
ended_time=ms_get_cur_time_ms();
BC_ASSERT_LOWER(labs((long)((linphone_call_log_get_duration(marie_call_log)*1000) - (int64_t)(ended_time - connected_time))), 1000, long, "%ld");
}
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
-static void call_with_early_media_and_no_sdp_in_200_with_video(void){
- early_media_without_sdp_in_200_base(TRUE, FALSE);
-}
-
static void call_with_early_media_and_no_sdp_in_200(void){
early_media_without_sdp_in_200_base(FALSE, FALSE);
}
@@ -4865,235 +3462,6 @@ static void call_with_transport_change_after_released(void) {
static void unsucessfull_call_with_transport_change_after_released(void) {
call_with_transport_change_base(FALSE);
}
-#ifdef VIDEO_ENABLED
-
-static void video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryption mode, bool_t no_sdp) {
- LinphoneCoreManager* marie;
- LinphoneCoreManager* pauline;
- LinphoneCallParams *params;
- const LinphoneCallParams *current_params;
- MSList *lcs=NULL;
- bool_t calls_ok;
-
- marie = linphone_core_manager_new( "marie_rc");
- pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- linphone_core_set_avpf_mode(pauline->lc,TRUE);
- linphone_core_set_video_device(pauline->lc,liblinphone_tester_mire_id);
- linphone_core_set_video_device(marie->lc,liblinphone_tester_mire_id);
- linphone_core_set_avpf_mode(marie->lc,TRUE);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
-
- video_call_base_2(marie,pauline,TRUE,mode,TRUE,TRUE);
-
- calls_ok = linphone_core_get_current_call(marie->lc) != NULL && linphone_core_get_current_call(pauline->lc) != NULL;
- BC_ASSERT_TRUE(calls_ok);
-
- if (calls_ok) {
- params=linphone_core_create_call_params(marie->lc,linphone_core_get_current_call(marie->lc));
- linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionInactive);
- linphone_call_params_set_video_direction(params,LinphoneMediaDirectionInactive);
-
- linphone_core_update_call(marie->lc, linphone_core_get_current_call(marie->lc),params);
- linphone_call_params_destroy(params);
-
- BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1));
- BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
- BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1));
-
- check_media_direction(marie,linphone_core_get_current_call(marie->lc),lcs,LinphoneMediaDirectionInactive,LinphoneMediaDirectionInactive);
- check_media_direction(pauline,linphone_core_get_current_call(pauline->lc), lcs, LinphoneMediaDirectionInactive, LinphoneMediaDirectionInactive);
-
- if (no_sdp) {
- linphone_core_enable_sdp_200_ack(marie->lc,TRUE);
- }
-
- params=linphone_core_create_call_params(marie->lc,linphone_core_get_current_call(marie->lc));
- linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionSendRecv);
- linphone_call_params_set_video_direction(params,LinphoneMediaDirectionSendRecv);
- linphone_core_update_call(marie->lc,linphone_core_get_current_call(marie->lc),params);
- linphone_call_params_destroy(params);
-
- BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,3));
- BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
-
- check_media_direction(marie,linphone_core_get_current_call(marie->lc),lcs,LinphoneMediaDirectionSendRecv,LinphoneMediaDirectionSendRecv);
- check_media_direction(pauline,linphone_core_get_current_call(pauline->lc),lcs,LinphoneMediaDirectionSendRecv,LinphoneMediaDirectionSendRecv);
-
- /*assert that after pause and resume, SRTP is still being used*/
- current_params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc));
- BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(current_params) , mode, int, "%d");
- current_params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc));
- BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(current_params) , mode, int, "%d");
-
- }
- end_call(marie,pauline);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void video_call_with_re_invite_inactive_followed_by_re_invite(void) {
- video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryptionNone,FALSE);
-}
-
-static void video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp(void) {
- video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryptionNone, TRUE);
-}
-
-static void srtp_video_call_with_re_invite_inactive_followed_by_re_invite(void) {
- if (ms_srtp_supported())
- video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryptionSRTP,FALSE);
- else
- ms_message("srtp_video_call_with_re_invite_inactive_followed_by_re_invite skipped, missing srtp support");
-}
-
-static void srtp_video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp(void) {
- if (ms_srtp_supported())
- video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryptionSRTP, TRUE);
- else
- ms_message("srtp_video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp skipped, missing srtp support");
-}
-
-static void video_call_ice_params(void) {
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
-
- linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
- linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
- video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-static void audio_call_with_ice_with_video_policy_enabled(void){
- LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- LinphoneVideoPolicy vpol;
-
-
- linphone_core_enable_video_capture(marie->lc, TRUE);
- linphone_core_enable_video_display(marie->lc, TRUE);
- linphone_core_enable_video_capture(pauline->lc, TRUE);
- linphone_core_enable_video_display(pauline->lc, TRUE);
- vpol.automatically_accept = vpol.automatically_initiate = TRUE;
- linphone_core_set_video_policy(marie->lc, &vpol);
- vpol.automatically_accept = vpol.automatically_initiate = FALSE;
- linphone_core_set_video_policy(pauline->lc, &vpol);
-
- linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
- linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
-
- linphone_core_invite_address(pauline->lc, marie->identity);
- if (!BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallIncomingReceived, 1))) goto end;
- linphone_core_accept_call(marie->lc, linphone_core_get_current_call(marie->lc));
- /*
- LinphoneCallParams *params;
- params = linphone_core_create_call_params(marie->lc, linphone_core_get_current_call(marie->lc));
- linphone_call_params_enable_video(params, TRUE);
- linphone_core_accept_call_with_params(marie->lc, linphone_core_get_current_call(marie->lc), params);
- linphone_call_params_destroy(params);*/
-
- /*wait for call to be established and ICE reINVITEs to be done */
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2));
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2));
-
- linphone_core_pause_call(marie->lc, linphone_core_get_current_call(marie->lc));
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallPausedByRemote, 1));
- BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallPaused, 1));
-
- end_call(marie, pauline);
-end:
- linphone_core_manager_destroy(marie);
- linphone_core_manager_destroy(pauline);
-}
-
-
-static void classic_video_entry_phone_setup(void) {
- LinphoneCoreManager *callee_mgr = linphone_core_manager_new("marie_rc");
- LinphoneCoreManager *caller_mgr = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- LinphoneCallParams *early_media_params = NULL;
- LinphoneCallParams *in_call_params = NULL;
- LinphoneCall *callee_call = NULL;
- LinphoneVideoPolicy vpol = { TRUE, TRUE };
- MSList *lcs = NULL;
- int retry = 0;
- bool_t ok;
-
- lcs = ms_list_append(lcs, caller_mgr->lc);
- lcs = ms_list_append(lcs, callee_mgr->lc);
-
- linphone_core_enable_video_capture(caller_mgr->lc, TRUE);
- linphone_core_enable_video_display(caller_mgr->lc, TRUE);
- linphone_core_enable_video_capture(callee_mgr->lc, TRUE);
- linphone_core_enable_video_display(callee_mgr->lc, TRUE);
- linphone_core_set_avpf_mode(caller_mgr->lc, LinphoneAVPFEnabled);
- linphone_core_set_avpf_mode(callee_mgr->lc, LinphoneAVPFEnabled);
- linphone_core_set_video_policy(caller_mgr->lc, &vpol);
- linphone_core_set_video_policy(callee_mgr->lc, &vpol);
- linphone_core_set_video_device(caller_mgr->lc, liblinphone_tester_mire_id);
- linphone_core_set_video_device(callee_mgr->lc, liblinphone_tester_mire_id);
-
- BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(caller_mgr->lc, callee_mgr->identity));
-
- ok = wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallIncomingReceived, 1);
- BC_ASSERT_TRUE(ok);
- if (!ok) goto end;
- BC_ASSERT_TRUE(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress == 1);
-
- callee_call = linphone_core_get_call_by_remote_address2(callee_mgr->lc, caller_mgr->identity);
- early_media_params = linphone_core_create_call_params(callee_mgr->lc, callee_call);
- linphone_call_params_set_audio_direction(early_media_params, LinphoneMediaDirectionInactive);
- linphone_call_params_set_video_direction(early_media_params, LinphoneMediaDirectionRecvOnly);
- linphone_core_accept_early_media_with_params(callee_mgr->lc, callee_call, early_media_params);
- linphone_call_params_destroy(early_media_params);
-
- while ((caller_mgr->stat.number_of_LinphoneCallOutgoingEarlyMedia != 1) && (retry++ < 100)) {
- linphone_core_iterate(caller_mgr->lc);
- linphone_core_iterate(callee_mgr->lc);
- ms_usleep(20000);
- }
- BC_ASSERT_TRUE(caller_mgr->stat.number_of_LinphoneCallOutgoingEarlyMedia == 1);
- BC_ASSERT_TRUE(callee_mgr->stat.number_of_LinphoneCallIncomingEarlyMedia == 1);
-
- check_media_direction(callee_mgr, callee_call, lcs, LinphoneMediaDirectionInactive, LinphoneMediaDirectionRecvOnly);
- callee_call = linphone_core_get_call_by_remote_address2(callee_mgr->lc, caller_mgr->identity);
- in_call_params = linphone_core_create_call_params(callee_mgr->lc, callee_call);
- linphone_call_params_set_audio_direction(in_call_params, LinphoneMediaDirectionSendRecv);
- linphone_call_params_set_video_direction(in_call_params, LinphoneMediaDirectionSendRecv);
- linphone_core_accept_call_with_params(callee_mgr->lc, callee_call, in_call_params);
- linphone_call_params_destroy(in_call_params);
-
- BC_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallConnected, 1));
- BC_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallConnected, 1));
-
- ok = wait_for_until(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, 1, 2000)
- && wait_for_until(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallStreamsRunning, 1, 2000);
- BC_ASSERT_TRUE(ok);
- if (!ok) goto end;
- check_media_direction(callee_mgr, callee_call, lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionSendRecv);
-
- callee_call = linphone_core_get_current_call(callee_mgr->lc);
- in_call_params = linphone_core_create_call_params(callee_mgr->lc, callee_call);
- linphone_call_params_set_audio_direction(in_call_params, LinphoneMediaDirectionRecvOnly);
- linphone_call_params_set_video_direction(in_call_params, LinphoneMediaDirectionSendOnly);
- linphone_core_update_call(callee_mgr->lc, callee_call, in_call_params);
- linphone_call_params_destroy(in_call_params);
-
- ok = wait_for_until(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, 2, 2000)
- && wait_for_until(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallStreamsRunning, 2, 2000);
- BC_ASSERT_TRUE(ok);
- if (!ok) goto end;
- callee_call = linphone_core_get_current_call(callee_mgr->lc);
- check_media_direction(callee_mgr, callee_call, lcs, LinphoneMediaDirectionRecvOnly, LinphoneMediaDirectionSendOnly);
-
- end_call(caller_mgr, callee_mgr);
-
-end:
- linphone_core_manager_destroy(callee_mgr);
- linphone_core_manager_destroy(caller_mgr);
- ms_list_free(lcs);
-}
-#endif
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID)
static void completion_cb(void *user_data, int percentage){
@@ -5195,6 +3563,14 @@ static void call_with_complex_late_offering(void){
linphone_core_enable_video_display(marie->lc, TRUE);
linphone_core_set_video_policy(pauline->lc, &vpol);
linphone_core_set_video_policy(marie->lc, &vpol);
+
+ // important: VP8 has really poor performances with the mire camera, at least
+ // on iOS - so when ever h264 is available, let's use it instead
+ if (linphone_core_find_payload_type(pauline->lc,"h264", -1, -1)!=NULL) {
+ disable_all_video_codecs_except_one(pauline->lc,"h264");
+ disable_all_video_codecs_except_one(marie->lc,"h264");
+ }
+
linphone_core_set_video_device(pauline->lc,liblinphone_tester_mire_id);
linphone_core_set_video_device(marie->lc,liblinphone_tester_mire_id);
@@ -5324,7 +3700,7 @@ static void call_with_rtp_io_mode(void) {
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphonePlayer *player;
char *hellopath = bc_tester_res("sounds/ahbahouaismaisbon.wav");
- char *recordpath = create_filepath(bc_tester_get_writable_dir_prefix(), "record-call_with_rtp_io_mode", "wav");
+ char *recordpath = bc_tester_file("record-call_with_rtp_io_mode.wav");
bool_t call_ok;
int attempts;
double similar=1;
@@ -5583,7 +3959,7 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
// The following are only used for the record test
LinphonePlayer *player;
char *hellopath = bc_tester_res("sounds/ahbahouaismaisbon.wav"); // File to be played
- char *recordpath = create_filepath(bc_tester_get_writable_dir_prefix(), "record-call_with_file_player", "wav"); // File to record the received sound
+ char *recordpath = bc_tester_file("record-call_with_file_player.wav"); // File to record the received sound
double similar = 1; // The factor of similarity between the played file and the one recorded
const double threshold = 0.85; // Minimum similarity value to consider the record file equal to the one sent
@@ -5700,8 +4076,8 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
rtp_stats_t pauline_rtp_stats = linphone_call_stats_get_rtp_stats(pauline_stats);
ms_message("Marie sent %i RTP packets and received %i (for real)", (int)marie_rtp_stats.packet_sent, (int)marie_rtp_stats.packet_recv);
ms_message("Pauline sent %i RTP packets and received %i (for real)", (int)pauline_rtp_stats.packet_sent, (int)pauline_rtp_stats.packet_recv);
- BC_ASSERT_TRUE(data_marie->packetReceivedCount == marie_rtp_stats.packet_recv);
- BC_ASSERT_TRUE(data_marie->packetSentCount == marie_rtp_stats.packet_sent);
+ BC_ASSERT_EQUAL(data_marie->packetReceivedCount, marie_rtp_stats.packet_recv, unsigned long long, "%llu");
+ BC_ASSERT_EQUAL(data_marie->packetSentCount, marie_rtp_stats.packet_sent, unsigned long long, "%llu");
// There can be a small difference between the number of packets received in the modifier and the number processed in reception because the processing is asynchronous
BC_ASSERT_TRUE(data_pauline->packetReceivedCount - pauline_rtp_stats.packet_recv < 20);
BC_ASSERT_TRUE(data_pauline->packetSentCount == pauline_rtp_stats.packet_sent);
@@ -5785,11 +4161,11 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCallParams *pauline_params = NULL;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
bool_t call_ok;
- lcs = ms_list_append(lcs, marie->lc);
- lcs = ms_list_append(lcs, pauline->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
+ lcs = bctbx_list_append(lcs, pauline->lc);
if (use_ice){
linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
@@ -5851,7 +4227,7 @@ end:
if (pauline_params) {
linphone_call_params_unref(pauline_params);
}
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@@ -5875,13 +4251,13 @@ static void call_with_network_switch_and_socket_refresh(void){
static void call_with_sip_and_rtp_independant_switches(void){
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
bool_t call_ok;
bool_t use_ice = TRUE;
bool_t with_socket_refresh = TRUE;
- lcs = ms_list_append(lcs, marie->lc);
- lcs = ms_list_append(lcs, pauline->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
+ lcs = bctbx_list_append(lcs, pauline->lc);
if (use_ice){
linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
@@ -5944,42 +4320,42 @@ static void call_with_sip_and_rtp_independant_switches(void){
/*pauline shall be able to end the call without problem now*/
end_call(pauline, marie);
end:
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
-#ifdef CALL_LOGS_STORAGE_ENABLED
+#ifdef SQLITE_STORAGE_ENABLED
static void call_logs_if_no_db_set(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* laure = linphone_core_manager_new("laure_call_logs_rc");
- BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 10);
+ BC_ASSERT_TRUE(bctbx_list_size(laure->lc->call_logs) == 10);
BC_ASSERT_TRUE(call(marie, laure));
wait_for_until(marie->lc, laure->lc, NULL, 5, 1000);
end_call(marie, laure);
- BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 11);
+ BC_ASSERT_TRUE(bctbx_list_size(laure->lc->call_logs) == 11);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(laure);
}
static void call_logs_migrate(void) {
LinphoneCoreManager* laure = linphone_core_manager_new("laure_call_logs_rc");
- char *logs_db = create_filepath(bc_tester_get_writable_dir_prefix(), "call_logs", "db");
- int i = 0;
+ char *logs_db = bc_tester_file("call_logs.db");
+ size_t i = 0;
int incoming_count = 0, outgoing_count = 0, missed_count = 0, aborted_count = 0, decline_count = 0, video_enabled_count = 0;
unlink(logs_db);
- BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 10);
+ BC_ASSERT_TRUE(bctbx_list_size(laure->lc->call_logs) == 10);
linphone_core_set_call_logs_database_path(laure->lc, logs_db);
BC_ASSERT_TRUE(linphone_core_get_call_history_size(laure->lc) == 10);
- for (; i < ms_list_size(laure->lc->call_logs); i++) {
- LinphoneCallLog *log = ms_list_nth_data(laure->lc->call_logs, i);
+ for (; i < bctbx_list_size(laure->lc->call_logs); i++) {
+ LinphoneCallLog *log = bctbx_list_nth_data(laure->lc->call_logs, i);
LinphoneCallStatus state = linphone_call_log_get_status(log);
LinphoneCallDir direction = linphone_call_log_get_dir(log);
@@ -6018,9 +4394,9 @@ static void call_logs_migrate(void) {
}
}
- laure->lc->call_logs = ms_list_free_with_data(laure->lc->call_logs, (void (*)(void*))linphone_call_log_unref);
+ laure->lc->call_logs = bctbx_list_free_with_data(laure->lc->call_logs, (void (*)(void*))linphone_call_log_unref);
call_logs_read_from_config_file(laure->lc);
- BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 0);
+ BC_ASSERT_TRUE(bctbx_list_size(laure->lc->call_logs) == 0);
unlink(logs_db);
ms_free(logs_db);
@@ -6030,8 +4406,8 @@ static void call_logs_migrate(void) {
static void call_logs_sqlite_storage(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- char *logs_db = create_filepath(bc_tester_get_writable_dir_prefix(), "call_logs", "db");
- MSList *logs = NULL;
+ char *logs_db = bc_tester_file("call_logs.db");
+ bctbx_list_t *logs = NULL;
LinphoneCallLog *call_log = NULL;
LinphoneAddress *laure = NULL;
time_t user_data_time = time(NULL);
@@ -6051,21 +4427,21 @@ static void call_logs_sqlite_storage(void) {
BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 1);
logs = linphone_core_get_call_history_for_address(marie->lc, linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc)));
- BC_ASSERT_TRUE(ms_list_size(logs) == 1);
- ms_list_free_with_data(logs, (void (*)(void*))linphone_call_log_unref);
+ BC_ASSERT_TRUE(bctbx_list_size(logs) == 1);
+ bctbx_list_free_with_data(logs, (void (*)(void*))linphone_call_log_unref);
laure = linphone_address_new("\"Laure\" ");
logs = linphone_core_get_call_history_for_address(marie->lc, laure);
- BC_ASSERT_TRUE(ms_list_size(logs) == 0);
+ BC_ASSERT_TRUE(bctbx_list_size(logs) == 0);
linphone_address_destroy(laure);
logs = linphone_core_get_call_history_for_address(marie->lc, linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc)));
- if (BC_ASSERT_TRUE(ms_list_size(logs) == 1)) {
+ if (BC_ASSERT_TRUE(bctbx_list_size(logs) == 1)) {
const char *call_id;
const char *ref_key = linphone_call_log_get_ref_key(call_log);
call_log = logs->data;
BC_ASSERT_EQUAL(linphone_call_log_get_dir(call_log), LinphoneCallOutgoing, int, "%d");
- BC_ASSERT_LOWER(linphone_call_log_get_duration(call_log), 2, float, "%.1f");
+ BC_ASSERT_LOWER(linphone_call_log_get_duration(call_log), 2, int, "%d");
BC_ASSERT_TRUE(linphone_address_equal(
linphone_call_log_get_from_address(call_log),
linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(marie->lc))));
@@ -6073,7 +4449,7 @@ static void call_logs_sqlite_storage(void) {
linphone_call_log_get_to_address(call_log),
linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc))));
BC_ASSERT_PTR_NOT_NULL(linphone_call_log_get_local_stats(call_log));
- BC_ASSERT_GREATER(linphone_call_log_get_quality(call_log), -1, int, "%d");
+ BC_ASSERT_GREATER(linphone_call_log_get_quality(call_log), -1, float, "%.1f");
BC_ASSERT_PTR_NOT_NULL(ref_key);
if (ref_key) {
BC_ASSERT_STRING_EQUAL(ref_key, "ref_key");
@@ -6093,12 +4469,12 @@ static void call_logs_sqlite_storage(void) {
linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc))));
BC_ASSERT_PTR_NOT_NULL(linphone_call_log_get_remote_stats(call_log));
- BC_ASSERT_EQUAL(linphone_call_log_get_start_date(call_log), start_time, int, "%d");
+ BC_ASSERT_EQUAL(linphone_call_log_get_start_date(call_log), start_time, unsigned long long, "%llu");
BC_ASSERT_EQUAL(linphone_call_log_get_status(call_log), LinphoneCallSuccess, int, "%d");
}
- linphone_core_delete_call_log(marie->lc, (LinphoneCallLog *)ms_list_nth_data(logs, 0));
- ms_list_free_with_data(logs, (void (*)(void*))linphone_call_log_unref);
+ linphone_core_delete_call_log(marie->lc, (LinphoneCallLog *)bctbx_list_nth_data(logs, 0));
+ bctbx_list_free_with_data(logs, (void (*)(void*))linphone_call_log_unref);
BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 0);
reset_counters(&marie->stat);
@@ -6178,10 +4554,10 @@ static void _call_with_rtcp_mux(bool_t caller_rtcp_mux, bool_t callee_rtcp_mux,
LinphoneCoreManager * marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
const LinphoneCallParams *params;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
- lcs = ms_list_append(lcs, marie->lc);
- lcs = ms_list_append(lcs, pauline->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
+ lcs = bctbx_list_append(lcs, pauline->lc);
if (caller_rtcp_mux){
lp_config_set_int(linphone_core_get_config(marie->lc), "rtp", "rtcp_mux", 1);
@@ -6228,7 +4604,7 @@ static void _call_with_rtcp_mux(bool_t caller_rtcp_mux, bool_t callee_rtcp_mux,
end_call(marie,pauline);
end:
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
@@ -6327,6 +4703,18 @@ static void call_with_ice_without_stun(void){
linphone_core_manager_destroy(pauline);
}
+static void call_with_ice_without_stun2(void){
+ LinphoneCoreManager * marie = linphone_core_manager_new( "marie_rc");
+ LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+
+ //linphone_core_set_stun_server(marie->lc, NULL);
+ linphone_core_set_stun_server(pauline->lc, NULL);
+ _call_with_ice_base(marie, pauline, TRUE, TRUE, TRUE, FALSE);
+
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
static void call_with_zrtp_configured_calling_side(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
@@ -6407,21 +4795,20 @@ 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");
-
- 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*/
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_v4proxy_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_v4proxy_rc");
- } else ms_warning("Test skipped, need both ipv6 and v4 available");
+ 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*/
+
+ } else ms_warning("Test skipped, need both ipv6 and v4 available");
}
-
test_t call_tests[] = {
TEST_NO_TAG("Early declined call", early_declined_call),
TEST_NO_TAG("Call declined", call_declined),
@@ -6457,13 +4844,6 @@ test_t call_tests[] = {
TEST_NO_TAG("Call without SDP and ACK without SDP", call_with_no_sdp_ack_without_sdp),
TEST_NO_TAG("Call paused resumed", call_paused_resumed),
TEST_NO_TAG("Call paused resumed with sip packets looses", call_paused_resumed_with_sip_packets_losses),
-#ifdef VIDEO_ENABLED
- TEST_NO_TAG("Call paused resumed with video", call_paused_resumed_with_video),
- TEST_NO_TAG("Call paused resumed with video no sdp ack", call_paused_resumed_with_no_sdp_ack),
- TEST_NO_TAG("Call paused resumed with video no sdk ack using video policy for resume offers", call_paused_resumed_with_no_sdp_ack_using_video_policy),
- TEST_NO_TAG("Call paused, updated and resumed with video no sdk ack using video policy for resume offers", call_paused_updated_resumed_with_no_sdp_ack_using_video_policy),
- TEST_NO_TAG("Call paused, updated and resumed with video no sdk ack using video policy for resume offers with accept call update", call_paused_updated_resumed_with_no_sdp_ack_using_video_policy_and_accept_call_update),
-#endif
TEST_NO_TAG("Call paused by both parties", call_paused_by_both),
TEST_NO_TAG("Call paused resumed with loss", call_paused_resumed_with_loss),
TEST_NO_TAG("Call paused resumed from callee", call_paused_resumed_from_callee),
@@ -6473,67 +4853,11 @@ test_t call_tests[] = {
TEST_NO_TAG("ZRTP Cipher call", zrtp_cipher_call),
TEST_NO_TAG("DTLS SRTP call", dtls_srtp_call),
TEST_NO_TAG("DTLS SRTP call with media relay", dtls_srtp_call_with_media_realy),
- TEST_NO_TAG("ZRTP video call", zrtp_video_call),
TEST_NO_TAG("SRTP call with declined srtp", call_with_declined_srtp),
TEST_NO_TAG("SRTP call paused and resumed", call_srtp_paused_and_resumed),
TEST_NO_TAG("Call with file player", call_with_file_player),
TEST_NO_TAG("Call with mkv file player", call_with_mkv_file_player),
TEST_ONE_TAG("Audio call with ICE no matching audio codecs", audio_call_with_ice_no_matching_audio_codecs, "ICE"),
-#ifdef VIDEO_ENABLED
- TEST_NO_TAG("Simple video call AVPF", video_call_avpf),
- TEST_NO_TAG("Simple video call implicit AVPF both", video_call_using_policy_AVPF_implicit_caller_and_callee),
- TEST_NO_TAG("Simple video call disable implicit AVPF on callee", video_call_disable_implicit_AVPF_on_callee),
- TEST_NO_TAG("Simple video call disable implicit AVPF on caller", video_call_disable_implicit_AVPF_on_caller),
- TEST_NO_TAG("Simple video call AVPF to implicit AVPF", video_call_AVPF_to_implicit_AVPF),
- TEST_NO_TAG("Simple video call implicit AVPF to AVPF", video_call_implicit_AVPF_to_AVPF),
- TEST_NO_TAG("Simple video call", video_call),
- TEST_NO_TAG("Simple video call without rtcp",video_call_without_rtcp),
- TEST_NO_TAG("Simple ZRTP video call", video_call_zrtp),
- TEST_NO_TAG("Simple DTLS video call", video_call_dtls),
- TEST_NO_TAG("Simple video call using policy", video_call_using_policy),
- TEST_NO_TAG("Video call using policy with callee video disabled", video_call_using_policy_with_callee_video_disabled),
- TEST_NO_TAG("Video call using policy with caller video disabled", video_call_using_policy_with_caller_video_disabled),
- TEST_NO_TAG("Video call without SDP", video_call_no_sdp),
- TEST_ONE_TAG("SRTP ice video call", srtp_video_ice_call, "ICE"),
- TEST_ONE_TAG("ZRTP ice video call", zrtp_video_ice_call, "ICE"),
- TEST_NO_TAG("Call with video added", call_with_video_added),
- TEST_NO_TAG("Call with video added 2", call_with_video_added_2),
- TEST_NO_TAG("Call with video added (random ports)", call_with_video_added_random_ports),
- TEST_NO_TAG("Call with several video switches", call_with_several_video_switches),
- TEST_NO_TAG("SRTP call with several video switches", srtp_call_with_several_video_switches),
- TEST_NO_TAG("Call with video declined", call_with_declined_video),
- TEST_NO_TAG("Call with video declined despite policy", call_with_declined_video_despite_policy),
- TEST_NO_TAG("Call with video declined using policy", call_with_declined_video_using_policy),
- TEST_NO_TAG("Video early-media call", video_early_media_call),
- TEST_NO_TAG("Call with multiple early media", multiple_early_media),
- TEST_ONE_TAG("Call with ICE from video to non-video", call_with_ice_video_to_novideo, "ICE"),
- TEST_ONE_TAG("Call with ICE and video added", call_with_ice_video_added, "ICE"),
- TEST_ONE_TAG("Call with ICE and video added 2", call_with_ice_video_added_2, "ICE"),
- TEST_ONE_TAG("Call with ICE and video added 3", call_with_ice_video_added_3, "ICE"),
- TEST_ONE_TAG("Call with ICE and video added and refused", call_with_ice_video_added_and_refused, "ICE"),
- TEST_ONE_TAG("Call with ICE and video added with video policies to false", call_with_ice_video_added_with_video_policies_to_false, "ICE"),
-#if ICE_WAS_WORKING_WITH_REAL_TIME_TEXT
- TEST_ONE_TAG("Call with ICE, video and realtime text", call_with_ice_video_and_rtt, "ICE"),
-#endif
- TEST_ONE_TAG("Video call with ICE accepted using call params", video_call_ice_params, "ICE"),
- TEST_ONE_TAG("Audio call with ICE paused with caller video policy enabled", audio_call_with_ice_with_video_policy_enabled, "ICE"),
- TEST_NO_TAG("Video call recording (H264)", video_call_recording_h264_test),
- TEST_NO_TAG("Video call recording (VP8)", video_call_recording_vp8_test),
- TEST_NO_TAG("Snapshot", video_call_snapshot),
- TEST_NO_TAG("Video call with early media and no matching audio codecs", video_call_with_early_media_no_matching_audio_codecs),
- TEST_NO_TAG("DTLS SRTP video call", dtls_srtp_video_call),
- TEST_ONE_TAG("DTLS SRTP ice video call", dtls_srtp_ice_video_call, "ICE"),
- TEST_ONE_TAG("DTLS SRTP ice video call with relay", dtls_srtp_ice_video_call_with_relay, "ICE"),
- TEST_NO_TAG("Video call with limited bandwidth", video_call_limited_bandwidth),
- TEST_NO_TAG("Video call accepted in send only", accept_call_in_send_only),
- TEST_ONE_TAG("Video call accepted in send only with ice", accept_call_in_send_only_with_ice, "ICE"),
- TEST_NO_TAG("2 Video call accepted in send only", two_accepted_call_in_send_only),
- TEST_NO_TAG("Video call with re-invite(inactive) followed by re-invite", video_call_with_re_invite_inactive_followed_by_re_invite),
- TEST_NO_TAG("Video call with re-invite(inactive) followed by re-invite(no sdp)", video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp),
- TEST_NO_TAG("SRTP Video call with re-invite(inactive) followed by re-invite", srtp_video_call_with_re_invite_inactive_followed_by_re_invite),
- TEST_NO_TAG("SRTP Video call with re-invite(inactive) followed by re-invite(no sdp)", srtp_video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp),
- TEST_NO_TAG("Classic video entry phone setup", classic_video_entry_phone_setup),
-#endif
TEST_ONE_TAG("SRTP ice call", srtp_ice_call, "ICE"),
TEST_ONE_TAG("ZRTP ice call", zrtp_ice_call, "ICE"),
TEST_ONE_TAG("ZRTP ice call with relay", zrtp_ice_call_with_relay, "ICE"),
@@ -6550,6 +4874,7 @@ test_t call_tests[] = {
TEST_ONE_TAG("Call with ICE (forced relay)", call_with_ice_forced_relay, "ICE"),
TEST_ONE_TAG("Call from ICE to not ICE", ice_to_not_ice, "ICE"),
TEST_ONE_TAG("Call from not ICE to ICE", not_ice_to_ice, "ICE"),
+ TEST_ONE_TAG("Call with ICE added by reINVITE", ice_added_by_reinvite, "ICE"),
TEST_NO_TAG("Call with custom headers", call_with_custom_headers),
TEST_NO_TAG("Call with custom SDP attributes", call_with_custom_sdp_attributes),
TEST_NO_TAG("Call established with rejected INFO", call_established_with_rejected_info),
@@ -6562,21 +4887,17 @@ test_t call_tests[] = {
TEST_NO_TAG("Call redirected by callee", call_redirect),
TEST_NO_TAG("Call with specified codec bitrate", call_with_specified_codec_bitrate),
TEST_NO_TAG("Call with no audio codec", call_with_no_audio_codec),
- TEST_NO_TAG("Video call with no audio and no video codec", video_call_with_no_audio_and_no_video_codec),
TEST_NO_TAG("Call with in-dialog UPDATE request", call_with_in_dialog_update),
TEST_NO_TAG("Call with in-dialog very early call request", call_with_very_early_call_update),
TEST_NO_TAG("Call with in-dialog codec change", call_with_in_dialog_codec_change),
TEST_NO_TAG("Call with in-dialog codec change no sdp", call_with_in_dialog_codec_change_no_sdp),
TEST_NO_TAG("Call with pause no SDP on resume", call_with_paused_no_sdp_on_resume),
TEST_NO_TAG("Call with early media and no SDP in 200 Ok", call_with_early_media_and_no_sdp_in_200),
- TEST_NO_TAG("Call with early media and no SDP in 200 Ok with video", call_with_early_media_and_no_sdp_in_200_with_video),
TEST_ONE_TAG("Call with ICE and no SDP in 200 OK", call_with_early_media_ice_and_no_sdp_in_200, "ICE"),
TEST_NO_TAG("Call with custom supported tags", call_with_custom_supported_tags),
TEST_NO_TAG("Call log from taken from asserted id", call_log_from_taken_from_p_asserted_id),
TEST_NO_TAG("Incoming INVITE with invalid SDP", incoming_invite_with_invalid_sdp),
TEST_NO_TAG("Outgoing INVITE with invalid ACK SDP", outgoing_invite_with_invalid_sdp),
- TEST_NO_TAG("Incoming REINVITE with invalid SDP in ACK", incoming_reinvite_with_invalid_ack_sdp),
- TEST_NO_TAG("Outgoing REINVITE with invalid SDP in ACK", outgoing_reinvite_with_invalid_ack_sdp),
TEST_NO_TAG("Call with generic CN", call_with_generic_cn),
TEST_NO_TAG("Call with transport change after released", call_with_transport_change_after_released),
TEST_NO_TAG("Unsuccessful call with transport change after released", unsucessfull_call_with_transport_change_after_released),
@@ -6587,7 +4908,7 @@ test_t call_tests[] = {
TEST_NO_TAG("Call with RTP IO mode", call_with_rtp_io_mode),
TEST_NO_TAG("Call with generic NACK RTCP feedback", call_with_generic_nack_rtcp_feedback),
TEST_NO_TAG("Call with complex late offering", call_with_complex_late_offering),
-#ifdef CALL_LOGS_STORAGE_ENABLED
+#ifdef SQLITE_STORAGE_ENABLED
TEST_NO_TAG("Call log working if no db set", call_logs_if_no_db_set),
TEST_NO_TAG("Call log storage migration from rc to db", call_logs_migrate),
TEST_NO_TAG("Call log storage in sqlite database", call_logs_sqlite_storage),
@@ -6608,6 +4929,7 @@ test_t call_tests[] = {
TEST_ONE_TAG("Call with ICE and rtcp-mux without ICE re-invite", call_with_ice_and_rtcp_mux_without_reinvite, "ICE"),
TEST_ONE_TAG("Call with ICE with default candidate not stun", call_with_ice_with_default_candidate_not_stun, "ICE"),
TEST_ONE_TAG("Call with ICE without stun server", call_with_ice_without_stun, "ICE"),
+ TEST_ONE_TAG("Call with ICE without stun server one side", call_with_ice_without_stun2, "ICE"),
TEST_NO_TAG("call with ZRTP configured calling side only", call_with_zrtp_configured_calling_side),
TEST_NO_TAG("call with ZRTP configured receiver side only", call_with_zrtp_configured_callee_side)
};
diff --git a/tester/call_video_tester.c b/tester/call_video_tester.c
new file mode 100644
index 000000000..2f8abfaaf
--- /dev/null
+++ b/tester/call_video_tester.c
@@ -0,0 +1,1782 @@
+/*
+ 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 "linphonecore.h"
+#include "liblinphone_tester.h"
+#include "private.h"
+
+#ifdef VIDEO_ENABLED
+static void call_paused_resumed_with_video_base_call_cb(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message) {
+ if (cstate == LinphoneCallUpdatedByRemote) {
+ LinphoneCallParams *params = linphone_core_create_call_params(lc, call);
+ linphone_call_params_enable_video(params, TRUE);
+ ms_message (" New state LinphoneCallUpdatedByRemote on call [%p], accepting with video on",call);
+ BC_ASSERT_NOT_EQUAL(linphone_core_accept_call_update(lc, call, params), 0, int, "%i");
+ linphone_call_params_destroy(params);
+ }
+}
+/*this test makes sure that pause/resume will not bring up video by accident*/
+static void call_paused_resumed_with_video_base(bool_t sdp_200_ack
+ ,bool_t use_video_policy_for_re_invite_sdp_200
+ ,bool_t resume_in_audio_send_only_video_inactive_first
+ ,bool_t with_call_accept){
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneCall* call_pauline, *call_marie;
+ bctbx_list_t *lcs = NULL;
+ LinphoneVideoPolicy vpol;
+ bool_t call_ok;
+ LinphoneCoreVTable *vtable = linphone_core_v_table_new();
+ vtable->call_state_changed = call_paused_resumed_with_video_base_call_cb;
+ lcs = bctbx_list_append(lcs, pauline->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
+
+ vpol.automatically_accept = FALSE;
+ vpol.automatically_initiate = TRUE; /* needed to present a video mline*/
+
+ linphone_core_set_video_policy(marie->lc, &vpol);
+ linphone_core_enable_video_capture(marie->lc, TRUE);
+ linphone_core_enable_video_display(marie->lc, TRUE);
+
+ vpol.automatically_accept = FALSE;
+ vpol.automatically_initiate = TRUE;
+
+ linphone_core_set_video_policy(pauline->lc, &vpol);
+ linphone_core_enable_video_capture(pauline->lc, TRUE);
+ linphone_core_enable_video_display(pauline->lc, TRUE);
+
+ BC_ASSERT_TRUE((call_ok=call(marie, pauline)));
+
+ if (!call_ok) goto end;
+
+ call_pauline = linphone_core_get_current_call(pauline->lc);
+ call_marie = linphone_core_get_current_call(marie->lc);
+
+ wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
+
+ linphone_core_pause_call(pauline->lc,call_pauline);
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1));
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1));
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_remote_params(call_marie)));
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1));
+
+ /*stay in pause a little while in order to generate traffic*/
+ wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
+
+ /*check if video stream is still offered even if disabled*/
+
+ BC_ASSERT_EQUAL(call_pauline->localdesc->nb_streams, 2, int, "%i");
+ BC_ASSERT_EQUAL(call_marie->localdesc->nb_streams, 2, int, "%i");
+
+ linphone_core_enable_sdp_200_ack(pauline->lc,sdp_200_ack);
+
+ if (use_video_policy_for_re_invite_sdp_200) {
+ LpConfig *marie_lp;
+ marie_lp = linphone_core_get_config(marie->lc);
+ lp_config_set_int(marie_lp,"sip","sdp_200_ack_follow_video_policy",1);
+ }
+ /*now pauline wants to resume*/
+ if (resume_in_audio_send_only_video_inactive_first) {
+ LinphoneCallParams *params = linphone_core_create_call_params(pauline->lc, call_pauline);
+ linphone_call_params_set_video_direction(params,LinphoneMediaDirectionInactive);
+ linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionSendOnly);
+ linphone_core_update_call(pauline->lc,call_pauline,params);
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,2));
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdating,1));
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
+ linphone_call_params_set_video_direction(params,LinphoneMediaDirectionSendRecv);
+ linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionSendRecv);
+ if (with_call_accept) {
+ linphone_core_add_listener(marie->lc, vtable);
+ }
+ linphone_core_update_call(pauline->lc,call_pauline,params);
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,3));
+ linphone_call_params_destroy(params);
+ } else {
+ linphone_core_resume_call(pauline->lc, call_pauline);
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallResuming,1));
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
+ }
+
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
+
+ if (use_video_policy_for_re_invite_sdp_200) {
+ /*make sure video was offered*/
+ BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_remote_params(call_pauline)));
+ } else {
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline)));
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_marie)));
+ }
+ end_call(marie, pauline);
+
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+ bctbx_list_free(lcs);
+}
+static void call_paused_resumed_with_video(void){
+ call_paused_resumed_with_video_base(FALSE, FALSE,FALSE,FALSE);
+}
+
+static void call_paused_resumed_with_no_sdp_ack(void){
+ call_paused_resumed_with_video_base(TRUE, FALSE,FALSE,FALSE);
+}
+static void call_paused_resumed_with_no_sdp_ack_using_video_policy(void){
+ call_paused_resumed_with_video_base(TRUE, TRUE,FALSE,FALSE);
+}
+static void call_paused_updated_resumed_with_no_sdp_ack_using_video_policy(void){
+ call_paused_resumed_with_video_base(TRUE, TRUE,TRUE,FALSE);
+}
+static void call_paused_updated_resumed_with_no_sdp_ack_using_video_policy_and_accept_call_update(void){
+ call_paused_resumed_with_video_base(TRUE, TRUE,TRUE,TRUE);
+}
+
+static void zrtp_video_call(void) {
+ call_base(LinphoneMediaEncryptionZRTP,TRUE,FALSE,LinphonePolicyNoFirewall,FALSE);
+}
+
+static LinphoneCall* setup_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t change_video_policy) {
+ LinphoneVideoPolicy caller_policy;
+ LinphoneCallParams* callee_params;
+ LinphoneCall* call_obj;
+
+ if (!linphone_core_get_current_call(callee->lc) || linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning
+ || !linphone_core_get_current_call(caller->lc) || linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning ) {
+ ms_warning("bad state for adding video");
+ return NULL;
+ }
+
+ if (change_video_policy) {
+ caller_policy.automatically_accept=TRUE;
+ caller_policy.automatically_initiate=TRUE;
+ linphone_core_set_video_policy(caller->lc,&caller_policy);
+ }
+ linphone_core_enable_video_capture(callee->lc, TRUE);
+ linphone_core_enable_video_display(callee->lc, TRUE);
+ linphone_core_enable_video_capture(caller->lc, TRUE);
+ linphone_core_enable_video_display(caller->lc, FALSE);
+
+ if ((call_obj = linphone_core_get_current_call(callee->lc))) {
+ callee_params = linphone_core_create_call_params(callee->lc, call_obj);
+ /*add video*/
+ linphone_call_params_enable_video(callee_params,TRUE);
+ linphone_core_update_call(callee->lc,call_obj,callee_params);
+ linphone_call_params_destroy(callee_params);
+ }
+ return call_obj;
+}
+
+bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t change_video_policy) {
+ stats initial_caller_stat=caller->stat;
+ stats initial_callee_stat=callee->stat;
+ const LinphoneVideoPolicy *video_policy;
+ LinphoneCall *call_obj;
+ if ((call_obj=setup_video(caller, callee, change_video_policy))){
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning+1));
+
+ video_policy = linphone_core_get_video_policy(caller->lc);
+ if (video_policy->automatically_accept) {
+ BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
+ BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc))));
+ } else {
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc))));
+ }
+ if (linphone_core_get_media_encryption(caller->lc) != LinphoneMediaEncryptionNone
+ && linphone_core_get_media_encryption(callee->lc) != LinphoneMediaEncryptionNone) {
+ const LinphoneCallParams* call_param;
+
+ switch (linphone_core_get_media_encryption(caller->lc)) {
+ case LinphoneMediaEncryptionZRTP:
+ case LinphoneMediaEncryptionDTLS:
+ /*wait for encryption to be on, in case of zrtp/dtls, it can take a few seconds*/
+ wait_for(callee->lc,caller->lc,&caller->stat.number_of_LinphoneCallEncryptedOn,initial_caller_stat.number_of_LinphoneCallEncryptedOn+1);
+ break;
+ case LinphoneMediaEncryptionNone:
+ case LinphoneMediaEncryptionSRTP:
+ break;
+ }
+ switch (linphone_core_get_media_encryption(callee->lc)) {
+ case LinphoneMediaEncryptionZRTP:
+ case LinphoneMediaEncryptionDTLS:
+ wait_for(callee->lc,caller->lc,&callee->stat.number_of_LinphoneCallEncryptedOn,initial_callee_stat.number_of_LinphoneCallEncryptedOn+1);
+ break;
+ case LinphoneMediaEncryptionNone:
+ case LinphoneMediaEncryptionSRTP:
+ break;
+ }
+
+ call_param = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc));
+ BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc), int, "%d");
+ call_param = linphone_call_get_current_params(linphone_core_get_current_call(caller->lc));
+ BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc), int, "%d");
+
+ }
+
+ if (video_policy->automatically_accept) {
+ linphone_call_set_next_video_frame_decoded_callback(call_obj,linphone_call_iframe_decoded_cb,callee->lc);
+ /*send vfu*/
+ linphone_call_send_vfu_request(call_obj);
+ return wait_for(caller->lc,callee->lc,&callee->stat.number_of_IframeDecoded,initial_callee_stat.number_of_IframeDecoded+1);
+ } else {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static bool_t remove_video(LinphoneCoreManager *caller, LinphoneCoreManager *callee) {
+ LinphoneCallParams *callee_params;
+ LinphoneCall *call_obj;
+ stats initial_caller_stat = caller->stat;
+ stats initial_callee_stat = callee->stat;
+
+ if (!linphone_core_get_current_call(callee->lc)
+ || (linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning)
+ || !linphone_core_get_current_call(caller->lc)
+ || (linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning)) {
+ ms_warning("bad state for removing video");
+ return FALSE;
+ }
+
+ if ((call_obj = linphone_core_get_current_call(callee->lc))) {
+ callee_params = linphone_core_create_call_params(callee->lc, call_obj);
+ /* Remove video. */
+ linphone_call_params_enable_video(callee_params, FALSE);
+ linphone_core_update_call(callee->lc, call_obj, callee_params);
+ linphone_call_params_destroy(callee_params);
+
+ BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallUpdatedByRemote, initial_caller_stat.number_of_LinphoneCallUpdatedByRemote + 1));
+ BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallUpdating, initial_callee_stat.number_of_LinphoneCallUpdating + 1));
+ BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallStreamsRunning, initial_callee_stat.number_of_LinphoneCallStreamsRunning + 1));
+ BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallStreamsRunning, initial_caller_stat.number_of_LinphoneCallStreamsRunning + 1));
+
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc))));
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void call_with_video_added(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ bool_t call_ok;
+
+ BC_ASSERT_TRUE((call_ok=call(pauline,marie)));
+ if (!call_ok) goto end;
+
+ BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
+
+ end_call(pauline, marie);
+
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void call_with_video_added_2(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ bool_t call_ok;
+ /*in this variant marie is already in automatically accept*/
+ LinphoneVideoPolicy marie_policy;
+ marie_policy.automatically_accept=TRUE;
+
+
+ linphone_core_set_video_policy(marie->lc,&marie_policy);
+ linphone_core_enable_video_capture(marie->lc, TRUE);
+ linphone_core_enable_video_display(marie->lc, FALSE);
+
+ BC_ASSERT_TRUE(call_ok=call(pauline,marie));
+ if (!call_ok) goto end;
+
+ BC_ASSERT_TRUE(add_video(marie,pauline, TRUE));
+
+ end_call(pauline, marie);
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void call_with_video_added_random_ports(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ bool_t call_ok;
+
+ linphone_core_set_audio_port(marie->lc,-1);
+ linphone_core_set_video_port(marie->lc,-1);
+ linphone_core_set_audio_port(pauline->lc,-1);
+ linphone_core_set_video_port(pauline->lc,-1);
+
+ BC_ASSERT_TRUE(call_ok=call(pauline,marie));
+ if (!call_ok) goto end;
+
+ BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
+ end_call(pauline, marie);
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void call_with_several_video_switches(void) {
+ int dummy = 0;
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ bool_t call_ok;
+ BC_ASSERT_TRUE(call_ok=call(pauline,marie));
+
+ if (!call_ok) goto end;
+
+ BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
+ wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
+ BC_ASSERT_TRUE(remove_video(pauline,marie));
+ BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
+ wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
+ BC_ASSERT_TRUE(remove_video(pauline,marie));
+ /**/
+ end_call(pauline, marie);
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void srtp_call_with_several_video_switches(void) {
+ int dummy = 0;
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ bool_t call_ok;
+
+ if (linphone_core_media_encryption_supported(marie->lc, LinphoneMediaEncryptionSRTP)) {
+ linphone_core_set_media_encryption(marie->lc, LinphoneMediaEncryptionSRTP);
+ linphone_core_set_media_encryption(pauline->lc, LinphoneMediaEncryptionSRTP);
+
+ BC_ASSERT_TRUE(call_ok=call(pauline,marie));
+ if (!call_ok) goto end;
+
+ BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
+ wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
+ BC_ASSERT_TRUE(remove_video(pauline,marie));
+ BC_ASSERT_TRUE(add_video(pauline,marie, TRUE));
+ wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
+ BC_ASSERT_TRUE(remove_video(pauline,marie));
+ /**/
+ end_call(pauline, marie);
+ } else {
+ ms_warning("Not tested because SRTP is not available.");
+ }
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void call_with_declined_video_base(bool_t using_policy) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneCall* marie_call;
+ LinphoneCall* pauline_call;
+ LinphoneVideoPolicy marie_policy, pauline_policy;
+ LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
+ bool_t call_ok;
+
+ linphone_core_enable_video_capture(marie->lc, TRUE);
+ linphone_core_enable_video_display(marie->lc, TRUE);
+ linphone_core_enable_video_capture(pauline->lc, TRUE);
+ linphone_core_enable_video_display(pauline->lc, FALSE);
+
+ if (using_policy) {
+ pauline_policy.automatically_initiate=TRUE;
+ pauline_policy.automatically_accept=FALSE;
+ marie_policy.automatically_initiate=FALSE;
+ marie_policy.automatically_accept=FALSE;
+
+ linphone_core_set_video_policy(marie->lc,&marie_policy);
+ linphone_core_set_video_policy(pauline->lc,&pauline_policy);
+ }
+
+ caller_test_params.base=linphone_core_create_call_params(pauline->lc, NULL);
+ if (!using_policy)
+ linphone_call_params_enable_video(caller_test_params.base,TRUE);
+
+ if (!using_policy){
+ callee_test_params.base=linphone_core_create_call_params(marie->lc, NULL);
+ linphone_call_params_enable_video(callee_test_params.base,FALSE);
+ }
+
+ BC_ASSERT_TRUE((call_ok=call_with_params2(pauline,marie,&caller_test_params,&callee_test_params,using_policy)));
+ if (!call_ok) goto end;
+
+ linphone_call_params_destroy(caller_test_params.base);
+ if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
+ marie_call=linphone_core_get_current_call(marie->lc);
+ pauline_call=linphone_core_get_current_call(pauline->lc);
+
+ BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call)));
+ BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call)));
+
+ end_call(pauline, marie);
+
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+static void call_with_declined_video(void) {
+ call_with_declined_video_base(FALSE);
+}
+
+static void call_with_declined_video_despite_policy(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneCall* marie_call;
+ LinphoneCall* pauline_call;
+ LinphoneVideoPolicy marie_policy, pauline_policy;
+ LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
+ bool_t call_ok;
+
+ linphone_core_enable_video_capture(marie->lc, TRUE);
+ linphone_core_enable_video_display(marie->lc, TRUE);
+ linphone_core_enable_video_capture(pauline->lc, TRUE);
+ linphone_core_enable_video_display(pauline->lc, FALSE);
+
+ pauline_policy.automatically_initiate=TRUE;
+ pauline_policy.automatically_accept=TRUE;
+ marie_policy.automatically_initiate=TRUE;
+ marie_policy.automatically_accept=TRUE;
+
+ linphone_core_set_video_policy(marie->lc,&marie_policy);
+ linphone_core_set_video_policy(pauline->lc,&pauline_policy);
+
+ caller_test_params.base=linphone_core_create_call_params(pauline->lc, NULL);
+
+ callee_test_params.base=linphone_core_create_call_params(marie->lc, NULL);
+ linphone_call_params_enable_video(callee_test_params.base,FALSE);
+
+ BC_ASSERT_TRUE((call_ok=call_with_params2(pauline,marie,&caller_test_params,&callee_test_params,FALSE)));
+ if (!call_ok) goto end;
+
+ linphone_call_params_destroy(caller_test_params.base);
+ if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
+ marie_call=linphone_core_get_current_call(marie->lc);
+ pauline_call=linphone_core_get_current_call(pauline->lc);
+
+ BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call)));
+ BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(pauline_call)));
+
+ end_call(pauline, marie);
+
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void call_with_declined_video_using_policy(void) {
+ call_with_declined_video_base(TRUE);
+}
+
+
+void video_call_base_2(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
+ LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
+ LinphoneCall* callee_call;
+ LinphoneCall* caller_call;
+ LinphoneVideoPolicy callee_policy, caller_policy;
+
+ if (using_policy) {
+ callee_policy.automatically_initiate=FALSE;
+ callee_policy.automatically_accept=TRUE;
+ caller_policy.automatically_initiate=TRUE;
+ caller_policy.automatically_accept=FALSE;
+
+ linphone_core_set_video_policy(callee->lc,&callee_policy);
+ linphone_core_set_video_policy(caller->lc,&caller_policy);
+ }
+
+ linphone_core_enable_video_display(callee->lc, callee_video_enabled);
+ linphone_core_enable_video_capture(callee->lc, callee_video_enabled);
+
+ linphone_core_enable_video_display(caller->lc, caller_video_enabled);
+ linphone_core_enable_video_capture(caller->lc, caller_video_enabled);
+
+ if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
+ char *path = bc_tester_file("certificates-marie");
+ callee->lc->user_certificates_path = ms_strdup(path);
+ bc_free(path);
+ path = bc_tester_file("certificates-pauline");
+ caller->lc->user_certificates_path = ms_strdup(path);
+ bc_free(path);
+ belle_sip_mkdir(callee->lc->user_certificates_path);
+ belle_sip_mkdir(caller->lc->user_certificates_path);
+ }
+
+ linphone_core_set_media_encryption(callee->lc,mode);
+ linphone_core_set_media_encryption(caller->lc,mode);
+
+ caller_test_params.base=linphone_core_create_call_params(caller->lc, NULL);
+ if (!using_policy)
+ linphone_call_params_enable_video(caller_test_params.base,TRUE);
+
+ if (!using_policy){
+ callee_test_params.base=linphone_core_create_call_params(callee->lc, NULL);
+ linphone_call_params_enable_video(callee_test_params.base,TRUE);
+ }
+
+ BC_ASSERT_TRUE(call_with_params2(caller,callee,&caller_test_params,&callee_test_params,using_policy));
+ callee_call=linphone_core_get_current_call(callee->lc);
+ caller_call=linphone_core_get_current_call(caller->lc);
+
+ linphone_call_params_destroy(caller_test_params.base);
+ if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
+
+ if (callee_call && caller_call ) {
+ if (callee_video_enabled && caller_video_enabled) {
+ BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(callee_call)));
+ BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(caller_call)));
+
+ /*check video path*/
+ linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc);
+ linphone_call_send_vfu_request(callee_call);
+ BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1));
+ } else {
+ BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(callee_call)));
+ BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(caller_call)));
+ }
+ liblinphone_tester_check_rtcp(callee,caller);
+ }
+}
+
+
+static void check_fir(LinphoneCoreManager* caller,LinphoneCoreManager* callee ){
+ LinphoneCall* callee_call;
+ LinphoneCall* caller_call;
+
+ callee_call=linphone_core_get_current_call(callee->lc);
+ caller_call=linphone_core_get_current_call(caller->lc);
+
+ /*check video path is established in both directions.
+ Indeed, FIR are ignored until the first RTP packet is received, because SSRC is not known.*/
+ linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc);
+ linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc);
+
+ BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1));
+ BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1));
+
+ linphone_call_send_vfu_request(callee_call);
+
+ if (rtp_session_avpf_enabled(callee_call->sessions->rtp_session)){
+ BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&caller_call->videostream->ms_video_stat.counter_rcvd_fir, 1));
+ }else{
+ BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&caller_call->videostream->ms_video_stat.counter_rcvd_fir, 0));
+ }
+ ms_message ("check_fir : [%p] received %d FIR ",&caller_call ,caller_call->videostream->ms_video_stat.counter_rcvd_fir);
+ ms_message ("check_fir : [%p] stat number of iframe decoded %d ",&callee_call, callee->stat.number_of_IframeDecoded);
+
+ linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc);
+ linphone_call_send_vfu_request(caller_call);
+ BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1));
+
+ if (rtp_session_avpf_enabled(caller_call->sessions->rtp_session)) {
+ if (rtp_session_avpf_enabled(callee_call->sessions->rtp_session)){
+ BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&callee_call->videostream->ms_video_stat.counter_rcvd_fir, 1));
+ }
+ }else{
+ BC_ASSERT_TRUE(wait_for(callee->lc,caller->lc,&callee_call->videostream->ms_video_stat.counter_rcvd_fir, 0));
+ }
+ ms_message ("check_fir : [%p] received %d FIR ",&callee_call ,callee_call->videostream->ms_video_stat.counter_rcvd_fir);
+ ms_message ("check_fir : [%p] stat number of iframe decoded %d ",&caller_call, caller->stat.number_of_IframeDecoded);
+
+}
+
+void video_call_base_3(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
+ LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
+
+ LinphoneCall* callee_call;
+ LinphoneCall* caller_call;
+ LinphoneVideoPolicy callee_policy, caller_policy;
+
+ if (using_policy) {
+ callee_policy.automatically_initiate=FALSE;
+ callee_policy.automatically_accept=TRUE;
+ caller_policy.automatically_initiate=TRUE;
+ caller_policy.automatically_accept=FALSE;
+
+ linphone_core_set_video_policy(callee->lc,&callee_policy);
+ linphone_core_set_video_policy(caller->lc,&caller_policy);
+ }
+
+ linphone_core_enable_video_display(callee->lc, callee_video_enabled);
+ linphone_core_enable_video_capture(callee->lc, callee_video_enabled);
+
+ linphone_core_enable_video_display(caller->lc, caller_video_enabled);
+ linphone_core_enable_video_capture(caller->lc, caller_video_enabled);
+
+ if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
+ char *path = bc_tester_file("certificates-marie");
+ callee->lc->user_certificates_path = ms_strdup(path);
+ bc_free(path);
+ path = bc_tester_file("certificates-pauline");
+ caller->lc->user_certificates_path = ms_strdup(path);
+ bc_free(path);
+ belle_sip_mkdir(callee->lc->user_certificates_path);
+ belle_sip_mkdir(caller->lc->user_certificates_path);
+ }
+
+ linphone_core_set_media_encryption(callee->lc,mode);
+ linphone_core_set_media_encryption(caller->lc,mode);
+ /* Create call params */
+ caller_test_params.base=linphone_core_create_call_params(caller->lc, NULL);
+
+ if (!using_policy)
+ linphone_call_params_enable_video(caller_test_params.base,TRUE);
+
+ if (!using_policy){
+ callee_test_params.base=linphone_core_create_call_params(callee->lc, NULL);
+ linphone_call_params_enable_video(callee_test_params.base,TRUE);
+ }
+
+ BC_ASSERT_TRUE(call_with_params2(caller,callee,&caller_test_params,&callee_test_params,using_policy));
+ callee_call=linphone_core_get_current_call(callee->lc);
+ caller_call=linphone_core_get_current_call(caller->lc);
+
+ linphone_call_params_destroy(caller_test_params.base);
+ if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
+
+ if (callee_call && caller_call ) {
+ if (callee_video_enabled && caller_video_enabled) {
+ check_fir(caller,callee);
+ } else {
+ BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(callee_call)));
+ BC_ASSERT_FALSE(linphone_call_log_video_enabled(linphone_call_get_call_log(caller_call)));
+ }
+ liblinphone_tester_check_rtcp(callee,caller);
+ }
+}
+
+
+
+static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
+ video_call_base_2(pauline,marie,using_policy,mode,callee_video_enabled,caller_video_enabled);
+ end_call(pauline, marie);
+}
+
+static void video_call(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void video_call_without_rtcp(void) {
+ LpConfig *lp;
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+
+ lp = linphone_core_get_config(marie->lc);
+ lp_config_set_int(lp,"rtp","rtcp_enabled",0);
+
+ lp = linphone_core_get_config(pauline->lc);
+ lp_config_set_int(lp,"rtp","rtcp_enabled",0);
+
+ video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void video_call_disable_implicit_AVPF_on_callee(void) {
+ LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
+ LpConfig *callee_lp;
+ const LinphoneCallParams *params, *params2;
+
+ callee_lp = linphone_core_get_config(callee->lc);
+ lp_config_set_int(callee_lp,"rtp","rtcp_fb_implicit_rtcp_fb",0);
+
+ video_call_base_3(caller,callee,TRUE,LinphoneMediaEncryptionNone,TRUE,TRUE);
+ if(BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(callee->lc))) {
+ params = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc));
+ BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), "RTP/AVP");
+ }
+ if(BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(caller->lc))) {
+ params2 =linphone_call_get_current_params(linphone_core_get_current_call(caller->lc));
+ BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params2), "RTP/AVP");
+ }
+ end_call(caller, callee);
+ linphone_core_manager_destroy(callee);
+ linphone_core_manager_destroy(caller);
+}
+
+
+static void video_call_disable_implicit_AVPF_on_caller(void) {
+ LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
+ LpConfig *caller_lp;
+ const LinphoneCallParams *params, *params2;
+
+ caller_lp = linphone_core_get_config(caller->lc);
+ lp_config_set_int(caller_lp, "rtp", "rtcp_fb_implicit_rtcp_fb", 0);
+
+ video_call_base_3(caller, callee, TRUE, LinphoneMediaEncryptionNone, TRUE, TRUE);
+ params = linphone_call_get_current_params(linphone_core_get_current_call(callee->lc));
+ BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), "RTP/AVP");
+ params2 = linphone_call_get_current_params(linphone_core_get_current_call(caller->lc));
+ BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params2), "RTP/AVP");
+ end_call(caller, callee);
+ linphone_core_manager_destroy(callee);
+ linphone_core_manager_destroy(caller);
+
+}
+
+static void video_call_AVPF_to_implicit_AVPF(void) {
+ LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
+
+ linphone_core_set_avpf_mode(caller->lc, LinphoneAVPFEnabled);
+ video_call_base_3(caller, callee, TRUE, LinphoneMediaEncryptionNone, TRUE, TRUE);
+ end_call(caller, callee);
+
+ linphone_core_manager_destroy(callee);
+ linphone_core_manager_destroy(caller);
+
+}
+
+static void video_call_implicit_AVPF_to_AVPF(void) {
+ LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
+
+ linphone_core_set_avpf_mode(callee->lc, LinphoneAVPFEnabled);
+ video_call_base_3(caller, callee, TRUE, LinphoneMediaEncryptionNone, TRUE, TRUE);
+ end_call(caller, callee);
+
+ linphone_core_manager_destroy(callee);
+ linphone_core_manager_destroy(caller);
+
+}
+
+static void video_call_using_policy_AVPF_implicit_caller_and_callee(void) {
+ LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
+ video_call_base_3(caller, callee, FALSE, LinphoneMediaEncryptionNone, TRUE, TRUE);
+ end_call(caller, callee);
+ linphone_core_manager_destroy(callee);
+ linphone_core_manager_destroy(caller);
+}
+
+static void video_call_base_avpf(LinphoneCoreManager *caller, LinphoneCoreManager *callee, bool_t using_policy, LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) {
+ linphone_core_set_avpf_mode(caller->lc, LinphoneAVPFEnabled);
+ linphone_core_set_avpf_mode(callee->lc, LinphoneAVPFEnabled);
+ video_call_base_3(caller, callee, using_policy, mode, callee_video_enabled, caller_video_enabled);
+ end_call(caller, callee);
+}
+
+static void video_call_avpf(void) {
+ LinphoneCoreManager *callee = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager *caller = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+
+ video_call_base_avpf(caller, callee, FALSE, LinphoneMediaEncryptionNone, TRUE, TRUE);
+ linphone_core_manager_destroy(callee);
+ linphone_core_manager_destroy(caller);
+
+}
+
+static void video_call_zrtp(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ if (linphone_core_media_encryption_supported(marie->lc,LinphoneMediaEncryptionZRTP)) {
+ video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionZRTP,TRUE,TRUE);
+ } else
+ ms_message("Skipping video_call_zrtp");
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void video_call_dtls(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ if (linphone_core_media_encryption_supported(pauline->lc,LinphoneMediaEncryptionDTLS)) {
+ video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionDTLS,TRUE,TRUE);
+ } else
+ ms_message("Skipping video_call_dtls");
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+
+}
+
+
+
+static void video_call_using_policy(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
+ video_call_base(pauline,marie,TRUE,LinphoneMediaEncryptionNone,TRUE,TRUE);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void video_call_using_policy_with_callee_video_disabled(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ video_call_base(marie,pauline,TRUE,LinphoneMediaEncryptionNone,FALSE,TRUE);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void video_call_using_policy_with_caller_video_disabled(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ video_call_base(marie,pauline,TRUE,LinphoneMediaEncryptionNone,TRUE,FALSE);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void video_call_no_sdp(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ linphone_core_enable_sdp_200_ack(pauline->lc,TRUE);
+ video_call_base(pauline,marie,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void call_with_ice_video_to_novideo(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneVideoPolicy vpol={0};
+ vpol.automatically_initiate=TRUE;
+ linphone_core_set_video_policy(pauline->lc,&vpol);
+ vpol.automatically_initiate=FALSE;
+ linphone_core_set_video_policy(marie->lc,&vpol);
+ _call_with_ice_base(pauline,marie,TRUE,TRUE,TRUE,FALSE);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVideoPolicy callee_policy,
+ bool_t video_added_by_caller, bool_t video_added_by_callee, bool_t video_removed_by_caller, bool_t video_removed_by_callee) {
+ LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ bool_t call_ok;
+ unsigned int nb_media_starts = 1;
+
+ linphone_core_set_video_policy(pauline->lc, &caller_policy);
+ linphone_core_set_video_policy(marie->lc, &callee_policy);
+ linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
+ linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
+
+ linphone_core_set_audio_port(marie->lc, -1);
+ linphone_core_set_video_port(marie->lc, -1);
+ linphone_core_set_audio_port(pauline->lc, -1);
+ linphone_core_set_video_port(pauline->lc, -1);
+
+ 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));
+ check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts);
+ nb_media_starts++;
+
+ if (video_added_by_caller) {
+ BC_ASSERT_TRUE(add_video(marie, pauline, FALSE));
+ } else if (video_added_by_callee) {
+ BC_ASSERT_TRUE(add_video(pauline, marie, FALSE));
+ }
+ if (video_added_by_caller || video_added_by_callee) {
+ BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection));
+ if (linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))){
+ /* Wait for ICE reINVITEs to complete if video was really added */
+ BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 4)
+ && wait_for(pauline->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 4));
+ check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts);
+ nb_media_starts++;
+ }
+ }
+
+ if (video_removed_by_caller) {
+ BC_ASSERT_TRUE(remove_video(marie, pauline));
+ } else if (video_removed_by_callee) {
+ BC_ASSERT_TRUE(remove_video(pauline, marie));
+ }
+ if (video_removed_by_caller || video_removed_by_callee) {
+ BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection));
+ check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts);
+ nb_media_starts++;
+ }
+
+ end_call(pauline, marie);
+
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void call_with_ice_video_added(void) {
+ LinphoneVideoPolicy vpol = { TRUE, TRUE };
+ _call_with_ice_video(vpol, vpol, TRUE, FALSE, TRUE, FALSE);
+}
+
+static void call_with_ice_video_added_2(void) {
+ LinphoneVideoPolicy vpol = { TRUE, TRUE };
+ _call_with_ice_video(vpol, vpol, TRUE, FALSE, FALSE, TRUE);
+}
+
+static void call_with_ice_video_added_3(void) {
+ LinphoneVideoPolicy vpol = { TRUE, TRUE };
+ _call_with_ice_video(vpol, vpol, FALSE, TRUE, TRUE, FALSE);
+}
+
+static void call_with_ice_video_added_and_refused(void) {
+ LinphoneVideoPolicy caller_policy = { TRUE, TRUE };
+ LinphoneVideoPolicy callee_policy = { FALSE, FALSE };
+ _call_with_ice_video(caller_policy, callee_policy, TRUE, FALSE, FALSE, FALSE);
+}
+
+static void call_with_ice_video_added_with_video_policies_to_false(void) {
+ LinphoneVideoPolicy vpol = { FALSE, FALSE };
+ _call_with_ice_video(vpol, vpol, FALSE, TRUE, FALSE, FALSE);
+}
+
+#if ICE_WAS_WORKING_WITH_REAL_TIME_TEXT /*which is not the case at the moment*/
+
+static void call_with_ice_video_and_rtt(void) {
+ LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ bool_t call_ok;
+ LinphoneVideoPolicy policy = { TRUE, TRUE };
+ LinphoneCallParams *params = NULL;
+ LinphoneCall *marie_call = NULL;
+
+ linphone_core_set_video_policy(pauline->lc, &policy);
+ linphone_core_set_video_policy(marie->lc, &policy);
+ linphone_core_enable_video_capture(marie->lc, TRUE);
+ linphone_core_enable_video_display(marie->lc, FALSE);
+ linphone_core_enable_video_capture(pauline->lc, FALSE);
+ linphone_core_enable_video_display(pauline->lc, TRUE);
+ linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
+ linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
+
+ linphone_core_set_audio_port(marie->lc, -1);
+ linphone_core_set_video_port(marie->lc, -1);
+ linphone_core_set_text_port(marie->lc, -1);
+ linphone_core_set_audio_port(pauline->lc, -1);
+ linphone_core_set_video_port(pauline->lc, -1);
+ linphone_core_set_text_port(pauline->lc, -1);
+
+ params = linphone_core_create_default_call_parameters(pauline->lc);
+ linphone_call_params_enable_realtime_text(params, TRUE);
+ BC_ASSERT_TRUE(call_ok = call_with_caller_params(pauline, marie, params));
+ if (!call_ok) goto end;
+ BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection));
+
+ marie_call = linphone_core_get_current_call(marie->lc);
+ BC_ASSERT_TRUE(linphone_call_params_audio_enabled(linphone_call_get_current_params(marie_call)));
+ BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(marie_call)));
+ BC_ASSERT_TRUE(linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(marie_call)));
+
+ end_call(pauline, marie);
+end:
+ linphone_call_params_destroy(params);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+#endif
+
+static void video_call_with_early_media_no_matching_audio_codecs(void) {
+ LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneCall *out_call, *pauline_call;
+ LinphoneVideoPolicy vpol={0};
+
+ linphone_core_enable_video_capture(marie->lc, TRUE);
+ linphone_core_enable_video_display(marie->lc, TRUE);
+ linphone_core_enable_video_capture(pauline->lc, TRUE);
+ linphone_core_enable_video_display(pauline->lc, FALSE);
+
+ vpol.automatically_initiate=TRUE;
+ vpol.automatically_accept=TRUE;
+ linphone_core_set_video_policy(pauline->lc,&vpol);
+ linphone_core_set_video_policy(marie->lc,&vpol);
+
+ linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMU", 8000, 1), FALSE); /* Disable PCMU */
+ linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMA", 8000, 1), TRUE); /* Enable PCMA */
+
+ out_call = linphone_core_invite_address(marie->lc, pauline->identity);
+ linphone_call_ref(out_call);
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1));
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingReceived, 1));
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging, 1));
+
+ pauline_call = linphone_core_get_current_call(pauline->lc);
+ if (!pauline_call) goto end;
+
+ linphone_core_accept_early_media(pauline->lc, pauline_call);
+
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia, 1));
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1));
+ /*audio stream shall not have been requested to start*/
+ BC_ASSERT_PTR_NULL(pauline_call->audiostream->soundread);
+
+ BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(out_call)));
+ BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(pauline_call)));
+
+ linphone_core_accept_call(pauline->lc, pauline_call);
+
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
+
+ end_call(marie, pauline);
+
+end:
+ linphone_call_unref(out_call);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void video_call_limited_bandwidth(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+
+ linphone_core_set_download_bandwidth(pauline->lc, 100);
+ video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
+
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void dtls_srtp_video_call(void) {
+ call_base(LinphoneMediaEncryptionDTLS,TRUE,FALSE,LinphonePolicyNoFirewall,FALSE);
+}
+
+static void dtls_srtp_ice_video_call(void) {
+ call_base(LinphoneMediaEncryptionDTLS,TRUE,FALSE,LinphonePolicyUseIce,FALSE);
+}
+static void dtls_srtp_ice_video_call_with_relay(void) {
+ call_base(LinphoneMediaEncryptionDTLS,TRUE,TRUE,LinphonePolicyUseIce,FALSE);
+}
+static void srtp_video_ice_call(void) {
+ call_base(LinphoneMediaEncryptionSRTP,TRUE,FALSE,LinphonePolicyUseIce,FALSE);
+}
+static void zrtp_video_ice_call(void) {
+ call_base(LinphoneMediaEncryptionZRTP,TRUE,FALSE,LinphonePolicyUseIce,FALSE);
+}
+
+static void accept_call_in_send_only_base(LinphoneCoreManager* pauline, LinphoneCoreManager *marie, bctbx_list_t *lcs) {
+#define DEFAULT_WAIT_FOR 10000
+ LinphoneCallParams *params;
+ LinphoneVideoPolicy pol;
+ LinphoneCall *call;
+ pol.automatically_accept=1;
+ pol.automatically_initiate=1;
+
+ // important: VP8 has really poor performances with the mire camera, at least
+ // on iOS - so when ever h264 is available, let's use it instead
+ if (linphone_core_find_payload_type(pauline->lc,"h264", -1, -1)!=NULL) {
+ disable_all_video_codecs_except_one(pauline->lc,"h264");
+ disable_all_video_codecs_except_one(marie->lc,"h264");
+ }
+
+ linphone_core_enable_video_capture(pauline->lc, TRUE);
+ linphone_core_enable_video_display(pauline->lc, TRUE);
+ linphone_core_set_video_policy(pauline->lc,&pol);
+ linphone_core_set_video_device(pauline->lc,liblinphone_tester_mire_id);
+
+ linphone_core_enable_video_capture(marie->lc, TRUE);
+ linphone_core_enable_video_display(marie->lc, TRUE);
+ linphone_core_set_video_policy(marie->lc,&pol);
+ linphone_core_set_video_device(marie->lc,liblinphone_tester_mire_id);
+
+ linphone_call_set_next_video_frame_decoded_callback(linphone_core_invite_address(pauline->lc,marie->identity)
+ ,linphone_call_iframe_decoded_cb
+ ,pauline->lc);
+
+
+ BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallIncomingReceived,1,DEFAULT_WAIT_FOR));
+
+ {
+ char* remote_uri = linphone_address_as_string_uri_only(pauline->identity);
+ call = linphone_core_find_call_from_uri(marie->lc,remote_uri);
+ ms_free(remote_uri);
+ }
+
+ if (call) {
+ params=linphone_core_create_call_params(marie->lc, NULL);
+ linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionSendOnly);
+ linphone_call_params_set_video_direction(params,LinphoneMediaDirectionSendOnly);
+ linphone_core_accept_call_with_params(marie->lc,call,params);
+ linphone_call_params_destroy(params);
+
+ BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning,1,DEFAULT_WAIT_FOR));
+ BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallPausedByRemote,1,DEFAULT_WAIT_FOR));
+
+ check_media_direction(marie,call,lcs,LinphoneMediaDirectionSendOnly,LinphoneMediaDirectionSendOnly);
+ }
+
+
+ call=linphone_core_get_current_call(pauline->lc);
+ if (call) {
+ check_media_direction(pauline,call,lcs,LinphoneMediaDirectionRecvOnly,LinphoneMediaDirectionRecvOnly);
+ }
+
+}
+static void accept_call_in_send_base(bool_t caller_has_ice) {
+ LinphoneCoreManager *pauline, *marie;
+ bctbx_list_t *lcs=NULL;;
+
+ marie = linphone_core_manager_new("marie_rc");
+ pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ if (caller_has_ice) {
+ linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
+ }
+
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+
+ accept_call_in_send_only_base(pauline,marie,lcs);
+
+
+ end_call(marie,pauline);
+ bctbx_list_free(lcs);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void accept_call_in_send_only(void) {
+ accept_call_in_send_base(FALSE);
+}
+
+static void accept_call_in_send_only_with_ice(void) {
+ accept_call_in_send_base(TRUE);
+}
+
+void two_accepted_call_in_send_only(void) {
+ LinphoneCoreManager *pauline, *marie, *laure;
+ bctbx_list_t *lcs=NULL;
+
+ marie = linphone_core_manager_new("marie_rc");
+ linphone_core_use_files(marie->lc, TRUE);
+ pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ laure = linphone_core_manager_new("laure_rc_udp");
+
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
+
+ accept_call_in_send_only_base(pauline,marie,lcs);
+
+ reset_counters(&marie->stat);
+ accept_call_in_send_only_base(laure,marie,lcs);
+
+ end_call(pauline, marie);
+ end_call(laure, marie);
+
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+ linphone_core_manager_destroy(laure);
+ bctbx_list_free(lcs);
+}
+
+static void video_early_media_call(void) {
+ LinphoneCoreManager *marie = linphone_core_manager_new("marie_early_rc");
+ LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc");
+ LinphoneCall *pauline_to_marie;
+
+ linphone_core_set_video_device(pauline->lc, "Mire: Mire (synthetic moving picture)");
+
+ video_call_base_3(pauline, marie, TRUE, LinphoneMediaEncryptionNone, TRUE, TRUE);
+
+ BC_ASSERT_PTR_NOT_NULL(pauline_to_marie = linphone_core_get_current_call(pauline->lc));
+ if(pauline_to_marie) {
+ BC_ASSERT_EQUAL(pauline_to_marie->videostream->source->desc->id, MS_MIRE_ID, int, "%d");
+ }
+
+ end_call(pauline, marie);
+
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+/*this is call forking with early media managed at client side (not by flexisip server)*/
+static void multiple_early_media(void) {
+ LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_tcp_rc");
+ LinphoneCoreManager* marie1 = linphone_core_manager_new("marie_early_rc");
+ LinphoneCoreManager* marie2 = linphone_core_manager_new("marie_early_rc");
+ bctbx_list_t *lcs=NULL;
+ LinphoneCallParams *params=linphone_core_create_call_params(pauline->lc, NULL);
+ LinphoneVideoPolicy pol;
+ LinphoneCall *marie1_call;
+ LinphoneCall *marie2_call;
+ LinphoneCall *pauline_call;
+ LinphoneInfoMessage *info;
+ int dummy=0;
+ pol.automatically_accept=1;
+ pol.automatically_initiate=1;
+
+ linphone_core_enable_video_capture(pauline->lc, TRUE);
+ linphone_core_enable_video_display(pauline->lc, TRUE);
+
+ linphone_core_enable_video_capture(marie1->lc, TRUE);
+ linphone_core_enable_video_display(marie1->lc, TRUE);
+ linphone_core_set_video_policy(marie1->lc,&pol);
+
+ linphone_core_enable_video_capture(marie2->lc, TRUE);
+ linphone_core_enable_video_display(marie2->lc, TRUE);
+ linphone_core_set_video_policy(marie2->lc,&pol);
+ linphone_core_set_audio_port_range(marie2->lc,40200,40300);
+ linphone_core_set_video_port_range(marie2->lc,40400,40500);
+
+ lcs=bctbx_list_append(lcs,marie1->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+
+ linphone_call_params_enable_early_media_sending(params,TRUE);
+ linphone_call_params_enable_video(params,TRUE);
+
+ linphone_core_invite_address_with_params(pauline->lc,marie1->identity,params);
+ linphone_call_params_destroy(params);
+
+ BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000));
+ BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000));
+ BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,3000));
+
+ pauline_call=linphone_core_get_current_call(pauline->lc);
+ marie1_call=linphone_core_get_current_call(marie1->lc);
+ marie2_call=linphone_core_get_current_call(marie2->lc);
+
+ BC_ASSERT_PTR_NOT_NULL(pauline_call);
+ BC_ASSERT_PTR_NOT_NULL(marie1_call);
+ BC_ASSERT_PTR_NOT_NULL(marie2_call);
+
+ if (pauline_call && marie1_call && marie2_call){
+
+ /*wait a bit that streams are established*/
+ wait_for_list(lcs,&dummy,1,6000);
+ BC_ASSERT_GREATER(linphone_core_manager_get_max_audio_down_bw(pauline),70,int,"%i");
+ BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie1), 70, int, "%i");
+ BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie2), 70, int, "%i");
+
+ linphone_core_accept_call(marie1->lc,linphone_core_get_current_call(marie1->lc));
+ BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000));
+ BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,3000));
+
+ /*marie2 should get her call terminated*/
+ BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
+
+ /*wait a bit that streams are established*/
+ wait_for_list(lcs,&dummy,1,3000);
+ BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(pauline), 71, int, "%i");
+ BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie1), 71, int, "%i");
+
+ /*send an INFO in reverse side to check that dialogs are properly established*/
+ info=linphone_core_create_info_message(marie1->lc);
+ linphone_call_send_info_message(marie1_call,info);
+ BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_inforeceived,1,3000));
+ }
+
+ end_call(pauline, marie1);
+
+ bctbx_list_free(lcs);
+ linphone_core_manager_destroy(marie1);
+ linphone_core_manager_destroy(marie2);
+ linphone_core_manager_destroy(pauline);
+}
+static void video_call_ice_params(void) {
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+
+ linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
+ linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
+ video_call_base(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void audio_call_with_ice_with_video_policy_enabled(void){
+ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneVideoPolicy vpol;
+
+
+ linphone_core_enable_video_capture(marie->lc, TRUE);
+ linphone_core_enable_video_display(marie->lc, TRUE);
+ linphone_core_enable_video_capture(pauline->lc, TRUE);
+ linphone_core_enable_video_display(pauline->lc, TRUE);
+ vpol.automatically_accept = vpol.automatically_initiate = TRUE;
+ linphone_core_set_video_policy(marie->lc, &vpol);
+ vpol.automatically_accept = vpol.automatically_initiate = FALSE;
+ linphone_core_set_video_policy(pauline->lc, &vpol);
+
+ linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
+ linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
+
+ linphone_core_invite_address(pauline->lc, marie->identity);
+ if (!BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallIncomingReceived, 1))) goto end;
+ linphone_core_accept_call(marie->lc, linphone_core_get_current_call(marie->lc));
+ /*
+ LinphoneCallParams *params;
+ params = linphone_core_create_call_params(marie->lc, linphone_core_get_current_call(marie->lc));
+ linphone_call_params_enable_video(params, TRUE);
+ linphone_core_accept_call_with_params(marie->lc, linphone_core_get_current_call(marie->lc), params);
+ linphone_call_params_destroy(params);*/
+
+ /*wait for call to be established and ICE reINVITEs to be done */
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2));
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2));
+
+ linphone_core_pause_call(marie->lc, linphone_core_get_current_call(marie->lc));
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallPausedByRemote, 1));
+ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallPaused, 1));
+
+ end_call(marie, pauline);
+end:
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+
+static void classic_video_entry_phone_setup(void) {
+ LinphoneCoreManager *callee_mgr = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager *caller_mgr = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneCallParams *early_media_params = NULL;
+ LinphoneCallParams *in_call_params = NULL;
+ LinphoneCall *callee_call = NULL;
+ LinphoneVideoPolicy vpol = { TRUE, TRUE };
+ bctbx_list_t *lcs = NULL;
+ int retry = 0;
+ bool_t ok;
+
+ lcs = bctbx_list_append(lcs, caller_mgr->lc);
+ lcs = bctbx_list_append(lcs, callee_mgr->lc);
+
+ linphone_core_enable_video_capture(caller_mgr->lc, TRUE);
+ linphone_core_enable_video_display(caller_mgr->lc, TRUE);
+ linphone_core_enable_video_capture(callee_mgr->lc, TRUE);
+ linphone_core_enable_video_display(callee_mgr->lc, TRUE);
+ linphone_core_set_avpf_mode(caller_mgr->lc, LinphoneAVPFEnabled);
+ linphone_core_set_avpf_mode(callee_mgr->lc, LinphoneAVPFEnabled);
+ linphone_core_set_video_policy(caller_mgr->lc, &vpol);
+ linphone_core_set_video_policy(callee_mgr->lc, &vpol);
+
+ // important: VP8 has really poor performances with the mire camera, at least
+ // on iOS - so when ever h264 is available, let's use it instead
+ if (linphone_core_find_payload_type(caller_mgr->lc,"h264", -1, -1)!=NULL) {
+ disable_all_video_codecs_except_one(caller_mgr->lc,"h264");
+ disable_all_video_codecs_except_one(callee_mgr->lc,"h264");
+ }
+
+ linphone_core_set_video_device(caller_mgr->lc, liblinphone_tester_mire_id);
+ linphone_core_set_video_device(callee_mgr->lc, liblinphone_tester_mire_id);
+
+ BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(caller_mgr->lc, callee_mgr->identity));
+
+ ok = wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallIncomingReceived, 1);
+ BC_ASSERT_TRUE(ok);
+ if (!ok) goto end;
+ BC_ASSERT_TRUE(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress == 1);
+
+ callee_call = linphone_core_get_call_by_remote_address2(callee_mgr->lc, caller_mgr->identity);
+ early_media_params = linphone_core_create_call_params(callee_mgr->lc, callee_call);
+ linphone_call_params_set_audio_direction(early_media_params, LinphoneMediaDirectionInactive);
+ linphone_call_params_set_video_direction(early_media_params, LinphoneMediaDirectionRecvOnly);
+ linphone_core_accept_early_media_with_params(callee_mgr->lc, callee_call, early_media_params);
+ linphone_call_params_destroy(early_media_params);
+
+ while ((caller_mgr->stat.number_of_LinphoneCallOutgoingEarlyMedia != 1) && (retry++ < 100)) {
+ linphone_core_iterate(caller_mgr->lc);
+ linphone_core_iterate(callee_mgr->lc);
+ ms_usleep(20000);
+ }
+ BC_ASSERT_TRUE(caller_mgr->stat.number_of_LinphoneCallOutgoingEarlyMedia == 1);
+ BC_ASSERT_TRUE(callee_mgr->stat.number_of_LinphoneCallIncomingEarlyMedia == 1);
+
+ check_media_direction(callee_mgr, callee_call, lcs, LinphoneMediaDirectionInactive, LinphoneMediaDirectionRecvOnly);
+ callee_call = linphone_core_get_call_by_remote_address2(callee_mgr->lc, caller_mgr->identity);
+ in_call_params = linphone_core_create_call_params(callee_mgr->lc, callee_call);
+ linphone_call_params_set_audio_direction(in_call_params, LinphoneMediaDirectionSendRecv);
+ linphone_call_params_set_video_direction(in_call_params, LinphoneMediaDirectionSendRecv);
+ linphone_core_accept_call_with_params(callee_mgr->lc, callee_call, in_call_params);
+ linphone_call_params_destroy(in_call_params);
+
+ BC_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallConnected, 1));
+ BC_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallConnected, 1));
+
+ ok = wait_for_until(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, 1, 2000)
+ && wait_for_until(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallStreamsRunning, 1, 2000);
+ BC_ASSERT_TRUE(ok);
+ if (!ok) goto end;
+ check_media_direction(callee_mgr, callee_call, lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionSendRecv);
+
+ callee_call = linphone_core_get_current_call(callee_mgr->lc);
+ in_call_params = linphone_core_create_call_params(callee_mgr->lc, callee_call);
+ linphone_call_params_set_audio_direction(in_call_params, LinphoneMediaDirectionRecvOnly);
+ linphone_call_params_set_video_direction(in_call_params, LinphoneMediaDirectionSendOnly);
+ linphone_core_update_call(callee_mgr->lc, callee_call, in_call_params);
+ linphone_call_params_destroy(in_call_params);
+
+ ok = wait_for_until(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, 2, 2000)
+ && wait_for_until(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallStreamsRunning, 2, 2000);
+ BC_ASSERT_TRUE(ok);
+ if (!ok) goto end;
+ callee_call = linphone_core_get_current_call(callee_mgr->lc);
+ check_media_direction(callee_mgr, callee_call, lcs, LinphoneMediaDirectionRecvOnly, LinphoneMediaDirectionSendOnly);
+
+ end_call(caller_mgr, callee_mgr);
+
+end:
+ linphone_core_manager_destroy(callee_mgr);
+ linphone_core_manager_destroy(caller_mgr);
+ bctbx_list_free(lcs);
+}
+static void video_call_recording_h264_test(void) {
+ record_call("recording", TRUE, "H264");
+}
+
+static void video_call_recording_vp8_test(void) {
+ record_call("recording", TRUE, "VP8");
+}
+
+static void video_call_snapshot(void) {
+ LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneCallParams *marieParams = linphone_core_create_call_params(marie->lc, NULL);
+ LinphoneCallParams *paulineParams = linphone_core_create_call_params(pauline->lc, NULL);
+ LinphoneCall *callInst = NULL;
+ char *filename = bc_tester_file("snapshot.jpeg");
+ int dummy = 0;
+ bool_t call_succeeded = FALSE;
+
+ linphone_core_enable_video_capture(marie->lc, TRUE);
+ linphone_core_enable_video_display(marie->lc, TRUE);
+ linphone_core_enable_video_capture(pauline->lc, TRUE);
+ linphone_core_enable_video_display(pauline->lc, FALSE);
+ linphone_call_params_enable_video(marieParams, TRUE);
+ linphone_call_params_enable_video(paulineParams, TRUE);
+
+ BC_ASSERT_TRUE(call_succeeded = call_with_params(marie, pauline, marieParams, paulineParams));
+ BC_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc));
+ if((call_succeeded == TRUE) && (callInst != NULL)) {
+ int jpeg_support = linphone_call_take_video_snapshot(callInst, filename);
+ if (jpeg_support < 0) {
+ ms_warning("No jpegwriter support!");
+ } else {
+ wait_for_until(marie->lc, pauline->lc, &dummy, 1, 5000);
+ BC_ASSERT_EQUAL(ortp_file_exist(filename), 0, int, "%d");
+ remove(filename);
+ }
+ end_call(marie, pauline);
+ }
+ ms_free(filename);
+ linphone_call_params_unref(marieParams);
+ linphone_call_params_unref(paulineParams);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryption mode, bool_t no_sdp) {
+ LinphoneCoreManager* marie;
+ LinphoneCoreManager* pauline;
+ LinphoneCallParams *params;
+ const LinphoneCallParams *current_params;
+ bctbx_list_t *lcs=NULL;
+ bool_t calls_ok;
+
+ marie = linphone_core_manager_new( "marie_rc");
+ pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+
+ linphone_core_set_avpf_mode(pauline->lc,TRUE);
+
+ // important: VP8 has really poor performances with the mire camera, at least
+ // on iOS - so when ever h264 is available, let's use it instead
+ if (linphone_core_find_payload_type(pauline->lc,"h264", -1, -1)!=NULL) {
+ disable_all_video_codecs_except_one(pauline->lc,"h264");
+ disable_all_video_codecs_except_one(marie->lc,"h264");
+ }
+ linphone_core_set_video_device(pauline->lc,liblinphone_tester_mire_id);
+ linphone_core_set_video_device(marie->lc,liblinphone_tester_mire_id);
+ linphone_core_set_avpf_mode(marie->lc,TRUE);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+
+ video_call_base_2(marie,pauline,TRUE,mode,TRUE,TRUE);
+
+ calls_ok = linphone_core_get_current_call(marie->lc) != NULL && linphone_core_get_current_call(pauline->lc) != NULL;
+ BC_ASSERT_TRUE(calls_ok);
+
+ if (calls_ok) {
+ params=linphone_core_create_call_params(marie->lc,linphone_core_get_current_call(marie->lc));
+ linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionInactive);
+ linphone_call_params_set_video_direction(params,LinphoneMediaDirectionInactive);
+
+ linphone_core_update_call(marie->lc, linphone_core_get_current_call(marie->lc),params);
+ linphone_call_params_destroy(params);
+
+ BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1));
+ BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
+ BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1));
+
+ check_media_direction(marie,linphone_core_get_current_call(marie->lc),lcs,LinphoneMediaDirectionInactive,LinphoneMediaDirectionInactive);
+ check_media_direction(pauline,linphone_core_get_current_call(pauline->lc), lcs, LinphoneMediaDirectionInactive, LinphoneMediaDirectionInactive);
+
+ if (no_sdp) {
+ linphone_core_enable_sdp_200_ack(marie->lc,TRUE);
+ }
+
+ params=linphone_core_create_call_params(marie->lc,linphone_core_get_current_call(marie->lc));
+ linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionSendRecv);
+ linphone_call_params_set_video_direction(params,LinphoneMediaDirectionSendRecv);
+ linphone_core_update_call(marie->lc,linphone_core_get_current_call(marie->lc),params);
+ linphone_call_params_destroy(params);
+
+ BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,3));
+ BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
+
+ check_media_direction(marie,linphone_core_get_current_call(marie->lc),lcs,LinphoneMediaDirectionSendRecv,LinphoneMediaDirectionSendRecv);
+ check_media_direction(pauline,linphone_core_get_current_call(pauline->lc),lcs,LinphoneMediaDirectionSendRecv,LinphoneMediaDirectionSendRecv);
+
+ /*assert that after pause and resume, SRTP is still being used*/
+ current_params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc));
+ BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(current_params) , mode, int, "%d");
+ current_params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc));
+ BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(current_params) , mode, int, "%d");
+
+ }
+ end_call(marie,pauline);
+ linphone_core_manager_destroy(marie);
+ linphone_core_manager_destroy(pauline);
+}
+
+static void video_call_with_re_invite_inactive_followed_by_re_invite(void) {
+ video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryptionNone,FALSE);
+}
+
+static void video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp(void) {
+ video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryptionNone, TRUE);
+}
+
+static void srtp_video_call_with_re_invite_inactive_followed_by_re_invite(void) {
+ if (ms_srtp_supported())
+ video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryptionSRTP,FALSE);
+ else
+ ms_message("srtp_video_call_with_re_invite_inactive_followed_by_re_invite skipped, missing srtp support");
+}
+
+static void srtp_video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp(void) {
+ if (ms_srtp_supported())
+ video_call_with_re_invite_inactive_followed_by_re_invite_base(LinphoneMediaEncryptionSRTP, TRUE);
+ else
+ ms_message("srtp_video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp skipped, missing srtp support");
+}
+
+static void incoming_reinvite_with_invalid_ack_sdp(void){
+ LinphoneCoreManager* caller = linphone_core_manager_new( "pauline_tcp_rc");
+ LinphoneCoreManager* callee = linphone_core_manager_new( "marie_rc");
+ LinphoneCall * inc_call;
+ BC_ASSERT_TRUE(call(caller,callee));
+ inc_call = linphone_core_get_current_call(callee->lc);
+
+ BC_ASSERT_PTR_NOT_NULL(inc_call);
+ if (inc_call) {
+ const LinphoneCallParams *caller_params;
+ stats initial_caller_stat=caller->stat;
+ stats initial_callee_stat=callee->stat;
+ sal_call_set_sdp_handling(inc_call->op, SalOpSDPSimulateError); /* will force a parse error for the ACK SDP*/
+ BC_ASSERT_PTR_NOT_NULL(setup_video(caller, callee, TRUE));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning));
+ /*Basically the negotiation failed but since the call was already running, we expect it to restore to
+ the previous state so error stats should not be changed*/
+ BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,initial_callee_stat.number_of_LinphoneCallError, int, "%d");
+ /*and remote should have received an update notification*/
+ BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1, int, "%d");
+
+
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
+ caller_params = linphone_call_get_current_params(linphone_core_get_current_call(caller->lc));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,(int*)&caller_params->has_video,FALSE));
+
+ sal_call_set_sdp_handling(inc_call->op, SalOpSDPNormal);
+ }
+ end_call(caller, callee);
+
+ linphone_core_manager_destroy(callee);
+ linphone_core_manager_destroy(caller);
+}
+
+static void outgoing_reinvite_with_invalid_ack_sdp(void) {
+ LinphoneCoreManager* caller = linphone_core_manager_new( "pauline_tcp_rc");
+ LinphoneCoreManager* callee = linphone_core_manager_new( "marie_rc");
+ LinphoneCall * out_call;
+ BC_ASSERT_TRUE(call(caller,callee));
+ out_call = linphone_core_get_current_call(caller->lc);
+
+ BC_ASSERT_PTR_NOT_NULL(out_call);
+ if (out_call) {
+ stats initial_caller_stat=caller->stat;
+ stats initial_callee_stat=callee->stat;
+ sal_call_set_sdp_handling(out_call->op, SalOpSDPSimulateError); /* will force a parse error for the ACK SDP*/
+ BC_ASSERT_PTR_NOT_NULL(setup_video(caller, callee, TRUE));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1));
+ BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning));
+ /*Basically the negotiation failed but since the call was already running, we expect it to restore to
+ the previous state so error stats should not be changed*/
+ BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallError,initial_callee_stat.number_of_LinphoneCallError, int, "%d");
+ /*and remote should not have received any update notification*/
+ BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote, int, "%d");
+
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
+ BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc))));
+
+ sal_call_set_sdp_handling(out_call->op, SalOpSDPNormal);
+ }
+ end_call(caller, callee);
+
+ linphone_core_manager_destroy(callee);
+ linphone_core_manager_destroy(caller);
+}
+
+#endif
+static void video_call_with_no_audio_and_no_video_codec(void){
+ LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc");
+ LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc");
+ LinphoneCall* out_call ;
+ LinphoneVideoPolicy callee_policy, caller_policy;
+ LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
+
+ const bctbx_list_t* elem_video =linphone_core_get_video_codecs(caller->lc);
+
+ const bctbx_list_t* elem_audio =linphone_core_get_audio_codecs(caller->lc);
+
+ disable_all_codecs(elem_audio, caller);
+ disable_all_codecs(elem_video, caller);
+
+ callee_policy.automatically_initiate=FALSE;
+ callee_policy.automatically_accept=TRUE;
+ caller_policy.automatically_initiate=TRUE;
+ caller_policy.automatically_accept=FALSE;
+
+ linphone_core_set_video_policy(callee->lc,&callee_policy);
+ linphone_core_set_video_policy(caller->lc,&caller_policy);
+
+
+ linphone_core_enable_video_display(callee->lc, TRUE);
+ linphone_core_enable_video_capture(callee->lc, TRUE);
+
+ linphone_core_enable_video_display(caller->lc, TRUE);
+ linphone_core_enable_video_capture(caller->lc, TRUE);
+
+ /* Create call params */
+ caller_test_params.base = linphone_core_create_call_params(caller->lc, NULL);
+
+
+ out_call = linphone_core_invite_address_with_params(caller->lc, callee->identity,caller_test_params.base);
+ linphone_call_ref(out_call);
+
+ linphone_call_params_destroy(caller_test_params.base);
+ if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base);
+
+
+ BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallOutgoingInit, 1));
+
+ BC_ASSERT_TRUE(wait_for_until(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallError, 1, 6000));
+ BC_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable, int, "%d");
+ BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived, 0, int, "%d");
+
+ linphone_call_unref(out_call);
+ linphone_core_manager_destroy(callee);
+ linphone_core_manager_destroy(caller);
+}
+
+static void call_with_early_media_and_no_sdp_in_200_with_video(void){
+ early_media_without_sdp_in_200_base(TRUE, FALSE);
+}
+
+test_t call_video_tests[] = {
+#ifdef VIDEO_ENABLED
+ TEST_NO_TAG("Call paused resumed with video", call_paused_resumed_with_video),
+ TEST_NO_TAG("Call paused resumed with video no sdp ack", call_paused_resumed_with_no_sdp_ack),
+ TEST_NO_TAG("Call paused resumed with video no sdk ack using video policy for resume offers", call_paused_resumed_with_no_sdp_ack_using_video_policy),
+ TEST_NO_TAG("Call paused, updated and resumed with video no sdk ack using video policy for resume offers", call_paused_updated_resumed_with_no_sdp_ack_using_video_policy),
+ TEST_NO_TAG("Call paused, updated and resumed with video no sdk ack using video policy for resume offers with accept call update", call_paused_updated_resumed_with_no_sdp_ack_using_video_policy_and_accept_call_update),
+ TEST_NO_TAG("ZRTP video call", zrtp_video_call),
+ TEST_NO_TAG("Simple video call AVPF", video_call_avpf),
+ TEST_NO_TAG("Simple video call implicit AVPF both", video_call_using_policy_AVPF_implicit_caller_and_callee),
+ TEST_NO_TAG("Simple video call disable implicit AVPF on callee", video_call_disable_implicit_AVPF_on_callee),
+ TEST_NO_TAG("Simple video call disable implicit AVPF on caller", video_call_disable_implicit_AVPF_on_caller),
+ TEST_NO_TAG("Simple video call AVPF to implicit AVPF", video_call_AVPF_to_implicit_AVPF),
+ TEST_NO_TAG("Simple video call implicit AVPF to AVPF", video_call_implicit_AVPF_to_AVPF),
+ TEST_NO_TAG("Simple video call", video_call),
+ TEST_NO_TAG("Simple video call without rtcp",video_call_without_rtcp),
+ TEST_NO_TAG("Simple ZRTP video call", video_call_zrtp),
+ TEST_NO_TAG("Simple DTLS video call", video_call_dtls),
+ TEST_NO_TAG("Simple video call using policy", video_call_using_policy),
+ TEST_NO_TAG("Video call using policy with callee video disabled", video_call_using_policy_with_callee_video_disabled),
+ TEST_NO_TAG("Video call using policy with caller video disabled", video_call_using_policy_with_caller_video_disabled),
+ TEST_NO_TAG("Video call without SDP", video_call_no_sdp),
+ TEST_ONE_TAG("SRTP ice video call", srtp_video_ice_call, "ICE"),
+ TEST_ONE_TAG("ZRTP ice video call", zrtp_video_ice_call, "ICE"),
+ TEST_NO_TAG("Call with video added", call_with_video_added),
+ TEST_NO_TAG("Call with video added 2", call_with_video_added_2),
+ TEST_NO_TAG("Call with video added (random ports)", call_with_video_added_random_ports),
+ TEST_NO_TAG("Call with several video switches", call_with_several_video_switches),
+ TEST_NO_TAG("SRTP call with several video switches", srtp_call_with_several_video_switches),
+ TEST_NO_TAG("Call with video declined", call_with_declined_video),
+ TEST_NO_TAG("Call with video declined despite policy", call_with_declined_video_despite_policy),
+ TEST_NO_TAG("Call with video declined using policy", call_with_declined_video_using_policy),
+ TEST_NO_TAG("Video early-media call", video_early_media_call),
+ TEST_NO_TAG("Call with multiple early media", multiple_early_media),
+ TEST_ONE_TAG("Call with ICE from video to non-video", call_with_ice_video_to_novideo, "ICE"),
+ TEST_ONE_TAG("Call with ICE and video added", call_with_ice_video_added, "ICE"),
+ TEST_ONE_TAG("Call with ICE and video added 2", call_with_ice_video_added_2, "ICE"),
+ TEST_ONE_TAG("Call with ICE and video added 3", call_with_ice_video_added_3, "ICE"),
+ TEST_ONE_TAG("Call with ICE and video added and refused", call_with_ice_video_added_and_refused, "ICE"),
+ TEST_ONE_TAG("Call with ICE and video added with video policies to false", call_with_ice_video_added_with_video_policies_to_false, "ICE"),
+#if ICE_WAS_WORKING_WITH_REAL_TIME_TEXT
+ TEST_ONE_TAG("Call with ICE, video and realtime text", call_with_ice_video_and_rtt, "ICE"),
+#endif
+ TEST_ONE_TAG("Video call with ICE accepted using call params", video_call_ice_params, "ICE"),
+ TEST_ONE_TAG("Audio call with ICE paused with caller video policy enabled", audio_call_with_ice_with_video_policy_enabled, "ICE"),
+ TEST_NO_TAG("Video call recording (H264)", video_call_recording_h264_test),
+ TEST_NO_TAG("Video call recording (VP8)", video_call_recording_vp8_test),
+ TEST_NO_TAG("Snapshot", video_call_snapshot),
+ TEST_NO_TAG("Video call with early media and no matching audio codecs", video_call_with_early_media_no_matching_audio_codecs),
+ TEST_NO_TAG("DTLS SRTP video call", dtls_srtp_video_call),
+ TEST_ONE_TAG("DTLS SRTP ice video call", dtls_srtp_ice_video_call, "ICE"),
+ TEST_ONE_TAG("DTLS SRTP ice video call with relay", dtls_srtp_ice_video_call_with_relay, "ICE"),
+ TEST_NO_TAG("Video call with limited bandwidth", video_call_limited_bandwidth),
+ TEST_NO_TAG("Video call accepted in send only", accept_call_in_send_only),
+ TEST_ONE_TAG("Video call accepted in send only with ice", accept_call_in_send_only_with_ice, "ICE"),
+ TEST_NO_TAG("2 Video call accepted in send only", two_accepted_call_in_send_only),
+ TEST_NO_TAG("Video call with re-invite(inactive) followed by re-invite", video_call_with_re_invite_inactive_followed_by_re_invite),
+ TEST_NO_TAG("Video call with re-invite(inactive) followed by re-invite(no sdp)", video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp),
+ TEST_NO_TAG("SRTP Video call with re-invite(inactive) followed by re-invite", srtp_video_call_with_re_invite_inactive_followed_by_re_invite),
+ TEST_NO_TAG("SRTP Video call with re-invite(inactive) followed by re-invite(no sdp)", srtp_video_call_with_re_invite_inactive_followed_by_re_invite_no_sdp),
+ TEST_NO_TAG("Classic video entry phone setup", classic_video_entry_phone_setup),
+ TEST_NO_TAG("Incoming REINVITE with invalid SDP in ACK", incoming_reinvite_with_invalid_ack_sdp),
+ TEST_NO_TAG("Outgoing REINVITE with invalid SDP in ACK", outgoing_reinvite_with_invalid_ack_sdp),
+#endif
+ TEST_NO_TAG("Video call with no audio and no video codec", video_call_with_no_audio_and_no_video_codec),
+ TEST_NO_TAG("Call with early media and no SDP in 200 Ok with video", call_with_early_media_and_no_sdp_in_200_with_video),
+};
+
+test_suite_t call_video_test_suite = {"Video Call", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
+ sizeof(call_video_tests) / sizeof(call_video_tests[0]), call_video_tests};
diff --git a/tester/complex_sip_call_tester.c b/tester/complex_sip_case_tester.c
similarity index 99%
rename from tester/complex_sip_call_tester.c
rename to tester/complex_sip_case_tester.c
index b446592a7..1e524bb2c 100644
--- a/tester/complex_sip_call_tester.c
+++ b/tester/complex_sip_case_tester.c
@@ -361,7 +361,7 @@ static test_t tests[] = {
};
test_suite_t complex_sip_call_test_suite = {
- "Complex SIP Call",
+ "Complex SIP Case",
NULL,
NULL,
liblinphone_tester_before_each,
diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c
index 9ddf99ff6..6baf10504 100644
--- a/tester/eventapi_tester.c
+++ b/tester/eventapi_tester.c
@@ -129,8 +129,8 @@ static void subscribe_test_declined(void) {
LinphoneContent* content;
LinphoneEvent *lev;
const LinphoneErrorInfo *ei;
- MSList* lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
@@ -171,9 +171,9 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes
LinphoneContent* content;
LinphoneEvent *lev;
int expires= refresh_type!=NoRefresh ? 4 : 600;
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
if (refresh_type==ManualRefresh){
lp_config_set_int(marie->lc->config,"sip","refresh_generic_subscribe",0);
@@ -224,9 +224,9 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe
LinphoneContent* content;
LinphoneEvent *lev;
int expires= refresh_type!=NoRefresh ? 4 : 600;
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
if (refresh_type==ManualRefresh){
lp_config_set_int(marie->lc->config,"sip","refresh_generic_subscribe",0);
@@ -308,8 +308,8 @@ static void publish_test_with_args(bool_t refresh, int expires){
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneContent* content;
LinphoneEvent *lev;
- MSList* lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
@@ -363,8 +363,8 @@ static void out_of_dialog_notify(void){
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneContent* content;
LinphoneEvent *lev;
- MSList* lcs=ms_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c
index 96cf74252..1310aab47 100644
--- a/tester/flexisip_tester.c
+++ b/tester/flexisip_tester.c
@@ -29,10 +29,10 @@ static void subscribe_forking(void) {
LinphoneContent* content;
LinphoneEvent *lev;
int expires= 600;
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,pauline2->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,pauline2->lc);
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
@@ -55,20 +55,20 @@ static void subscribe_forking(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(pauline2);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void message_forking(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(message);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
linphone_chat_room_send_chat_message(chat_room, message);
@@ -84,7 +84,7 @@ static void message_forking(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(pauline);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void message_forking_with_unreachable_recipients(void) {
@@ -92,14 +92,14 @@ static void message_forking_with_unreachable_recipients(void) {
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(message);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,marie2->lc);
- lcs=ms_list_append(lcs,marie3->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,marie3->lc);
/*the following lines are to workaround a problem with messages sent by a previous test (Message forking) that arrive together with REGISTER responses,
* because the ForkMessageContext is not terminated at flexisip side if Message forking test is passing fast*/
@@ -134,7 +134,7 @@ static void message_forking_with_unreachable_recipients(void) {
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(marie3);
linphone_core_manager_destroy(pauline);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void message_forking_with_all_recipients_unreachable(void) {
@@ -142,14 +142,14 @@ static void message_forking_with_all_recipients_unreachable(void) {
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(message);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,marie2->lc);
- lcs=ms_list_append(lcs,marie3->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,marie3->lc);
/*the following lines are to workaround a problem with messages sent by a previous test (Message forking) that arrive together with REGISTER responses,
* because the ForkMessageContext is not terminated at flexisip side if Message forking test is passing fast*/
@@ -193,7 +193,7 @@ static void message_forking_with_all_recipients_unreachable(void) {
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(marie3);
linphone_core_manager_destroy(pauline);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void call_forking(void){
@@ -201,11 +201,11 @@ static void call_forking(void){
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
- MSList* lcs=ms_list_append(NULL,pauline->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,marie2->lc);
- lcs=ms_list_append(lcs,marie3->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,marie3->lc);
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
@@ -239,7 +239,7 @@ static void call_forking(void){
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(marie3);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void call_forking_with_urgent_reply(void){
@@ -247,10 +247,10 @@ static void call_forking_with_urgent_reply(void){
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
- MSList* lcs=ms_list_append(NULL,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,marie2->lc);
- lcs=ms_list_append(lcs,marie3->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,marie3->lc);
if (linphone_core_media_encryption_supported(pauline->lc,LinphoneMediaEncryptionSRTP)) {
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
@@ -284,7 +284,7 @@ static void call_forking_with_urgent_reply(void){
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(marie3);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void call_forking_cancelled(void){
@@ -292,11 +292,11 @@ static void call_forking_cancelled(void){
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
- MSList* lcs=ms_list_append(NULL,pauline->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,marie2->lc);
- lcs=ms_list_append(lcs,marie3->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,marie3->lc);
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
@@ -324,7 +324,7 @@ static void call_forking_cancelled(void){
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(marie3);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void call_forking_declined(bool_t declined_globaly){
@@ -332,11 +332,11 @@ static void call_forking_declined(bool_t declined_globaly){
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
- MSList* lcs=ms_list_append(NULL,pauline->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,marie2->lc);
- lcs=ms_list_append(lcs,marie3->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,marie3->lc);
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
@@ -379,7 +379,7 @@ static void call_forking_declined(bool_t declined_globaly){
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(marie3);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void call_forking_declined_globaly(void){
@@ -391,7 +391,7 @@ static void call_forking_declined_localy(void){
}
static void call_forking_with_push_notification_single(void){
- MSList* lcs;
+ bctbx_list_t* lcs;
LinphoneCoreManager* marie = linphone_core_manager_new2( "marie_rc", FALSE);
LinphoneCoreManager* pauline = linphone_core_manager_new2( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc",FALSE);
int dummy=0;
@@ -402,8 +402,8 @@ static void call_forking_with_push_notification_single(void){
linphone_core_get_default_proxy_config(marie->lc),
"app-id=org.linphonetester;pn-tok=aaabbb;pn-type=apple;pn-msg-str=33;pn-call-str=34;");
- lcs=ms_list_append(NULL,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(NULL,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneRegistrationOk,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneRegistrationOk,1,5000));
@@ -437,7 +437,7 @@ static void call_forking_with_push_notification_single(void){
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void call_forking_with_push_notification_multiple(void){
@@ -445,10 +445,10 @@ static void call_forking_with_push_notification_multiple(void){
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
- MSList* lcs=ms_list_append(NULL,pauline->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
@@ -497,11 +497,11 @@ static void call_forking_not_responded(void){
LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
- MSList* lcs=ms_list_append(NULL,pauline->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,marie2->lc);
- lcs=ms_list_append(lcs,marie3->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,marie3->lc);
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
@@ -527,14 +527,14 @@ static void call_forking_not_responded(void){
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(marie3);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void early_media_call_forking(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_early_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new("marie_early_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
- MSList *lcs=NULL;
+ bctbx_list_t *lcs=NULL;
LinphoneCallParams *params=linphone_core_create_call_params(pauline->lc, NULL);
LinphoneVideoPolicy pol;
int dummy=0;
@@ -560,9 +560,9 @@ static void early_media_call_forking(void) {
linphone_core_set_audio_port_range(marie2->lc,40200,40300);
linphone_core_set_video_port_range(marie2->lc,40400,40500);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,marie2->lc);
- lcs=ms_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
linphone_call_params_enable_early_media_sending(params,TRUE);
linphone_call_params_enable_video(params,TRUE);
@@ -600,7 +600,7 @@ static void early_media_call_forking(void) {
end_call(pauline, marie);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(marie);
@@ -611,10 +611,10 @@ static void call_with_sips(void){
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_sips_rc");
LinphoneCoreManager* pauline1 = linphone_core_manager_new( "pauline_sips_rc");
LinphoneCoreManager* pauline2 = linphone_core_manager_new( "pauline_tcp_rc");
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
- lcs=ms_list_append(lcs,pauline1->lc);
- lcs=ms_list_append(lcs,pauline2->lc);
+ lcs=bctbx_list_append(lcs,pauline1->lc);
+ lcs=bctbx_list_append(lcs,pauline2->lc);
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
linphone_core_set_user_agent(pauline1->lc,"Natted Linphone",NULL);
@@ -644,7 +644,7 @@ static void call_with_sips(void){
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline1);
linphone_core_manager_destroy(pauline2);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
}
@@ -653,13 +653,13 @@ static void call_with_sips_not_achievable(void){
LinphoneCoreManager* pauline2 = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_sips_rc");
LinphoneCoreManager* pauline1 = linphone_core_manager_new( "pauline_rc");
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
LinphoneAddress *dest;
LinphoneCall *call;
const LinphoneErrorInfo *ei;
- lcs=ms_list_append(lcs,pauline1->lc);
- lcs=ms_list_append(lcs,pauline2->lc);
+ lcs=bctbx_list_append(lcs,pauline1->lc);
+ lcs=bctbx_list_append(lcs,pauline2->lc);
dest=linphone_address_clone(pauline1->identity);
@@ -679,7 +679,7 @@ static void call_with_sips_not_achievable(void){
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline1);
linphone_core_manager_destroy(pauline2);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
}
@@ -1079,7 +1079,7 @@ static void test_list_subscribe (void) {
LinphoneEvent *lev;
- MSList* lcs=ms_list_append(NULL,marie->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
char * pauline_uri=linphone_address_as_string_uri_only(pauline->identity);
char * laure_uri=linphone_address_as_string_uri_only(laure->identity);
char * subscribe_content = ms_strdup_printf(list,pauline_uri,laure_uri);
@@ -1091,8 +1091,8 @@ static void test_list_subscribe (void) {
ms_free(pauline_uri);
ms_free(laure_uri);
- lcs=ms_list_append(lcs,pauline->lc);
- lcs=ms_list_append(lcs,laure->lc);
+ lcs=bctbx_list_append(lcs,pauline->lc);
+ lcs=bctbx_list_append(lcs,laure->lc);
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"resource-lists+xml");
diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c
index bbd1052bf..8fc38cc53 100644
--- a/tester/liblinphone_tester.c
+++ b/tester/liblinphone_tester.c
@@ -24,7 +24,12 @@
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#endif
#ifdef HAVE_GTK
#include
@@ -82,6 +87,19 @@ static void liblinphone_android_ortp_log_handler(const char *domain, OrtpLogLeve
liblinphone_android_log_handler(prio, fmt, args);
}
+static void liblinphone_android_bctbx_log_handler(const char *domain, BctbxLogLevel lev, const char *fmt, va_list args) {
+ int prio;
+ switch(lev){
+ case BCTBX_LOG_DEBUG: prio = ANDROID_LOG_DEBUG; break;
+ case BCTBX_LOG_MESSAGE: prio = ANDROID_LOG_INFO; break;
+ case BCTBX_LOG_WARNING: prio = ANDROID_LOG_WARN; break;
+ case BCTBX_LOG_ERROR: prio = ANDROID_LOG_ERROR; break;
+ case BCTBX_LOG_FATAL: prio = ANDROID_LOG_FATAL; break;
+ default: prio = ANDROID_LOG_DEFAULT; break;
+ }
+ liblinphone_android_log_handler(prio, fmt, args);
+}
+
void cunit_android_trace_handler(int level, const char *fmt, va_list args) {
char buffer[CALLBACK_BUFFER_SIZE];
jstring javaString;
@@ -158,6 +176,7 @@ void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, v
if (! log_file) {
#if defined(ANDROID)
linphone_core_set_log_handler(liblinphone_android_ortp_log_handler);
+ bctbx_set_log_handler(liblinphone_android_bctbx_log_handler);
#endif
}
@@ -176,6 +195,7 @@ int liblinphone_tester_set_log_file(const char *filename) {
return -1;
}
ms_message("Redirecting traces to file [%s]", filename);
+ bctbx_set_log_file(log_file);
ortp_set_log_file(log_file);
return 0;
}
@@ -191,7 +211,9 @@ static const char* liblinphone_helper =
"\t\t\t--auth-domain \n"
"\t\t\t--dns-hosts \n"
"\t\t\t--keep-recorded-files\n"
- "\t\t\t--disable-leak-detector\n";
+ "\t\t\t--disable-leak-detector\n"
+ "\t\t\t--6\n"
+ ;
int main (int argc, char *argv[])
{
diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h
index 7dea47ed1..898c0ed24 100644
--- a/tester/liblinphone_tester.h
+++ b/tester/liblinphone_tester.h
@@ -42,6 +42,7 @@ extern "C" {
extern test_suite_t setup_test_suite;
extern test_suite_t register_test_suite;
extern test_suite_t call_test_suite;
+extern test_suite_t call_video_test_suite;
extern test_suite_t message_test_suite;
extern test_suite_t presence_test_suite;
extern test_suite_t presence_server_test_suite;
@@ -323,12 +324,18 @@ bool_t call_with_test_params(LinphoneCoreManager* caller_mgr
,LinphoneCoreManager* callee_mgr
,const LinphoneCallTestParams *caller_test_params
,const LinphoneCallTestParams *callee_test_params);
+bool_t call_with_params2(LinphoneCoreManager* caller_mgr
+ ,LinphoneCoreManager* callee_mgr
+ , const LinphoneCallTestParams *caller_test_params
+ , const LinphoneCallTestParams *callee_test_params
+ , bool_t build_callee_params);
bool_t call(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr);
bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t change_video_policy);
void end_call(LinphoneCoreManager *m1, LinphoneCoreManager *m2);
void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime, int rate);
void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime);
+void disable_all_codecs(const MSList* elem, LinphoneCoreManager* call);
stats * get_stats(LinphoneCore *lc);
bool_t transport_supported(LinphoneTransportType transport);
LinphoneCoreManager *get_manager(LinphoneCore *lc);
@@ -352,6 +359,9 @@ bool_t call_with_caller_params(LinphoneCoreManager* caller_mgr,LinphoneCoreManag
bool_t pause_call_1(LinphoneCoreManager* mgr_1,LinphoneCall* call_1,LinphoneCoreManager* mgr_2,LinphoneCall* call_2);
void compare_files(const char *path1, const char *path2);
void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList* lcs,LinphoneMediaDirection audio_dir, LinphoneMediaDirection video_dir);
+void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay);
+void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts);
+void record_call(const char *filename, bool_t enableVideo, const char *video_codec);
extern const MSAudioDiffParams audio_cmp_params;
@@ -370,6 +380,7 @@ void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, v
void liblinphone_tester_uninit(void);
int liblinphone_tester_set_log_file(const char *filename);
bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, LinphoneIceState state);
+void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts);
LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bool_t do_registration);
void linphone_conference_server_destroy(LinphoneConferenceServer *conf_srv);
@@ -379,6 +390,7 @@ extern const char *liblinphone_tester_mire_id;
LinphoneAddress * linphone_core_manager_resolve(LinphoneCoreManager *mgr, const LinphoneAddress *source);
FILE *sip_start(const char *senario, const char* dest_username, const char *passwd, LinphoneAddress* dest_addres);
+void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ice );
#ifdef __cplusplus
diff --git a/tester/liblinphone_tester_ios.m b/tester/liblinphone_tester_ios.m
new file mode 100644
index 000000000..60b53ee93
--- /dev/null
+++ b/tester/liblinphone_tester_ios.m
@@ -0,0 +1,67 @@
+/*
+ linphone library - modular sound and video processing and streaming
+ Copyright (C) 2006-2014 Belledonne Communications, Grenoble
+
+ 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.
+ */
+
+#if TARGET_OS_IPHONE
+
+#import
+#import
+#include
+#include
+#include "liblinphone_tester.h"
+
+int g_argc;
+char** g_argv;
+void stop_handler(int sig) {
+ return;
+}
+
+static void* _apple_main(void* data) {
+ NSString *bundlePath = [[[NSBundle mainBundle] bundlePath] retain];
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+ NSString *documentPath = [[paths objectAtIndex:0] retain];
+
+ NSLog(@"Bundle path: %@", bundlePath);
+ NSLog(@"Document path: %@", documentPath);
+
+ bc_tester_set_resource_dir_prefix(bundlePath.UTF8String);
+ bc_tester_set_writable_dir_prefix(documentPath.UTF8String);
+
+ liblinphone_tester_init(NULL);
+ bc_tester_start("toto");
+ liblinphone_tester_uninit();
+
+ [bundlePath release];
+ [documentPath release];
+ return NULL;
+}
+int main(int argc, char * argv[]) {
+ pthread_t main_thread;
+ g_argc=argc;
+ g_argv=argv;
+ pthread_create(&main_thread,NULL,_apple_main,NULL);
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ int value = UIApplicationMain(0, nil, nil, nil);
+ [pool release];
+ return value;
+ pthread_join(main_thread,NULL);
+ return 0;
+}
+
+
+#endif // target IPHONE
diff --git a/tester/marie_xml b/tester/marie_xml
deleted file mode 100644
index 5818930ba..000000000
--- a/tester/marie_xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
- -1
- -1
- -1
- 0
- 0
- 0
- 1
-
-
- marie
- marie
- secret
- sip.example.org
-
-
- sip.example.org;transport=tcp
- sip.example.org;transport=tcp;lr
- sip:marie@sip.example.org
- 3600
- 1
- 0
- 0
-
-
- "Paupoche" <sip:pauline@sip.example.org>
- accept
- 0
-
-
-
- 0
- 0
- 0
- vga
- 0
- 0
- 0
- 0
- StaticImage: Static picture
-
-
- 0 #to not overload cpu in case of VG
-
-
diff --git a/tester/message_tester.c b/tester/message_tester.c
index 5ada03f4e..abdf8edf2 100644
--- a/tester/message_tester.c
+++ b/tester/message_tester.c
@@ -23,14 +23,19 @@
#include "liblinphone_tester.h"
#include "lime.h"
-#ifdef MSG_STORAGE_ENABLED
+#ifdef SQLITE_STORAGE_ENABLED
#include
#endif
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
static char* message_external_body_url=NULL;
@@ -357,15 +362,15 @@ static void text_message_with_send_error(void) {
linphone_chat_room_send_chat_message(chat_room,msg);
/* check transient msg list: the msg should be in it, and should be the only one */
- BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1, int, "%d");
- BC_ASSERT_PTR_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), msg);
+ BC_ASSERT_EQUAL(bctbx_list_size(chat_room->transient_messages), 1, int, "%d");
+ BC_ASSERT_PTR_EQUAL(bctbx_list_nth_data(chat_room->transient_messages,0), msg);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1));
/*BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageInProgress,1, int, "%d");*/
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0, int, "%d");
/* the msg should have been discarded from transient list after an error */
- BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(chat_room->transient_messages), 0, int, "%d");
sal_set_send_error(marie->lc->sal, 0);
@@ -391,8 +396,8 @@ static void text_message_with_external_body(void) {
linphone_chat_room_send_chat_message(chat_room,msg);
/* check transient msg list: the msg should be in it, and should be the only one */
- BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1, int, "%d");
- BC_ASSERT_PTR_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), msg);
+ BC_ASSERT_EQUAL(bctbx_list_size(chat_room->transient_messages), 1, int, "%d");
+ BC_ASSERT_PTR_EQUAL(bctbx_list_nth_data(chat_room->transient_messages,0), msg);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1));
@@ -400,7 +405,7 @@ static void text_message_with_external_body(void) {
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1, int, "%d");
- BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(chat_room->transient_messages), 0, int, "%d");
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@@ -453,8 +458,10 @@ void transfer_message_base2(LinphoneCoreManager* marie, LinphoneCoreManager* pau
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneMessageNotDelivered,1, 10000));
belle_http_provider_set_recv_error(marie->lc->http_provider, 0);
} else {
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1));
- compare_files(send_filepath, receive_filepath);
+ /* wait for a long time in case the DNS SRV resolution takes times - it should be immediate though */
+ if (BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1,55000))) {
+ compare_files(send_filepath, receive_filepath);
+ }
}
}
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,2, int, "%d"); //sent twice because of file transfer
@@ -608,42 +615,44 @@ static void file_transfer_2_messages_simultaneously(void) {
cbs = linphone_chat_message_get_callbacks(msg2);
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
- BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_chat_rooms(marie->lc)), 0, int, "%d");
- linphone_chat_room_send_chat_message(pauline_room,msg);
- linphone_chat_room_send_chat_message(pauline_room,msg2);
- if (BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1))) {
- msg = linphone_chat_message_clone(marie->stat.last_received_chat_message);
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,2));
- msg2 = marie->stat.last_received_chat_message;
- BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_chat_rooms(marie->lc)), 1, int, "%d");
- if (ms_list_size(linphone_core_get_chat_rooms(marie->lc)) != 1) {
- char * buf = ms_strdup_printf("Found %d rooms instead of 1: ", ms_list_size(linphone_core_get_chat_rooms(marie->lc)));
- const MSList *it = linphone_core_get_chat_rooms(marie->lc);
- while (it) {
- const LinphoneAddress * peer = linphone_chat_room_get_peer_address(it->data);
- buf = ms_strcat_printf("%s, ", linphone_address_get_username(peer));
- it = it->next;
+ BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)), 0, int, "%d");
+ if (bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)) == 0) {
+ linphone_chat_room_send_chat_message(pauline_room,msg);
+ linphone_chat_room_send_chat_message(pauline_room,msg2);
+ if (BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1))) {
+ msg = linphone_chat_message_clone(marie->stat.last_received_chat_message);
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,2));
+ msg2 = marie->stat.last_received_chat_message;
+ BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)), 1, int, "%d");
+ if (bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)) != 1) {
+ char * buf = ms_strdup_printf("Found %d rooms instead of 1: ", bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)));
+ const bctbx_list_t *it = linphone_core_get_chat_rooms(marie->lc);
+ while (it) {
+ const LinphoneAddress * peer = linphone_chat_room_get_peer_address(it->data);
+ buf = ms_strcat_printf("%s, ", linphone_address_get_username(peer));
+ it = it->next;
+ }
+ ms_error("%s", buf);
}
- ms_error("%s", buf);
+
+ cbs = linphone_chat_message_get_callbacks(msg);
+ linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
+ linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
+ linphone_chat_message_download_file(msg);
+
+ cbs = linphone_chat_message_get_callbacks(msg2);
+ linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
+ linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
+ linphone_chat_message_download_file(msg2);
+
+ BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,2));
+
+ BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,4, int, "%d");
+ BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,2, int, "%d");
+ compare_files(send_filepath, receive_filepath);
+
+ linphone_chat_message_unref(msg);
}
-
- cbs = linphone_chat_message_get_callbacks(msg);
- linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
- linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
- linphone_chat_message_download_file(msg);
-
- cbs = linphone_chat_message_get_callbacks(msg2);
- linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
- linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
- linphone_chat_message_download_file(msg2);
-
- BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,2));
-
- BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,4, int, "%d");
- BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,2, int, "%d");
- compare_files(send_filepath, receive_filepath);
-
- linphone_chat_message_unref(msg);
}
linphone_core_manager_destroy(pauline);
ms_free(send_filepath);
@@ -757,9 +766,6 @@ static void is_composing_notification(void) {
linphone_core_manager_destroy(pauline);
}
-
-#ifdef HAVE_LIME
-
static FILE* fopen_from_write_dir(const char * name, const char * mode) {
char *filepath = bc_tester_file(name);
FILE * file = fopen(filepath,mode);
@@ -817,7 +823,7 @@ static void lime_text_message_to_non_lime(void) {
char* filepath;
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
-
+
if (!linphone_core_lime_available(marie->lc)) {
ms_warning("Lime not available, skiping");
goto end;
@@ -857,7 +863,7 @@ void lime_transfer_message_base(bool_t encrypt_file,bool_t download_file_from_st
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new( "pauline_tcp_rc");
-
+
if (!linphone_core_lime_available(marie->lc)) {
ms_warning("Lime not available, skiping");
goto end;
@@ -944,8 +950,8 @@ static void lime_transfer_message_without_encryption(void) {
lime_transfer_message_base(FALSE,FALSE);
}
-static void printHex(char *title, uint8_t *data, uint32_t length) {
- int i;
+static void printHex(char *title, uint8_t *data, size_t length) {
+ size_t i;
char debug_string_buffer[2048];
char *debug_string = debug_string_buffer;
sprintf (debug_string, "%s : ", title);
@@ -959,174 +965,177 @@ static void printHex(char *title, uint8_t *data, uint32_t length) {
}
static void lime_unit(void) {
- const char* PLAIN_TEXT_TEST_MESSAGE = "Ceci est un fabuleux msg de test à encrypter";
- int retval;
- size_t size;
- uint8_t *cacheBufferString;
- xmlDocPtr cacheBufferAlice;
- xmlDocPtr cacheBufferBob;
- uint8_t *multipartMessage = NULL;
- uint8_t *decryptedMessage = NULL;
- xmlChar *xmlStringOutput;
- int xmlStringLength;
- limeURIKeys_t associatedKeys;
- int i;
- limeKey_t associatedKey;
- uint8_t targetZID[12] = {0x00, 0x5d, 0xbe, 0x03, 0x99, 0x64, 0x3d, 0x95, 0x3a, 0x22, 0x02, 0xdd};
- uint8_t senderZID[12] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x70, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0};
- uint8_t encryptedMessage[1024];
- uint8_t plainMessage[1024];
- uint8_t receiverZID[12];
- xmlDocPtr cacheBuffer;
- FILE *CACHE;
-
- /**** Low level tests using on cache file to extract keys, encrypt/decrypt ****/
- /**** use functions that are not directly used by external entities ****/
-
- /* create and load cache file */
- CACHE = fopen_from_write_dir("ZIDCache.xml", "wb");
- fprintf (CACHE, "\nef7692d0792a67491ae2d44e005dbe0399643d953a2202dd9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899pipo1@pipo.com963c57bb28e62068d2df23e8f9b771932d3c57bb28e62068d2df23e8f9b7719305d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b771935f9aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b7719302ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b7719300000069000001e8011234567889643d953a2202ee9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899pipo1@pipo.com123456789012345678901234567890123456765431262068d2df23e8f9b7719325d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b77193f69aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b7719322ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b77193000000010000000001");
- fclose(CACHE);
- CACHE = fopen_from_write_dir("ZIDCache.xml", "rb+");
- cacheBufferString = (uint8_t*) ms_load_file_content(CACHE, &size);
- *(cacheBufferString+size) = '\0';
- fclose(CACHE);
- /* parse it to an xmlDoc */
- cacheBuffer = xmlParseDoc(cacheBufferString);
- ms_free(cacheBufferString);
-
- /* get data from cache : sender */
- associatedKeys.peerURI = (uint8_t *)malloc(15);
- memcpy(associatedKeys.peerURI, "pipo1@pipo.com", 15);
- associatedKeys.associatedZIDNumber = 0;
- retval = lime_getCachedSndKeysByURI(cacheBuffer, &associatedKeys);
- BC_ASSERT_EQUAL(retval, 0, int, "%d");
- BC_ASSERT_EQUAL(associatedKeys.associatedZIDNumber, 2, int, "%d"); /* there are 2 keys associated to pipo1@pipo.com address in the cache above*/
- ms_message("Get cached key by URI, for sender, return %d keys", associatedKeys.associatedZIDNumber);
-
- for (i=0; ipeerZID, 12);
- printHex("key", associatedKeys.peerKeys[i]->key, 32);
- printHex("sessionID", associatedKeys.peerKeys[i]->sessionId, 32);
- ms_message("session index %d\n", associatedKeys.peerKeys[i]->sessionIndex);
+ if (lime_is_available()) {
+ const char* PLAIN_TEXT_TEST_MESSAGE = "Ceci est un fabuleux msg de test à encrypter";
+ int retval;
+ size_t size;
+ uint8_t *cacheBufferString;
+ xmlDocPtr cacheBufferAlice;
+ xmlDocPtr cacheBufferBob;
+ uint8_t *multipartMessage = NULL;
+ uint8_t *decryptedMessage = NULL;
+ xmlChar *xmlStringOutput;
+ int xmlStringLength;
+ limeURIKeys_t associatedKeys;
+ int i;
+ limeKey_t associatedKey;
+ uint8_t targetZID[12] = {0x00, 0x5d, 0xbe, 0x03, 0x99, 0x64, 0x3d, 0x95, 0x3a, 0x22, 0x02, 0xdd};
+ uint8_t senderZID[12] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x70, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0};
+ uint8_t encryptedMessage[1024];
+ uint8_t plainMessage[1024];
+ uint8_t receiverZID[12];
+ xmlDocPtr cacheBuffer;
+ FILE *CACHE;
+
+ /**** Low level tests using on cache file to extract keys, encrypt/decrypt ****/
+ /**** use functions that are not directly used by external entities ****/
+
+ /* create and load cache file */
+ CACHE = fopen_from_write_dir("ZIDCache.xml", "wb");
+ fprintf (CACHE, "\nef7692d0792a67491ae2d44e005dbe0399643d953a2202dd9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899pipo1@pipo.com963c57bb28e62068d2df23e8f9b771932d3c57bb28e62068d2df23e8f9b7719305d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b771935f9aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b7719302ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b7719300000069000001e8011234567889643d953a2202ee9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899pipo1@pipo.com123456789012345678901234567890123456765431262068d2df23e8f9b7719325d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b77193f69aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b7719322ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b77193000000010000000001");
+ fclose(CACHE);
+ CACHE = fopen_from_write_dir("ZIDCache.xml", "rb+");
+ cacheBufferString = (uint8_t*) ms_load_file_content(CACHE, &size);
+ *(cacheBufferString+size) = '\0';
+ fclose(CACHE);
+ /* parse it to an xmlDoc */
+ cacheBuffer = xmlParseDoc(cacheBufferString);
+ ms_free(cacheBufferString);
+
+ /* get data from cache : sender */
+ associatedKeys.peerURI = (uint8_t *)malloc(15);
+ memcpy(associatedKeys.peerURI, "pipo1@pipo.com", 15);
+ associatedKeys.associatedZIDNumber = 0;
+ retval = lime_getCachedSndKeysByURI(cacheBuffer, &associatedKeys);
+ BC_ASSERT_EQUAL(retval, 0, int, "%d");
+ BC_ASSERT_EQUAL(associatedKeys.associatedZIDNumber, 2, int, "%d"); /* there are 2 keys associated to pipo1@pipo.com address in the cache above*/
+ ms_message("Get cached key by URI, for sender, return %d keys", associatedKeys.associatedZIDNumber);
+
+ for (i=0; ipeerZID, 12);
+ printHex("key", associatedKeys.peerKeys[i]->key, 32);
+ printHex("sessionID", associatedKeys.peerKeys[i]->sessionId, 32);
+ ms_message("session index %d\n", associatedKeys.peerKeys[i]->sessionIndex);
+ }
+
+ /* get data from cache : receiver */
+ memcpy(associatedKey.peerZID, targetZID, 12);
+ retval = lime_getCachedRcvKeyByZid(cacheBuffer, &associatedKey);
+ BC_ASSERT_EQUAL(retval, 0, int, "%d");
+ printHex("Got receiver key for ZID", targetZID, 12);
+ printHex("Key", associatedKey.key, 32);
+ printHex("sessionID", associatedKey.sessionId, 32);
+ ms_message("session index %d\n", associatedKey.sessionIndex);
+
+ /* encrypt/decrypt a msg */
+ lime_encryptMessage(associatedKeys.peerKeys[0], (uint8_t *)PLAIN_TEXT_TEST_MESSAGE, strlen(PLAIN_TEXT_TEST_MESSAGE), senderZID, encryptedMessage);
+ printHex("Ciphered", encryptedMessage, strlen((char *)encryptedMessage));
+ /* invert sender and receiverZID to decrypt/authenticate */
+ memcpy(receiverZID, associatedKeys.peerKeys[0]->peerZID, 12);
+ memcpy(associatedKeys.peerKeys[0]->peerZID, senderZID, 12);
+ retval = lime_decryptMessage(associatedKeys.peerKeys[0], encryptedMessage, strlen(PLAIN_TEXT_TEST_MESSAGE)+16, receiverZID, plainMessage);
+ BC_ASSERT_EQUAL(retval, 0, int, "%d");
+ BC_ASSERT_STRING_EQUAL((char *)plainMessage, (char *)PLAIN_TEXT_TEST_MESSAGE);
+ ms_message("Decrypt and auth returned %d\nPlain text is %s\n", retval, plainMessage);
+
+ /* update receiver data */
+ associatedKey.sessionIndex++;
+ associatedKey.key[0]++;
+ associatedKey.sessionId[0]++;
+ retval = lime_setCachedKey(cacheBuffer, &associatedKey, LIME_RECEIVER);
+ BC_ASSERT_EQUAL(retval, 0, int, "%d");
+
+ /* update sender data */
+ associatedKeys.peerKeys[0]->sessionIndex++;
+ associatedKeys.peerKeys[0]->key[0]++;
+ associatedKeys.peerKeys[0]->sessionId[0]++;
+ retval = lime_setCachedKey(cacheBuffer, associatedKeys.peerKeys[0], LIME_SENDER);
+ BC_ASSERT_EQUAL(retval, 0, int, "%d");
+
+ /* free memory */
+ lime_freeKeys(&associatedKeys);
+
+ /* write the file */
+ /* dump the xml document into a string */
+ xmlDocDumpFormatMemoryEnc(cacheBuffer, &xmlStringOutput, &xmlStringLength, "UTF-8", 0);
+ /* write it to the file */
+ CACHE = fopen_from_write_dir("ZIDCache.xml", "w+");
+ fwrite(xmlStringOutput, 1, xmlStringLength, CACHE);
+ xmlFree(xmlStringOutput);
+ fclose(CACHE);
+ xmlFreeDoc(cacheBuffer);
+
+ /**** Higher level tests using 2 caches to encrypt/decrypt a msg ****/
+ /* Create Alice cache file and then load it */
+ CACHE = fopen_from_write_dir("ZIDCacheAlice.xml", "wb");
+ fprintf(CACHE, "\nef7692d0792a67491ae2d44e005dbe0399643d953a2202dd9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899sip:pauline@sip.example.org9111ebeb52e50edcc6fcb3eea1a2d3ae3c2c75d3668923e83c59d0f47245515060f020a3fe11dc2cc0e1e8ed9341b4cd14944db806ca4fc95456bbe45d95c43a5f9aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193bcffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b7719300000080000001cf011234567889643d953a2202ee9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899sip:pauline@sip.example.org72d80ab1cad243cf45634980c1d02cfb2df81ce0dd5dfcf1ebeacfc5345a917625d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b77193f69aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b7719322ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b771930000000f00000000");
+ fclose(CACHE);
+ CACHE = fopen_from_write_dir("ZIDCacheAlice.xml", "rb+");
+ cacheBufferString = (uint8_t *)ms_load_file_content(CACHE, &size);
+ *(cacheBufferString+size) = '\0';
+ fclose(CACHE);
+ /* parse it to an xmlDoc */
+ cacheBufferAlice = xmlParseDoc(cacheBufferString);
+ ms_free(cacheBufferString);
+
+ /* Create Bob cache file and then load it */
+ CACHE = fopen_from_write_dir("ZIDCacheBob.xml", "wb");
+ fprintf(CACHE, "\n005dbe0399643d953a2202ddef7692d0792a67491ae2d44e9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899sip:marie@sip.example.org9111ebeb52e50edcc6fcb3eea1a2d3ae3c2c75d3668923e83c59d0f47245515060f020a3fe11dc2cc0e1e8ed9341b4cd14944db806ca4fc95456bbe45d95c43a5f9aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193bcffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b7719300000080000001cf011234567889643d953a2202ee9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899sip:marie@sip.example.org81e6e6362c34dc974263d1f77cbb9a8d6d6a718330994379099a8fa19fb12faa25d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b77193f69aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b7719322ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b771930000002e0000000001");
+ fclose(CACHE);
+ CACHE = fopen_from_write_dir("ZIDCacheBob.xml", "rb+");
+ cacheBufferString = (uint8_t *)ms_load_file_content(CACHE, &size);
+ *(cacheBufferString+size) = '\0';
+ fclose(CACHE);
+ /* parse it to an xmlDoc */
+ cacheBufferBob = xmlParseDoc(cacheBufferString);
+ ms_free(cacheBufferString);
+
+
+
+ /* encrypt a msg */
+ retval = lime_createMultipartMessage(cacheBufferAlice, (uint8_t *)PLAIN_TEXT_TEST_MESSAGE, (uint8_t *)"sip:pauline@sip.example.org", &multipartMessage);
+
+ BC_ASSERT_EQUAL(retval, 0, int, "%d");
+ if (retval == 0) {
+ ms_message("Encrypted msg created is %s", multipartMessage);
+ }
+
+ /* decrypt the multipart msg */
+ retval = lime_decryptMultipartMessage(cacheBufferBob, multipartMessage, &decryptedMessage);
+
+ BC_ASSERT_EQUAL(retval, 0, int, "%d");
+ if (retval == 0) {
+ BC_ASSERT_STRING_EQUAL((char *)decryptedMessage, (char *)PLAIN_TEXT_TEST_MESSAGE);
+ ms_message("Succesfully decrypted msg is %s", decryptedMessage);
+ }
+ free(multipartMessage);
+ free(decryptedMessage);
+
+ /* update ZID files */
+ /* dump the xml document into a string */
+ xmlDocDumpFormatMemoryEnc(cacheBufferAlice, &xmlStringOutput, &xmlStringLength, "UTF-8", 0);
+ /* write it to the file */
+ CACHE = fopen_from_write_dir("ZIDCacheAlice.xml", "wb+");
+ fwrite(xmlStringOutput, 1, xmlStringLength, CACHE);
+ xmlFree(xmlStringOutput);
+ fclose(CACHE);
+
+ xmlDocDumpFormatMemoryEnc(cacheBufferBob, &xmlStringOutput, &xmlStringLength, "UTF-8", 0);
+ /* write it to the file */
+ CACHE = fopen_from_write_dir("ZIDCacheBob.xml", "wb+");
+ fwrite(xmlStringOutput, 1, xmlStringLength, CACHE);
+ xmlFree(xmlStringOutput);
+ fclose(CACHE);
+
+
+ xmlFreeDoc(cacheBufferAlice);
+ xmlFreeDoc(cacheBufferBob);
+ } else {
+ ms_warning("Lime not available, skiping");
}
-
- /* get data from cache : receiver */
- memcpy(associatedKey.peerZID, targetZID, 12);
- retval = lime_getCachedRcvKeyByZid(cacheBuffer, &associatedKey);
- BC_ASSERT_EQUAL(retval, 0, int, "%d");
- printHex("Got receiver key for ZID", targetZID, 12);
- printHex("Key", associatedKey.key, 32);
- printHex("sessionID", associatedKey.sessionId, 32);
- ms_message("session index %d\n", associatedKey.sessionIndex);
-
- /* encrypt/decrypt a msg */
- lime_encryptMessage(associatedKeys.peerKeys[0], (uint8_t *)PLAIN_TEXT_TEST_MESSAGE, strlen(PLAIN_TEXT_TEST_MESSAGE), senderZID, encryptedMessage);
- printHex("Ciphered", encryptedMessage, strlen((char *)encryptedMessage));
- /* invert sender and receiverZID to decrypt/authenticate */
- memcpy(receiverZID, associatedKeys.peerKeys[0]->peerZID, 12);
- memcpy(associatedKeys.peerKeys[0]->peerZID, senderZID, 12);
- retval = lime_decryptMessage(associatedKeys.peerKeys[0], encryptedMessage, strlen(PLAIN_TEXT_TEST_MESSAGE)+16, receiverZID, plainMessage);
- BC_ASSERT_EQUAL(retval, 0, int, "%d");
- BC_ASSERT_STRING_EQUAL((char *)plainMessage, (char *)PLAIN_TEXT_TEST_MESSAGE);
- ms_message("Decrypt and auth returned %d\nPlain text is %s\n", retval, plainMessage);
-
- /* update receiver data */
- associatedKey.sessionIndex++;
- associatedKey.key[0]++;
- associatedKey.sessionId[0]++;
- retval = lime_setCachedKey(cacheBuffer, &associatedKey, LIME_RECEIVER);
- BC_ASSERT_EQUAL(retval, 0, int, "%d");
-
- /* update sender data */
- associatedKeys.peerKeys[0]->sessionIndex++;
- associatedKeys.peerKeys[0]->key[0]++;
- associatedKeys.peerKeys[0]->sessionId[0]++;
- retval = lime_setCachedKey(cacheBuffer, associatedKeys.peerKeys[0], LIME_SENDER);
- BC_ASSERT_EQUAL(retval, 0, int, "%d");
-
- /* free memory */
- lime_freeKeys(&associatedKeys);
-
- /* write the file */
- /* dump the xml document into a string */
- xmlDocDumpFormatMemoryEnc(cacheBuffer, &xmlStringOutput, &xmlStringLength, "UTF-8", 0);
- /* write it to the file */
- CACHE = fopen_from_write_dir("ZIDCache.xml", "w+");
- fwrite(xmlStringOutput, 1, xmlStringLength, CACHE);
- xmlFree(xmlStringOutput);
- fclose(CACHE);
- xmlFreeDoc(cacheBuffer);
-
- /**** Higher level tests using 2 caches to encrypt/decrypt a msg ****/
- /* Create Alice cache file and then load it */
- CACHE = fopen_from_write_dir("ZIDCacheAlice.xml", "wb");
- fprintf(CACHE, "\nef7692d0792a67491ae2d44e005dbe0399643d953a2202dd9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899sip:pauline@sip.example.org9111ebeb52e50edcc6fcb3eea1a2d3ae3c2c75d3668923e83c59d0f47245515060f020a3fe11dc2cc0e1e8ed9341b4cd14944db806ca4fc95456bbe45d95c43a5f9aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193bcffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b7719300000080000001cf011234567889643d953a2202ee9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899sip:pauline@sip.example.org72d80ab1cad243cf45634980c1d02cfb2df81ce0dd5dfcf1ebeacfc5345a917625d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b77193f69aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b7719322ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b771930000000f00000000");
- fclose(CACHE);
- CACHE = fopen_from_write_dir("ZIDCacheAlice.xml", "rb+");
- cacheBufferString = (uint8_t *)ms_load_file_content(CACHE, &size);
- *(cacheBufferString+size) = '\0';
- fclose(CACHE);
- /* parse it to an xmlDoc */
- cacheBufferAlice = xmlParseDoc(cacheBufferString);
- ms_free(cacheBufferString);
-
- /* Create Bob cache file and then load it */
- CACHE = fopen_from_write_dir("ZIDCacheBob.xml", "wb");
- fprintf(CACHE, "\n005dbe0399643d953a2202ddef7692d0792a67491ae2d44e9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899sip:marie@sip.example.org9111ebeb52e50edcc6fcb3eea1a2d3ae3c2c75d3668923e83c59d0f47245515060f020a3fe11dc2cc0e1e8ed9341b4cd14944db806ca4fc95456bbe45d95c43a5f9aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b77193bcffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b7719300000080000001cf011234567889643d953a2202ee9b5c8f06f3b6c2c695f2dfc3c26f31f5fef8661f8c5fe7c95aeb5c5b0435b045f8324dd18ea905171ec2be89f879d01d5994132048d92ea020778cbdf31c605e2fdcef69380937c2cf221f7d11526f286c39f49641452ba9012521c705094899sip:marie@sip.example.org81e6e6362c34dc974263d1f77cbb9a8d6d6a718330994379099a8fa19fb12faa25d9ac653a83c4559cb0ae7394e7cd3b2d3c57bb28e62068d2df23e8f9b77193f69aa1e5e4c7ec88fa389a9f6b8879b42d3c57bb28e62068d2df23e8f9b7719322ffd51e7316a6c6f53a50fcf01b01bf2d3c57bb28e62068d2df23e8f9b771930000002e0000000001");
- fclose(CACHE);
- CACHE = fopen_from_write_dir("ZIDCacheBob.xml", "rb+");
- cacheBufferString = (uint8_t *)ms_load_file_content(CACHE, &size);
- *(cacheBufferString+size) = '\0';
- fclose(CACHE);
- /* parse it to an xmlDoc */
- cacheBufferBob = xmlParseDoc(cacheBufferString);
- ms_free(cacheBufferString);
-
-
-
- /* encrypt a msg */
- retval = lime_createMultipartMessage(cacheBufferAlice, (uint8_t *)PLAIN_TEXT_TEST_MESSAGE, (uint8_t *)"sip:pauline@sip.example.org", &multipartMessage);
-
- BC_ASSERT_EQUAL(retval, 0, int, "%d");
- if (retval == 0) {
- ms_message("Encrypted msg created is %s", multipartMessage);
- }
-
- /* decrypt the multipart msg */
- retval = lime_decryptMultipartMessage(cacheBufferBob, multipartMessage, &decryptedMessage);
-
- BC_ASSERT_EQUAL(retval, 0, int, "%d");
- if (retval == 0) {
- BC_ASSERT_STRING_EQUAL((char *)decryptedMessage, (char *)PLAIN_TEXT_TEST_MESSAGE);
- ms_message("Succesfully decrypted msg is %s", decryptedMessage);
- }
- free(multipartMessage);
- free(decryptedMessage);
-
- /* update ZID files */
- /* dump the xml document into a string */
- xmlDocDumpFormatMemoryEnc(cacheBufferAlice, &xmlStringOutput, &xmlStringLength, "UTF-8", 0);
- /* write it to the file */
- CACHE = fopen_from_write_dir("ZIDCacheAlice.xml", "wb+");
- fwrite(xmlStringOutput, 1, xmlStringLength, CACHE);
- xmlFree(xmlStringOutput);
- fclose(CACHE);
-
- xmlDocDumpFormatMemoryEnc(cacheBufferBob, &xmlStringOutput, &xmlStringLength, "UTF-8", 0);
- /* write it to the file */
- CACHE = fopen_from_write_dir("ZIDCacheBob.xml", "wb+");
- fwrite(xmlStringOutput, 1, xmlStringLength, CACHE);
- xmlFree(xmlStringOutput);
- fclose(CACHE);
-
-
- xmlFreeDoc(cacheBufferAlice);
- xmlFreeDoc(cacheBufferBob);
}
-
-#endif /* HAVE_LIME */
+#ifdef SQLITE_STORAGE_ENABLED
/*
* Copy file "from" to file "to".
@@ -1182,16 +1191,16 @@ int check_no_strange_time(void* data,int argc, char** argv,char** cNames) {
}
void history_message_count_helper(LinphoneChatRoom* chatroom, int x, int y, int expected ){
- MSList* messages = linphone_chat_room_get_history_range(chatroom, x, y);
- BC_ASSERT_EQUAL(ms_list_size(messages), expected, int, "%d");
- ms_list_free_with_data(messages, (void (*)(void *))linphone_chat_message_unref);
+ bctbx_list_t* messages = linphone_chat_room_get_history_range(chatroom, x, y);
+ BC_ASSERT_EQUAL(bctbx_list_size(messages), expected, int, "%d");
+ bctbx_list_free_with_data(messages, (void (*)(void *))linphone_chat_message_unref);
}
static void database_migration(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
char *src_db = bc_tester_res("messages.db");
char *tmp_db = bc_tester_file("tmp.db");
- const MSList* chatrooms;
+ const bctbx_list_t* chatrooms;
BC_ASSERT_EQUAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d");
@@ -1201,13 +1210,16 @@ static void database_migration(void) {
// the messages.db has 10000 dummy messages with the very first DB scheme.
// This will test the migration procedure
linphone_core_set_chat_database_path(marie->lc, tmp_db);
+ BC_ASSERT_PTR_NOT_NULL(marie->lc->db);
+ if (!marie->lc->db) goto end;
chatrooms = linphone_core_get_chat_rooms(marie->lc);
- BC_ASSERT(ms_list_size(chatrooms) > 0);
+ BC_ASSERT(bctbx_list_size(chatrooms) > 0);
// check that all messages have been migrated to the UTC time storage
BC_ASSERT(sqlite3_exec(marie->lc->db, "SELECT COUNT(*) FROM history WHERE time != '-1';", check_no_strange_time, NULL, NULL) == SQLITE_OK );
+end:
linphone_core_manager_destroy(marie);
remove(tmp_db);
ms_free(src_db);
@@ -1224,6 +1236,8 @@ static void history_range(void){
BC_ASSERT_EQUAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d");
linphone_core_set_chat_database_path(marie->lc, tmp_db);
+ BC_ASSERT_PTR_NOT_NULL(marie->lc->db);
+ if (!marie->lc->db) goto end;
chatroom = linphone_core_get_chat_room(marie->lc, jehan_addr);
BC_ASSERT_PTR_NOT_NULL(chatroom);
@@ -1247,6 +1261,8 @@ static void history_range(void){
history_message_count_helper(chatroom, -2, 2, 3);
history_message_count_helper(chatroom, -3, 1, 2);
}
+
+end:
linphone_core_manager_destroy(marie);
linphone_address_destroy(jehan_addr);
remove(tmp_db);
@@ -1258,28 +1274,30 @@ static void history_count(void) {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneAddress *jehan_addr = linphone_address_new("");
LinphoneChatRoom *chatroom;
- MSList *messages;
+ bctbx_list_t *messages;
char *src_db = bc_tester_res("messages.db");
char *tmp_db = bc_tester_file("tmp.db");
BC_ASSERT_EQUAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d");
linphone_core_set_chat_database_path(marie->lc, tmp_db);
+ BC_ASSERT_PTR_NOT_NULL(marie->lc->db);
+ if (!marie->lc->db) goto end;
chatroom = linphone_core_get_chat_room(marie->lc, jehan_addr);
BC_ASSERT_PTR_NOT_NULL(chatroom);
if (chatroom){
messages=linphone_chat_room_get_history(chatroom,10);
- BC_ASSERT_EQUAL(ms_list_size(messages), 10, int, "%d");
- ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
+ BC_ASSERT_EQUAL(bctbx_list_size(messages), 10, int, "%d");
+ bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
messages=linphone_chat_room_get_history(chatroom,1);
- BC_ASSERT_EQUAL(ms_list_size(messages), 1, int, "%d");
- ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
+ BC_ASSERT_EQUAL(bctbx_list_size(messages), 1, int, "%d");
+ bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
messages=linphone_chat_room_get_history(chatroom,0);
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270, int, "%d");
- BC_ASSERT_EQUAL(ms_list_size(messages), 1270, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(messages), 1270, int, "%d");
/*check the second most recent msg*/
BC_ASSERT_PTR_NOT_NULL(messages);
@@ -1290,35 +1308,38 @@ static void history_count(void) {
}
}
- ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
+ bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test offset+limit: retrieve the 42th latest msg only and check its content*/
messages=linphone_chat_room_get_history_range(chatroom, 42, 42);
- BC_ASSERT_EQUAL(ms_list_size(messages), 1, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(messages), 1, int, "%d");
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->data), "If you open yourself to the Tao is intangible and evasive, yet prefers to keep us at the mercy of the kingdom, then all of the streams of hundreds of valleys because of its limitless possibilities.");
- ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
+ bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test offset without limit*/
messages = linphone_chat_room_get_history_range(chatroom, 1265, -1);
- BC_ASSERT_EQUAL(ms_list_size(messages), 1270-1265, int, "%d");
- ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
+ BC_ASSERT_EQUAL(bctbx_list_size(messages), 1270-1265, int, "%d");
+ bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test limit without offset*/
messages = linphone_chat_room_get_history_range(chatroom, 0, 5);
- BC_ASSERT_EQUAL(ms_list_size(messages), 6, int, "%d");
- ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
+ BC_ASSERT_EQUAL(bctbx_list_size(messages), 6, int, "%d");
+ bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test invalid start*/
messages = linphone_chat_room_get_history_range(chatroom, 1265, 1260);
- BC_ASSERT_EQUAL(ms_list_size(messages), 1270-1265, int, "%d");
- ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
+ BC_ASSERT_EQUAL(bctbx_list_size(messages), 1270-1265, int, "%d");
+ bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
}
+
+end:
linphone_core_manager_destroy(marie);
linphone_address_destroy(jehan_addr);
remove(tmp_db);
ms_free(src_db);
bc_free(tmp_db);
}
+#endif
static void text_status_after_destroying_chat_room(void) {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
@@ -1351,7 +1372,15 @@ void file_transfer_io_error_base(char *server_url, bool_t destroy_room) {
}
static void file_transfer_not_sent_if_invalid_url(void) {
- file_transfer_io_error_base("INVALID URL", FALSE);
+ LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
+ LinphoneChatRoom *chatroom = linphone_core_get_chat_room_from_uri(marie->lc, "");
+ LinphoneChatMessage *msg = create_message_from_nowebcam(chatroom);
+ LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg);
+ linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
+ linphone_core_set_file_transfer_server(marie->lc, "INVALID URL");
+ linphone_chat_room_send_chat_message(chatroom, msg);
+ BC_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneMessageNotDelivered, 1, 1000));
+ linphone_core_manager_destroy(marie);
}
static void file_transfer_not_sent_if_host_not_found(void) {
@@ -1366,7 +1395,7 @@ static void file_transfer_io_error_after_destroying_chatroom(void) {
file_transfer_io_error_base("https://www.linphone.org:444/lft.php", TRUE);
}
-static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, bool_t mess_with_marie_payload_number, bool_t mess_with_pauline_payload_number,
+static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, bool_t mess_with_marie_payload_number, bool_t mess_with_pauline_payload_number,
bool_t ice_enabled, bool_t sql_storage, bool_t do_not_store_rtt_messages_in_sql_storage) {
LinphoneChatRoom *pauline_chat_room;
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
@@ -1375,10 +1404,12 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
LinphoneCall *pauline_call, *marie_call;
char *marie_db = bc_tester_file("marie.db");
char *pauline_db = bc_tester_file("pauline.db");
-
+
if (sql_storage) {
linphone_core_set_chat_database_path(marie->lc, marie_db);
+ BC_ASSERT_PTR_NOT_NULL(marie->lc->db);
linphone_core_set_chat_database_path(pauline->lc, pauline_db);
+ BC_ASSERT_PTR_NOT_NULL(pauline->lc->db);
if (do_not_store_rtt_messages_in_sql_storage) {
lp_config_set_int(marie->lc->config, "misc", "store_rtt_messages", 0);
lp_config_set_int(pauline->lc->config, "misc", "store_rtt_messages", 0);
@@ -1386,7 +1417,7 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
}
if (mess_with_marie_payload_number) {
- MSList *elem;
+ bctbx_list_t *elem;
for (elem = marie->lc->codecs_conf.text_codecs; elem != NULL; elem = elem->next) {
PayloadType *pt = (PayloadType*)elem->data;
if (strcasecmp(pt->mime_type, payload_type_t140.mime_type) == 0) {
@@ -1395,7 +1426,7 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
}
}
} else if (mess_with_pauline_payload_number) {
- MSList *elem;
+ bctbx_list_t *elem;
for (elem = pauline->lc->codecs_conf.text_codecs; elem != NULL; elem = elem->next) {
PayloadType *pt = (PayloadType*)elem->data;
if (strcasecmp(pt->mime_type, payload_type_t140.mime_type) == 0) {
@@ -1422,8 +1453,8 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
linphone_call_params_enable_realtime_text(marie_params,TRUE);
if (!audio_stream_enabled) {
linphone_call_params_enable_audio(marie_params,FALSE);
- linphone_core_set_nortp_timeout(marie->lc, 10);
- linphone_core_set_nortp_timeout(pauline->lc, 10);
+ linphone_core_set_nortp_timeout(marie->lc, 5);
+ linphone_core_set_nortp_timeout(pauline->lc, 5);
}
BC_ASSERT_TRUE(call_with_caller_params(marie, pauline, marie_params));
@@ -1438,8 +1469,8 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
pauline_chat_room = linphone_call_get_chat_room(pauline_call);
BC_ASSERT_PTR_NOT_NULL(pauline_chat_room);
if (pauline_chat_room) {
- const char* message = "Lorem Ipsum Belledonnum Communicatum";
- int i;
+ const char* message = "Be l3l";
+ size_t i;
LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL);
LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(marie_call);
@@ -1450,18 +1481,18 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
}
linphone_chat_room_send_chat_message(pauline_chat_room, rtt_message);
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
-
+
if (sql_storage) {
- MSList *marie_messages = linphone_chat_room_get_history(marie_chat_room, 0);
- MSList *pauline_messages = linphone_chat_room_get_history(pauline_chat_room, 0);
+ bctbx_list_t *marie_messages = linphone_chat_room_get_history(marie_chat_room, 0);
+ bctbx_list_t *pauline_messages = linphone_chat_room_get_history(pauline_chat_room, 0);
LinphoneChatMessage *marie_msg = NULL;
LinphoneChatMessage *pauline_msg = NULL;
if (do_not_store_rtt_messages_in_sql_storage) {
- BC_ASSERT_EQUAL(ms_list_size(marie_messages), 0, int , "%i");
- BC_ASSERT_EQUAL(ms_list_size(pauline_messages), 0, int , "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(marie_messages), 0, int , "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(pauline_messages), 0, int , "%i");
} else {
- BC_ASSERT_EQUAL(ms_list_size(marie_messages), 1, int , "%i");
- BC_ASSERT_EQUAL(ms_list_size(pauline_messages), 1, int , "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(marie_messages), 1, int , "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(pauline_messages), 1, int , "%i");
if (!marie_messages || !pauline_messages) {
goto end;
}
@@ -1469,15 +1500,15 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
pauline_msg = (LinphoneChatMessage *)pauline_messages->data;
BC_ASSERT_STRING_EQUAL(marie_msg->message, message);
BC_ASSERT_STRING_EQUAL(pauline_msg->message, message);
- ms_list_free_with_data(marie_messages, (void (*)(void *))linphone_chat_message_unref);
- ms_list_free_with_data(pauline_messages, (void (*)(void *))linphone_chat_message_unref);
+ bctbx_list_free_with_data(marie_messages, (void (*)(void *))linphone_chat_message_unref);
+ bctbx_list_free_with_data(pauline_messages, (void (*)(void *))linphone_chat_message_unref);
}
}
}
if (!audio_stream_enabled) {
int dummy = 0;
- wait_for_until(pauline->lc, marie->lc, &dummy, 1, 13000); /* Wait to see if call is dropped after the nortp_timeout */
+ wait_for_until(pauline->lc, marie->lc, &dummy, 1, 7000); /* Wait to see if call is dropped after the nortp_timeout */
BC_ASSERT_FALSE(marie->stat.number_of_LinphoneCallEnd > 0);
BC_ASSERT_FALSE(pauline->stat.number_of_LinphoneCallEnd > 0);
}
@@ -1528,11 +1559,11 @@ static void real_time_text_conversation(void) {
marie_chat_room = linphone_call_get_chat_room(marie_call);
BC_ASSERT_PTR_NOT_NULL(pauline_chat_room);
if (pauline_chat_room && marie_chat_room) {
- const char* message1_1 = "Lorem Ipsum";
- const char* message1_2 = "Muspi Merol";
- const char* message2_1 = "Belledonnum Communicatum";
- const char* message2_2 = "Mutacinummoc Munnodelleb";
- int i;
+ const char* message1_1 = "Lorem";
+ const char* message1_2 = "Ipsum";
+ const char* message2_1 = "Be lle Com";
+ const char* message2_2 = "eB ell moC";
+ size_t i;
LinphoneChatMessage* pauline_rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL);
LinphoneChatMessage* marie_rtt_message = linphone_chat_room_create_message(marie_chat_room,NULL);
@@ -1640,8 +1671,8 @@ static void real_time_text_message_compat(bool_t end_with_crlf, bool_t end_with_
pauline_chat_room = linphone_call_get_chat_room(pauline_call);
BC_ASSERT_PTR_NOT_NULL(pauline_chat_room);
if (pauline_chat_room) {
- const char* message = "Lorem Ipsum Belledonnum Communicatum";
- int i;
+ const char* message = "Be l3l";
+ size_t i;
LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL);
LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(marie_call);
uint32_t crlf = 0x0D0A;
@@ -1660,6 +1691,7 @@ static void real_time_text_message_compat(bool_t end_with_crlf, bool_t end_with_
}
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, strlen(message), 1000));
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
+ linphone_chat_message_unref(rtt_message);
}
end_call(marie, pauline);
}
@@ -1753,8 +1785,8 @@ static void real_time_text_copy_paste(void) {
pauline_chat_room = linphone_call_get_chat_room(pauline_call);
BC_ASSERT_PTR_NOT_NULL(pauline_chat_room);
if (pauline_chat_room) {
- const char* message = "Lorem Ipsum Belledonnum Communicatum";
- int i;
+ const char* message = "Be l3l";
+ size_t i;
LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL);
LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(marie_call);
@@ -1817,27 +1849,29 @@ test_t message_tests[] = {
TEST_ONE_TAG("Lime transfer message from history", lime_transfer_message_from_history,"LeaksMemory"),
TEST_NO_TAG("Lime transfer message without encryption", lime_transfer_message_without_encryption),
TEST_NO_TAG("Lime unitary", lime_unit),
+#ifdef SQLITE_STORAGE_ENABLED
TEST_NO_TAG("Database migration", database_migration),
TEST_NO_TAG("History range", history_range),
TEST_NO_TAG("History count", history_count),
+#endif
TEST_NO_TAG("Text status after destroying chat room", text_status_after_destroying_chat_room),
- TEST_ONE_TAG("Transfer not sent if invalid url", file_transfer_not_sent_if_invalid_url, "LeaksMemory"),
- TEST_ONE_TAG("Transfer not sent if host not found", file_transfer_not_sent_if_host_not_found, "LeaksMemory"),
- TEST_ONE_TAG("Transfer not sent if url moved permanently", file_transfer_not_sent_if_url_moved_permanently, "LeaksMemory"),
- TEST_ONE_TAG("Transfer io error after destroying chatroom", file_transfer_io_error_after_destroying_chatroom, "LeaksMemory"),
- TEST_NO_TAG("Real Time Text message", real_time_text_message),
- TEST_NO_TAG("Real Time Text SQL storage", real_time_text_sql_storage),
- TEST_NO_TAG("Real Time Text SQL storage with RTT messages not stored", real_time_text_sql_storage_rtt_disabled),
- TEST_NO_TAG("Real Time Text conversation", real_time_text_conversation),
- TEST_NO_TAG("Real Time Text without audio", real_time_text_without_audio),
- TEST_NO_TAG("Real Time Text with srtp", real_time_text_srtp),
- TEST_NO_TAG("Real Time Text with ice", real_time_text_ice),
- TEST_ONE_TAG("Real Time Text message compatibility crlf", real_time_text_message_compat_crlf, "LeaksMemory"),
- TEST_ONE_TAG("Real Time Text message compatibility lf", real_time_text_message_compat_lf, "LeaksMemory"),
- TEST_NO_TAG("Real Time Text message with accented characters", real_time_text_message_accented_chars),
- TEST_NO_TAG("Real Time Text offer answer with different payload numbers (sender side)", real_time_text_message_different_text_codecs_payload_numbers_sender_side),
- TEST_NO_TAG("Real Time Text offer answer with different payload numbers (receiver side)", real_time_text_message_different_text_codecs_payload_numbers_receiver_side),
- TEST_NO_TAG("Real Time Text copy paste", real_time_text_copy_paste),
+ TEST_NO_TAG("Transfer not sent if invalid url", file_transfer_not_sent_if_invalid_url),
+ TEST_NO_TAG("Transfer not sent if host not found", file_transfer_not_sent_if_host_not_found),
+ TEST_NO_TAG("Transfer not sent if url moved permanently", file_transfer_not_sent_if_url_moved_permanently),
+ TEST_NO_TAG("Transfer io error after destroying chatroom", file_transfer_io_error_after_destroying_chatroom),
+ TEST_ONE_TAG("Real Time Text message", real_time_text_message, "RTT"),
+ TEST_ONE_TAG("Real Time Text SQL storage", real_time_text_sql_storage, "RTT"),
+ TEST_ONE_TAG("Real Time Text SQL storage with RTT messages not stored", real_time_text_sql_storage_rtt_disabled, "RTT"),
+ TEST_ONE_TAG("Real Time Text conversation", real_time_text_conversation, "RTT"),
+ TEST_ONE_TAG("Real Time Text without audio", real_time_text_without_audio, "RTT"),
+ TEST_ONE_TAG("Real Time Text with srtp", real_time_text_srtp, "RTT"),
+ TEST_ONE_TAG("Real Time Text with ice", real_time_text_ice, "RTT"),
+ TEST_ONE_TAG("Real Time Text message compatibility crlf", real_time_text_message_compat_crlf, "RTT"),
+ TEST_ONE_TAG("Real Time Text message compatibility lf", real_time_text_message_compat_lf, "RTT"),
+ TEST_ONE_TAG("Real Time Text message with accented characters", real_time_text_message_accented_chars, "RTT"),
+ TEST_ONE_TAG("Real Time Text offer answer with different payload numbers (sender side)", real_time_text_message_different_text_codecs_payload_numbers_sender_side, "RTT"),
+ TEST_ONE_TAG("Real Time Text offer answer with different payload numbers (receiver side)", real_time_text_message_different_text_codecs_payload_numbers_receiver_side, "RTT"),
+ TEST_ONE_TAG("Real Time Text copy paste", real_time_text_copy_paste, "RTT"),
};
test_suite_t message_test_suite = {
diff --git a/tester/offeranswer_tester.c b/tester/offeranswer_tester.c
index 138bae80c..901c65120 100644
--- a/tester/offeranswer_tester.c
+++ b/tester/offeranswer_tester.c
@@ -158,7 +158,7 @@ static void profile_call_base(bool_t avpf1
linphone_core_set_media_encryption_mandatory(marie->lc,TRUE);
linphone_core_set_media_encryption_mandatory(pauline->lc,TRUE);
}
-
+
if (enable_video && linphone_core_video_supported(marie->lc)) {
LinphoneVideoPolicy policy;
policy.automatically_accept = TRUE;
@@ -534,7 +534,7 @@ static test_t offeranswer_tests[] = {
TEST_NO_TAG("SAVPF/DTLS to SAVPF/DTLS encryption mandatory video call", savpf_dtls_to_savpf_dtls_encryption_mandatory_video_call),
TEST_NO_TAG("SAVPF/DTLS to SAVPF video call", savpf_dtls_to_savpf_video_call),
TEST_NO_TAG("SAVPF/DTLS to SAVPF encryption mandatory video call", savpf_dtls_to_savpf_encryption_mandatory_video_call),
- TEST_NO_TAG("SAVPF/DTLS to AVPF call", savpf_dtls_to_avpf_video_call),
+ TEST_NO_TAG("SAVPF/DTLS to AVPF video call", savpf_dtls_to_avpf_video_call),
TEST_NO_TAG("Compatible AVPF features", compatible_avpf_features),
TEST_NO_TAG("Incompatible AVPF features", incompatible_avpf_features)
diff --git a/tester/presence_server_tester.c b/tester/presence_server_tester.c
index a82f83898..25034f834 100644
--- a/tester/presence_server_tester.c
+++ b/tester/presence_server_tester.c
@@ -121,13 +121,13 @@ static void subscriber_no_longer_reachable(void){
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline1 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneFriend *lf;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
LinphonePresenceModel * presence;
int previous_number_of_LinphonePresenceActivityOnline=0;
int previous_number_of_LinphonePresenceActivityOffline=0;
- lcs = ms_list_append(lcs, marie->lc);
- lcs = ms_list_append(lcs, pauline1->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
+ lcs = bctbx_list_append(lcs, pauline1->lc);
lp_config_set_int(marie->lc->config, "sip", "subscribe_expires", 40);
linphone_core_set_user_agent(marie->lc, "full-presence-support", NULL);
@@ -176,7 +176,7 @@ static void subscriber_no_longer_reachable(void){
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline1);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
@@ -265,10 +265,10 @@ static void test_forked_subscribe_notify_publish(void) {
LpConfig *pauline_lp;
char* lf_identity;
LinphoneFriend *lf;
- MSList* lcs=ms_list_append(NULL,pauline->lc);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,marie->lc);
- lcs=ms_list_append(lcs,marie2->lc);
+ bctbx_list_t* lcs=bctbx_list_append(NULL,pauline->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,marie->lc);
+ lcs=bctbx_list_append(lcs,marie2->lc);
linphone_core_set_user_agent(marie->lc, "full-presence-support", NULL);
linphone_core_set_user_agent(marie2->lc, "full-presence-support", NULL);
linphone_core_set_user_agent(pauline->lc, "full-presence-support", NULL);
@@ -334,7 +334,7 @@ static void test_presence_list_base(bool_t enable_compression) {
const char *laure_identity;
const char *marie_identity;
const char *pauline_identity;
- MSList* lcs = NULL;
+ bctbx_list_t* lcs = NULL;
laure_identity = get_identity(laure);
marie_identity = get_identity(marie);
@@ -365,9 +365,9 @@ static void test_presence_list_base(bool_t enable_compression) {
linphone_friend_list_unref(lfl);
linphone_core_set_presence_model(laure->lc, linphone_core_create_presence_model_with_activity(laure->lc, LinphonePresenceActivityOnline, NULL));
- lcs = ms_list_append(lcs, laure->lc);
- lcs = ms_list_append(lcs, marie->lc);
- lcs = ms_list_append(lcs, pauline->lc);
+ lcs = bctbx_list_append(lcs, laure->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
+ lcs = bctbx_list_append(lcs, pauline->lc);
wait_for_list(lcs, &laure->stat.number_of_NotifyPresenceReceived, 2, 4000);
BC_ASSERT_EQUAL(laure->stat.number_of_NotifyPresenceReceived, 2, int, "%d");
@@ -497,7 +497,7 @@ static void test_presence_list_subscribe_before_publish(void) {
LinphoneFriendList *lfl;
LinphoneFriend *lf;
const char *pauline_identity;
- MSList* lcs = NULL;
+ bctbx_list_t* lcs = NULL;
int dummy = 0;
pauline_identity = get_identity(pauline);
@@ -516,8 +516,8 @@ static void test_presence_list_subscribe_before_publish(void) {
linphone_core_set_presence_model(laure->lc, linphone_core_create_presence_model_with_activity(laure->lc, LinphonePresenceActivityOnline, NULL));
linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(laure->lc), NULL, FALSE);
- lcs = ms_list_append(lcs, laure->lc);
- lcs = ms_list_append(lcs, pauline->lc);
+ lcs = bctbx_list_append(lcs, laure->lc);
+ lcs = bctbx_list_append(lcs, pauline->lc);
wait_for_list(lcs, &dummy, 1, 2000); /* Wait a little bit for the subscribe to happen */
@@ -572,7 +572,7 @@ static void test_presence_list_subscribe_with_error(bool_t io_error) {
LinphoneFriendList *lfl;
LinphoneFriend *lf;
const char *pauline_identity;
- MSList* lcs = NULL;
+ bctbx_list_t* lcs = NULL;
int dummy = 0;
lp_config_set_int(laure->lc->config, "sip", "rls_presence_expires", 5);
@@ -594,8 +594,8 @@ static void test_presence_list_subscribe_with_error(bool_t io_error) {
linphone_friend_list_unref(lfl);
linphone_core_set_presence_model(laure->lc, linphone_core_create_presence_model_with_activity(laure->lc, LinphonePresenceActivityOnline, NULL));
linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(laure->lc), NULL, FALSE);
- lcs = ms_list_append(lcs, laure->lc);
- lcs = ms_list_append(lcs, pauline->lc);
+ lcs = bctbx_list_append(lcs, laure->lc);
+ lcs = bctbx_list_append(lcs, pauline->lc);
wait_for_list(lcs, &dummy, 1, 2000); /* Wait a little bit for the subscribe to happen */
diff --git a/tester/presence_tester.c b/tester/presence_tester.c
index b14914800..6bb1771bd 100644
--- a/tester/presence_tester.c
+++ b/tester/presence_tester.c
@@ -49,7 +49,7 @@ void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char
void notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf) {
stats* counters;
- int i;
+ unsigned int i;
char* from=linphone_address_as_string(linphone_friend_get_address(lf));
ms_message("New Notify request from [%s] ",from);
ms_free(from);
@@ -449,11 +449,11 @@ static void subscribe_presence_forked(void){
LinphoneCoreManager* pauline1 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_tcp_rc" : "pauline_tcp_rc");
LinphoneCoreManager* pauline2 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_tcp_rc" : "pauline_tcp_rc");
LinphoneFriend *lf;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
- lcs = ms_list_append(lcs, marie->lc);
- lcs = ms_list_append(lcs, pauline1->lc);
- lcs = ms_list_append(lcs, pauline2->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
+ lcs = bctbx_list_append(lcs, pauline1->lc);
+ lcs = bctbx_list_append(lcs, pauline2->lc);
lf = linphone_core_create_friend(marie->lc);
linphone_friend_set_address(lf, pauline1->identity);
@@ -480,17 +480,17 @@ static void subscribe_presence_forked(void){
linphone_core_manager_destroy(pauline1);
linphone_core_manager_destroy(pauline2);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void subscribe_presence_expired(void){
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline1 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneFriend *lf;
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
- lcs = ms_list_append(lcs, marie->lc);
- lcs = ms_list_append(lcs, pauline1->lc);
+ lcs = bctbx_list_append(lcs, marie->lc);
+ lcs = bctbx_list_append(lcs, pauline1->lc);
lp_config_set_int(marie->lc->config, "sip", "subscribe_expires", 10);
@@ -521,7 +521,7 @@ static void subscribe_presence_expired(void){
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline1);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
}
static void simple_subscribe_with_friend_from_rc(void) {
@@ -529,9 +529,9 @@ static void simple_subscribe_with_friend_from_rc(void) {
LinphoneCoreManager *marie = presence_linphone_core_manager_new_with_rc_name("marie", "pauline_as_friend_rc");
LinphoneFriend *pauline_as_friend;
- BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_friend_list(marie->lc)), 1, int , "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_friend_list(marie->lc)), 1, int , "%i");
- if (ms_list_size(linphone_core_get_friend_list(marie->lc))>0) {
+ if (bctbx_list_size(linphone_core_get_friend_list(marie->lc))>0) {
pauline_as_friend = (LinphoneFriend*)linphone_core_get_friend_list(marie->lc)->data;
linphone_friend_set_address(pauline_as_friend, pauline->identity); /*hack to update addr with port number*/
}
diff --git a/tester/quality_reporting_tester.c b/tester/quality_reporting_tester.c
index ec321b2dd..31ec4d7a5 100644
--- a/tester/quality_reporting_tester.c
+++ b/tester/quality_reporting_tester.c
@@ -165,7 +165,7 @@ static void quality_reporting_not_sent_if_call_not_started(void) {
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallError,1, 10000));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1, int, "%d");
- if (ms_list_size(linphone_core_get_call_logs(marie->lc))>0) {
+ if (bctbx_list_size(linphone_core_get_call_logs(marie->lc))>0) {
out_call_log=(LinphoneCallLog*)(linphone_core_get_call_logs(marie->lc)->data);
BC_ASSERT_PTR_NOT_NULL(out_call_log);
BC_ASSERT_EQUAL(linphone_call_log_get_status(out_call_log),LinphoneCallAborted, int, "%d");
@@ -400,7 +400,7 @@ static void quality_reporting_interval_report_video_and_rtt(void) {
BC_ASSERT_PTR_NOT_NULL(pauline_chat_room);
if (pauline_chat_room) {
const char* message = "Lorem Ipsum Belledonnum Communicatum";
- int i;
+ size_t i;
LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL);
LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(call_marie);
diff --git a/tester/register_tester.c b/tester/register_tester.c
index edcaf89d4..d9a33a4e2 100644
--- a/tester/register_tester.c
+++ b/tester/register_tester.c
@@ -505,7 +505,7 @@ static LinphoneCoreManager* configure_lcm(void) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager *lcm=linphone_core_manager_new2( "multi_account_rc", FALSE);
stats *counters=&lcm->stat;
- BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(lcm->lc))));
+ BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,bctbx_list_size(linphone_core_get_proxy_config_list(lcm->lc))));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d");
return lcm;
}
@@ -541,7 +541,7 @@ static void network_state_change(void){
static int get_number_of_udp_proxy(const LinphoneCore* lc) {
int number_of_udp_proxy=0;
LinphoneProxyConfig* proxy_cfg;
- const MSList* proxys;
+ const bctbx_list_t* proxys;
for (proxys=linphone_core_get_proxy_config_list(lc);proxys!=NULL;proxys=proxys->next) {
proxy_cfg=(LinphoneProxyConfig*)proxys->data;
if (strcmp("udp",linphone_proxy_config_get_transport(proxy_cfg))==0)
@@ -567,7 +567,7 @@ static void transport_change(void){
register_ok=counters->number_of_LinphoneRegistrationOk;
number_of_udp_proxy=get_number_of_udp_proxy(lc);
- total_number_of_proxies=ms_list_size(linphone_core_get_proxy_config_list(lc));
+ total_number_of_proxies=bctbx_list_size(linphone_core_get_proxy_config_list(lc));
linphone_core_get_sip_transports(lc,&sip_tr_orig);
sip_tr.udp_port=sip_tr_orig.udp_port;
@@ -734,12 +734,12 @@ static void io_recv_error_late_recovery(void){
int register_ok;
stats* counters ;
int number_of_udp_proxy=0;
- MSList* lcs;
+ bctbx_list_t* lcs;
lcm=linphone_core_manager_new2( "multi_account_rc",FALSE); /*to make sure iterates are not call yet*/
lc=lcm->lc;
sal_set_refresher_retry_after(lc->sal,1000);
counters=&lcm->stat;
- BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(lcm->lc))));
+ BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,bctbx_list_size(linphone_core_get_proxy_config_list(lcm->lc))));
counters = get_stats(lc);
@@ -752,12 +752,12 @@ static void io_recv_error_late_recovery(void){
BC_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d");
- BC_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationFailed,(register_ok-number_of_udp_proxy),sal_get_refresher_retry_after(lc->sal)+3000));
+ BC_ASSERT_TRUE(wait_for_list(lcs=bctbx_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationFailed,(register_ok-number_of_udp_proxy),sal_get_refresher_retry_after(lc->sal)+3000));
sal_set_recv_error(lc->sal, 1); /*reset*/
sal_set_send_error(lc->sal, 0);
- BC_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy +register_ok,sal_get_refresher_retry_after(lc->sal)+3000));
+ BC_ASSERT_TRUE(wait_for_list(lcs=bctbx_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy +register_ok,sal_get_refresher_retry_after(lc->sal)+3000));
linphone_core_manager_destroy(lcm);
}
}
@@ -767,7 +767,7 @@ static void io_recv_error_without_active_register(void){
LinphoneCore* lc;
int register_ok;
stats* counters ;
- MSList* proxys;
+ bctbx_list_t* proxys;
int dummy=0;
lcm=configure_lcm();
@@ -777,13 +777,13 @@ static void io_recv_error_without_active_register(void){
register_ok=counters->number_of_LinphoneRegistrationOk;
- for (proxys=ms_list_copy(linphone_core_get_proxy_config_list(lc));proxys!=NULL;proxys=proxys->next) {
+ for (proxys=bctbx_list_copy(linphone_core_get_proxy_config_list(lc));proxys!=NULL;proxys=proxys->next) {
LinphoneProxyConfig* proxy_cfg=(LinphoneProxyConfig*)proxys->data;
linphone_proxy_config_edit(proxy_cfg);
linphone_proxy_config_enableregister(proxy_cfg,FALSE);
linphone_proxy_config_done(proxy_cfg);
}
- ms_list_free(proxys);
+ bctbx_list_free(proxys);
/*wait for unregistrations*/
BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationCleared,register_ok /*because 1 udp*/));
@@ -791,7 +791,7 @@ static void io_recv_error_without_active_register(void){
/*nothing should happen because no active registration*/
wait_for_until(lc,lc, &dummy, 1, 3000);
- BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress, ms_list_size(linphone_core_get_proxy_config_list(lc)), int, "%d");
+ BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress, bctbx_list_size(linphone_core_get_proxy_config_list(lc)), int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d");
diff --git a/tester/setup_tester.c b/tester/setup_tester.c
index 160856f7c..cd1e9d142 100644
--- a/tester/setup_tester.c
+++ b/tester/setup_tester.c
@@ -338,7 +338,7 @@ end:
static void codec_setup(void){
LinphoneCoreManager *mgr = linphone_core_manager_new2("empty_rc", FALSE);
PayloadType *vp8, *h264;
- const MSList *codecs;
+ const bctbx_list_t *codecs;
if ((vp8 = linphone_core_find_payload_type(mgr->lc, "VP8", 90000, -1)) == NULL ||
(h264 = linphone_core_find_payload_type(mgr->lc, "H264", 90000, -1)) == NULL){
linphone_core_manager_destroy(mgr);
@@ -347,7 +347,7 @@ static void codec_setup(void){
return;
}
codecs = linphone_core_get_video_codecs(mgr->lc);
- BC_ASSERT_TRUE(ms_list_size(codecs)>=2);
+ BC_ASSERT_TRUE(bctbx_list_size(codecs)>=2);
BC_ASSERT_TRUE(codecs->data == vp8);
BC_ASSERT_TRUE(codecs->next->data == h264);
linphone_core_manager_destroy(mgr);
@@ -356,7 +356,7 @@ static void codec_setup(void){
vp8 = linphone_core_find_payload_type(mgr->lc, "VP8", 90000, -1);
h264 = linphone_core_find_payload_type(mgr->lc, "H264", 90000, -1);
codecs = linphone_core_get_video_codecs(mgr->lc);
- BC_ASSERT_TRUE(ms_list_size(codecs)>=2);
+ BC_ASSERT_TRUE(bctbx_list_size(codecs)>=2);
BC_ASSERT_PTR_NOT_NULL(vp8);
BC_ASSERT_PTR_NOT_NULL(h264);
BC_ASSERT_TRUE(codecs->data == vp8);
@@ -367,7 +367,7 @@ static void codec_setup(void){
vp8 = linphone_core_find_payload_type(mgr->lc, "VP8", 90000, -1);
h264 = linphone_core_find_payload_type(mgr->lc, "H264", 90000, -1);
codecs = linphone_core_get_video_codecs(mgr->lc);
- BC_ASSERT_TRUE(ms_list_size(codecs)>=2);
+ BC_ASSERT_TRUE(bctbx_list_size(codecs)>=2);
BC_ASSERT_PTR_NOT_NULL(vp8);
BC_ASSERT_PTR_NOT_NULL(h264);
BC_ASSERT_TRUE(codecs->data == vp8);
diff --git a/tester/stun_tester.c b/tester/stun_tester.c
index e52927386..3967ebb44 100644
--- a/tester/stun_tester.c
+++ b/tester/stun_tester.c
@@ -16,7 +16,6 @@
along with this program. If not, see .
*/
-
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
@@ -24,52 +23,34 @@
#include "ortp/port.h"
-static const char* stun_address = "stun.linphone.org";
+static const char *stun_address = "stun.linphone.org";
-static int test_stun_encode( char*buffer, size_t len, bool_t expect_fail )
+static size_t test_stun_encode(char **buffer)
{
- StunAtrString username;
- StunAtrString password;
- StunMessage req;
- memset(&req, 0, sizeof(StunMessage));
- memset(&username,0,sizeof(username));
- memset(&password,0,sizeof(password));
- stunBuildReqSimple( &req, &username, TRUE , TRUE , 11);
- len = stunEncodeMessage( &req, buffer, (unsigned int)len, &password);
- if (len<=0){
- if( expect_fail )
- ms_message("Fail to encode stun message (EXPECTED).\n");
- else
- ms_error("Fail to encode stun message.\n");
- return -1;
- }
- return (int)len;
+ MSStunMessage *req = ms_stun_binding_request_create();
+ UInt96 tr_id = ms_stun_message_get_tr_id(req);
+ tr_id.octet[0] = 11;
+ ms_stun_message_set_tr_id(req, tr_id);
+ return ms_stun_message_encode(req, buffer);
}
-
static void linphone_stun_test_encode(void)
{
- char smallBuff[12];
- size_t smallLen = 12;
- char bigBuff[STUN_MAX_MESSAGE_SIZE];
- size_t bigLen = STUN_MAX_MESSAGE_SIZE;
-
- size_t len = test_stun_encode(smallBuff, smallLen, TRUE);
- BC_ASSERT(len == -1);
-
- len = test_stun_encode(bigBuff, bigLen, TRUE);
+ char *buffer = NULL;
+ size_t len = test_stun_encode(&buffer);
BC_ASSERT(len > 0);
+ BC_ASSERT_PTR_NOT_NULL(buffer);
+ if (buffer != NULL) ms_free(buffer);
ms_message("STUN message encoded in %i bytes", (int)len);
}
-
static void linphone_stun_test_grab_ip(void)
{
- LinphoneCoreManager* lc_stun = linphone_core_manager_new2( "stun_rc", FALSE);
+ LinphoneCoreManager* lc_stun = linphone_core_manager_new2("stun_rc", FALSE);
LinphoneCall dummy_call;
int ping_time;
- int tmp=0;
+ int tmp = 0;
memset(&dummy_call, 0, sizeof(LinphoneCall));
dummy_call.main_audio_stream_index = 0;
@@ -82,41 +63,166 @@ static void linphone_stun_test_grab_ip(void)
linphone_core_set_stun_server(lc_stun->lc, stun_address);
BC_ASSERT_STRING_EQUAL(stun_address, linphone_core_get_stun_server(lc_stun->lc));
- wait_for(lc_stun->lc,lc_stun->lc,&tmp,1);
+ wait_for(lc_stun->lc, lc_stun->lc, &tmp, 1);
ping_time = linphone_core_run_stun_tests(lc_stun->lc, &dummy_call);
BC_ASSERT(ping_time != -1);
ms_message("Round trip to STUN: %d ms", ping_time);
- BC_ASSERT( dummy_call.ac.addr[0] != '\0');
- BC_ASSERT( dummy_call.ac.port != 0);
+ BC_ASSERT(dummy_call.ac.addr[0] != '\0');
+ BC_ASSERT(dummy_call.ac.port != 0);
#ifdef VIDEO_ENABLED
- BC_ASSERT( dummy_call.vc.addr[0] != '\0');
- BC_ASSERT( dummy_call.vc.port != 0);
+ BC_ASSERT(dummy_call.vc.addr[0] != '\0');
+ BC_ASSERT(dummy_call.vc.port != 0);
#endif
- BC_ASSERT( dummy_call.tc.addr[0] != '\0');
- BC_ASSERT( dummy_call.tc.port != 0);
+ BC_ASSERT(dummy_call.tc.addr[0] != '\0');
+ BC_ASSERT(dummy_call.tc.port != 0);
- ms_message("STUN test result: local audio port maps to %s:%i",
- dummy_call.ac.addr,
- dummy_call.ac.port);
+ ms_message("STUN test result: local audio port maps to %s:%i", dummy_call.ac.addr, dummy_call.ac.port);
#ifdef VIDEO_ENABLED
- ms_message("STUN test result: local video port maps to %s:%i",
- dummy_call.vc.addr,
- dummy_call.vc.port);
+ ms_message("STUN test result: local video port maps to %s:%i", dummy_call.vc.addr, dummy_call.vc.port);
#endif
- ms_message("STUN test result: local text port maps to %s:%i",
- dummy_call.tc.addr,
- dummy_call.tc.port);
+ ms_message("STUN test result: local text port maps to %s:%i", dummy_call.tc.addr, dummy_call.tc.port);
linphone_core_manager_destroy(lc_stun);
}
+static void configure_nat_policy(LinphoneCore *lc, bool_t turn_enabled) {
+ const char *username = "liblinphone-tester";
+ const char *password = "retset-enohpnilbil";
+ LinphoneAuthInfo *auth_info = linphone_core_create_auth_info(lc, username, NULL, password, NULL, "sip.linphone.org", NULL);
+ LinphoneNatPolicy *nat_policy = linphone_core_create_nat_policy(lc);
+ linphone_nat_policy_enable_ice(nat_policy, TRUE);
+ if (turn_enabled) {
+ linphone_nat_policy_enable_turn(nat_policy, TRUE);
+ linphone_nat_policy_set_stun_server(nat_policy, "sip1.linphone.org:3479");
+ linphone_nat_policy_set_stun_server_username(nat_policy, username);
+ } else {
+ linphone_nat_policy_enable_stun(nat_policy, TRUE);
+ linphone_nat_policy_set_stun_server(nat_policy, "stun.linphone.org");
+ }
+ linphone_core_set_nat_policy(lc, nat_policy);
+ linphone_core_add_auth_info(lc, auth_info);
+ linphone_nat_policy_unref(nat_policy);
+ linphone_auth_info_destroy(auth_info);
+}
+
+static void check_turn_context_statistics(MSTurnContext *turn_context, bool_t forced_relay) {
+ BC_ASSERT_TRUE(turn_context->stats.nb_successful_allocate > 1);
+ if (forced_relay == TRUE) {
+ BC_ASSERT_TRUE(turn_context->stats.nb_send_indication > 0);
+ BC_ASSERT_TRUE(turn_context->stats.nb_data_indication > 0);
+ BC_ASSERT_TRUE(turn_context->stats.nb_received_channel_msg > 0);
+ BC_ASSERT_TRUE(turn_context->stats.nb_sent_channel_msg > 0);
+ BC_ASSERT_TRUE(turn_context->stats.nb_successful_refresh > 0);
+ BC_ASSERT_TRUE(turn_context->stats.nb_successful_create_permission > 1);
+ BC_ASSERT_TRUE(turn_context->stats.nb_successful_channel_bind > 1);
+ }
+}
+
+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;
+ LinphoneIceState expected_ice_state = LinphoneIceStateHostConnection;
+ LinphoneMediaDirection expected_video_dir = LinphoneMediaDirectionInactive;
+ bctbx_list_t *lcs = NULL;
+
+ marie = linphone_core_manager_new("marie_rc");
+ lcs = bctbx_list_append(lcs, marie->lc);
+ pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
+ lcs = bctbx_list_append(lcs, pauline->lc);
+
+ configure_nat_policy(marie->lc, caller_turn_enabled);
+ configure_nat_policy(pauline->lc, callee_turn_enabled);
+ if (forced_relay == TRUE) {
+ linphone_core_enable_forced_ice_relay(marie->lc, TRUE);
+ linphone_core_enable_forced_ice_relay(pauline->lc, TRUE);
+ linphone_core_enable_short_turn_refresh(marie->lc, TRUE);
+ linphone_core_enable_short_turn_refresh(pauline->lc, TRUE);
+ expected_ice_state = LinphoneIceStateRelayConnection;
+ }
+ if (rtcp_mux_enabled == TRUE) {
+ lp_config_set_int(linphone_core_get_config(marie->lc), "rtp", "rtcp_mux", 1);
+ lp_config_set_int(linphone_core_get_config(pauline->lc), "rtp", "rtcp_mux", 1);
+ }
+
+ if (video_enabled) {
+#ifdef VIDEO_ENABLED
+ video_call_base_2(marie, pauline, FALSE, LinphoneMediaEncryptionNone, TRUE, TRUE);
+ expected_video_dir = LinphoneMediaDirectionSendRecv;
+#endif
+ } else {
+ BC_ASSERT_TRUE(call(marie, pauline));
+ }
+
+ /* Wait for the ICE reINVITE to complete */
+ 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(pauline, marie, expected_ice_state));
+ check_nb_media_starts(pauline, marie, 1, 1);
+ check_media_direction(marie, linphone_core_get_current_call(marie->lc), lcs, LinphoneMediaDirectionSendRecv, expected_video_dir);
+ 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);
+ }
+ }
+
+ end_call(marie, pauline);
+
+ linphone_core_manager_destroy(pauline);
+ linphone_core_manager_destroy(marie);
+ bctbx_list_free(lcs);
+}
+
+static void basic_ice_turn_call(void) {
+ 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);
+}
+#endif
+
+static void relayed_ice_turn_call(void) {
+ 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);
+}
+#endif
+
+static void relayed_ice_turn_call_with_rtcp_mux(void) {
+ 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);
+}
+
test_t stun_tests[] = {
- TEST_NO_TAG("Basic Stun test (Ping/public IP)", linphone_stun_test_grab_ip),
- TEST_NO_TAG("STUN encode buffer protection", linphone_stun_test_encode)
+ 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"),
+#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"),
+#endif
+ TEST_TWO_TAGS("Relayed ICE+TURN call", relayed_ice_turn_call, "ICE", "TURN"),
+ TEST_TWO_TAGS("Relayed ICE+TURN call with rtcp-mux", relayed_ice_turn_call_with_rtcp_mux, "ICE", "TURN"),
+ TEST_TWO_TAGS("Relayed ICE+TURN to ICE+STUN call", relayed_ice_turn_to_ice_stun_call, "ICE", "TURN")
};
test_suite_t stun_test_suite = {"Stun", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
diff --git a/tester/tester.c b/tester/tester.c
index e6d472918..ad0c9fe69 100644
--- a/tester/tester.c
+++ b/tester/tester.c
@@ -25,7 +25,9 @@
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifndef _MSC_VER
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#endif
#ifdef HAVE_GTK
#include
@@ -136,7 +138,7 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
nowebcampath = ms_strdup_printf("%s/images/nowebcamCIF.jpg", path);
rootcapath = ms_strdup_printf("%s/certificates/cn/cafile.pem", path);
dnsuserhostspath = ms_strdup_printf("%s/%s", path, userhostsfile);
-
+
if( config != NULL ) {
lp_config_set_string(config, "sound", "remote_ring", ringbackpath);
@@ -151,15 +153,17 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
linphone_core_set_root_ca(lc,rootcapath);
}
chatdb = ms_strdup_printf("%s/messages-%p.db",bc_tester_get_writable_dir_prefix(),lc);
-
+
linphone_core_enable_ipv6(lc, liblinphonetester_ipv6);
sal_enable_test_features(lc->sal,TRUE);
sal_set_dns_user_hosts_file(lc->sal, dnsuserhostspath);
+#ifdef VIDEO_ENABLED
linphone_core_set_static_picture(lc,nowebcampath);
+#endif
linphone_core_set_chat_database_path(lc, chatdb);
-
+
ms_free(ringpath);
ms_free(ringbackpath);
ms_free(nowebcampath);
@@ -176,14 +180,14 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
bool_t wait_for_until(LinphoneCore* lc_1, LinphoneCore* lc_2,int* counter,int value,int timout) {
- MSList* lcs=NULL;
+ bctbx_list_t* lcs=NULL;
bool_t result;
if (lc_1)
- lcs=ms_list_append(lcs,lc_1);
+ lcs=bctbx_list_append(lcs,lc_1);
if (lc_2)
- lcs=ms_list_append(lcs,lc_2);
+ lcs=bctbx_list_append(lcs,lc_2);
result=wait_for_list(lcs,counter,value,timout);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
return result;
}
@@ -191,8 +195,8 @@ bool_t wait_for(LinphoneCore* lc_1, LinphoneCore* lc_2,int* counter,int value) {
return wait_for_until(lc_1, lc_2,counter,value,10000);
}
-bool_t wait_for_list(MSList* lcs,int* counter,int value,int timeout_ms) {
- MSList* iterator;
+bool_t wait_for_list(bctbx_list_t* lcs,int* counter,int value,int timeout_ms) {
+ bctbx_list_t* iterator;
MSTimeSpec start;
liblinphone_tester_clock_start(&start);
@@ -223,26 +227,25 @@ bool_t wait_for_list(MSList* lcs,int* counter,int value,int timeout_ms) {
bool_t wait_for_stun_resolution(LinphoneCoreManager *m) {
MSTimeSpec start;
int timeout_ms = 10000;
-
liblinphone_tester_clock_start(&start);
- while (m->lc->net_conf.stun_addrinfo == NULL && !liblinphone_tester_clock_elapsed(&start,timeout_ms)) {
+ while (linphone_core_get_stun_server_addrinfo(m->lc) == NULL && !liblinphone_tester_clock_elapsed(&start,timeout_ms)) {
linphone_core_iterate(m->lc);
ms_usleep(20000);
}
- return m->lc->net_conf.stun_addrinfo != NULL;
+ return linphone_core_get_stun_server_addrinfo(m->lc) != NULL;
}
static void set_codec_enable(LinphoneCore* lc,const char* type,int rate,bool_t enable) {
- MSList* codecs=ms_list_copy(linphone_core_get_audio_codecs(lc));
- MSList* codecs_it;
+ bctbx_list_t* codecs=bctbx_list_copy(linphone_core_get_audio_codecs(lc));
+ bctbx_list_t* codecs_it;
PayloadType* pt;
for (codecs_it=codecs;codecs_it!=NULL;codecs_it=codecs_it->next) {
linphone_core_enable_payload_type(lc,(PayloadType*)codecs_it->data,0);
}
- if((pt = linphone_core_find_payload_type(lc,type,rate,1))) {
+ if ((pt = linphone_core_find_payload_type(lc,type,rate,1))) {
linphone_core_enable_payload_type(lc,pt, enable);
}
- ms_list_free(codecs);
+ bctbx_list_free(codecs);
}
static void enable_codec(LinphoneCore* lc,const char* type,int rate) {
@@ -269,7 +272,11 @@ bool_t transport_supported(LinphoneTransportType transport) {
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) {
char *rc_path = NULL;
char *hellopath = bc_tester_res("sounds/hello8000.wav");
@@ -347,11 +354,12 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) {
void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies) {
LinphoneProxyConfig* proxy;
+ LinphoneNatPolicy *nat_policy;
int proxy_count;
- /*BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count, int, "%d");*/
+ /*BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count, int, "%d");*/
if (check_for_proxies){ /**/
- proxy_count=ms_list_size(linphone_core_get_proxy_config_list(mgr->lc));
+ proxy_count=bctbx_list_size(linphone_core_get_proxy_config_list(mgr->lc));
}else{
proxy_count=0;
/*this is to prevent registration to go on*/
@@ -378,7 +386,9 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies
linphone_address_clean(mgr->identity);
}
- if (linphone_core_get_stun_server(mgr->lc) != NULL){
+ nat_policy = linphone_core_get_nat_policy(mgr->lc);
+ if ((nat_policy != NULL) && (linphone_nat_policy_get_stun_server(nat_policy) != NULL) &&
+ (linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy))) {
/*before we go, ensure that the stun server is resolved, otherwise all ice related test will fail*/
const char **tags = bc_tester_current_test_tags();
int ice_test = (tags && ((tags[0] && !strcmp(tags[0], "ICE")) || (tags[1] && !strcmp(tags[1], "ICE"))));
@@ -502,6 +512,7 @@ void liblinphone_tester_add_suites() {
bc_tester_add_suite(&tunnel_test_suite);
bc_tester_add_suite(&offeranswer_test_suite);
bc_tester_add_suite(&call_test_suite);
+ bc_tester_add_suite(&call_video_test_suite);
bc_tester_add_suite(&audio_bypass_suite);
bc_tester_add_suite(&multi_call_test_suite);
bc_tester_add_suite(&message_test_suite);
@@ -588,6 +599,7 @@ int liblinphone_tester_after_each(void) {
ms_error("%s", format);
all_leaks_buffer = ms_strcat_printf(all_leaks_buffer, "\n%s", format);
+ ms_free(format);
}
// prevent any future leaks
diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c
index 9ea80266f..4a04fb9b5 100644
--- a/tester/vcard_tester.c
+++ b/tester/vcard_tester.c
@@ -30,16 +30,16 @@
static void linphone_vcard_import_export_friends_test(void) {
LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE);
LinphoneFriendList *lfl = linphone_core_get_default_friend_list(manager->lc);
- const MSList *friends = linphone_friend_list_get_friends(lfl);
+ const bctbx_list_t *friends = linphone_friend_list_get_friends(lfl);
char *import_filepath = bc_tester_res("vcards/vcards.vcf");
char *export_filepath = bc_tester_file("export_vcards.vcf");
int count = 0;
- BC_ASSERT_EQUAL(ms_list_size(friends), 0, int, "%d");
-
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
+
count = linphone_friend_list_import_friends_from_vcard4_file(lfl, import_filepath);
BC_ASSERT_EQUAL(count, 3, int, "%d");
friends = linphone_friend_list_get_friends(lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 3, int, "%d");
linphone_friend_list_export_friends_as_vcard4_file(lfl, export_filepath);
@@ -47,7 +47,7 @@ static void linphone_vcard_import_export_friends_test(void) {
count = linphone_friend_list_import_friends_from_vcard4_file(lfl, export_filepath);
BC_ASSERT_EQUAL(count, 3, int, "%d");
friends = linphone_friend_list_get_friends(lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 3, int, "%d");
linphone_friend_list_unref(lfl);
remove(export_filepath);
@@ -62,7 +62,7 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) {
char *import_filepath = bc_tester_res("vcards/thousand_vcards.vcf");
clock_t start, end;
double elapsed = 0;
- const MSList *friends = NULL;
+ const bctbx_list_t *friends = NULL;
FILE *infile = NULL;
char *buffer = NULL;
long numbytes = 0;
@@ -72,10 +72,10 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) {
end = clock();
friends = linphone_friend_list_get_friends(lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends), 482, int, "%i"); // Thousand vcards contains 482 contacts with a SIP URI
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 482, int, "%i"); // Thousand vcards contains 482 contacts with a SIP URI
elapsed = (double)(end - start);
- ms_error("Imported a thousand of vCards from file (only %i friends with SIP address found) in %f seconds", ms_list_size(friends), elapsed / CLOCKS_PER_SEC);
+ ms_error("Imported a thousand of vCards from file (only %u friends with SIP address found) in %f seconds", (unsigned int)bctbx_list_size(friends), elapsed / CLOCKS_PER_SEC);
lfl = linphone_core_create_friend_list(manager->lc);
infile = fopen(import_filepath, "rb");
@@ -95,10 +95,10 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) {
}
friends = linphone_friend_list_get_friends(lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends), 482, int, "%i"); // Thousand vcards contains 482 contacts with a SIP URI
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 482, int, "%i"); // Thousand vcards contains 482 contacts with a SIP URI
elapsed = (double)(end - start);
- ms_error("Imported a thousand of vCards from buffer (only %i friends with SIP address found) in %f seconds", ms_list_size(friends), elapsed / CLOCKS_PER_SEC);
+ ms_error("Imported a thousand of vCards from buffer (only %u friends with SIP address found) in %f seconds", (unsigned int)bctbx_list_size(friends), elapsed / CLOCKS_PER_SEC);
linphone_friend_list_unref(lfl);
@@ -106,6 +106,15 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) {
linphone_core_manager_destroy(manager);
}
+#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
+#pragma GCC diagnostic push
+#endif
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#else
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
static void linphone_vcard_update_existing_friends_test(void) {
LinphoneFriend *lf = linphone_friend_new_with_addr("sip:oldfriend@sip.linphone.org");
@@ -122,17 +131,21 @@ static void linphone_vcard_update_existing_friends_test(void) {
lf = NULL;
}
+#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
+#pragma GCC diagnostic pop
+#endif
+
static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer("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);
- MSList *sip_addresses = linphone_friend_get_addresses(lf);
- MSList *phone_numbers = linphone_friend_get_phone_numbers(lf);
+ bctbx_list_t *sip_addresses = linphone_friend_get_addresses(lf);
+ bctbx_list_t *phone_numbers = linphone_friend_get_phone_numbers(lf);
LinphoneAddress *addr = NULL;
- BC_ASSERT_EQUAL(ms_list_size(sip_addresses), 2, int, "%i");
- BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 1, int, "%i");
- if (sip_addresses) ms_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
- if (phone_numbers) ms_list_free(phone_numbers);
+ BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 2, int, "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 1, int, "%i");
+ if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
+ if (phone_numbers) bctbx_list_free(phone_numbers);
linphone_friend_unref(lf);
lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nTEL;TYPE=work:0952636505\r\nTEL:0476010203\r\nEND:VCARD\r\n");
@@ -140,39 +153,39 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
sip_addresses = linphone_friend_get_addresses(lf);
phone_numbers = linphone_friend_get_phone_numbers(lf);
- BC_ASSERT_EQUAL(ms_list_size(sip_addresses), 0, int, "%i");
- BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 2, int, "%i");
- if (sip_addresses) ms_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
- if (phone_numbers) ms_list_free(phone_numbers);
+ BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 0, int, "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 2, int, "%i");
+ if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
+ if (phone_numbers) bctbx_list_free(phone_numbers);
addr = linphone_address_new("sip:sylvain@sip.linphone.org");
linphone_friend_add_address(lf, addr);
linphone_address_unref(addr);
sip_addresses = linphone_friend_get_addresses(lf);
- BC_ASSERT_EQUAL(ms_list_size(sip_addresses), 1, int, "%i");
- if (sip_addresses) ms_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
+ BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 1, int, "%i");
+ if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
linphone_friend_remove_phone_number(lf, "0952636505");
phone_numbers = linphone_friend_get_phone_numbers(lf);
- BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 1, int, "%i");
- if (phone_numbers) ms_list_free(phone_numbers);
+ BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 1, int, "%i");
+ if (phone_numbers) bctbx_list_free(phone_numbers);
linphone_friend_remove_phone_number(lf, "0476010203");
phone_numbers = linphone_friend_get_phone_numbers(lf);
- BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 0, int, "%i");
- if (phone_numbers) ms_list_free(phone_numbers);
+ BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 0, int, "%i");
+ if (phone_numbers) bctbx_list_free(phone_numbers);
addr = linphone_address_new("sip:sylvain@sip.linphone.org");
linphone_friend_remove_address(lf, addr);
linphone_address_unref(addr);
sip_addresses = linphone_friend_get_addresses(lf);
- BC_ASSERT_EQUAL(ms_list_size(sip_addresses), 0, int, "%i");
- if (sip_addresses) ms_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
+ BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 0, int, "%i");
+ if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
linphone_friend_add_phone_number(lf, "+33952636505");
phone_numbers = linphone_friend_get_phone_numbers(lf);
- BC_ASSERT_EQUAL(ms_list_size(phone_numbers), 1, int, "%i");
- if (phone_numbers) ms_list_free(phone_numbers);
+ BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 1, int, "%i");
+ if (phone_numbers) bctbx_list_free(phone_numbers);
linphone_friend_unref(lf);
lf = NULL;
@@ -184,19 +197,19 @@ static void friends_if_no_db_set(void) {
LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE);
LinphoneFriend *lf = linphone_core_create_friend(manager->lc);
LinphoneAddress *addr = linphone_address_new("sip:sylvain@sip.linphone.org");
- const MSList *friends = NULL;
+ const bctbx_list_t *friends = NULL;
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
linphone_friend_set_address(lf, addr);
linphone_friend_set_name(lf, "Sylvain");
linphone_friend_list_add_friend(lfl, lf);
friends = linphone_friend_list_get_friends(lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends), 1, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 1, int, "%d");
linphone_friend_list_remove_friend(lfl, lf);
linphone_friend_unref(lf);
friends = linphone_friend_list_get_friends(lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
linphone_friend_list_unref(lfl);
linphone_address_unref(addr);
@@ -207,22 +220,22 @@ static void friends_migration(void) {
LinphoneCoreManager* manager = linphone_core_manager_new2("friends_rc", FALSE);
LpConfig *lpc = linphone_core_get_config(manager->lc);
LinphoneFriendList *lfl = linphone_core_get_default_friend_list(manager->lc);
- const MSList *friends = linphone_friend_list_get_friends(lfl);
- MSList *friends_from_db = NULL;
+ const bctbx_list_t *friends = linphone_friend_list_get_friends(lfl);
+ bctbx_list_t *friends_from_db = NULL;
char *friends_db = bc_tester_file("friends.db");
- BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 3, int, "%d");
BC_ASSERT_EQUAL(lp_config_get_int(lpc, "misc", "friends_migration_done", 0), 0, int, "%i");
unlink(friends_db);
linphone_core_set_friends_database_path(manager->lc, friends_db);
lfl = linphone_core_get_default_friend_list(manager->lc);
friends = linphone_friend_list_get_friends(lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 3, int, "%d");
friends_from_db = linphone_core_fetch_friends_from_db(manager->lc, lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends_from_db), 3, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 3, int, "%d");
BC_ASSERT_EQUAL(lp_config_get_int(lpc, "misc", "friends_migration_done", 0), 1, int, "%i");
- friends_from_db = ms_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
+ friends_from_db = bctbx_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
unlink(friends_db);
ms_free(friends_db);
linphone_core_manager_destroy(manager);
@@ -255,9 +268,9 @@ static void friends_sqlite_storage(void) {
LinphoneFriend *lf2 = NULL;
LinphoneVcard *lvc = linphone_vcard_new();
LinphoneAddress *addr = linphone_address_new("sip:sylvain@sip.linphone.org");
- const MSList *friends = NULL;
- MSList *friends_from_db = NULL;
- MSList *friends_lists_from_db = NULL;
+ const bctbx_list_t *friends = NULL;
+ bctbx_list_t *friends_from_db = NULL;
+ bctbx_list_t *friends_lists_from_db = NULL;
char *friends_db = bc_tester_file("friends.db");
LinphoneFriendListStats *stats = (LinphoneFriendListStats *)ms_new0(LinphoneFriendListStats, 1);
@@ -267,12 +280,12 @@ static void friends_sqlite_storage(void) {
friends = linphone_friend_list_get_friends(linphone_core_get_default_friend_list(lc));
lfl = linphone_core_create_friend_list(lc);
linphone_friend_list_set_user_data(lfl, stats);
- BC_ASSERT_EQUAL(ms_list_size(friends), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
unlink(friends_db);
linphone_core_set_friends_database_path(lc, friends_db);
friends_from_db = linphone_core_fetch_friends_from_db(lc, linphone_core_get_default_friend_list(lc));
- BC_ASSERT_EQUAL(ms_list_size(friends_from_db), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 0, int, "%d");
linphone_vcard_set_etag(lvc, "\"123-456789\"");
linphone_vcard_set_url(lvc, "http://dav.somewhere.fr/addressbook/me/someone.vcf");
@@ -287,29 +300,29 @@ static void friends_sqlite_storage(void) {
linphone_friend_list_set_display_name(lfl, "Test");
BC_ASSERT_EQUAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%i");
linphone_friend_unref(lf);
- BC_ASSERT_EQUAL(lfl->storage_id, 1, int, "%d");
- BC_ASSERT_EQUAL(lf->storage_id, 1, int, "%d");
+ BC_ASSERT_EQUAL(lfl->storage_id, 1, unsigned int, "%u");
+ BC_ASSERT_EQUAL(lf->storage_id, 1, unsigned int, "%u");
friends = linphone_friend_list_get_friends(linphone_core_get_default_friend_list(lc));
- BC_ASSERT_EQUAL(ms_list_size(friends), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
friends_lists_from_db = linphone_core_fetch_friends_lists_from_db(lc);
- BC_ASSERT_EQUAL(ms_list_size(friends_lists_from_db), 1, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends_lists_from_db), 1, int, "%d");
friends_from_db = ((LinphoneFriendList *)friends_lists_from_db->data)->friends;
- BC_ASSERT_EQUAL(ms_list_size(friends_from_db), 1, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 1, int, "%d");
lf2 = (LinphoneFriend *)friends_from_db->data;
BC_ASSERT_PTR_NOT_NULL(lf2->lc);
BC_ASSERT_PTR_NOT_NULL(lf2->friend_list);
- friends_lists_from_db = ms_list_free_with_data(friends_lists_from_db, (void (*)(void *))linphone_friend_list_unref);
+ friends_lists_from_db = bctbx_list_free_with_data(friends_lists_from_db, (void (*)(void *))linphone_friend_list_unref);
friends_from_db = linphone_core_fetch_friends_from_db(lc, lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends_from_db), 1, int, "%d");
- if (ms_list_size(friends_from_db) < 1) {
+ BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 1, int, "%d");
+ if (bctbx_list_size(friends_from_db) < 1) {
goto end;
}
lf2 = (LinphoneFriend *)friends_from_db->data;
BC_ASSERT_STRING_EQUAL(linphone_friend_get_name(lf2), linphone_friend_get_name(lf));
- BC_ASSERT_EQUAL(lf2->storage_id, lf->storage_id, int, "%i");
+ BC_ASSERT_EQUAL(lf2->storage_id, lf->storage_id, unsigned int, "%u");
BC_ASSERT_STRING_EQUAL(linphone_vcard_get_etag(linphone_friend_get_vcard(lf2)), linphone_vcard_get_etag(linphone_friend_get_vcard(lf)));
BC_ASSERT_STRING_EQUAL(linphone_vcard_get_url(linphone_friend_get_vcard(lf2)), linphone_vcard_get_url(linphone_friend_get_vcard(lf)));
BC_ASSERT_STRING_EQUAL(linphone_address_as_string(linphone_friend_get_address(lf2)), linphone_address_as_string(linphone_friend_get_address(lf)));
@@ -317,21 +330,21 @@ static void friends_sqlite_storage(void) {
linphone_friend_edit(lf);
linphone_friend_set_name(lf, "Margaux");
linphone_friend_done(lf);
- friends_from_db = ms_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
+ friends_from_db = bctbx_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
friends_from_db = linphone_core_fetch_friends_from_db(lc, lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends_from_db), 1, int, "%d");
- if (ms_list_size(friends_from_db) < 1) {
+ BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 1, int, "%d");
+ if (bctbx_list_size(friends_from_db) < 1) {
goto end;
}
lf2 = (LinphoneFriend *)friends_from_db->data;
BC_ASSERT_STRING_EQUAL(linphone_friend_get_name(lf2), "Margaux");
- friends_from_db = ms_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
+ friends_from_db = bctbx_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
linphone_friend_list_remove_friend(lfl, lf);
friends = linphone_friend_list_get_friends(linphone_core_get_default_friend_list(lc));
- BC_ASSERT_EQUAL(ms_list_size(friends), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
friends_from_db = linphone_core_fetch_friends_from_db(lc, lfl);
- BC_ASSERT_EQUAL(ms_list_size(friends_from_db), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 0, int, "%d");
linphone_core_remove_friend_list(lc, lfl);
wait_for_until(lc, NULL, &stats->removed_list_count, 1, 1000);
@@ -571,15 +584,15 @@ static void carddav_integration(void) {
linphone_core_add_friend_list(manager->lc, lfl);
BC_ASSERT_PTR_NULL(linphone_vcard_get_uid(lvc));
- BC_ASSERT_EQUAL(ms_list_size(lfl->dirty_friends_to_update), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(lfl->dirty_friends_to_update), 0, int, "%d");
BC_ASSERT_EQUAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%d");
- BC_ASSERT_EQUAL(ms_list_size(lfl->dirty_friends_to_update), 1, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(lfl->dirty_friends_to_update), 1, int, "%d");
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 5000);
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
- BC_ASSERT_EQUAL(ms_list_size(lfl->dirty_friends_to_update), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(lfl->dirty_friends_to_update), 0, int, "%d");
BC_ASSERT_PTR_NOT_NULL(linphone_vcard_get_uid(lvc));
linphone_friend_list_remove_friend(lfl, lf);
- BC_ASSERT_EQUAL(ms_list_size(lfl->friends), 0, int, "%d");
+ BC_ASSERT_EQUAL(bctbx_list_size(lfl->friends), 0, int, "%d");
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 2, 5000);
BC_ASSERT_EQUAL(stats->sync_done_count, 2, int, "%i");
linphone_friend_unref(lf);
@@ -608,22 +621,22 @@ static void carddav_integration(void) {
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 3, 5000);
BC_ASSERT_EQUAL(stats->sync_done_count, 3, int, "%i");
- BC_ASSERT_EQUAL(ms_list_size(lfl->friends), 1, int, "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(lfl->friends), 1, int, "%i");
lf = (LinphoneFriend *)lfl->friends->data;
BC_ASSERT_STRING_EQUAL(lf->refkey, refkey);
- BC_ASSERT_EQUAL(lf->storage_id, lf2->storage_id, int, "%i");
+ BC_ASSERT_EQUAL(lf->storage_id, lf2->storage_id, unsigned int, "%u");
linphone_friend_unref(lf2);
BC_ASSERT_STRING_EQUAL(linphone_address_as_string_uri_only(lf->uri), "sip:sylvain@sip.linphone.org");
linphone_friend_edit(lf);
linphone_friend_done(lf);
- BC_ASSERT_EQUAL(ms_list_size(lf->friend_list->dirty_friends_to_update), 0, int, "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(lf->friend_list->dirty_friends_to_update), 0, int, "%i");
linphone_core_set_network_reachable(manager->lc, FALSE); //To prevent the CardDAV update
linphone_friend_edit(lf);
linphone_friend_set_name(lf, "François Grisez");
linphone_friend_done(lf);
- BC_ASSERT_EQUAL(ms_list_size(lf->friend_list->dirty_friends_to_update), 1, int, "%i");
+ BC_ASSERT_EQUAL(bctbx_list_size(lf->friend_list->dirty_friends_to_update), 1, int, "%i");
ms_free(stats);
linphone_friend_list_unref(lfl);
@@ -635,8 +648,8 @@ static void carddav_clean(void) { // This is to ensure the content of the test
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(lfl);
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1);
- MSList *friends = NULL;
- MSList *friends_iterator = NULL;
+ bctbx_list_t *friends = NULL;
+ bctbx_list_t *friends_iterator = NULL;
LinphoneFriend *lf = NULL;
LinphoneVcard *lvc = NULL;
@@ -653,7 +666,7 @@ static void carddav_clean(void) { // This is to ensure the content of the test
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
stats->sync_done_count = 0;
- friends = ms_list_copy(lfl->friends);
+ friends = bctbx_list_copy(lfl->friends);
friends_iterator = friends;
while (friends_iterator) {
LinphoneFriend *lf = (LinphoneFriend *)friends_iterator->data;
@@ -662,9 +675,9 @@ static void carddav_clean(void) { // This is to ensure the content of the test
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
stats->sync_done_count = 0;
stats->removed_contact_count = 0;
- friends_iterator = ms_list_next(friends_iterator);
+ friends_iterator = bctbx_list_next(friends_iterator);
}
- ms_list_free(friends);
+ bctbx_list_free(friends);
lvc = linphone_vcard_new_from_vcard4_buffer("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");
@@ -718,7 +731,7 @@ static void carddav_server_to_client_and_client_to_sever_sync(void) {
LinphoneFriend *lf1 = linphone_friend_new_from_vcard(lvc1);
LinphoneVcard *lvc2 = linphone_vcard_new_from_vcard4_buffer("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);
- MSList *friends = NULL, *friends_iterator = NULL;
+ bctbx_list_t *friends = NULL, *friends_iterator = NULL;
linphone_friend_list_cbs_set_user_data(cbs, stats);
linphone_friend_list_cbs_set_contact_created(cbs, carddav_contact_created);
@@ -737,7 +750,7 @@ static void carddav_server_to_client_and_client_to_sever_sync(void) {
BC_ASSERT_EQUAL(stats->sync_done_count, 3, int, "%i");
stats->sync_done_count = 0;
- friends = ms_list_copy(lfl->friends);
+ friends = bctbx_list_copy(lfl->friends);
friends_iterator = friends;
while (friends_iterator) {
LinphoneFriend *lf = (LinphoneFriend *)friends_iterator->data;
@@ -747,9 +760,9 @@ static void carddav_server_to_client_and_client_to_sever_sync(void) {
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
stats->sync_done_count = 0;
}
- friends_iterator = ms_list_next(friends_iterator);
+ friends_iterator = bctbx_list_next(friends_iterator);
}
- ms_list_free(friends);
+ bctbx_list_free(friends);
ms_free(stats);
linphone_friend_list_unref(lfl);
diff --git a/tester/video_tester.c b/tester/video_tester.c
index d1be16593..6d2e4cce9 100644
--- a/tester/video_tester.c
+++ b/tester/video_tester.c
@@ -27,7 +27,9 @@
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
+#ifndef _MSC_VER
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#endif
#if HAVE_GTK
#include
@@ -158,14 +160,14 @@ static void early_media_video_call_state_changed_with_inactive_audio(LinphoneCor
}
bool_t wait_for_three_cores(LinphoneCore *lc1, LinphoneCore *lc2, LinphoneCore *lc3, int timeout) {
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
bool_t result;
int dummy = 0;
- if (lc1) lcs = ms_list_append(lcs, lc1);
- if (lc2) lcs = ms_list_append(lcs, lc2);
- if (lc3) lcs = ms_list_append(lcs, lc3);
+ if (lc1) lcs = bctbx_list_append(lcs, lc1);
+ if (lc2) lcs = bctbx_list_append(lcs, lc2);
+ if (lc3) lcs = bctbx_list_append(lcs, lc3);
result = wait_for_list(lcs, &dummy, 1, timeout);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
return result;
}
@@ -303,7 +305,7 @@ static void two_incoming_early_media_video_calls_test(void) {
LinphoneCallParams *pauline_params;
LinphoneCallParams *laure_params;
LinphoneCall *call;
- const MSList *calls_list;
+ const bctbx_list_t *calls_list;
marie = linphone_core_manager_new("marie_rc");
pauline = linphone_core_manager_new("pauline_tcp_rc");
@@ -333,7 +335,7 @@ static void two_incoming_early_media_video_calls_test(void) {
BC_ASSERT_EQUAL(linphone_core_get_calls_nb(marie->lc), 2, int, "%d");
if (linphone_core_get_calls_nb(marie->lc) == 2) {
calls_list = linphone_core_get_calls(marie->lc);
- call = (LinphoneCall *)ms_list_nth_data(calls_list, 0);
+ call = (LinphoneCall *)bctbx_list_nth_data(calls_list, 0);
BC_ASSERT_PTR_NOT_NULL(call);
if (call != NULL) {
LinphoneCallParams *params = linphone_call_params_copy(linphone_call_get_current_params(call));
@@ -407,7 +409,7 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void
LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_tcp_rc");
LinphoneCoreManager *marie1 = linphone_core_manager_new("marie_early_rc");
LinphoneCoreManager *marie2 = linphone_core_manager_new("marie_early_rc");
- MSList *lcs = NULL;
+ bctbx_list_t *lcs = NULL;
LinphoneCallParams *pauline_params;
LinphoneCallParams *marie1_params;
LinphoneCallParams *marie2_params;
@@ -431,9 +433,9 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void
linphone_core_set_audio_port_range(marie2->lc, 40200, 40300);
linphone_core_set_video_port_range(marie2->lc, 40400, 40500);
- lcs = ms_list_append(lcs,marie1->lc);
- lcs = ms_list_append(lcs,marie2->lc);
- lcs = ms_list_append(lcs,pauline->lc);
+ lcs = bctbx_list_append(lcs,marie1->lc);
+ lcs = bctbx_list_append(lcs,marie2->lc);
+ lcs = bctbx_list_append(lcs,pauline->lc);
pauline_params = linphone_core_create_call_params(pauline->lc, NULL);
linphone_call_params_enable_early_media_sending(pauline_params, TRUE);
@@ -509,7 +511,7 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void
linphone_call_params_destroy(marie1_params);
linphone_call_params_destroy(marie2_params);
- ms_list_free(lcs);
+ bctbx_list_free(lcs);
linphone_core_manager_destroy(marie1);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(pauline);
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 0a871aba5..71a3acea5 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -25,72 +25,59 @@ if(MSVC)
find_library(LIBMINGWEX NAMES mingwex)
endif()
+set(USE_BUNDLE )
+if (IOS)
+ set(USE_BUNDLE MACOSX_BUNDLE)
+endif()
+
set(LP_GEN_WRAPPERS_SOURCE_FILES
generator.cc
generator.hh
genwrappers.cc
software-desc.cc
software-desc.hh
-)
-
-add_definitions(
- -DIN_LINPHONE
-)
+ )
+add_definitions(-DIN_LINPHONE)
set(LP_GEN_WRAPPERS_LIBS
${LIBGCC}
${LIBMINGWEX}
${XML2_LIBRARIES}
-)
+ )
apply_compile_flags(LP_GEN_WRAPPERS_SOURCE_FILES "CPP" "CXX")
-add_executable(lp-gen-wrappers ${LP_GEN_WRAPPERS_SOURCE_FILES})
+add_executable(lp-gen-wrappers ${USE_BUNDLE} ${LP_GEN_WRAPPERS_SOURCE_FILES})
target_link_libraries(lp-gen-wrappers ${LP_GEN_WRAPPERS_LIBS})
-
-install(TARGETS lp-gen-wrappers
- 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
-)
-
-set(LP_AUTO_ANSWER_SOURCE_FILES
- auto_answer.c
-)
-
-add_definitions(
- -DIN_LINPHONE
-)
-
+set(LP_AUTO_ANSWER_SOURCE_FILES auto_answer.c)
apply_compile_flags(LP_AUTO_ANSWER_SOURCE_FILES "CPP" "C")
-add_executable(lp-auto-answer ${LP_AUTO_ANSWER_SOURCE_FILES})
-target_link_libraries(lp-auto-answer linphone)
-
-
-install(TARGETS lp-auto-answer
- 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
-)
-
-set(LP_SENDMSG_SOURCE_FILES
- lpsendmsg.c
-)
-
-add_definitions(
- -DIN_LINPHONE
-)
+add_executable(lp-auto-answer ${USE_BUNDLE} ${LP_AUTO_ANSWER_SOURCE_FILES})
+target_link_libraries(lp-auto-answer ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES})
+set_target_properties(lp-auto-answer PROPERTIES LINK_FLAGS "${MEDIASTREAMER2_LDFLAGS}")
+set(LP_SENDMSG_SOURCE_FILES lpsendmsg.c)
apply_compile_flags(LP_SENDMSG_SOURCE_FILES "CPP" "C")
-add_executable(lp-sendmsg ${LP_SENDMSG_SOURCE_FILES})
-target_link_libraries(lp-sendmsg linphone)
+add_executable(lp-sendmsg ${USE_BUNDLE} ${LP_SENDMSG_SOURCE_FILES})
+target_link_libraries(lp-sendmsg ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
+set_target_properties(lp-sendmsg PROPERTIES LINK_FLAGS "${MEDIASTREAMER2_LDFLAGS}")
-
-install(TARGETS lp-sendmsg
- 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 lp-gen-wrappers
+ 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(TARGETS lp-auto-answer
+ 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(TARGETS lp-sendmsg
+ 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
+ )
+endif()
diff --git a/tools/auto_answer.c b/tools/auto_answer.c
index c150f24e9..83ed77bcf 100644
--- a/tools/auto_answer.c
+++ b/tools/auto_answer.c
@@ -184,13 +184,13 @@ int main(int argc, char *argv[]){
/* main loop for receiving notifications and doing background linphonecore work: */
while(running){
- const MSList * iterator;
+ const bctbx_list_t * iterator;
linphone_core_iterate(lc);
ms_usleep(50000);
if (print_stats) {
ms_message("*********************************");
- ms_message("*Current number of calls [%10i] *",ms_list_size(linphone_core_get_calls(lc)));
- ms_message("*Number of calls until now [%10i] *",ms_list_size(linphone_core_get_call_logs(lc)));
+ ms_message("*Current number of calls [%10u] *", (unsigned int)bctbx_list_size(linphone_core_get_calls(lc)));
+ ms_message("*Number of calls until now [%10u] *", (unsigned int)bctbx_list_size(linphone_core_get_call_logs(lc)));
ms_message("*********************************");
print_stats=FALSE;
}
diff --git a/tools/genapixml.py b/tools/genapixml.py
index d03d96f54..f0bb2c51c 100755
--- a/tools/genapixml.py
+++ b/tools/genapixml.py
@@ -436,7 +436,7 @@ class Project:
returnarg = CArgument(returntype, enums = self.enums, structs = self.__structs)
returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']")
if returndesc is not None:
- if returnarg.ctype == 'MSList':
+ if returnarg.ctype == 'MSList' or returnarg.ctype == 'bctbx_list_t':
n = returndesc.find('.//mslist')
if n is not None:
returnarg.containedType = n.text
@@ -507,7 +507,7 @@ class Project:
returnarg = CArgument(t, enums = self.enums, structs = self.__structs)
returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']")
if returndesc is not None:
- if returnarg.ctype == 'MSList':
+ if returnarg.ctype == 'MSList' or returnarg.ctype == 'bctbx_list_t':
n = returndesc.find('.//mslist')
if n is not None:
returnarg.containedType = n.text
@@ -530,7 +530,7 @@ class Project:
for arg in argslist.arguments:
for paramdesc in paramdescs:
if arg.name == paramdesc.find('./parameternamelist').find('./parametername').text:
- if arg.ctype == 'MSList':
+ if arg.ctype == 'MSList' or arg.ctype == 'bctbx_list_t':
n = paramdesc.find('.//mslist')
if n is not None:
arg.containedType = n.text
diff --git a/tools/python/apixml2python.py b/tools/python/apixml2python.py
index ba4fa7a72..423df355d 100755
--- a/tools/python/apixml2python.py
+++ b/tools/python/apixml2python.py
@@ -47,6 +47,7 @@ blacklisted_functions = [
'linphone_core_can_we_add_call', # private function
'linphone_core_enable_log_collection', # need to handle class properties
'linphone_core_get_audio_port_range', # to be handwritten because of result via arguments
+ 'linphone_core_get_network_simulator_params', # missing OrtpNetworkSimulatorParams
'linphone_core_get_supported_video_sizes', # missing MSVideoSizeDef
'linphone_core_get_video_policy', # missing LinphoneVideoPolicy
'linphone_core_get_video_port_range', # to be handwritten because of result via arguments
@@ -60,7 +61,9 @@ blacklisted_functions = [
'linphone_core_set_log_handler', # Hand-written but put directly in the linphone module
'linphone_core_set_log_level', # There is no use to wrap this function
'linphone_core_set_log_level_mask', # There is no use to wrap this function
+ 'linphone_core_set_network_simulator_params', # missing OrtpNetworkSimulatorParams
'linphone_core_set_video_policy', # missing LinphoneVideoPolicy
+ 'linphone_nat_policy_get_stun_server_addrinfo',
'linphone_proxy_config_get_privacy', # missing LinphonePrivacyMask
'linphone_proxy_config_normalize_number', # to be handwritten because of result via arguments
'linphone_proxy_config_set_file_transfer_server', # defined but not implemented in linphone core
diff --git a/tools/python/apixml2python/handwritten_declarations.mustache b/tools/python/apixml2python/handwritten_declarations.mustache
index 0f694d6c3..ca7cfd1c4 100644
--- a/tools/python/apixml2python/handwritten_declarations.mustache
+++ b/tools/python/apixml2python/handwritten_declarations.mustache
@@ -24,8 +24,8 @@ typedef struct {
LCSipTransports lcst;
} pylinphone_SipTransportsObject;
-PyObject * PyList_FromMSListOfString(const MSList *msl);
-MSList * PyList_AsMSListOfString(PyObject *pyl);
+PyObject * PyList_FromMSListOfString(const bctbx_list_t *msl);
+bctbx_list_t * PyList_AsMSListOfString(PyObject *pyl);
int PyLinphoneVideoSize_Check(PyObject *p);
MSVideoSize PyLinphoneVideoSize_AsMSVideoSize(PyObject *obj);
diff --git a/tools/python/apixml2python/handwritten_definitions.mustache b/tools/python/apixml2python/handwritten_definitions.mustache
index e34c7f16b..f87dfe7f2 100644
--- a/tools/python/apixml2python/handwritten_definitions.mustache
+++ b/tools/python/apixml2python/handwritten_definitions.mustache
@@ -1,21 +1,21 @@
-PyObject * PyList_FromMSListOfString(const MSList *msl) {
+PyObject * PyList_FromMSListOfString(const bctbx_list_t *msl) {
PyObject *pyl = PyList_New(0);
while (msl != NULL) {
PyObject *item = Py_BuildValue("z", (const char *)msl->data);
PyList_Append(pyl, item);
- msl = ms_list_next(msl);
+ msl = bctbx_list_next(msl);
}
return pyl;
}
-MSList * PyList_AsMSListOfString(PyObject *pyl) {
- MSList *msl = NULL;
+bctbx_list_t * PyList_AsMSListOfString(PyObject *pyl) {
+ bctbx_list_t *msl = NULL;
Py_ssize_t idx;
Py_ssize_t size = PyList_Size(pyl);
for (idx = 0; idx < size; idx++) {
PyObject *item = PyList_GetItem(pyl, idx);
char *citem = (char *)PyString_AsString(item);
- msl = ms_list_append(msl, citem);
+ msl = bctbx_list_append(msl, citem);
}
return msl;
}
diff --git a/tools/python/apixml2python/linphone.py b/tools/python/apixml2python/linphone.py
index a6456159b..0b3687129 100644
--- a/tools/python/apixml2python/linphone.py
+++ b/tools/python/apixml2python/linphone.py
@@ -101,7 +101,7 @@ class ArgumentType:
self.use_native_pointer = False
self.cast_convert_func_result = True
self.__compute()
- if self.basic_type == 'MSList' and self.contained_type is not None and self.contained_type != 'const char *':
+ if (self.basic_type == 'MSList' or self.basic_type == 'bctbx_list_t') and self.contained_type is not None and self.contained_type != 'const char *':
self.linphone_module.mslist_types.add(self.contained_type)
def __compute(self):
@@ -214,7 +214,7 @@ class ArgumentType:
self.fmt_str = 'O'
self.cfmt_str = '%p'
self.cnativefmt_str = '%ld'
- elif self.basic_type == 'MSList':
+ elif self.basic_type == 'MSList' or self.basic_type == 'bctbx_list_t':
if self.contained_type == 'const char *':
self.type_str = 'list of string'
self.convert_code = "{result_name}{result_suffix} = {cast}PyList_AsMSListOfString({arg_name});\n"
diff --git a/tools/python/apixml2python/linphone_module.mustache b/tools/python/apixml2python/linphone_module.mustache
index 9d5410979..7ee8443cb 100644
--- a/tools/python/apixml2python/linphone_module.mustache
+++ b/tools/python/apixml2python/linphone_module.mustache
@@ -72,25 +72,25 @@ static PyObject * pylinphone_{{class_name}}_instance_method_{{method_name}}(PyOb
{{/classes}}
{{#mslist_types}}
-PyObject * PyList_FromMSListOf{{c_contained_type}}(const MSList *msl) {
+PyObject * PyList_FromMSListOf{{c_contained_type}}(const bctbx_list_t *msl) {
PyObject *pyl = PyList_New(0);
while (msl != NULL) {
{{c_contained_type}} *native_ptr = ({{c_contained_type}} *)msl->data;
PyObject *item = pylinphone_{{python_contained_type}}_from_native_ptr(&pylinphone_{{python_contained_type}}Type, native_ptr);
PyList_Append(pyl, item);
- msl = ms_list_next(msl);
+ msl = bctbx_list_next(msl);
}
return pyl;
}
-MSList * PyList_AsMSListOf{{c_contained_type}}(PyObject *pyl) {
- MSList *msl = NULL;
+bctbx_list_t * PyList_AsMSListOf{{c_contained_type}}(PyObject *pyl) {
+ bctbx_list_t *msl = NULL;
Py_ssize_t idx;
Py_ssize_t size = PyList_Size(pyl);
for (idx = 0; idx < size; idx++) {
PyObject *item = PyList_GetItem(pyl, idx);
{{c_contained_type}} *native_ptr = pylinphone_{{python_contained_type}}_get_native_ptr(item);
- msl = ms_list_append(msl, native_ptr);
+ msl = bctbx_list_append(msl, native_ptr);
}
return msl;
}