Merge remote-tracking branch 'origin/master' into dev_dtls

Conflicts:
	mediastreamer2
	oRTP
This commit is contained in:
Johan Pascal 2014-12-10 15:18:14 +01:00
commit 8637eacae5
127 changed files with 11240 additions and 16091 deletions

3
.gitignore vendored
View file

@ -78,3 +78,6 @@ Linphone.app
*.dmg
tester/linphone*.log
tester/linphone_log.txt
.tx/linphone-gtk.linphonedesktopin/
po/linphone.pot
.tx/linphone-gtk.audio-assistantdesktopin/

20
.tx/config Normal file
View file

@ -0,0 +1,20 @@
[main]
host = https://www.transifex.com
minimum_perc = 1
[linphone-gtk.linphonepot]
file_filter = po/<lang>.po
source_file = po/linphone.pot
source_lang = en
type = PO
[linphone-gtk.linphonedesktopin]
source_file = share/linphone.desktop.in
source_lang = en
type = DESKTOP
[linphone-gtk.audio-assistantdesktopin]
source_file = share/audio-assistant.desktop.in
source_lang = en
type = DESKTOP

View file

@ -30,6 +30,8 @@ set(LINPHONE_MICRO_VERSION "0")
set(LINPHONE_VERSION "${LINPHONE_MAJOR_VERSION}.${LINPHONE_MINOR_VERSION}.${LINPHONE_MICRO_VERSION}")
set(LINPHONE_SO_VERSION "6")
set(LINPHONE_ALL_LANGS "cs de es fr he hu it ja nb_NO nl pl pt_BR ru sr sv zh_CN zh_TW")
include(CMakeDependentOption)
@ -39,9 +41,9 @@ option(ENABLE_DATE "Use build date in internal version number." NO)
option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." YES)
option(ENABLE_LDAP "Enable LDAP support." NO)
option(ENABLE_MSG_STORAGE "Turn on compilation of message storage." YES)
option(ENABLE_NOTIFY "Enable libnotify support." YES)
cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI" NO)
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
option(ENABLE_TOOLS "Turn on or off compilation of console interface" YES)
option(ENABLE_TOOLS "Turn on or off compilation of tools." YES)
option(ENABLE_TUNNEL "Turn on compilation of tunnel support." NO)
option(ENABLE_TUTORIALS "Enable compilation of tutorials." YES)
option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES)
@ -50,24 +52,56 @@ option(ENABLE_VIDEO "Build with video support." YES)
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/share/cmake/Modules")
include(CheckIncludeFile)
include(CheckSymbolExists)
if(MSVC)
list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_PREFIX_PATH}/include/MSVC)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CMAKE_PREFIX_PATH}/include/MSVC")
endif()
find_package(BelleSIP REQUIRED)
find_package(MS2 REQUIRED)
find_package(XML2 REQUIRED)
if(ENABLE_UNIT_TESTS)
find_package(CUnit)
if(CUNIT_FOUND)
cmake_push_check_state(RESET)
list(APPEND CMAKE_REQUIRED_INCLUDES ${CUNIT_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CUNIT_LIBRARIES})
check_symbol_exists("CU_get_suite" "CUnit/CUnit.h" HAVE_CU_GET_SUITE)
check_symbol_exists("CU_curses_run_tests" "CUnit/CUnit.h" HAVE_CU_CURSES)
cmake_pop_check_state()
else()
message(WARNING "Could not find the cunit library!")
set(ENABLE_UNIT_TESTS OFF CACHE BOOL "Enable compilation of unit tests." FORCE)
endif()
endif()
if(ENABLE_TUNNEL)
find_package(Tunnel)
if(NOT TUNNEL_FOUND)
message(WARNING "Could not find the tunnel library!")
set(ENABLE_TUNNEL OFF CACHE BOOL "Enable tunnel support" FORCE)
set(ENABLE_TUNNEL OFF CACHE BOOL "Enable tunnel support." FORCE)
endif()
endif()
if(ENABLE_MSG_STORAGE)
find_package(Sqlite3)
if(NOT SQLITE3_FOUND)
message(FATAL_ERROR "Could not find the sqlite3 library!")
endif()
endif()
if(ENABLE_NOTIFY)
find_package(Notify)
if(NOTIFY_FOUND)
set(HAVE_NOTIFY4 1)
else()
message(WARNING "Could not find the notify library!")
set(ENABLE_NOTIFY OFF CACHE BOOL "Enable libnotify support." FORCE)
endif()
endif()
find_package(Gettext)
include_directories(
@ -79,6 +113,10 @@ include_directories(
${MS2_INCLUDE_DIRS}
${XML2_INCLUDE_DIRS}
)
if(SQLITE3_FOUND)
include_directories(${SQLITE3_INCLUDE_DIRS})
add_definitions("-DMSG_STORAGE_ENABLED")
endif()
if(ENABLE_TUNNEL)
include_directories(${TUNNEL_INCLUDE_DIRS})
endif()
@ -87,7 +125,29 @@ if(MSVC)
include_directories(${CMAKE_PREFIX_PATH}/include/MSVC)
endif()
add_definitions("-DIN_LINPHONE")
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wuninitialized -Wdeclaration-after-statement -fno-strict-aliasing -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wuninitialized -Werror")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -Wno-array-bounds")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -Wno-array-bounds")
endif()
if(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unknown-warning-option -Wno-tautological-compare -Wno-unused-function")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unknown-warning-option -Wno-tautological-compare -Wno-unused-function")
endif()
endif()
set(GETTEXT_PACKAGE "linphone")
if(ENABLE_RELATIVE_PREFIX)
set(LINPHONE_DATA_DIR ".")
else()
@ -97,19 +157,36 @@ set(LINPHONE_PLUGINS_DIR "${LINPHONE_DATA_DIR}/lib/liblinphone/plugins")
set(PACKAGE_LOCALE_DIR "${LINPHONE_DATA_DIR}/share/locale")
set(PACKAGE_DATA_DIR "${LINPHONE_DATA_DIR}/share")
set(PACKAGE_SOUND_DIR "${LINPHONE_DATA_DIR}/share/sounds/linphone")
set(PACKAGE_RING_DIR "${PACKAGE_SOUND_DIR}/rings")
set(PACKAGE_FREEDESKTOP_DIR "${PACKAGE_DATA_DIR}/applications")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/config.h PROPERTIES GENERATED ON)
add_definitions(-DHAVE_CONFIG_H)
add_subdirectory(coreapi)
add_subdirectory(share)
if(ENABLE_TOOLS)
add_subdirectory(tools)
if(ENABLE_VIDEO)
add_definitions(-DVIDEO_ENABLED)
endif()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/FindLinphone.cmake
add_subdirectory(coreapi)
add_subdirectory(share)
if(ENABLE_GTK_UI)
add_subdirectory(gtk)
add_subdirectory(pixmaps)
add_subdirectory(po)
endif()
if(ENABLE_TOOLS)
add_subdirectory(tools)
endif()
if(ENABLE_UNIT_TESTS)
add_subdirectory(tester)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLinphone.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindLinphone.cmake)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FindLinphone.cmake
DESTINATION share/cmake/Modules
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)

View file

@ -205,7 +205,8 @@ MACAPPZIP=$(PACKAGE)-$(VERSION).app.zip
MACAPPDMG=$(PACKAGE)-$(VERSION).dmg
BUNDLEPREFIX=./
BUNDLEDIR=$(BUNDLEPREFIX)$(MACAPPNAME)
#a path prefix where additional libs can be cherry-picked by the bundler.
LINPHONE_ADDITIONAL_DEPENDENCIES_PREFIX=/usr/local
bundle:
rm -rf $(INSTALLDIR)
@ -215,6 +216,7 @@ bundle:
LINPHONE_INSTALL_PREFIX=$(INSTALLDIR_WITH_PREFIX) \
LIBLINPHONE_INSTALL_PREFIX=$(INSTALLDIR_WITH_PREFIX) \
MS2_PLUGINS_INSTALL_PREFIX=$(prefix) \
LINPHONE_ADDITIONAL_DEPENDENCIES_PREFIX=$(LINPHONE_ADDITIONAL_DEPENDENCIES_PREFIX) \
gtk-mac-bundler $(PACKAGE_BUNDLE_FILE)
printf "[Pango]\nModuleFiles=./etc/pango/pango.modules\n" \
> $(BUNDLEDIR)/Contents/Resources/etc/pango/pangorc

View file

@ -42,18 +42,9 @@ In order to enable generation of bundle for multiple MacOS version and 32 bit pr
# readline is required from linphonec.c otherwise compilation will fail
brew link readline --force
# then you have to install antlr3 from a tap.
wget https://gist.githubusercontent.com/Gui13/f5cf103f50d34c28c7be/raw/f50242f5e0c3a6d25ed7fca1462bce3a7b738971/antlr3.rb
mv antlr3.rb /usr/local/Library/Formula/
brew install antlr3
brew tap marekjelen/gtk
brew install gtk+-quartz
# gtk-mac-integration is not available in main repository or Brew yet.
wget https://gist.github.com/Gui13/cdcad37faa6b8ffa0588/raw/bf2277d45e261ad48ae1344c4c97f2684974ed87/gtk-mac-integration.rb
mv gtk-mac-integration.rb /usr/local/Library/Formula/
brew install gtk-mac-integration
# then you have to install some dependencies from a tap.
brew tap Gui13/linphone
brew install antlr3.2 libantlr3.4c mattintosh4/gtk-mac-integration/gtk-mac-integration
### Building Linphone
@ -121,10 +112,7 @@ The libvpx build isn't able to produce dual architecture files. To workaround th
If you got the source code from git, run `./autogen.sh` first.
Then or otherwise, :
# HomeBrew
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --prefix=/opt/local --disable-x11 --with-srtp=/opt/local --with-gsm=/opt/local --enable-zrtp --disable-strict --with-readline=/usr/local && make
# MacPorts
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --prefix=/opt/local --disable-x11 --with-srtp=/opt/local --with-gsm=/opt/local --enable-zrtp --disable-strict --with-readline=/opt/local && make
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --prefix=/opt/local --disable-x11 --with-srtp=/opt/local --with-gsm=/opt/local --enable-zrtp --disable-strict && make
* Install on the system

View file

@ -17,7 +17,8 @@ common_SRC_FILES := \
log_collection_tester.c \
transport_tester.c \
player_tester.c \
dtmf_tester.c
dtmf_tester.c \
accountmanager.c
common_C_INCLUDES += \
$(LOCAL_PATH) \

View file

@ -1,4 +1,5 @@
export EXTRA_ARGS="--workdir $bundle_res"
#export EXTRA_ARGS="--workdir $bundle_res"
export LINPHONE_WORKDIR="$bundle_res"
export GIO_EXTRA_MODULES="$bundle_lib/gio/modules"
export PANGO_LIBDIR="$bundle_lib"
export PANGO_SYSCONFDIR="$bundle_etc"

View file

@ -16,7 +16,7 @@
<prefix name="linphone">${env:LINPHONE_INSTALL_PREFIX}</prefix>
<prefix name="ms2plugins">${env:MS2_PLUGINS_INSTALL_PREFIX}</prefix>
<!-- This prefix definition is necessary if some dependencies are to be taken from /usr/local/lib -->
<prefix name="local">/usr/local</prefix>
<prefix name="local">${env:LINPHONE_ADDITIONAL_DEPENDENCIES_PREFIX}</prefix>
<!-- The project directory is the default location of the created
app. If you leave out the path, the current directory is
used. Note the usage of an environment variable here again.

View file

@ -1,5 +1,5 @@
############################################################################
# FindLinphone.txt
# FindLinphone.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
@ -32,8 +32,11 @@ find_package(ORTP REQUIRED)
find_package(MS2 REQUIRED)
find_package(XML2 REQUIRED)
find_package(BelleSIP REQUIRED)
if(@ENABLE_MSG_STORAGE@)
find_package(Sqlite3)
endif()
set(_LINPHONEROOT_PATHS
set(_LINPHONE_ROOT_PATHS
${WITH_LINPHONE}
${CMAKE_INSTALL_PREFIX}
)
@ -56,6 +59,12 @@ find_library(LINPHONE_LIBRARIES
list(APPEND LINPHONE_INCLUDE_DIRS ${ORTP_INCLUDE_DIRS} ${MS2_INCLUDE_DIRS} ${XML2_INCLUDE_DIRS} ${BELLESIP_INCLUDE_DIRS})
list(APPEND LINPHONE_LIBRARIES ${ORTP_LIBRARIES} ${MS2_LIBRARIES} ${XML2_LIBRARIES} ${BELLESIP_LIBRARIES})
if(SQLITE3_FOUND)
list(APPEND LINPHONE_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIRS})
list(APPEND LINPHONE_LIBRARIES ${SQLITE3_LIBRARIES})
endif()
if(WIN32)
list(APPEND LINPHONE_LIBRARIES shlwapi)
endif(WIN32)

56
cmake/FindNotify.cmake Normal file
View file

@ -0,0 +1,56 @@
############################################################################
# FindNotify.cmake
# Copyright (C) 2014 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.
#
############################################################################
#
# - Find the notify include file and library
#
# NOTIFY_FOUND - system has linphone
# NOTIFY_INCLUDE_DIRS - the linphone include directory
# NOTIFY_LIBRARIES - The libraries needed to use linphone
set(_NOTIFY_ROOT_PATHS
${WITH_NOTIFY}
${CMAKE_INSTALL_PREFIX}
)
find_path(NOTIFY_INCLUDE_DIRS
NAMES libnotify/notify.h
HINTS _NOTIFY_ROOT_PATHS
PATH_SUFFIXES include
)
if(NOTIFY_INCLUDE_DIRS)
set(HAVE_LIBNOTIFY_NOTIFY_H 1)
endif()
find_library(NOTIFY_LIBRARIES
NAMES notify
HINTS ${_NOTIFY_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Notify
DEFAULT_MSG
NOTIFY_INCLUDE_DIRS NOTIFY_LIBRARIES HAVE_LIBNOTIFY_NOTIFY_H
)
mark_as_advanced(NOTIFY_INCLUDE_DIRS NOTIFY_LIBRARIES HAVE_LIBNOTIFY_NOTIFY_H)

View file

@ -26,7 +26,16 @@
#define LINPHONE_VERSION "${LINPHONE_VERSION}"
#define LIBLINPHONE_VERSION "${LINPHONE_VERSION}"
#define LINPHONE_ALL_LANGS "${LINPHONE_ALL_LANGS}"
#define LINPHONE_PLUGINS_DIR "${LINPHONE_PLUGINS_DIR}"
#define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}"
#define PACKAGE_LOCALE_DIR "${PACKAGE_LOCALE_DIR}"
#define PACKAGE_DATA_DIR "${PACKAGE_DATA_DIR}"
#define PACKAGE_SOUND_DIR "${PACKAGE_SOUND_DIR}"
#cmakedefine HAVE_NOTIFY4
#cmakedefine HAVE_CU_GET_SUITE 1
#cmakedefine HAVE_CU_CURSES 1

View file

@ -129,7 +129,7 @@ AC_CONFIG_COMMANDS([libtool-hacking],
dnl Add the languages which your application supports here.
PKG_PROG_PKG_CONFIG
ALL_LINGUAS="fr it de ja es pl cs nl sv pt_BR hu ru zh_CN nb_NO zh_TW he sr"
ALL_LINGUAS=$(cd po && echo *.po | sed 's/\.po//g')
AC_SUBST(ALL_LINGUAS)
AC_DEFINE_UNQUOTED(LINPHONE_ALL_LANGS, "$ALL_LINGUAS", [All supported languages])

View file

@ -31,6 +31,7 @@ set(SOURCE_FILES
authentication.c
bellesip_sal/sal_address_impl.c
bellesip_sal/sal_impl.c
bellesip_sal/sal_impl.h
bellesip_sal/sal_op_call.c
bellesip_sal/sal_op_call_transfer.c
bellesip_sal/sal_op_events.c
@ -46,42 +47,45 @@ set(SOURCE_FILES
call_params.c
chat.c
conference.c
contactprovider.c
content.c
dict.c
ec-calibrator.c
enum.c
enum.h
event.c
event.h
friend.c
info.c
ldap/ldapprovider.c
linphonecall.c
linphonecore.c
linphonecore.h
linphonecore_utils.h
linphonefriend.h
linphone_tunnel_config.c
linphone_tunnel.h
localplayer.c
lpconfig.c
lpconfig.h
lsd.c
message_storage.c
misc.c
offeranswer.c
offeranswer.h
player.c
presence.c
private.h
proxy.c
quality_reporting.c
remote_provisioning.c
sal.c
siplogin.c
sipsetup.c
xml.c
xml2lpc.c
bellesip_sal/sal_impl.h
enum.h
event.h
linphonecore.h
linphonecore_utils.h
linphonefriend.h
linphone_tunnel.h
lpconfig.h
offeranswer.h
private.h
sipsetup.h
xml2lpc.c
xml2lpc.h
xml.c
)
if(ENABLE_TUNNEL)
list(APPEND SOURCE_FILES
@ -102,15 +106,10 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liblinphone_gitversion.h
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DWORK_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/gitversion.cmake)
add_definitions(
-DIN_LINPHONE
-DUSE_BELLESIP
-DLIBLINPHONE_EXPORTS
)
if(ENABLE_VIDEO)
add_definitions(-DVIDEO_ENABLED)
endif()
set(LIBS
${LIBGCC}
${LIBMINGWEX}
@ -118,6 +117,9 @@ set(LIBS
${MS2_LIBRARIES}
${XML2_LIBRARIES}
)
if(SQLITE3_FOUND)
list(APPEND LIBS ${SQLITE3_LIBRARIES})
endif()
if(ENABLE_TUNNEL)
list(APPEND LIBS ${TUNNEL_LIBRARIES})
endif()

View file

@ -388,7 +388,7 @@ bool TunnelManager::startAutoDetection() {
bool TunnelManager::isActivated() const{
switch(getMode()){
case LinphoneTunnelModeAuto:
return !mState==disabled;
return !(mState==disabled);
case LinphoneTunnelModeDisable:
return false;
case LinphoneTunnelModeEnable:

View file

@ -167,7 +167,10 @@ static bool_t strings_equals(const char *s1, const char *s2){
/**
* Compare two LinphoneAddress ignoring tags and headers, basically just domain, username, and port.
* Returns TRUE if they are equal.
* @param[in] a1 LinphoneAddress object
* @param[in] a2 LinphoneAddress object
* @return Boolean value telling if the LinphoneAddress objects are equal.
* @see linphone_address_equal()
**/
bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2){
const char *u1,*u2;
@ -182,6 +185,27 @@ bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddr
return strings_equals(u1,u2) && strings_equals(h1,h2) && p1==p2;
}
/**
* Compare two LinphoneAddress taking the tags and headers into account.
* @param[in] a1 LinphoneAddress object
* @param[in] a2 LinphoneAddress object
* @return Boolean value telling if the LinphoneAddress objects are equal.
* @see linphone_address_weak_equal()
*/
bool_t linphone_address_equal(const LinphoneAddress *a1, const LinphoneAddress *a2) {
char *s1;
char *s2;
bool_t res;
if ((a1 == NULL) && (a2 == NULL)) return TRUE;
if ((a1 == NULL) || (a2 == NULL)) return FALSE;
s1 = linphone_address_as_string(a1);
s2 = linphone_address_as_string(a2);
res = (strcmp(s1, s2) == 0) ? TRUE : FALSE;
ms_free(s1);
ms_free(s2);
return res;
}
/**
* Destroys a LinphoneAddress object (actually calls linphone_address_unref()).
* @deprecated Use linphone_address_unref() instead
@ -201,6 +225,37 @@ int linphone_address_get_port(const LinphoneAddress *u) {
return sal_address_get_port(u);
}
/**
* Set the password encoded in the address.
* It is used for basic authentication (not recommended).
* @param addr the LinphoneAddress
* @param passwd the password to set.
**/
void linphone_address_set_password(LinphoneAddress *addr, const char *passwd){
sal_address_set_password(addr,passwd);
}
/**
* Get the password encoded in the address.
* It is used for basic authentication (not recommended).
* @param addr the address
* @return the password, if any, NULL otherwise.
**/
const char *linphone_address_get_password(const LinphoneAddress *addr){
return sal_address_get_password(addr);
}
/**
* Set a header into the address.
* Headers appear in the URI with '?', such as <sip:test@linphone.org?SomeHeader=SomeValue>.
* @param addr the address
* @param header_name the header name
* @param header_value the header value
**/
void linphone_address_set_header(LinphoneAddress *addr, const char *header_name, const char *header_value){
sal_address_set_header(addr,header_name,header_value);
}
LinphoneAddress * linphone_core_create_address(LinphoneCore *lc, const char *address) {
return linphone_address_new(address);
}

View file

@ -39,10 +39,13 @@ SalAddress * sal_address_clone(const SalAddress *addr){
const char *sal_address_get_scheme(const SalAddress *addr){
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);
belle_sip_uri_t* uri = belle_sip_header_address_get_uri(header_addr);
belle_generic_uri_t* generic_uri = belle_sip_header_address_get_absolute_uri(header_addr);
if (uri) {
if (belle_sip_uri_is_secure(uri)) return "sips";
else return "sip";
} else
} else if (generic_uri)
return belle_generic_uri_get_scheme(generic_uri);
else
return NULL;
}
@ -114,6 +117,14 @@ void sal_address_set_username(SalAddress *addr, const char *username){
SAL_ADDRESS_SET(addr,user,username);
}
void sal_address_set_password(SalAddress *addr, const char *passwd){
SAL_ADDRESS_SET(addr,user_password,passwd);
}
const char* sal_address_get_password(const SalAddress *addr){
SAL_ADDRESS_GET(addr,user_password);
}
void sal_address_set_domain(SalAddress *addr, const char *host){
SAL_ADDRESS_SET(addr,host,host);
}
@ -142,10 +153,21 @@ char *sal_address_as_string(const SalAddress *addr){
char *sal_address_as_string_uri_only(const SalAddress *addr){
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);
belle_sip_uri_t* uri = belle_sip_header_address_get_uri(header_addr);
belle_sip_uri_t* sip_uri = belle_sip_header_address_get_uri(header_addr);
belle_generic_uri_t* absolute_uri = belle_sip_header_address_get_absolute_uri(header_addr);
char tmp[1024]={0};
size_t off=0;
belle_sip_object_marshal((belle_sip_object_t*)uri,tmp,sizeof(tmp),&off);
belle_sip_object_t* uri;
if (sip_uri) {
uri=(belle_sip_object_t*)sip_uri;
} else if (absolute_uri) {
uri=(belle_sip_object_t*)absolute_uri;
} else {
ms_error("Cannot generate string for addr [%p] with null uri",addr);
return NULL;
}
belle_sip_object_marshal(uri,tmp,sizeof(tmp),&off);
return ms_strdup(tmp);
}
@ -166,6 +188,10 @@ void sal_address_set_uri_params(SalAddress *addr, const char *params){
belle_sip_parameters_set(parameters,params);
}
void sal_address_set_header(SalAddress *addr, const char *header_name, const char *header_value){
belle_sip_uri_set_header(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(addr)),header_name, header_value);
}
void sal_address_set_transport(SalAddress* addr,SalTransport transport){
if (!sal_address_is_secure(addr)){
SAL_ADDRESS_SET(addr,transport_param,sal_transport_to_string(transport));

View file

@ -204,7 +204,7 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve
belle_sip_request_t* req = belle_sip_request_event_get_request(event);
belle_sip_dialog_t* dialog=belle_sip_request_event_get_dialog(event);
belle_sip_header_address_t* origin_address;
belle_sip_header_address_t* address;
belle_sip_header_address_t* address=NULL;
belle_sip_header_from_t* from_header;
belle_sip_header_to_t* to;
belle_sip_response_t* resp;
@ -266,8 +266,14 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve
}
if (!op->base.from_address) {
address=belle_sip_header_address_create(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(from_header))
,belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from_header)));
if (belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from_header)))
address=belle_sip_header_address_create(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(from_header))
,belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from_header)));
else if ((belle_sip_header_address_get_absolute_uri(BELLE_SIP_HEADER_ADDRESS(from_header))))
address=belle_sip_header_address_create2(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(from_header))
,belle_sip_header_address_get_absolute_uri(BELLE_SIP_HEADER_ADDRESS(from_header)));
else
ms_error("Cannot not find from uri from request [%p]",req);
sal_op_set_from_address(op,(SalAddress*)address);
belle_sip_object_unref(address);
}
@ -278,8 +284,15 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve
if (!op->base.to_address) {
to=belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_to_t);
address=belle_sip_header_address_create(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(to))
,belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(to)));
if (belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(to)))
address=belle_sip_header_address_create(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(to))
,belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(to)));
else if ((belle_sip_header_address_get_absolute_uri(BELLE_SIP_HEADER_ADDRESS(to))))
address=belle_sip_header_address_create2(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(to))
,belle_sip_header_address_get_absolute_uri(BELLE_SIP_HEADER_ADDRESS(to)));
else
ms_error("Cannot not find to uri from request [%p]",req);
sal_op_set_to_address(op,(SalAddress*)address);
belle_sip_object_unref(address);
}
@ -1100,6 +1113,10 @@ unsigned char * sal_get_random_bytes(unsigned char *ret, size_t size){
return belle_sip_random_bytes(ret,size);
}
char *sal_get_random_token(int size){
return belle_sip_random_token(ms_malloc(size),size);
}
unsigned int sal_get_random(void){
unsigned int ret=0;
belle_sip_random_bytes((unsigned char*)&ret,4);

View file

@ -103,6 +103,7 @@ belle_sip_header_contact_t* sal_op_create_contact(SalOp *op){
belle_sip_header_address_set_uri(BELLE_SIP_HEADER_ADDRESS(contact_header),contact_uri);
}
belle_sip_uri_set_user_password(contact_uri,NULL);
belle_sip_uri_set_secure(contact_uri,sal_op_is_secure(op));
if (op->privacy!=SalPrivacyNone){
belle_sip_uri_set_user(contact_uri,NULL);
@ -312,7 +313,7 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
}
}else{
#ifdef TUNNEL_ENABLED
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(udplp,belle_sip_tunnel_listening_point_t)){
if (udplp && BELLE_SIP_OBJECT_IS_INSTANCE_OF(udplp,belle_sip_tunnel_listening_point_t)){
/* our tunnel mode only supports UDP. Force transport to be set to UDP */
belle_sip_uri_set_transport_param(next_hop_uri,"udp");
}

View file

@ -215,7 +215,7 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl){
status=_("missed");
break;
default:
status="unknown";
status=_("unknown");
}
tmp=ortp_strdup_printf(_("%s at %s\nFrom: %s\nTo: %s\nStatus: %s\nDuration: %i mn %i sec\n"),
(cl->dir==LinphoneCallIncoming) ? _("Incoming call") : _("Outgoing call"),

View file

@ -303,9 +303,9 @@ static void call_received(SalOp *h){
linphone_address_destroy(to_addr);
return;
}
call=linphone_call_new_incoming(lc,from_addr,to_addr,h);
linphone_call_make_local_media_description(lc,call);
sal_call_set_local_media_description(call->op,call->localdesc);
md=sal_call_get_final_media_description(call->op);
@ -772,8 +772,11 @@ static void call_failure(SalOp *op){
char* url = linphone_address_as_string(redirection_to);
ms_warning("Redirecting call [%p] to %s",call, url);
ms_free(url);
linphone_call_create_op(call);
linphone_core_start_invite(lc, call, redirection_to);
if( call->log->to != NULL ) {
linphone_address_unref(call->log->to);
}
call->log->to = linphone_address_ref(redirection_to);
linphone_core_restart_invite(lc, call);
return;
}
}
@ -1170,14 +1173,18 @@ static void text_delivery_update(SalOp *op, SalTextDeliveryStatus status){
}
chat_msg->state=chatStatusSal2Linphone(status);
linphone_chat_message_store_state(chat_msg);
if (chat_msg && chat_msg->cb) {
linphone_chat_message_update_state(chat_msg);
if (chat_msg && (chat_msg->cb || (chat_msg->callbacks && linphone_chat_message_cbs_get_msg_state_changed(chat_msg->callbacks)))) {
ms_message("Notifying text delivery with status %i",chat_msg->state);
chat_msg->cb(chat_msg
,chat_msg->state
,chat_msg->cb_ud);
if (chat_msg->callbacks && linphone_chat_message_cbs_get_msg_state_changed(chat_msg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(chat_msg->callbacks)(chat_msg, chat_msg->state);
} else {
/* Legacy */
chat_msg->cb(chat_msg,chat_msg->state,chat_msg->cb_ud);
}
}
if (status != SalTextDeliveryInProgress) { /*don't release op if progress*/
if (status != SalTextDeliveryInProgress) { /*only release op if not in progress*/
linphone_chat_message_destroy(chat_msg);
}
}

View file

@ -35,6 +35,139 @@
#define COMPOSING_DEFAULT_REMOTE_REFRESH_TIMEOUT 120
static LinphoneChatMessageCbs * linphone_chat_message_cbs_new(void) {
return belle_sip_object_new(LinphoneChatMessageCbs);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatMessageCbs);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatMessageCbs, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // marshal
FALSE
);
/**
* @addtogroup chatroom
* @{
*/
/**
* Acquire a reference to the LinphoneChatMessageCbs object.
* @param[in] cbs LinphoneChatMessageCbs object.
* @return The same LinphoneChatMessageCbs object.
*/
LinphoneChatMessageCbs * linphone_chat_message_cbs_ref(LinphoneChatMessageCbs *cbs) {
belle_sip_object_ref(cbs);
return cbs;
}
/**
* Release reference to the LinphoneChatMessageCbs object.
* @param[in] cbs LinphoneChatMessageCbs object.
*/
void linphone_chat_message_cbs_unref(LinphoneChatMessageCbs *cbs) {
belle_sip_object_unref(cbs);
}
/**
* Retrieve the user pointer associated with the LinphoneChatMessageCbs object.
* @param[in] cbs LinphoneChatMessageCbs object.
* @return The user pointer associated with the LinphoneChatMessageCbs object.
*/
void *linphone_chat_message_cbs_get_user_data(const LinphoneChatMessageCbs *cbs) {
return cbs->user_data;
}
/**
* Assign a user pointer to the LinphoneChatMessageCbs object.
* @param[in] cbs LinphoneChatMessageCbs object.
* @param[in] ud The user pointer to associate with the LinphoneChatMessageCbs object.
*/
void linphone_chat_message_cbs_set_user_data(LinphoneChatMessageCbs *cbs, void *ud) {
cbs->user_data = ud;
}
/**
* Get the message state changed callback.
* @param[in] cbs LinphoneChatMessageCbs object.
* @return The current message state changed callback.
*/
LinphoneChatMessageCbsMsgStateChangedCb linphone_chat_message_cbs_get_msg_state_changed(const LinphoneChatMessageCbs *cbs) {
return cbs->msg_state_changed;
}
/**
* Set the message state changed callback.
* @param[in] cbs LinphoneChatMessageCbs object.
* @param[in] cb The message state changed callback to be used.
*/
void linphone_chat_message_cbs_set_msg_state_changed(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsMsgStateChangedCb cb) {
cbs->msg_state_changed = cb;
}
/**
* Get the file transfer receive callback.
* @param[in] cbs LinphoneChatMessageCbs object.
* @return The current file transfer receive callback.
*/
LinphoneChatMessageCbsFileTransferRecvCb linphone_chat_message_cbs_get_file_transfer_recv(const LinphoneChatMessageCbs *cbs) {
return cbs->file_transfer_recv;
}
/**
* Set the file transfer receive callback.
* @param[in] cbs LinphoneChatMessageCbs object.
* @param[in] cb The file transfer receive callback to be used.
*/
void linphone_chat_message_cbs_set_file_transfer_recv(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferRecvCb cb) {
cbs->file_transfer_recv = cb;
}
/**
* Get the file transfer send callback.
* @param[in] cbs LinphoneChatMessageCbs object.
* @return The current file transfer send callback.
*/
LinphoneChatMessageCbsFileTransferSendCb linphone_chat_message_cbs_get_file_transfer_send(const LinphoneChatMessageCbs *cbs) {
return cbs->file_transfer_send;
}
/**
* Set the file transfer send callback.
* @param[in] cbs LinphoneChatMessageCbs object.
* @param[in] cb The file transfer send callback to be used.
*/
void linphone_chat_message_cbs_set_file_transfer_send(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferSendCb cb) {
cbs->file_transfer_send = cb;
}
/**
* Get the file transfer progress indication callback.
* @param[in] cbs LinphoneChatMessageCbs object.
* @return The current file transfer progress indication callback.
*/
LinphoneChatMessageCbsFileTransferProgressIndicationCb linphone_chat_message_cbs_get_file_transfer_progress_indication(const LinphoneChatMessageCbs *cbs) {
return cbs->file_transfer_progress_indication;
}
/**
* Set the file transfer progress indication callback.
* @param[in] cbs LinphoneChatMessageCbs object.
* @param[in] cb The file transfer progress indication callback to be used.
*/
void linphone_chat_message_cbs_set_file_transfer_progress_indication(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferProgressIndicationCb cb) {
cbs->file_transfer_progress_indication = cb;
}
/**
* @}
*/
static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage* msg);
static void process_io_error_upload(void *data, const belle_sip_io_error_event_t *event){
@ -43,6 +176,9 @@ static void process_io_error_upload(void *data, const belle_sip_io_error_event_t
if (msg->cb) {
msg->cb(msg, LinphoneChatMessageStateNotDelivered, msg->cb_ud);
}
if (linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)(msg, LinphoneChatMessageStateNotDelivered);
}
}
static void process_auth_requested_upload(void *data, belle_sip_auth_event_t *event){
LinphoneChatMessage* msg=(LinphoneChatMessage *)data;
@ -50,6 +186,9 @@ static void process_auth_requested_upload(void *data, belle_sip_auth_event_t *ev
if (msg->cb) {
msg->cb(msg, LinphoneChatMessageStateNotDelivered, msg->cb_ud);
}
if (linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)(msg, LinphoneChatMessageStateNotDelivered);
}
}
static void process_io_error_download(void *data, const belle_sip_io_error_event_t *event){
@ -58,6 +197,9 @@ static void process_io_error_download(void *data, const belle_sip_io_error_event
if (msg->cb) {
msg->cb(msg, LinphoneChatMessageStateFileTransferError, msg->cb_ud);
}
if (linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)(msg, LinphoneChatMessageStateFileTransferError);
}
}
static void process_auth_requested_download(void *data, belle_sip_auth_event_t *event){
LinphoneChatMessage* msg=(LinphoneChatMessage *)data;
@ -65,6 +207,9 @@ static void process_auth_requested_download(void *data, belle_sip_auth_event_t *
if (msg->cb) {
msg->cb(msg, LinphoneChatMessageStateFileTransferError, msg->cb_ud);
}
if (linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)(msg, LinphoneChatMessageStateFileTransferError);
}
}
/**
@ -73,10 +218,12 @@ static void process_auth_requested_download(void *data, belle_sip_auth_event_t *
*/
static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handler_t *bh, belle_sip_message_t *msg, void *data, size_t offset, size_t total){
LinphoneChatMessage* chatMsg=(LinphoneChatMessage *)data;
LinphoneCore *lc = chatMsg->chat_room->lc;
/* call back given by application level */
linphone_core_notify_file_transfer_progress_indication(lc, chatMsg, chatMsg->file_transfer_information, offset, total);
return;
if (linphone_chat_message_cbs_get_file_transfer_progress_indication(chatMsg->callbacks)) {
linphone_chat_message_cbs_get_file_transfer_progress_indication(chatMsg->callbacks)(chatMsg, chatMsg->file_transfer_information, offset, total);
} else {
/* Legacy: call back given by application level */
linphone_core_notify_file_transfer_progress_indication(chatMsg->chat_room->lc, chatMsg, chatMsg->file_transfer_information, offset, total);
}
}
/**
@ -98,7 +245,12 @@ static int linphone_chat_message_file_transfer_on_send_body(belle_sip_user_body_
/* if we've not reach the end of file yet, ask for more data*/
if (offset<linphone_content_get_size(chatMsg->file_transfer_information)){
/* get data from call back */
linphone_core_notify_file_transfer_send(lc, chatMsg, chatMsg->file_transfer_information, buf, size);
if (linphone_chat_message_cbs_get_file_transfer_send(chatMsg->callbacks)) {
linphone_chat_message_cbs_get_file_transfer_send(chatMsg->callbacks)(chatMsg, chatMsg->file_transfer_information, buf, size);
} else {
/* Legacy */
linphone_core_notify_file_transfer_send(lc, chatMsg, chatMsg->file_transfer_information, buf, size);
}
}
return BELLE_SIP_CONTINUE;
@ -173,6 +325,9 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
if (msg->cb) {
msg->cb(msg, LinphoneChatMessageStateFileTransferDone, msg->cb_ud);
}
if (linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)(msg, LinphoneChatMessageStateFileTransferDone);
}
_linphone_chat_room_send_message(msg->chat_room, msg);
}
}
@ -494,6 +649,17 @@ static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatM
linphone_chat_message_unref(msg);
}
void linphone_chat_message_update_state(LinphoneChatMessage* chat_msg ) {
linphone_chat_message_store_state(chat_msg);
if( chat_msg->state == LinphoneChatMessageStateDelivered
|| chat_msg->state == LinphoneChatMessageStateNotDelivered ){
// message is not transient anymore, we can remove it from our transient list and unref it :
chat_msg->chat_room->transient_messages = ms_list_remove(chat_msg->chat_room->transient_messages, chat_msg);
linphone_chat_message_unref(chat_msg);
}
}
/**
* Send a message to peer member of this chat room.
* @deprecated linphone_chat_room_send_message2() gives more control on the message expedition.
@ -523,7 +689,7 @@ void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessag
addr=linphone_address_new(sal_msg->from);
linphone_address_clean(addr);
cr=linphone_core_get_chat_room(lc,addr);
if (sal_msg->content_type != NULL) { /* content_type field is, for now, used only for rcs file transfer but we shall strcmp it with "application/vnd.gsma.rcs-ft-http+xml" */
xmlChar *file_url = NULL;
xmlDocPtr xmlMessageBody;
@ -725,6 +891,7 @@ const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr)
*/
LinphoneChatMessage* linphone_chat_room_create_message(LinphoneChatRoom *cr, const char* message) {
LinphoneChatMessage* msg = belle_sip_object_new(LinphoneChatMessage);
msg->callbacks=linphone_chat_message_cbs_new();
msg->chat_room=(LinphoneChatRoom*)cr;
msg->message=message?ms_strdup(message):NULL;
msg->is_read=TRUE;
@ -751,6 +918,7 @@ LinphoneChatMessage* linphone_chat_room_create_message_2(
LinphoneCore *lc=linphone_chat_room_get_lc(cr);
LinphoneChatMessage* msg = belle_sip_object_new(LinphoneChatMessage);
msg->callbacks=linphone_chat_message_cbs_new();
msg->chat_room=(LinphoneChatRoom*)cr;
msg->message=message?ms_strdup(message):NULL;
msg->external_body_url=external_body_url?ms_strdup(external_body_url):NULL;
@ -777,6 +945,7 @@ LinphoneChatMessage* linphone_chat_room_create_message_2(
* @param msg #LinphoneChatMessage message to be sent
* @param status_cb LinphoneChatMessageStateChangeCb status callback invoked when message is delivered or could not be delivered. May be NULL
* @param ud user data for the status cb.
* @deprecated Use linphone_chat_room_send_chat_message() instead.
* @note The LinphoneChatMessage must not be destroyed until the the callback is called.
*/
void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangedCb status_cb, void* ud) {
@ -786,6 +955,18 @@ void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage*
_linphone_chat_room_send_message(cr, msg);
}
/**
* Send a message to peer member of this chat room.
* @param[in] cr LinphoneChatRoom object
* @param[in] msg LinphoneChatMessage object
* The state of the message sending will be notified via the callbacks defined in the LinphoneChatMessageCbs object that can be obtained
* by calling linphone_chat_message_get_callbacks().
*/
void linphone_chat_room_send_chat_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
msg->state = LinphoneChatMessageStateInProgress;
_linphone_chat_room_send_message(cr, msg);
}
static char * linphone_chat_room_create_is_composing_xml(LinphoneChatRoom *cr) {
xmlBufferPtr buf;
xmlTextWriterPtr writer;
@ -1023,8 +1204,12 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
if (chatMsg->http_request == NULL) {
return;
}
/* call back given by application level */
linphone_core_notify_file_transfer_recv(lc, chatMsg, chatMsg->file_transfer_information, (char *)buffer, size);
if (linphone_chat_message_cbs_get_file_transfer_recv(chatMsg->callbacks)) {
linphone_chat_message_cbs_get_file_transfer_recv(chatMsg->callbacks)(chatMsg, chatMsg->file_transfer_information, (char *)buffer, size);
} else {
/* Legacy: call back given by application level */
linphone_core_notify_file_transfer_recv(lc, chatMsg, chatMsg->file_transfer_information, (char *)buffer, size);
}
return;
}
@ -1093,21 +1278,26 @@ static void linphone_chat_process_response_from_get_file(void *data, const belle
LinphoneChatMessage* chatMsg=(LinphoneChatMessage *)data;
LinphoneCore *lc = chatMsg->chat_room->lc;
/* file downloaded succesfully, call again the callback with size at zero */
linphone_core_notify_file_transfer_recv(lc, chatMsg, chatMsg->file_transfer_information, NULL, 0);
if (linphone_chat_message_cbs_get_file_transfer_recv(chatMsg->callbacks)) {
linphone_chat_message_cbs_get_file_transfer_recv(chatMsg->callbacks)(chatMsg, chatMsg->file_transfer_information, NULL, 0);
} else {
linphone_core_notify_file_transfer_recv(lc, chatMsg, chatMsg->file_transfer_information, NULL, 0);
}
if (chatMsg->cb) {
chatMsg->cb(chatMsg, LinphoneChatMessageStateFileTransferDone, chatMsg->cb_ud);
}
if (linphone_chat_message_cbs_get_msg_state_changed(chatMsg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(chatMsg->callbacks)(chatMsg, LinphoneChatMessageStateFileTransferDone);
}
}
}
}
/**
* Start the download of the file from remote server
*
* @param message #LinphoneChatMessage
* @param status_cb LinphoneChatMessageStateChangeCb status callback invoked when file is downloaded or could not be downloaded
* Start the download of the file referenced in a LinphoneChatMessage from remote server.
* @param[in] message LinphoneChatMessage object.
*/
void linphone_chat_message_start_file_download(LinphoneChatMessage *message, LinphoneChatMessageStateChangedCb status_cb, void *ud) {
void linphone_chat_message_download_file(LinphoneChatMessage *message) {
belle_http_request_listener_callbacks_t cbs={0};
belle_http_request_listener_t *l;
belle_generic_uri_t *uri;
@ -1131,12 +1321,23 @@ void linphone_chat_message_start_file_download(LinphoneChatMessage *message, Lin
l=belle_http_request_listener_create_from_callbacks(&cbs, (void *)message);
belle_sip_object_data_set(BELLE_SIP_OBJECT(req),"message",(void *)message,NULL);
message->http_request = req; /* keep a reference on the request to be able to cancel the download */
message->cb = status_cb;
message->cb_ud = ud;
message->state = LinphoneChatMessageStateInProgress; /* start the download, status is In Progress */
belle_http_provider_send_request(message->chat_room->lc->http_provider,req,l);
}
/**
* Start the download of the file from remote server
*
* @param message #LinphoneChatMessage
* @param status_cb LinphoneChatMessageStateChangeCb status callback invoked when file is downloaded or could not be downloaded
* @deprecated Use linphone_chat_message_download_file() instead.
*/
void linphone_chat_message_start_file_download(LinphoneChatMessage *message, LinphoneChatMessageStateChangedCb status_cb, void *ud) {
message->cb = status_cb;
message->cb_ud = ud;
linphone_chat_message_download_file(message);
}
/**
* Cancel an ongoing file transfer attached to this message.(upload or download)
* @param msg #LinphoneChatMessage
@ -1149,6 +1350,9 @@ void linphone_chat_message_cancel_file_transfer(LinphoneChatMessage *msg) {
if (msg->cb) {
msg->cb(msg, LinphoneChatMessageStateNotDelivered, msg->cb_ud);
}
if (linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)(msg, LinphoneChatMessageStateNotDelivered);
}
}
@ -1328,6 +1532,7 @@ static void _linphone_chat_message_destroy(LinphoneChatMessage* msg) {
if (msg->file_transfer_filepath != NULL) {
ms_free(msg->file_transfer_filepath);
}
linphone_chat_message_cbs_unref(msg->callbacks);
ms_message("LinphoneChatMessage [%p] destroyed.",msg);
}
@ -1385,6 +1590,15 @@ const char * linphone_chat_message_get_file_transfer_filepath(LinphoneChatMessag
return msg->file_transfer_filepath;
}
/**
* Get the LinphoneChatMessageCbs object associated with the LinphoneChatMessage.
* @param[in] msg LinphoneChatMessage object
* @return The LinphoneChatMessageCbs object associated with the LinphoneChatMessage.
*/
LinphoneChatMessageCbs * linphone_chat_message_get_callbacks(const LinphoneChatMessage *msg) {
return msg->callbacks;
}
/**
* Create a message attached to a dedicated chat room with a particular content. Use #linphone_chat_room_send_message2 to initiate the transfer
@ -1395,6 +1609,7 @@ const char * linphone_chat_message_get_file_transfer_filepath(LinphoneChatMessag
LinphoneChatMessage* linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, LinphoneContent* initial_content) {
LinphoneChatMessage* msg = belle_sip_object_new(LinphoneChatMessage);
msg->callbacks=linphone_chat_message_cbs_new();
msg->chat_room=(LinphoneChatRoom*)cr;
msg->message = NULL;
msg->file_transfer_information = linphone_content_copy(initial_content);

View file

@ -23,27 +23,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void linphone_content_destroy(LinphoneContent *content) {
if (content->lcp.type) belle_sip_free(content->lcp.type);
if (content->lcp.subtype) belle_sip_free(content->lcp.subtype);
if (content->lcp.data) belle_sip_free(content->lcp.data);
if (content->lcp.encoding) belle_sip_free(content->lcp.encoding);
if (content->lcp.name) belle_sip_free(content->lcp.name);
if (content->owned_fields == TRUE) {
if (content->lcp.type) belle_sip_free(content->lcp.type);
if (content->lcp.subtype) belle_sip_free(content->lcp.subtype);
if (content->lcp.data) belle_sip_free(content->lcp.data);
if (content->lcp.encoding) belle_sip_free(content->lcp.encoding);
if (content->lcp.name) belle_sip_free(content->lcp.name);
}
}
static void linphone_content_clone(LinphoneContent *obj, const LinphoneContent *ref) {
void *data;
linphone_content_set_type(obj, linphone_content_get_type(ref));
linphone_content_set_subtype(obj, linphone_content_get_subtype(ref));
linphone_content_set_encoding(obj, linphone_content_get_encoding(ref));
linphone_content_set_name(obj, linphone_content_get_name(ref));
linphone_content_set_size(obj, linphone_content_get_size(ref));
data = linphone_content_get_data(ref);
if (data != NULL) {
size_t size = linphone_content_get_size(ref);
void *objdata = belle_sip_malloc(size + 1);
memcpy(objdata, data, size);
((char *)objdata)[size] = '\0';
linphone_content_set_data(obj, objdata);
if (linphone_content_get_buffer(ref) != NULL) {
linphone_content_set_buffer(obj, linphone_content_get_buffer(ref), linphone_content_get_size(ref));
} else {
linphone_content_set_size(obj, linphone_content_get_size(ref));
}
}
@ -107,12 +104,24 @@ void linphone_content_set_subtype(LinphoneContent *content, const char *subtype)
}
}
void * linphone_content_get_data(const LinphoneContent *content) {
void * linphone_content_get_buffer(const LinphoneContent *content) {
return content->lcp.data;
}
void linphone_content_set_data(LinphoneContent *content, void *data) {
content->lcp.data = data;
void linphone_content_set_buffer(LinphoneContent *content, const void *buffer, size_t size) {
content->lcp.size = size;
content->lcp.data = belle_sip_malloc(size + 1);
memcpy(content->lcp.data, buffer, size);
((char *)content->lcp.data)[size] = '\0';
}
char * linphone_content_get_string_buffer(const LinphoneContent *content) {
return (char *)content->lcp.data;
}
void linphone_content_set_string_buffer(LinphoneContent *content, const char *buffer) {
content->lcp.size = strlen(buffer);
content->lcp.data = belle_sip_strdup(buffer);
}
size_t linphone_content_get_size(const LinphoneContent *content) {
@ -156,6 +165,7 @@ void linphone_content_set_name(LinphoneContent *content, const char *name) {
LinphoneContent * linphone_content_new(void) {
LinphoneContent *content = belle_sip_object_new(LinphoneContent);
belle_sip_object_ref(content);
content->owned_fields = TRUE;
return content;
}
@ -165,16 +175,15 @@ LinphoneContent * linphone_content_copy(const LinphoneContent *ref) {
LinphoneContent * linphone_content_from_sal_body(const SalBody *ref) {
if (ref && ref->type) {
void *objdata;
LinphoneContent *content = linphone_content_new();
linphone_content_set_type(content, ref->type);
linphone_content_set_subtype(content, ref->subtype);
linphone_content_set_encoding(content, ref->encoding);
linphone_content_set_size(content, ref->size);
objdata = belle_sip_malloc(ref->size + 1);
memcpy(objdata, ref->data, ref->size);
((char *)objdata)[ref->size] = '\0';
linphone_content_set_data(content, objdata);
if (ref->data != NULL) {
linphone_content_set_buffer(content, ref->data, ref->size);
} else {
linphone_content_set_size(content, ref->size);
}
return content;
}
return NULL;
@ -184,7 +193,7 @@ SalBody *sal_body_from_content(SalBody *body, const LinphoneContent *content) {
if (content && linphone_content_get_type(content)) {
body->type = linphone_content_get_type(content);
body->subtype = linphone_content_get_subtype(content);
body->data = linphone_content_get_data(content);
body->data = linphone_content_get_buffer(content);
body->size = linphone_content_get_size(content);
body->encoding = linphone_content_get_encoding(content);
return body;
@ -197,6 +206,7 @@ SalBody *sal_body_from_content(SalBody *body, const LinphoneContent *content) {
LinphoneContent * linphone_content_private_to_linphone_content(const LinphoneContentPrivate *lcp) {
LinphoneContent *content = belle_sip_object_new(LinphoneContent);
memcpy(&content->lcp, lcp, sizeof(LinphoneContentPrivate));
content->owned_fields = FALSE;
return content;
}

View file

@ -150,26 +150,41 @@ LINPHONE_PUBLIC void linphone_content_set_subtype(LinphoneContent *content, cons
* @param[in] content LinphoneContent object.
* @return The content data buffer.
*/
LINPHONE_PUBLIC void * linphone_content_get_data(const LinphoneContent *content);
LINPHONE_PUBLIC void * linphone_content_get_buffer(const LinphoneContent *content);
/**
* Set the content data buffer, usually a string.
* @param[in] content LinphoneContent object.
* @param[in] data The content data buffer.
* @param[in] buffer The content data buffer.
* @param[in] size The size of the content data buffer.
*/
LINPHONE_PUBLIC void linphone_content_set_data(LinphoneContent *content, void *data);
LINPHONE_PUBLIC void linphone_content_set_buffer(LinphoneContent *content, const void *buffer, size_t size);
/**
* Get the content data size, excluding null character despite null character is always set for convenience.
* Get the string content data buffer.
* @param[in] content LinphoneContent object
* @return The string content data buffer.
*/
LINPHONE_PUBLIC char * linphone_content_get_string_buffer(const LinphoneContent *content);
/**
* Set the string content data buffer.
* @param[in] content LinphoneContent object.
* @return The content data size.
* @param[in] buffer The string content data buffer.
*/
LINPHONE_PUBLIC void linphone_content_set_string_buffer(LinphoneContent *content, const char *buffer);
/**
* Get the content data buffer size, excluding null character despite null character is always set for convenience.
* @param[in] content LinphoneContent object.
* @return The content data buffer size.
*/
LINPHONE_PUBLIC size_t linphone_content_get_size(const LinphoneContent *content);
/**
* Set the content data size, excluding null character despite null character is always set for convenience.
* @param[in] content LinphoneContent object
* @param[in] size The content data size.
* @param[in] size The content data buffer size.
*/
LINPHONE_PUBLIC void linphone_content_set_size(LinphoneContent *content, size_t size);

View file

@ -65,7 +65,7 @@ const char *linphone_online_status_to_string(LinphoneOnlineStatus ss){
case LinphoneStatusVacation:
str=_("Vacation");
default:
str=_("Unknown-bug");
str=_("Unknown status");
}
return str;
}

View file

@ -1,5 +1,5 @@
############################################################################
# CMakeLists.txt
# gitversion.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################

View file

@ -48,7 +48,7 @@ static void stop(int signum){
/**
* function invoked to report file transfer progress.
* */
static void file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total) {
static void file_transfer_progress_indication(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total) {
const LinphoneAddress* from_address = linphone_chat_message_get_from(message);
const LinphoneAddress* to_address = linphone_chat_message_get_to(message);
char *address = linphone_chat_message_is_outgoing(message)?linphone_address_as_string(to_address):linphone_address_as_string(from_address);
@ -63,7 +63,7 @@ static void file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMess
/**
* function invoked when a file transfer is received.
**/
static void file_transfer_received(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size){
static void file_transfer_received(LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size){
FILE* file=NULL;
if (!linphone_chat_message_get_user_data(message)) {
/*first chunk, creating file*/
@ -92,7 +92,7 @@ char big_file [128000];
/*
* function called when the file transfer is initiated. file content should be feed into object LinphoneContent
* */
static void file_transfer_send(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, char* buff, size_t* size){
static void file_transfer_send(LinphoneChatMessage *message, const LinphoneContent* content, char* buff, size_t* size){
int offset=-1;
if (!linphone_chat_message_get_user_data(message)) {
@ -147,6 +147,7 @@ int main(int argc, char *argv[]){
LinphoneChatRoom* chat_room;
LinphoneContent* content;
LinphoneChatMessage* chat_message;
LinphoneChatMessageCbs *cbs;
/*seting dummy file content to something*/
for (i=0;i<sizeof(big_file);i+=strlen(big_file_content))
@ -160,15 +161,6 @@ int main(int argc, char *argv[]){
#ifdef DEBUG
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
#endif
/*
Fill the LinphoneCoreVTable with application callbacks.
All are optional. Here we only use the file_transfer_received callback
in order to get notifications about incoming file receive, file_transfer_send to feed file to be transfered
and file_transfer_progress_indication to print progress.
*/
vtable.file_transfer_recv=file_transfer_received;
vtable.file_transfer_send=file_transfer_send;
vtable.file_transfer_progress_indication=file_transfer_progress_indication;
vtable.message_received=message_received;
@ -201,8 +193,18 @@ int main(int argc, char *argv[]){
printf("returned message is null\n");
}
/**
* Fill the application callbacks. The file_transfer_received callback is used in order to get notifications
* about incoming file reception, file_transfer_send to feed file to be transfered and
* file_transfer_progress_indication to print progress.
*/
cbs = linphone_chat_message_get_callbacks(chat_message);
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
linphone_chat_message_cbs_set_file_transfer_send(cbs, file_transfer_send);
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
/*initiating file transfer*/
linphone_chat_room_send_message2(chat_room, chat_message, linphone_file_transfer_state_changed, NULL);
linphone_chat_room_send_chat_message(chat_room, chat_message);
/* main loop for receiving incoming messages and doing background linphone core work: */
while(running){

View file

@ -34,7 +34,7 @@ import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneCoreListener.LinphoneListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneFriend.SubscribePolicy;
@ -60,7 +60,7 @@ import org.linphone.core.SubscriptionState;
* @author Guillaume Beraudo
*
*/
public class TutorialBuddyStatus implements LinphoneCoreListener {
public class TutorialBuddyStatus implements LinphoneListener {
private boolean running;
private TutorialNotifier TutorialNotifier;

View file

@ -34,7 +34,7 @@ import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneCoreListener.LinphoneListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneInfoMessage;
@ -58,7 +58,7 @@ import org.linphone.core.SubscriptionState;
* @author Guillaume Beraudo
*
*/
public class TutorialChatRoom implements LinphoneCoreListener, LinphoneChatMessage.StateListener {
public class TutorialChatRoom implements LinphoneListener, LinphoneChatMessage.StateListener {
private boolean running;
private TutorialNotifier TutorialNotifier;

View file

@ -22,23 +22,23 @@ import java.nio.ByteBuffer;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneCoreListener.LinphoneListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneInfoMessage;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.PublishState;
import org.linphone.core.SubscriptionState;
@ -52,7 +52,7 @@ import org.linphone.core.SubscriptionState;
* @author Guillaume Beraudo
*
*/
public class TutorialHelloWorld implements LinphoneCoreListener {
public class TutorialHelloWorld implements LinphoneListener {
private boolean running;
private TutorialNotifier TutorialNotifier;

View file

@ -34,7 +34,7 @@ import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneCoreListener.LinphoneListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneInfoMessage;
@ -57,7 +57,7 @@ import org.linphone.core.SubscriptionState;
* @author Guillaume Beraudo
*
*/
public class TutorialRegistration implements LinphoneCoreListener {
public class TutorialRegistration implements LinphoneListener {
private boolean running;
private TutorialNotifier TutorialNotifier;

View file

@ -1047,6 +1047,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
if (cstate==LinphoneCallReleased){
linphone_call_set_released(call);
}
linphone_core_soundcard_hint_check(lc);
}
}
@ -2871,13 +2872,24 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v
call->stats[LINPHONE_CALL_STATS_AUDIO].upload_bandwidth=(as!=NULL) ? (media_stream_get_up_bw(as)*1e-3) : 0;
call->stats[LINPHONE_CALL_STATS_VIDEO].download_bandwidth=(vs!=NULL) ? (media_stream_get_down_bw(vs)*1e-3) : 0;
call->stats[LINPHONE_CALL_STATS_VIDEO].upload_bandwidth=(vs!=NULL) ? (media_stream_get_up_bw(vs)*1e-3) : 0;
ms_message("bandwidth usage for call [%p]: audio=[d=%.1f,u=%.1f] video=[d=%.1f,u=%.1f] kbit/sec",
call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_download_bandwidth=(as!=NULL) ? (media_stream_get_rtcp_down_bw(as)*1e-3) : 0;
call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_upload_bandwidth=(as!=NULL) ? (media_stream_get_rtcp_up_bw(as)*1e-3) : 0;
call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_download_bandwidth=(vs!=NULL) ? (media_stream_get_rtcp_down_bw(vs)*1e-3) : 0;
call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_upload_bandwidth=(vs!=NULL) ? (media_stream_get_rtcp_up_bw(vs)*1e-3) : 0;
ms_message("Bandwidth usage for call [%p]: audio[ rtp]=[d=%.1f,u=%.1f], video[ rtp]=[d=%.1f,u=%.1f] kbit/sec",
call,
call->stats[LINPHONE_CALL_STATS_AUDIO].download_bandwidth,
call->stats[LINPHONE_CALL_STATS_AUDIO].upload_bandwidth ,
call->stats[LINPHONE_CALL_STATS_VIDEO].download_bandwidth,
call->stats[LINPHONE_CALL_STATS_VIDEO].upload_bandwidth
);
ms_message(" [rtcp]=[d=%.1f,u=%.1f], video[rtcp]=[d=%.1f,u=%.1f] kbit/sec",
call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_download_bandwidth,
call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_upload_bandwidth ,
call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_download_bandwidth,
call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_upload_bandwidth
);
}
static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){

View file

@ -560,8 +560,8 @@ void linphone_core_upload_log_collection(LinphoneCore *core) {
core->log_collection_upload_information = (LinphoneContent *)malloc(sizeof(LinphoneContent));
memset(core->log_collection_upload_information, 0, sizeof(LinphoneContent));
#ifdef HAVE_ZLIB
core->log_collection_upload_information->type = "application";
core->log_collection_upload_information->subtype = "gzip";
linphone_content_set_type(core->log_collection_upload_information, "application");
linphone_content_set_subtype(core->log_collection_upload_information, "gzip");
#else
linphone_content_set_type(core->log_collection_upload_information, "text");
linphone_content_set_subtype(core->log_collection_upload_information,"plain");
@ -1508,7 +1508,6 @@ static void linphone_core_start(LinphoneCore * lc) {
misc_config_read(lc);
ui_config_read(lc);
#ifdef TUNNEL_ENABLED
lc->tunnel=linphone_core_tunnel_new(lc);
if (lc->tunnel) {
linphone_tunnel_configure(lc->tunnel);
}
@ -1530,13 +1529,31 @@ void linphone_configuring_terminated(LinphoneCore *lc, LinphoneConfiguringState
linphone_core_start(lc);
}
static int linphone_core_serialization_ref = 0;
static void linphone_core_activate_log_serialization_if_needed(void) {
if (liblinphone_serialize_logs == TRUE) {
linphone_core_serialization_ref++;
if (linphone_core_serialization_ref == 1)
ortp_set_log_thread_id(ortp_thread_self());
}
}
static void linphone_core_deactivate_log_serialization_if_needed(void) {
if (liblinphone_serialize_logs == TRUE) {
--linphone_core_serialization_ref;
if (linphone_core_serialization_ref == 0)
ortp_set_log_thread_id(0);
}
}
static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtable, LpConfig *config, void * userdata)
{
const char *remote_provisioning_uri = NULL;
const char *aac_fmtp162248, *aac_fmtp3244;
LinphoneCoreVTable* local_vtable= linphone_core_v_table_new();
ms_message("Initializing LinphoneCore %s", linphone_core_get_version());
memset (lc, 0, sizeof (LinphoneCore));
lc->config=lp_config_ref(config);
lc->data=userdata;
lc->ringstream_autorelease=TRUE;
@ -1546,9 +1563,7 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
ortp_init();
if (liblinphone_serialize_logs == TRUE) {
ortp_set_log_thread_id(ortp_thread_self());
}
linphone_core_activate_log_serialization_if_needed();
lc->dyn_pt=96;
lc->default_profile=rtp_profile_new("default profile");
linphone_core_assign_payload_type(lc,&payload_type_pcmu8000,0,NULL);
@ -1636,6 +1651,10 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
sal_set_user_pointer(lc->sal,lc);
sal_set_callbacks(lc->sal,&linphone_sal_callbacks);
#ifdef TUNNEL_ENABLED
lc->tunnel=linphone_core_tunnel_new(lc);
#endif
lc->network_last_check = 0;
lc->network_last_status = FALSE;
@ -1682,7 +1701,7 @@ LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, struct _LpConfig *config, void *userdata)
{
LinphoneCore *core = ms_new(LinphoneCore, 1);
LinphoneCore *core = ms_new0(LinphoneCore, 1);
linphone_core_init(core, vtable, config, userdata);
return core;
}
@ -2804,6 +2823,10 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const L
LinphoneProxyConfig *found_noreg_cfg=NULL;
LinphoneProxyConfig *default_cfg=lc->default_proxy;
if (linphone_address_get_domain(uri) == NULL) {
ms_message("cannot seach for proxy for uri [%p] if no domain set. returning default",uri);
return default_cfg;
}
/*return default proxy if it is matching the destination uri*/
if (default_cfg){
const char *domain=linphone_proxy_config_get_domain(default_cfg);
@ -3237,7 +3260,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
tmp=linphone_address_as_string(from_parsed);
linphone_address_destroy(from_parsed);
barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"),
(sal_call_autoanswer_asked(call->op)) ?_(" and asked autoanswer."):_("."));
(sal_call_autoanswer_asked(call->op)) ?_(" and asked autoanswer."):".");
linphone_core_notify_show_interface(lc);
linphone_core_notify_display_status(lc,barmesg);
@ -4943,11 +4966,11 @@ void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy
lp_config_set_string(lc->config,"net","firewall_policy",policy);
}
ORTP_INLINE LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc) {
LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc) {
return _linphone_core_get_firewall_policy_with_lie(lc, FALSE);
}
ORTP_INLINE LinphoneFirewallPolicy _linphone_core_get_firewall_policy(const LinphoneCore *lc) {
LinphoneFirewallPolicy _linphone_core_get_firewall_policy(const LinphoneCore *lc) {
return _linphone_core_get_firewall_policy_with_lie(lc, TRUE);
}
@ -6047,6 +6070,8 @@ 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->deleted_proxies=ms_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 */
@ -6279,9 +6304,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
linphone_core_message_storage_close(lc);
ms_exit();
linphone_core_set_state(lc,LinphoneGlobalOff,"Off");
if (liblinphone_serialize_logs == TRUE) {
ortp_set_log_thread_id(0);
}
linphone_core_deactivate_log_serialization_if_needed();
ms_list_free_with_data(lc->vtables,(void (*)(void *))linphone_core_v_table_destroy);
}
@ -6405,6 +6428,28 @@ static void notify_soundcard_usage(LinphoneCore *lc, bool_t used){
}
}
void linphone_core_soundcard_hint_check( LinphoneCore* lc){
MSList* the_calls = lc->calls;
LinphoneCall* call = NULL;
bool_t remaining_paused = FALSE;
/* check if the remaining calls are paused */
while( the_calls ){
call = the_calls->data;
if( call->state == LinphoneCallPausing || call->state == LinphoneCallPaused ){
remaining_paused = TRUE;
break;
}
the_calls = the_calls->next;
}
/* if no more calls or all calls are paused, we can free the soundcard */
if ( (lc->calls==NULL || remaining_paused) && !lc->use_files){
ms_message("Notifying soundcard that we don't need it anymore for calls.");
notify_soundcard_usage(lc,FALSE);
}
}
int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call)
{
if (linphone_core_can_we_add_call(lc)){
@ -6431,7 +6476,9 @@ int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
return -1;
}
lc->calls = the_calls;
if (lc->calls==NULL) notify_soundcard_usage(lc,FALSE);
linphone_core_soundcard_hint_check(lc);
return 0;
}
@ -6646,7 +6693,7 @@ typedef struct Hook{
}Hook;
static Hook *hook_new(LinphoneCoreIterateHook hook, void *hook_data){
Hook *h=ms_new(Hook,1);
Hook *h=ms_new0(Hook,1);
h->fun=hook;
h->data=hook_data;
return h;
@ -7054,16 +7101,34 @@ LinphoneCoreVTable *linphone_core_v_table_new() {
return ms_new0(LinphoneCoreVTable,1);
}
void linphone_core_v_table_set_user_data(LinphoneCoreVTable *table, void *data) {
if (table->user_data) {
ms_free(table->user_data);
}
table->user_data = data;
}
void* linphone_core_v_table_get_user_data(LinphoneCoreVTable *table) {
return table->user_data;
}
void linphone_core_v_table_destroy(LinphoneCoreVTable* table) {
if (table->user_data) {
ms_free(table->user_data);
}
ms_free(table);
}
LinphoneCoreVTable *linphone_core_get_current_vtable(LinphoneCore *lc) {
return lc->current_vtable;
}
#define NOTIFY_IF_EXIST(function_name) \
MSList* iterator; \
ms_message ("Linphone core [%p] notifying [%s]",lc,#function_name);\
for (iterator=lc->vtables; iterator!=NULL; iterator=iterator->next) \
if (((LinphoneCoreVTable*)(iterator->data))->function_name)\
if ((lc->current_vtable=((LinphoneCoreVTable*)(iterator->data)))->function_name)\
((LinphoneCoreVTable*)(iterator->data))->function_name
void linphone_core_notify_global_state_changed(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message) {
NOTIFY_IF_EXIST(global_state_changed)(lc,gstate,message);
}

View file

@ -401,6 +401,10 @@ LINPHONE_PUBLIC void linphone_address_set_transport(LinphoneAddress *uri,Linphon
LINPHONE_PUBLIC char *linphone_address_as_string(const LinphoneAddress *u);
LINPHONE_PUBLIC char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
LINPHONE_PUBLIC bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
LINPHONE_PUBLIC bool_t linphone_address_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
LINPHONE_PUBLIC void linphone_address_set_password(LinphoneAddress *addr, const char *passwd);
LINPHONE_PUBLIC const char *linphone_address_get_password(const LinphoneAddress *addr);
LINPHONE_PUBLIC void linphone_address_set_header(LinphoneAddress *addr, const char *header_name, const char *header_value);
LINPHONE_PUBLIC void linphone_address_destroy(LinphoneAddress *u);
/**
@ -478,6 +482,8 @@ enum _LinphoneIceState{
**/
typedef enum _LinphoneIceState LinphoneIceState;
LINPHONE_PUBLIC const char *linphone_ice_state_to_string(LinphoneIceState state);
/**
* Enum describing uPnP states.
* @ingroup initializing
@ -535,6 +541,8 @@ struct _LinphoneCallStats {
float local_late_rate; /**<percentage of packet received too late over last second*/
float local_loss_rate; /**<percentage of lost packet over last second*/
int updated; /**< Tell which RTCP packet has been updated (received_rtcp or sent_rtcp). Can be either LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE or LINPHONE_CALL_STATS_SENT_RTCP_UPDATE */
float rtcp_download_bandwidth; /**<RTCP download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float rtcp_upload_bandwidth; /**<RTCP download bandwidth measurement of sent stream, expressed in kbit/s, including IP/UDP/RTP headers*/
};
/**
@ -1297,7 +1305,12 @@ struct _LinphoneChatRoom;
*/
/**
* A chat room message to old content to be sent.
* An object to handle the callbacks for the handling a LinphoneChatMessage objects.
*/
typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs;
/**
* A chat room message to hold content to be sent.
* <br> Can be created by linphone_chat_room_create_message().
*/
typedef struct _LinphoneChatMessage LinphoneChatMessage;
@ -1322,12 +1335,53 @@ typedef enum _LinphoneChatMessageState {
/**
* Call back used to notify message delivery status
*@param msg #LinphoneChatMessage object
*@param status LinphoneChatMessageState
*@param ud application user data
* @param msg #LinphoneChatMessage object
* @param status LinphoneChatMessageState
* @param ud application user data
* @deprecated
*/
typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud);
/**
* Call back used to notify message delivery status
* @param msg #LinphoneChatMessage object
* @param status LinphoneChatMessageState
*/
typedef void (*LinphoneChatMessageCbsMsgStateChangedCb)(LinphoneChatMessage* msg, LinphoneChatMessageState state);
/**
* File transfer receive callback prototype. This function is called by the core upon an incoming File transfer is started. This function may be call several time for the same file in case of large file.
*
* @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent incoming content information
* @param buff pointer to the received data
* @param size number of bytes to be read from buff. 0 means end of file.
*
*/
typedef void (*LinphoneChatMessageCbsFileTransferRecvCb)(LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size);
/**
* File transfer send callback prototype. This function is called by the core upon an outgoing File transfer is started. This function is called until size is set to 0.
* <br> a #LinphoneContent with a size equal zero
*
* @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent outgoing content
* @param buff pointer to the buffer where data chunk shall be written by the app
* @param size as input value, it represents the number of bytes expected by the framework. As output value, it means the number of bytes wrote by the application in the buffer. 0 means end of file.
*
*/
typedef void (*LinphoneChatMessageCbsFileTransferSendCb)(LinphoneChatMessage *message, const LinphoneContent* content, char* buff, size_t* size);
/**
* File transfer progress indication callback prototype.
*
* @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent incoming content information
* @param offset The number of bytes sent/received since the beginning of the transfer.
* @param total The total number of bytes to be sent/received.
*/
typedef void (*LinphoneChatMessageCbsFileTransferProgressIndicationCb)(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
LINPHONE_PUBLIC void linphone_core_set_chat_database_path(LinphoneCore *lc, const char *path);
LINPHONE_PUBLIC LinphoneChatRoom * linphone_core_create_chat_room(LinphoneCore *lc, const char *to);
LINPHONE_PUBLIC LinphoneChatRoom * linphone_core_get_or_create_chat_room(LinphoneCore *lc, const char *to);
@ -1378,10 +1432,26 @@ LINPHONE_PUBLIC LinphoneChatMessage* linphone_chat_room_create_file_transfer_mes
LINPHONE_PUBLIC const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr);
LINPHONE_PUBLIC void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
LINPHONE_PUBLIC void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangedCb status_cb,void* ud);
LINPHONE_PUBLIC void linphone_chat_room_send_chat_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
LINPHONE_PUBLIC void linphone_chat_room_update_url(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
LINPHONE_PUBLIC MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message);
/**
* Mark all messages of the conversation as read
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation.
*/
LINPHONE_PUBLIC void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr);
/**
* Delete a message from the chat room history.
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation.
* @param[in] msg The #LinphoneChatMessage object to remove.
*/
LINPHONE_PUBLIC void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
/**
* Delete all messages from the history
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation.
*/
LINPHONE_PUBLIC void linphone_chat_room_delete_history(LinphoneChatRoom *cr);
/**
* Gets the number of messages in a chat room.
@ -1412,6 +1482,11 @@ LINPHONE_PUBLIC void linphone_chat_room_compose(LinphoneChatRoom *cr);
*/
LINPHONE_PUBLIC bool_t linphone_chat_room_is_remote_composing(const LinphoneChatRoom *cr);
/**
* Gets the number of unread messages in the chatroom.
* @param[in] cr The "LinphoneChatRoom object corresponding to the conversation.
* @return the number of unread messages.
*/
LINPHONE_PUBLIC int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *cr);
LINPHONE_PUBLIC LinphoneCore* linphone_chat_room_get_lc(LinphoneChatRoom *cr);
LINPHONE_PUBLIC LinphoneCore* linphone_chat_room_get_core(LinphoneChatRoom *cr);
@ -1439,6 +1514,7 @@ LINPHONE_PUBLIC const char* linphone_chat_message_get_external_body_url(const Li
LINPHONE_PUBLIC void linphone_chat_message_set_external_body_url(LinphoneChatMessage* message,const char* url);
LINPHONE_PUBLIC const LinphoneContent* linphone_chat_message_get_file_transfer_information(const LinphoneChatMessage* message);
LINPHONE_PUBLIC void linphone_chat_message_start_file_download(LinphoneChatMessage* message, LinphoneChatMessageStateChangedCb status_cb, void* ud);
LINPHONE_PUBLIC void linphone_chat_message_download_file(LinphoneChatMessage *message);
LINPHONE_PUBLIC void linphone_chat_message_cancel_file_transfer(LinphoneChatMessage* msg);
LINPHONE_PUBLIC const char* linphone_chat_message_get_appdata(const LinphoneChatMessage* message);
LINPHONE_PUBLIC void linphone_chat_message_set_appdata(LinphoneChatMessage* message, const char* data);
@ -1458,6 +1534,21 @@ LINPHONE_PUBLIC LinphoneReason linphone_chat_message_get_reason(LinphoneChatMess
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_chat_message_get_error_info(const LinphoneChatMessage *msg);
LINPHONE_PUBLIC void linphone_chat_message_set_file_transfer_filepath(LinphoneChatMessage *msg, const char *filepath);
LINPHONE_PUBLIC const char * linphone_chat_message_get_file_transfer_filepath(LinphoneChatMessage *msg);
LINPHONE_PUBLIC LinphoneChatMessageCbs * linphone_chat_message_get_callbacks(const LinphoneChatMessage *msg);
LINPHONE_PUBLIC LinphoneChatMessageCbs * linphone_chat_message_cbs_ref(LinphoneChatMessageCbs *cbs);
LINPHONE_PUBLIC void linphone_chat_message_cbs_unref(LinphoneChatMessageCbs *cbs);
LINPHONE_PUBLIC void *linphone_chat_message_cbs_get_user_data(const LinphoneChatMessageCbs *cbs);
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_user_data(LinphoneChatMessageCbs *cbs, void *ud);
LINPHONE_PUBLIC LinphoneChatMessageCbsMsgStateChangedCb linphone_chat_message_cbs_get_msg_state_changed(const LinphoneChatMessageCbs *cbs);
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_msg_state_changed(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsMsgStateChangedCb cb);
LINPHONE_PUBLIC LinphoneChatMessageCbsFileTransferRecvCb linphone_chat_message_cbs_get_file_transfer_recv(const LinphoneChatMessageCbs *cbs);
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_file_transfer_recv(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferRecvCb cb);
LINPHONE_PUBLIC LinphoneChatMessageCbsFileTransferSendCb linphone_chat_message_cbs_get_file_transfer_send(const LinphoneChatMessageCbs *cbs);
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_file_transfer_send(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferSendCb cb);
LINPHONE_PUBLIC LinphoneChatMessageCbsFileTransferProgressIndicationCb linphone_chat_message_cbs_get_file_transfer_progress_indication(const LinphoneChatMessageCbs *cbs);
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_file_transfer_progress_indication(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferProgressIndicationCb cb);
/**
* @}
*/
@ -1497,7 +1588,7 @@ typedef enum _LinphoneCoreLogCollectionUploadState {
* @param gstate the global state
* @param message informational message.
*/
typedef void (*LinphoneCoreGlobalStateChangedCb )(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
typedef void (*LinphoneCoreGlobalStateChangedCb)(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
/**
* Call state notification callback.
* @param lc the LinphoneCore
@ -1742,12 +1833,13 @@ typedef struct _LinphoneCoreVTable{
DisplayUrlCb display_url; /**< @deprecated */
ShowInterfaceCb show; /**< @deprecated Notifies the application that it should show up*/
LinphoneCoreTextMessageReceivedCb text_received; /**< @deprecated, use #message_received instead <br> A text message has been received */
LinphoneCoreFileTransferRecvCb file_transfer_recv; /**< Callback to store file received attached to a #LinphoneChatMessage */
LinphoneCoreFileTransferSendCb file_transfer_send; /**< Callback to collect file chunk to be sent for a #LinphoneChatMessage */
LinphoneCoreFileTransferProgressIndicationCb file_transfer_progress_indication; /**< Callback to indicate file transfer progress */
LinphoneCoreFileTransferRecvCb file_transfer_recv; /**< @deprecated Callback to store file received attached to a #LinphoneChatMessage */
LinphoneCoreFileTransferSendCb file_transfer_send; /**< @deprecated Callback to collect file chunk to be sent for a #LinphoneChatMessage */
LinphoneCoreFileTransferProgressIndicationCb file_transfer_progress_indication; /**< @deprecated Callback to indicate file transfer progress */
LinphoneCoreNetworkReachableCb network_reachable; /**< Callback to report IP network status (I.E up/down )*/
LinphoneCoreLogCollectionUploadStateChangedCb log_collection_upload_state_changed; /**< Callback to upload collected logs */
LinphoneCoreLogCollectionUploadProgressIndicationCb log_collection_upload_progress_indication; /**< Callback to indicate log collection upload progress */
void *user_data;
} LinphoneCoreVTable;
/**
@ -1756,6 +1848,28 @@ typedef struct _LinphoneCoreVTable{
*/
LINPHONE_PUBLIC LinphoneCoreVTable *linphone_core_v_table_new();
/**
* Sets a user data pointer in the vtable.
* @param table the vtable
* @param data the user data to attach
*/
LINPHONE_PUBLIC void linphone_core_v_table_set_user_data(LinphoneCoreVTable *table, void *data);
/**
* Gets a user data pointer in the vtable.
* @param table the vtable
* @returns the data attached to the vtable
*/
LINPHONE_PUBLIC void* linphone_core_v_table_get_user_data(LinphoneCoreVTable *table);
/**
* Gets the current VTable.
* This is meant only to be called from a callback to be able to get the user_data associated with the vtable that called the callback.
* @param lc the linphonecore
* @returns the vtable that called the last callback
*/
LINPHONE_PUBLIC LinphoneCoreVTable *linphone_core_get_current_vtable(LinphoneCore *lc);
/**
* Destroy a vtable.
* @param vtable to be destroyed
@ -3114,6 +3228,7 @@ LINPHONE_PUBLIC void linphone_core_set_tone(LinphoneCore *lc, LinphoneToneID id,
* Globaly set an http file transfer server to be used for content type application/vnd.gsma.rcs-ft-http+xml. This value can also be set for a dedicated account using #linphone_proxy_config_set_file_transfer_server
* @param[in] core #LinphoneCore to be modified
* @param[in] server_url URL of the file server like https://file.linphone.org/upload.php
* @ingroup misc
* */
LINPHONE_PUBLIC void linphone_core_set_file_transfer_server(LinphoneCore *core, const char * server_url);
@ -3121,6 +3236,7 @@ LINPHONE_PUBLIC void linphone_core_set_file_transfer_server(LinphoneCore *core,
* Get the globaly set http file transfer server to be used for content type application/vnd.gsma.rcs-ft-http+xml.
* @param[in] core #LinphoneCore from which to get the server_url
* @return URL of the file server like https://file.linphone.org/upload.php
* @ingroup misc
* */
LINPHONE_PUBLIC const char * linphone_core_get_file_transfer_server(LinphoneCore *core);

File diff suppressed because it is too large Load diff

View file

@ -202,7 +202,7 @@ static int linphone_chat_message_store_content(LinphoneChatMessage *msg) {
linphone_content_get_encoding(content),
linphone_content_get_size(content),
NULL
);
);
linphone_sql_request(lc->db, buf);
sqlite3_free(buf);
id = (unsigned int) sqlite3_last_insert_rowid (lc->db);
@ -237,7 +237,7 @@ unsigned int linphone_chat_message_store(LinphoneChatMessage *msg){
(int64_t)msg->time,
msg->appdata,
content_id
);
);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
ms_free(local_contact);
@ -255,13 +255,6 @@ void linphone_chat_message_store_state(LinphoneChatMessage *msg){
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
}
if( msg->state == LinphoneChatMessageStateDelivered
|| msg->state == LinphoneChatMessageStateNotDelivered ){
// message is not transient anymore, we can remove it from our transient list:
msg->chat_room->transient_messages = ms_list_remove(msg->chat_room->transient_messages, msg);
linphone_chat_message_unref(msg);
}
}
void linphone_chat_message_store_appdata(LinphoneChatMessage* msg){
@ -378,7 +371,7 @@ MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, i
if (startm<0) startm=0;
if (endm>0&&endm>=startm){
if ((endm>0&&endm>=startm) || (startm == 0 && endm == 0) ){
buf2=ms_strdup_printf("%s LIMIT %i ",buf,endm+1-startm);
ms_free(buf);
buf = buf2;

View file

@ -641,6 +641,24 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call)
return 0;
}
const char *linphone_ice_state_to_string(LinphoneIceState state){
switch(state){
case LinphoneIceStateFailed:
return "IceStateFailed";
case LinphoneIceStateHostConnection:
return "IceStateHostConnection";
case LinphoneIceStateInProgress:
return "IceStateInProgress";
case LinphoneIceStateNotActivated:
return "IceStateNotActivated";
case LinphoneIceStateReflexiveConnection:
return "IceStateReflexiveConnection";
case LinphoneIceStateRelayConnection:
return "IceStateRelayConnection";
}
return "invalid";
}
void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call)
{
IceCheckList *audio_check_list;
@ -699,6 +717,8 @@ void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call)
call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateFailed;
}
}
ms_message("Call [%p] New ICE state: audio: [%s] video: [%s]", call,
linphone_ice_state_to_string(call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state), linphone_ice_state_to_string(call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state));
}
void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session)
@ -825,8 +845,25 @@ static void clear_ice_check_list(LinphoneCall *call, IceCheckList *removed){
void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md)
{
bool_t ice_restarted = FALSE;
if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) {
bool_t ice_params_found=FALSE;
if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) {
ice_params_found=TRUE;
} else {
int i;
for (i = 0; i < md->nb_streams; i++) {
const SalStreamDescription *stream = &md->streams[i];
IceCheckList *cl = ice_session_check_list(call->ice_session, i);
if (cl) {
if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) {
ice_params_found=TRUE;
} else {
ice_params_found=FALSE;
break;
}
}
}
}
if (ice_params_found) {
int i, j;
/* Check for ICE restart and set remote credentials. */
@ -858,11 +895,14 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
IceCheckList *cl = ice_session_check_list(call->ice_session, i);
if (cl && (stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) {
if (ice_check_list_remote_credentials_changed(cl, stream->ice_ufrag, stream->ice_pwd)) {
if (ice_restarted == FALSE) {
if (ice_restarted == FALSE
&& ice_check_list_remote_ufrag(cl)
&& ice_check_list_remote_pwd(cl)) {
/* restart onlu if remote ufrag/paswd was already set*/
ice_session_restart(call->ice_session);
ice_restarted = TRUE;
}
ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd);
ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd);
break;
}
}

View file

@ -146,6 +146,17 @@ typedef struct _CallCallbackObj
void * _user_data;
}CallCallbackObj;
struct _LinphoneChatMessageCbs {
belle_sip_object_t base;
void *user_data;
LinphoneChatMessageCbsMsgStateChangedCb msg_state_changed;
LinphoneChatMessageCbsFileTransferRecvCb file_transfer_recv; /**< Callback to store file received attached to a #LinphoneChatMessage */
LinphoneChatMessageCbsFileTransferSendCb file_transfer_send; /**< Callback to collect file chunk to be sent for a #LinphoneChatMessage */
LinphoneChatMessageCbsFileTransferProgressIndicationCb file_transfer_progress_indication; /**< Callback to indicate file transfer progress */
};
BELLE_SIP_DECLARE_VPTR(LinphoneChatMessageCbs);
typedef enum _LinphoneChatMessageDir{
LinphoneChatMessageIncoming,
LinphoneChatMessageOutgoing
@ -154,6 +165,7 @@ typedef enum _LinphoneChatMessageDir{
struct _LinphoneChatMessage {
belle_sip_object_t base;
LinphoneChatRoom* chat_room;
LinphoneChatMessageCbs *callbacks;
LinphoneChatMessageDir dir;
char* message;
LinphoneChatMessageStateChangedCb cb;
@ -363,6 +375,8 @@ void linphone_notify_parse_presence(SalOp *op, const char *content_type, const c
void linphone_notify_convert_presence_to_xml(SalOp *op, SalPresenceModel *presence, const char *contact, char **content);
void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model);
void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, SalOp *op);
void linphone_core_soundcard_hint_check(LinphoneCore* lc);
void linphone_subscription_answered(LinphoneCore *lc, SalOp *op);
void linphone_subscription_closed(LinphoneCore *lc, SalOp *op);
@ -434,14 +448,21 @@ bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc);
void linphone_core_queue_task(LinphoneCore *lc, belle_sip_source_func_t task_fun, void *data, const char *task_description);
LINPHONE_PUBLIC bool_t linphone_proxy_config_address_equal(const LinphoneAddress *a, const LinphoneAddress *b);
LINPHONE_PUBLIC bool_t linphone_proxy_config_is_server_config_changed(const LinphoneProxyConfig* obj);
typedef enum _LinphoneProxyConfigAddressComparisonResult{
LinphoneProxyConfigAddressDifferent,
LinphoneProxyConfigAddressEqual,
LinphoneProxyConfigAddressWeakEqual
} LinphoneProxyConfigAddressComparisonResult;
LINPHONE_PUBLIC LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_address_equal(const LinphoneAddress *a, const LinphoneAddress *b);
LINPHONE_PUBLIC LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_config_changed(const LinphoneProxyConfig* obj);
void _linphone_proxy_config_unregister(LinphoneProxyConfig *obj);
void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj);
/*chat*/
void linphone_chat_room_release(LinphoneChatRoom *cr);
void linphone_chat_message_destroy(LinphoneChatMessage* msg);
void linphone_chat_message_update_state(LinphoneChatMessage* chat_msg );
/**/
struct _LinphoneProxyConfig
@ -773,6 +794,7 @@ struct _LinphoneCore
LinphoneReason chat_deny_code;
const char **supported_formats;
LinphoneContent *log_collection_upload_information;
LinphoneCoreVTable *current_vtable; // the latest vtable to call a callback, see linphone_core_get_current_vtable
};
@ -911,6 +933,7 @@ struct _LinphoneContent {
belle_sip_object_t base;
void *user_data;
struct _LinphoneContentPrivate lcp;
bool_t owned_fields;
};
BELLE_SIP_DECLARE_VPTR(LinphoneContent);
@ -997,6 +1020,7 @@ BELLE_SIP_TYPE_ID(LinphoneCall),
BELLE_SIP_TYPE_ID(LinphoneCallLog),
BELLE_SIP_TYPE_ID(LinphoneCallParams),
BELLE_SIP_TYPE_ID(LinphoneChatMessage),
BELLE_SIP_TYPE_ID(LinphoneChatMessageCbs),
BELLE_SIP_TYPE_ID(LinphoneChatRoom),
BELLE_SIP_TYPE_ID(LinphoneContent),
BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider),

View file

@ -41,33 +41,41 @@ static void linphone_proxy_config_store_server_config(LinphoneProxyConfig* obj)
obj->saved_proxy = NULL;
}
bool_t linphone_proxy_config_address_equal(const LinphoneAddress *a, const LinphoneAddress *b) {
LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_address_equal(const LinphoneAddress *a, const LinphoneAddress *b) {
if (a == NULL && b == NULL)
return TRUE;
return LinphoneProxyConfigAddressEqual;
else if (!a || !b)
return FALSE;
return LinphoneProxyConfigAddressDifferent;
if (linphone_address_equal(a,b))
return LinphoneProxyConfigAddressEqual;
if (linphone_address_weak_equal(a,b)) {
/*also check both transport and uri */
return linphone_address_is_secure(a) == linphone_address_is_secure(b) && linphone_address_get_transport(a) == linphone_address_get_transport(b);
} else
return FALSE; /*either username, domain or port ar not equals*/
if (linphone_address_is_secure(a) == linphone_address_is_secure(b) && linphone_address_get_transport(a) == linphone_address_get_transport(b))
return LinphoneProxyConfigAddressWeakEqual;
else
return LinphoneProxyConfigAddressDifferent;
}
return LinphoneProxyConfigAddressDifferent; /*either username, domain or port ar not equals*/
}
bool_t linphone_proxy_config_is_server_config_changed(const LinphoneProxyConfig* obj) {
LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_config_changed(const LinphoneProxyConfig* obj) {
LinphoneAddress *current_identity=obj->reg_identity?linphone_address_new(obj->reg_identity):NULL;
LinphoneAddress *current_proxy=obj->reg_proxy?linphone_address_new(obj->reg_proxy):NULL;
bool_t result=FALSE;
LinphoneProxyConfigAddressComparisonResult result_identity;
LinphoneProxyConfigAddressComparisonResult result;
if (!linphone_proxy_config_address_equal(obj->saved_identity,current_identity)){
result=TRUE;
goto end;
}
if (!linphone_proxy_config_address_equal(obj->saved_proxy,current_proxy)){
result=TRUE;
goto end;
}
result = linphone_proxy_config_address_equal(obj->saved_identity,current_identity);
if (result == LinphoneProxyConfigAddressDifferent) goto end;
result_identity = result;
result = linphone_proxy_config_address_equal(obj->saved_proxy,current_proxy);
if (result == LinphoneProxyConfigAddressDifferent) goto end;
/** If the proxies are equal use the result of the difference between the identities,
* otherwise the result is weak-equal and so weak-equal must be returned even if the
* identities were equal.
*/
if (result == LinphoneProxyConfigAddressEqual) result = result_identity;
end:
if (current_identity) linphone_address_destroy(current_identity);
@ -976,14 +984,19 @@ int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const cha
**/
int linphone_proxy_config_done(LinphoneProxyConfig *obj)
{
LinphoneProxyConfigAddressComparisonResult res;
if (!linphone_proxy_config_check(obj->lc,obj))
return -1;
/*check if server address as changed*/
if (linphone_proxy_config_is_server_config_changed(obj)) {
res = linphone_proxy_config_is_server_config_changed(obj);
if (res != LinphoneProxyConfigAddressEqual) {
/* server config has changed, need to unregister from previous first*/
if (obj->op) {
_linphone_proxy_config_unregister(obj);
if (res == LinphoneProxyConfigAddressDifferent) {
_linphone_proxy_config_unregister(obj);
}
sal_op_set_user_pointer(obj->op,NULL); /*we don't want to receive status for this un register*/
sal_op_unref(obj->op); /*but we keep refresher to handle authentication if needed*/
obj->op=NULL;

View file

@ -331,8 +331,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
append_to_buffer(&buffer, &size, &offset, "\r\n");
}
linphone_content_set_data(content, buffer);
linphone_content_set_size(content, strlen(buffer));
linphone_content_set_buffer(content, buffer, strlen(buffer));
if (call->log->reporting.on_report_sent != NULL){
call->log->reporting.on_report_sent(

View file

@ -145,7 +145,7 @@ char * linphone_upnp_format_device_id(const char *device_id) {
if(device_id == NULL) {
return ret;
}
ret = ms_new(char, UPNP_UUID_LEN + 1);
ret = ms_new0(char, UPNP_UUID_LEN + 1);
tmp = ret;
if(linphone_upnp_strncmpi(device_id, "uuid:", linphone_upnp_str_min(device_id, "uuid:")) == 0) {
device_id += strlen("uuid:");

91
gtk/CMakeLists.txt Normal file
View file

@ -0,0 +1,91 @@
############################################################################
# CMakeLists.txt
# Copyright (C) 2014 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.
#
############################################################################
find_package(GTK2 2.18 REQUIRED gtk)
set(UI_FILES
about.ui
audio_assistant.ui
buddylookup.ui
call_logs.ui
call_statistics.ui
config-uri.ui
contact.ui
dscp_settings.ui
keypad.ui
ldap.ui
log.ui
main.ui
parameters.ui
password.ui
provisioning-fetch.ui
sip_account.ui
tunnel_config.ui
waiting.ui
)
set(PIXMAPS stock_people.png)
set(SOURCE_FILES
audio_assistant.c
buddylookup.c
calllogs.c
chat.c
conference.c
config-fetching.c
friendlist.c
incall_view.c
logging.c
loginframe.c
main.c
propertybox.c
singleinstance.c
support.c
update.c
utils.c
videowindow.c
)
if(GETTEXT_FOUND)
add_definitions("-DENABLE_NLS")
endif()
add_executable(linphone-gtk ${SOURCE_FILES})
set_target_properties(linphone-gtk PROPERTIES OUTPUT_NAME linphone)
target_include_directories(linphone-gtk PUBLIC ${GTK2_INCLUDE_DIRS})
target_link_libraries(linphone-gtk linphone ${GTK2_LIBRARIES})
if(ENABLE_NOTIFY)
target_include_directories(linphone-gtk PUBLIC ${NOTIFY_INCLUDE_DIRS})
target_link_libraries(linphone-gtk ${NOTIFY_LIBRARIES})
endif()
install(TARGETS linphone-gtk
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES ${UI_FILES} ${PIXMAPS}
DESTINATION ${PACKAGE_DATA_DIR}/linphone
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)

View file

@ -5,14 +5,14 @@
<object class="GtkAboutDialog" id="about">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">About linphone</property>
<property name="title" translatable="yes">About Linphone</property>
<property name="resizable">False</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<property name="program_name">Linphone</property>
<property name="version">undef</property>
<property name="copyright" translatable="yes">(C) Belledonne Communications,2010
<property name="copyright" translatable="yes">(C) Belledonne Communications, 2010
</property>
<property name="comments" translatable="yes">An internet video phone using the standard SIP (rfc3261) protocol.</property>
<property name="website">http://www.linphone.org</property>

View file

@ -180,7 +180,7 @@ static void calibration_finished(LinphoneCore *lc, LinphoneEcCalibratorStatus st
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
"%s","Did you hear three beeps ?");
"%s",_("Did you hear three beeps ?"));
g_signal_connect(G_OBJECT (dialog), "response",
G_CALLBACK (dialog_click),speaker_page);
@ -289,12 +289,12 @@ static void open_mixer(){
#ifdef WIN32
if(!g_spawn_command_line_async("control mmsys.cpl",&error)){
display_popup(GTK_MESSAGE_WARNING,"Sound preferences not found ");
display_popup(GTK_MESSAGE_WARNING,_("Sound preferences not found "));
g_error_free(error);
}
#elif __APPLE__
if(!g_spawn_command_line_async("open /System/Library/PreferencePanes/Sound.prefPane",&error)){
display_popup(GTK_MESSAGE_WARNING,"Sound preferences not found ");
display_popup(GTK_MESSAGE_WARNING,_("Sound preferences not found "));
g_error_free(error);
}
#else
@ -303,7 +303,7 @@ static void open_mixer(){
if(!g_spawn_command_line_async("kmix",&error)){
if(!g_spawn_command_line_async("mate-volume-control",&error)){
if(!g_spawn_command_line_async("xterm alsamixer",&error)){
display_popup(GTK_MESSAGE_WARNING,"Cannot launch system sound control ");
display_popup(GTK_MESSAGE_WARNING,_("Cannot launch system sound control "));
g_error_free(error);
}
}
@ -315,7 +315,7 @@ static void open_mixer(){
static GtkWidget *create_intro(){
GtkWidget *vbox=gtk_vbox_new(FALSE,2);
GtkWidget *label=gtk_label_new(_("Welcome !\nThis assistant will help you to configure audio settings for Linphone"));
GtkWidget *label=gtk_label_new(_("Welcome!\nThis assistant will help you to configure audio settings for Linphone"));
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 2);
gtk_widget_show_all(vbox);
return vbox;
@ -331,7 +331,7 @@ static GtkWidget *create_mic_page(){
GtkWidget *capture_device=gtk_combo_box_new();
GtkWidget *box = gtk_vbox_new(FALSE,0);
GtkWidget *label_audiolevel=gtk_label_new(_("No voice"));
GtkWidget *mixer_button=gtk_button_new_with_label("System sound preferences");
GtkWidget *mixer_button=gtk_button_new_with_label(_("System sound preferences"));
GtkWidget *image;
image=gtk_image_new_from_stock(GTK_STOCK_PREFERENCES,GTK_ICON_SIZE_MENU);
@ -370,7 +370,7 @@ static GtkWidget *create_speaker_page(){
GtkWidget *labelSpeakerLevel=gtk_label_new(_("Play three beeps"));
GtkWidget *spk_button=gtk_button_new_from_stock(GTK_STOCK_MEDIA_PLAY);
GtkWidget *playback_device=gtk_combo_box_new();
GtkWidget *mixer_button=gtk_button_new_with_label("System sound preferences");
GtkWidget *mixer_button=gtk_button_new_with_label(_("System sound preferences"));
GtkWidget *image;
const char **sound_devices;
@ -402,8 +402,8 @@ static GtkWidget *create_play_record_page(){
GtkWidget *vbox=gtk_table_new(2,2,FALSE);
GtkWidget *labelRecord=gtk_label_new(_("Press the record button and say some words"));
GtkWidget *labelPlay=gtk_label_new(_("Listen to your record voice"));
GtkWidget *rec_button=gtk_toggle_button_new_with_label("Record");
GtkWidget *play_button=gtk_toggle_button_new_with_label("Play");
GtkWidget *rec_button=gtk_toggle_button_new_with_label(_("Record"));
GtkWidget *play_button=gtk_toggle_button_new_with_label(_("Play"));
GtkWidget *image;
image=gtk_image_new_from_stock(GTK_STOCK_MEDIA_RECORD,GTK_ICON_SIZE_MENU);

View file

@ -332,7 +332,7 @@ void linphone_gtk_call_log_update(GtkWidget *w){
ngettext("%i second", "%i seconds", duration%60),
duration%60);
if (status==NULL) {
headtxt=g_markup_printf_escaped(_("<big><b>%s</b></big>\t%s"),display,start_date ? start_date : "");
headtxt=g_markup_printf_escaped("<big><b>%s</b></big>\t%s",display,start_date ? start_date : "");
logtxt=g_markup_printf_escaped(
_("<small><i>%s</i>\t"
"<i>Quality: %s</i></small>\n%s\t%s\t"),
@ -340,8 +340,8 @@ void linphone_gtk_call_log_update(GtkWidget *w){
} else {
headtxt=g_markup_printf_escaped(_("<big><b>%s</b></big>\t%s"),display,start_date ? start_date : "");
logtxt=g_markup_printf_escaped(
_("<small><i>%s</i></small>\t"
"\n%s"),addr, status);
"<small><i>%s</i></small>\t"
"\n%s",addr, status);
}
g_free(minutes);
g_free(seconds);

View file

@ -276,7 +276,7 @@ void update_chat_state_message(LinphoneChatMessageState state,LinphoneChatMessag
}
}
static void on_chat_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state, void *user_pointer){
static void on_chat_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state){
update_chat_state_message(state,msg);
}
@ -300,8 +300,11 @@ void linphone_gtk_send_text(){
entered=gtk_entry_get_text(GTK_ENTRY(entry));
if (strlen(entered)>0) {
LinphoneChatMessage *msg;
LinphoneChatMessageCbs *cbs;
msg=linphone_chat_room_create_message(cr,entered);
linphone_chat_room_send_message2(cr,msg,on_chat_state_changed,NULL);
cbs=linphone_chat_message_get_callbacks(msg);
linphone_chat_message_cbs_set_msg_state_changed(cbs,on_chat_state_changed);
linphone_chat_room_send_chat_message(cr,msg);
linphone_gtk_push_text(w,linphone_chat_message_get_from(msg),
TRUE,cr,msg,FALSE);
@ -471,8 +474,9 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
}
void linphone_gtk_chat_destroyed(GtkWidget *w){
/*
LinphoneChatRoom *cr=(LinphoneChatRoom*)g_object_get_data(G_OBJECT(w),"cr");
linphone_chat_room_destroy(cr);
*/
}

View file

@ -77,7 +77,7 @@ Please enter or modify the configuration URI below. After clicking OK, Linphone
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<property name="text" translatable="yes">https://</property>
<property name="text" translatable="no">https://</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>

View file

@ -428,7 +428,7 @@ void linphone_gtk_update_video_button(LinphoneCall *call){
gboolean has_video=linphone_call_params_video_enabled(params);
gboolean button_sensitive=FALSE;
if (call_view==NULL) return;
button=linphone_gtk_get_widget(call_view,"video_button");
gtk_button_set_image(GTK_BUTTON(button),
@ -721,7 +721,7 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
GtkWidget *call_stats=(GtkWidget*)g_object_get_data(G_OBJECT(callview),"call_stats");
linphone_gtk_in_call_show_video(call);
display_peer_name_in_label(callee,linphone_call_get_remote_address (call));
gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel"));
@ -774,7 +774,7 @@ void linphone_gtk_in_call_view_update_duration(LinphoneCall *call){
int seconds=duration%60;
int minutes=(duration/60)%60;
int hours=duration/3600;
snprintf(tmp,sizeof(tmp)-1,_("%02i::%02i::%02i"),hours,minutes,seconds);
snprintf(tmp,sizeof(tmp)-1,"%02i::%02i::%02i",hours,minutes,seconds);
gtk_label_set_text(GTK_LABEL(duration_label),tmp);
}

View file

@ -29,7 +29,7 @@
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="dtmf_D">
<property name="label" translatable="yes">D</property>
<property name="label" translatable="no">D</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -45,7 +45,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_#">
<property name="label" translatable="yes">#</property>
<property name="label" translatable="no">#</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -61,7 +61,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_0">
<property name="label" translatable="yes">0</property>
<property name="label" translatable="no">0</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -77,7 +77,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_*">
<property name="label" translatable="yes">*</property>
<property name="label" translatable="no">*</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -91,7 +91,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_C">
<property name="label" translatable="yes">C</property>
<property name="label" translatable="no">C</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -107,7 +107,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_9">
<property name="label" translatable="yes">9</property>
<property name="label" translatable="no">9</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -123,7 +123,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_8">
<property name="label" translatable="yes">8</property>
<property name="label" translatable="no">8</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -139,7 +139,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_7">
<property name="label" translatable="yes">7</property>
<property name="label" translatable="no">7</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -153,7 +153,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_B">
<property name="label" translatable="yes">B</property>
<property name="label" translatable="no">B</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -169,7 +169,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_6">
<property name="label" translatable="yes">6</property>
<property name="label" translatable="no">6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -185,7 +185,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_5">
<property name="label" translatable="yes">5</property>
<property name="label" translatable="no">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -201,7 +201,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_4">
<property name="label" translatable="yes">4</property>
<property name="label" translatable="no">4</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -215,7 +215,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_A">
<property name="label" translatable="yes">A</property>
<property name="label" translatable="no">A</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -229,7 +229,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_3">
<property name="label" translatable="yes">3</property>
<property name="label" translatable="no">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -243,7 +243,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_2">
<property name="label" translatable="yes">2</property>
<property name="label" translatable="no">2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -257,7 +257,7 @@
</child>
<child>
<object class="GtkButton" id="dtmf_1">
<property name="label" translatable="yes">1</property>
<property name="label" translatable="no">1</property>
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>

View file

@ -77,6 +77,7 @@ void linphone_gtk_status_icon_set_blinking(gboolean val);
void _linphone_gtk_enable_video(gboolean val);
void linphone_gtk_on_uribar_changed(GtkEditable *uribar, gpointer user_data);
static void linphone_gtk_init_ui(void);
static void linphone_gtk_quit(void);
#ifndef HAVE_GTK_OSX
static gint main_window_x=0;
@ -90,6 +91,7 @@ static int start_option = START_LINPHONE;
static gboolean no_video=FALSE;
static gboolean iconified=FALSE;
static gboolean run_audio_assistant=FALSE;
static gboolean selftest=FALSE;
static gchar *workingdir=NULL;
static char *progpath=NULL;
gchar *linphone_logfile=NULL;
@ -162,6 +164,13 @@ static GOptionEntry linphone_options[]={
.arg_data = (gpointer) &run_audio_assistant,
.description = N_("Run the audio assistant")
},
{
.long_name = "selftest",
.short_name = '\0',
.arg = G_OPTION_ARG_NONE,
.arg_data = (gpointer) &selftest,
.description = N_("Run self test and exit 0 if succeed")
},
{0}
};
@ -1324,6 +1333,9 @@ static void linphone_gtk_global_state_changed(LinphoneCore *lc, LinphoneGlobalSt
break;
case LinphoneGlobalOn:
linphone_gtk_init_ui();
if (selftest) {
gtk_timeout_add(300,(GtkFunction)gtk_main_quit,NULL);
}
break;
default:
break;
@ -2106,6 +2118,7 @@ int main(int argc, char *argv[]){
LpConfig *factory;
const char *db_file;
GError *error=NULL;
const char *tmp;
#if !GLIB_CHECK_VERSION(2, 31, 0)
g_thread_init(NULL);
@ -2115,6 +2128,8 @@ int main(int argc, char *argv[]){
progpath = strdup(argv[0]);
config_file=linphone_gtk_get_config_file(NULL);
workingdir= (tmp=g_getenv("LINPHONE_WORKDIR")) ? g_strdup(tmp) : NULL;
#ifdef WIN32
/*workaround for windows: sometimes LANG is defined to an integer value, not understood by gtk */

View file

@ -1890,7 +1890,7 @@
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Welcome !&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Welcome!&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>

View file

@ -8,8 +8,8 @@
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Welcome !
This wizard will help you to setup a SIP account.
<property name="label" translatable="yes">Welcome!
This wizard will help you to setup a SIP account.
</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>

View file

@ -2538,7 +2538,7 @@
<object class="GtkLabel" id="ldap_server">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="label" translatable="no">label</property>
</object>
<packing>
<property name="left_attach">1</property>
@ -2550,7 +2550,7 @@
<object class="GtkLabel" id="ldap_auth_method">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="label" translatable="no">label</property>
</object>
<packing>
<property name="left_attach">1</property>
@ -2564,7 +2564,7 @@
<object class="GtkLabel" id="ldap_username">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="label" translatable="no">label</property>
</object>
<packing>
<property name="left_attach">1</property>

View file

@ -913,13 +913,13 @@ void linphone_gtk_show_proxy_config(GtkWidget *pb, LinphoneProxyConfig *cfg){
GtkWidget *w=linphone_gtk_create_window("sip_account");
const char *tmp;
gboolean is_new=FALSE;
if (!cfg) {
cfg=linphone_core_create_proxy_config(linphone_gtk_get_core());
is_new=TRUE;
g_object_set_data(G_OBJECT(w),"is_new",GINT_TO_POINTER(TRUE));
}
if (!is_new){
linphone_proxy_config_edit(cfg);
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"identity")),
@ -930,7 +930,7 @@ void linphone_gtk_show_proxy_config(GtkWidget *pb, LinphoneProxyConfig *cfg){
tmp=linphone_proxy_config_get_contact_parameters(cfg);
if (tmp) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"params")),tmp);
}
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"regperiod")),
linphone_proxy_config_get_expires(cfg));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"register")),

View file

@ -31,7 +31,7 @@ static GdkPixbuf *notok;
static GtkWidget *create_intro(){
GtkWidget *vbox=gtk_vbox_new(FALSE,2);
GtkWidget *label=gtk_label_new(_("Welcome !\nThis assistant will help you to use a SIP account for your calls."));
GtkWidget *label=gtk_label_new(_("Welcome!\nThis assistant will help you to use a SIP account for your calls."));
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 2);
g_object_set_data(G_OBJECT(vbox),"label",label);
gtk_widget_show_all(vbox);
@ -452,7 +452,7 @@ static void linphone_gtk_assistant_prepare(GtkWidget *assistant, GtkWidget *page
linphone_core_add_auth_info(linphone_gtk_get_core(),info);
linphone_address_destroy(identity);
if (strcmp(creator->domain, "sip:sip.linphone.org") == 0 ){
if (strcmp(creator->domain, "sip:sip.linphone.org") == 0) {
linphone_proxy_config_enable_avpf(cfg,TRUE);
// If account created on sip.linphone.org, we configure linphone to use TLS by default
if (linphone_core_sip_transport_supported(linphone_gtk_get_core(),LinphoneTransportTls)) {
@ -465,6 +465,8 @@ static void linphone_gtk_assistant_prepare(GtkWidget *assistant, GtkWidget *page
ms_free(tmp);
linphone_address_destroy(addr);
}
linphone_core_set_stun_server(linphone_gtk_get_core(), "stun.linphone.org");
linphone_core_set_firewall_policy(linphone_gtk_get_core(), LinphonePolicyUseIce);
}
if (linphone_core_add_proxy_config(linphone_gtk_get_core(),cfg)==-1)

View file

@ -110,6 +110,9 @@ void sal_address_set_transport_name(SalAddress* addr,const char* transport);
void sal_address_set_params(SalAddress *addr, const char *params);
void sal_address_set_uri_params(SalAddress *addr, const char *params);
bool_t sal_address_is_ipv6(SalAddress *addr);
void sal_address_set_password(SalAddress *addr, const char *passwd);
const char *sal_address_get_password(const SalAddress *addr);
void sal_address_set_header(SalAddress *addr, const char *header_name, const char *header_value);
Sal * sal_init();
void sal_uninit(Sal* sal);
@ -782,6 +785,7 @@ LINPHONE_PUBLIC bool_t sal_dns_srv_enabled(const Sal *sal);
LINPHONE_PUBLIC void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file);
LINPHONE_PUBLIC const char *sal_get_dns_user_hosts_file(const Sal *sal);
unsigned int sal_get_random(void);
char *sal_get_random_token(int size);
unsigned char * sal_get_random_bytes(unsigned char *ret, size_t size);
belle_sip_source_t * sal_create_timer(Sal *sal, belle_sip_source_func_t func, void *data, unsigned int timeout_value_ms, const char* timer_name);
void sal_cancel_timer(Sal *sal, belle_sip_source_t *timer);

View file

@ -79,15 +79,10 @@ public interface LinphoneAddress {
*/
public String getDomain();
/**
* Port as String
* @return null if not set
* Port
* @return 0 if not set
*/
public String getPort();
/**
* Port as integer value.
* @return negative value if not set if not set
*/
public int getPortInt();
public int getPort();
/**
* set display name
* @param name
@ -104,15 +99,11 @@ public interface LinphoneAddress {
*/
public void setDomain(String domain);
/**
* set port as String
* @param port, null if not set
* set port
* @param port, 0 if not set
*/
public void setPort(String port);
/**
* set port as int
* @param port, negative value if not set
*/
public void setPortInt(int port);
public void setPort(int port);
/**
* Removes address's tags and uri headers so that it is displayable to the user.
**/

View file

@ -1787,4 +1787,29 @@ public interface LinphoneCore {
* @return An object that implement LinphonePlayer
*/
public LinphonePlayer createLocalPlayer(AndroidVideoWindowImpl window);
/**
* Adds a new listener to be called by the core
* @param listener to add
*/
public void addListener(LinphoneCoreListener listener);
/**
* Removes a listener previously added with addListener
* @param listener to remove
*/
public void removeListener(LinphoneCoreListener listener);
/**
* Specifies a ring back tone to be played to far end during incoming calls, when early media is requested.
* @param file
*/
public void setRemoteRingbackTone(String file);
/**
* Return the ringback tone file used when doing early media. It may be null.
* @return the ringback tone file path.
*/
String getRemoteRingbackTone();
}

View file

@ -22,203 +22,226 @@ import java.nio.ByteBuffer;
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
/**
*
*This interface holds all callbacks that the application should implement. None is mandatory.
*/
public interface LinphoneCoreListener {
/**< Ask the application some authentication information
* @return */
void authInfoRequested(LinphoneCore lc, String realm, String username, String Domain);
/** General State notification
* @param state LinphoneCore.State
* @return
* */
void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message);
/** Call State notification
* @param state LinphoneCall.State
* @return
* */
void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message);
/**
* Call stats notification
*/
void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats);
/**
* Callback to display change in encryption state.
* @param encrypted true if all streams of the call are encrypted
* @param authenticationToken token like ZRTP SAS that may be displayed to user
*/
void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, boolean encrypted, String authenticationToken);
/**
* Registration state notification
* */
void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage);
/**
* Reports that a new subscription request has been received and wait for a decision.
*Status on this subscription request is notified by changing policy for this friend
*@param lc LinphoneCore
*@param lf LinphoneFriend corresponding to the subscriber
*@param url of the subscriber
*
*/
void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url);
/**
* Report status change for a friend previously added to LinphoneCore.
* @param lc LinphoneCore
* @param lf updated LinphoneFriend
*/
void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf);
/**
* invoked when a new text message is received
* @param lc LinphoneCore
* @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room.
* @param from LinphoneAddress from
* @param message incoming message
*/
void textReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, String message);
/**
* invoked when a new linphone chat message is received
* @param lc LinphoneCore
* @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room.
* @param message incoming linphone chat message message
*/
void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message);
public interface LinphoneListener extends LinphoneCoreListener,
LinphoneRemoteProvisioningListener, LinphoneMessageListener, LinphoneCallStateListener,
LinphoneCallEncryptionStateListener, LinphoneNotifyListener, LinphoneComposingListener,
LinphoneGlobalStateListener, LinphoneRegistrationStateListener {
/**< Ask the application some authentication information
* @return */
void authInfoRequested(LinphoneCore lc, String realm, String username, String Domain);
/**
* invoked when a composing notification is received
* @param lc LinphoneCore
* @param room LinphoneChatRoom involved in the conversation.
*/
void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr);
/**
* Call stats notification
*/
void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats);
/**
* invoked when a new dtmf is received
* @param lc LinphoneCore
* @param call LinphoneCall involved in the dtmf sending
* @param dtmf value of the dtmf sent
*/
void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf);
/**
* Invoked when echo cancalation calibration is completed
* @param lc LinphoneCore
* @param status
* @param delay_ms echo delay
* @param data
*/
void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data);
/**
* Report Notified message received for this identity.
* @param lc LinphoneCore
* @param call LinphoneCall in case the notify is part of a dialog, may be null
* @param from LinphoneAddress the message comes from
* @param event String the raw body of the notify event.
*
*/
void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event);
/**
* Reports that a new subscription request has been received and wait for a decision.
*Status on this subscription request is notified by changing policy for this friend
*@param lc LinphoneCore
*@param lf LinphoneFriend corresponding to the subscriber
*@param url of the subscriber
*
*/
void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url);
/**
* Notifies progress of a call transfer.
* @param lc the LinphoneCore
* @param call the call through which the transfer was sent.
* @param new_call_state the state of the call resulting of the transfer, at the other party.
**/
void transferState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State new_call_state);
/**
* Notifies an incoming INFO message.
* @param lc the LinphoneCore.
* @param info the info message
*/
void infoReceived(LinphoneCore lc, LinphoneCall call, LinphoneInfoMessage info);
/**
* Notifies of subscription requests state changes, including new incoming subscriptions.
* @param lc the LinphoneCore
* @param ev LinphoneEvent object representing the subscription context.
* @param state actual state of the subscription.
*/
void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev, SubscriptionState state);
/**
* Notifies of an incoming NOTIFY received.
* @param lc the linphoneCore
* @param ev a LinphoneEvent representing the subscription context for which this notify belongs, or null if it is a NOTIFY out of of any subscription.
* @param eventName the event name
* @param content content of the NOTIFY request.
*/
void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content);
/**
* Notifies about outgoing generic publish states.
* @param lc the LinphoneCore
* @param ev a LinphoneEvent representing the publish, typically created by {@link LinphoneCore#publish}
* @param state the publish state
*/
void publishStateChanged(LinphoneCore lc, LinphoneEvent ev, PublishState state);
/**
* Notifies the changes about the remote provisioning step
* @param lc the LinphoneCore
* @param state the RemoteProvisioningState
* @param message the error message if state == Failed
*/
void configuringStatus(LinphoneCore lc, RemoteProvisioningState state,
String message);
/**< @Deprecated Notifies the application that it should show up
* @return */
void show(LinphoneCore lc);
/**< @Deprecated Callback that notifies various events with human readable text.
* @return */
void displayStatus(LinphoneCore lc,String message);
/**
* Report status change for a friend previously added to LinphoneCore.
* @param lc LinphoneCore
* @param lf updated LinphoneFriend
*/
void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf);
/**< @Deprecated Callback to display a message to the user
* @return */
void displayMessage(LinphoneCore lc,String message);
/**
* invoked when a new text message is received
* @param lc LinphoneCore
* @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room.
* @param from LinphoneAddress from
* @param message incoming message
*/
void textReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, String message);
/**
* invoked when a new dtmf is received
* @param lc LinphoneCore
* @param call LinphoneCall involved in the dtmf sending
* @param dtmf value of the dtmf sent
*/
void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf);
/**
* Invoked when echo cancalation calibration is completed
* @param lc LinphoneCore
* @param status
* @param delay_ms echo delay
* @param data
*/
void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data);
/**
* Report Notified message received for this identity.
* @param lc LinphoneCore
* @param call LinphoneCall in case the notify is part of a dialog, may be null
* @param from LinphoneAddress the message comes from
* @param event String the raw body of the notify event.
*
*/
void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event);
/** @Deprecated Callback to display a warning to the user
* @return */
void displayWarning(LinphoneCore lc,String message);
/**
* Notifies progress of a call transfer.
* @param lc the LinphoneCore
* @param call the call through which the transfer was sent.
* @param new_call_state the state of the call resulting of the transfer, at the other party.
**/
void transferState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State new_call_state);
/**
* Notifies an incoming INFO message.
* @param lc the LinphoneCore.
* @param info the info message
*/
void infoReceived(LinphoneCore lc, LinphoneCall call, LinphoneInfoMessage info);
/**
* Notifies of subscription requests state changes, including new incoming subscriptions.
* @param lc the LinphoneCore
* @param ev LinphoneEvent object representing the subscription context.
* @param state actual state of the subscription.
*/
void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev, SubscriptionState state);
/**
* Notifies about outgoing generic publish states.
* @param lc the LinphoneCore
* @param ev a LinphoneEvent representing the publish, typically created by {@link LinphoneCore#publish}
* @param state the publish state
*/
void publishStateChanged(LinphoneCore lc, LinphoneEvent ev, PublishState state);
/**< @Deprecated Notifies the application that it should show up
* @return */
void show(LinphoneCore lc);
/**< @Deprecated Callback that notifies various events with human readable text.
* @return */
void displayStatus(LinphoneCore lc,String message);
/**< @Deprecated Callback to display a message to the user
* @return */
void displayMessage(LinphoneCore lc,String message);
/** @Deprecated Callback to display a warning to the user
* @return */
void displayWarning(LinphoneCore lc,String message);
/**
* Callback to be notified about the transfer progress.
* @param lc the LinphoneCore
* @param message the LinphoneChatMessage
* @param content the LinphoneContent
* @param progress percentage of the transfer done
*/
void fileTransferProgressIndication(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, int progress);
/**
* Callback to be notified when new data has been received
* @param lc the LinphoneCore
* @param message the LinphoneChatMessage
* @param content the LinphoneContent
* @param buffer
* @param size
*/
void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, byte[] buffer, int size);
/**
* Callback to be notified when new data needs to be sent
* @param lc the LinphoneCore
* @param message the LinphoneChatMessage
* @param content the LinphoneContent
* @param buffer
* @param size
* @return the number of bytes written into buffer
*/
int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, ByteBuffer buffer, int size);
}
/**
* Callback to be notified about the transfer progress.
* @param lc the LinphoneCore
* @param message the LinphoneChatMessage
* @param content the LinphoneContent
* @param progress percentage of the transfer done
*/
void fileTransferProgressIndication(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, int progress);
public interface LinphoneGlobalStateListener extends LinphoneCoreListener {
/** General State notification
* @param state LinphoneCore.State
* @return
* */
void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message);
}
/**
* Callback to be notified when new data has been received
* @param lc the LinphoneCore
* @param message the LinphoneChatMessage
* @param content the LinphoneContent
* @param buffer
* @param size
*/
void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, byte[] buffer, int size);
public interface LinphoneRegistrationStateListener extends LinphoneCoreListener {
/**
* Registration state notification
* */
void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage);
}
/**
* Callback to be notified when new data needs to be sent
* @param lc the LinphoneCore
* @param message the LinphoneChatMessage
* @param content the LinphoneContent
* @param buffer
* @param size
* @return the number of bytes written into buffer
*/
int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message, LinphoneContent content, ByteBuffer buffer, int size);
public interface LinphoneRemoteProvisioningListener extends LinphoneCoreListener {
/**
* Notifies the changes about the remote provisioning step
* @param lc the LinphoneCore
* @param state the RemoteProvisioningState
* @param message the error message if state == Failed
*/
void configuringStatus(LinphoneCore lc, RemoteProvisioningState state, String message);
}
public interface LinphoneMessageListener extends LinphoneCoreListener {
/**
* invoked when a new linphone chat message is received
* @param lc LinphoneCore
* @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room.
* @param message incoming linphone chat message message
*/
void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message);
}
public interface LinphoneCallStateListener extends LinphoneCoreListener {
/** Call State notification
* @param state LinphoneCall.State
* @return
* */
void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message);
}
public interface LinphoneCallEncryptionStateListener extends LinphoneCoreListener {
/**
* Callback to display change in encryption state.
* @param encrypted true if all streams of the call are encrypted
* @param authenticationToken token like ZRTP SAS that may be displayed to user
*/
void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, boolean encrypted, String authenticationToken);
}
public interface LinphoneNotifyListener extends LinphoneCoreListener {
/**
* Notifies of an incoming NOTIFY received.
* @param lc the linphoneCore
* @param ev a LinphoneEvent representing the subscription context for which this notify belongs, or null if it is a NOTIFY out of of any subscription.
* @param eventName the event name
* @param content content of the NOTIFY request.
*/
void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content);
}
public interface LinphoneComposingListener extends LinphoneCoreListener {
/**
* invoked when a composing notification is received
* @param lc LinphoneCore
* @param room LinphoneChatRoom involved in the conversation.
*/
void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr);
}
}

View file

@ -35,11 +35,13 @@ public class LinphoneAddressImpl implements LinphoneAddress {
private native String getUserName(long ptr);
private native String getDomain(long ptr);
private native int getTransport(long ptr);
private native int getPort(long ptr);
private native String toUri(long ptr);
private native void setDisplayName(long ptr,String name);
private native void setDomain(long ptr,String domain);
private native void setUserName(long ptr,String username);
private native void setTransport(long ptr, int transport);
private native void setPort(long ptr, int port);
private native String toString(long ptr);
protected LinphoneAddressImpl(String identity) throws LinphoneCoreException{
@ -89,40 +91,33 @@ public class LinphoneAddressImpl implements LinphoneAddress {
public TransportType getTransport() {
return TransportType.fromInt(getTransport(nativePtr));
}
public String toString() {
public int getPort() { return getPort(nativePtr); }
public String toString() {
return toString(nativePtr);
}
public String toUri() {
return toUri(nativePtr);
}
public String asString() {
return toString();
}
public String asStringUriOnly() {
return toUri(nativePtr);
}
public void clean() {
throw new RuntimeException("Not implemented");
}
public void setDisplayName(String name) {
setDisplayName(nativePtr,name);
}
public String asString() {
return toString();
}
public String asStringUriOnly() {
return toUri(nativePtr);
}
public void clean() {
throw new RuntimeException("Not implemented");
}
public String getPort() {
return String.valueOf(getPortInt());
}
public int getPortInt() {
return getPortInt();
}
public void setDomain(String domain) {
setDomain(nativePtr, domain);
}
public void setPort(String port) {
throw new RuntimeException("Not implemented");
}
public void setPortInt(int port) {
throw new RuntimeException("Not implemented");
}
public void setPort(int port) { setPort(nativePtr, port); }
public void setUserName(String username) {
setUserName(nativePtr,username);
}

View file

@ -1,8 +1,10 @@
package org.linphone.core;
import java.io.UnsupportedEncodingException;
public class LinphoneChatMessageImpl implements LinphoneChatMessage {
protected final long nativePtr;
private native String getText(long ptr);
private native byte[] getText(long ptr);
private native long getPeerAddress(long ptr);
private native String getExternalBodyUrl(long ptr);
private native void setExternalBodyUrl(long ptr, String url);
@ -25,7 +27,12 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage {
@Override
public String getText() {
return getText(nativePtr);
try {
return new String(getText(nativePtr), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
@Override

View file

@ -1291,4 +1291,26 @@ class LinphoneCoreImpl implements LinphoneCore {
return null;
}
}
private native void addListener(long nativePtr, LinphoneCoreListener listener);
@Override
public void addListener(LinphoneCoreListener listener) {
addListener(nativePtr, listener);
}
private native void removeListener(long nativePtr, LinphoneCoreListener listener);
@Override
public void removeListener(LinphoneCoreListener listener) {
removeListener(nativePtr, listener);
}
private native void setRemoteRingbackTone(long nativePtr, String file);
@Override
public void setRemoteRingbackTone(String file) {
setRemoteRingbackTone(nativePtr,file);
}
private native String getRemoteRingbackTone(long nativePtr);
@Override
public String getRemoteRingbackTone() {
return getRemoteRingbackTone(nativePtr);
}
}

View file

@ -5,8 +5,12 @@
AC_DEFUN([LP_CHECK_READLINE],[
AC_ARG_WITH( readline,
[ --with-readline Set prefix where gnu readline headers and libs can be found (ex:/usr, /usr/local, none) [default=/usr] ],
[ readline_prefix=${withval}],[ readline_prefix="/usr" ])
[ --with-readline Set prefix where gnu readline headers and libs can be found (ex:/usr, /usr/local, none) [default=/usr] ],
[ readline_prefix=${withval} ],
[ readline_prefix="/usr/local" ],
[ readline_prefix="/opt/local" ],
[ readline_prefix="/usr" ]
)
if test "$readline_prefix" != "none"; then
@ -14,14 +18,14 @@ if test "$readline_prefix" != "none"; then
READLINE_CFLAGS="-I$readline_prefix/include"
READLINE_LIBS="-L$readline_prefix/lib"
fi
CPPFLAGS_save=$CPPFLAGS
LIBS_save=$LIBS
CPPFLAGS="$CPPFLAGS $READLINE_CFLAGS"
LIBS="$LIBS $READLINE_LIBS"
AC_CHECK_HEADERS(readline.h readline/readline.h, readline_h_found=yes)
AC_CHECK_HEADERS(history.h readline/history.h)
for termcap_lib in "" -ltermcap -lcurses -lncurses; do
unset ac_cv_lib_readline_readline
AC_CHECK_LIB(readline, readline, [readline_libs_found=yes],[],[$termcap_lib])
@ -33,14 +37,14 @@ if test "$readline_prefix" != "none"; then
LIBS=$LIBS_save
CPPFLAGS=$CPPFLAGS_save
if test "$readline_libs_found$readline_h_found" != "yesyes" ; then
AC_MSG_WARN([Could not find libreadline headers or library, linphonec will have limited prompt features])
else
AC_DEFINE([HAVE_READLINE],1,[defined when compiling with readline support])
fi
AC_SUBST(READLINE_CFLAGS)
AC_SUBST(READLINE_LIBS)

@ -1 +1 @@
Subproject commit dd1d93944369d5e19808109ea94b51f28b0e5a92
Subproject commit 6ef87545afabc2f66e28b1092bc490cbe7a994c3

2
oRTP

@ -1 +1 @@
Subproject commit 29802b08dac2de2f320db28249d5d459a47507e8
Subproject commit 1ad38563419acb9665af4bf65543ccdcfd76fda6

64
pixmaps/CMakeLists.txt Normal file
View file

@ -0,0 +1,64 @@
############################################################################
# CMakeLists.txt
# Copyright (C) 2014 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(PIXMAPS
active_chat.png
addcall-green.png
call.png
call_status_incoming.png
call_status_outgoing.png
chat_message_delivered.png
chat_message_inprogress.png
chat_message_not_delivered.png
chat.png
composing_active_chat.png
composing_chat.png
contact-orange.png
contact_starred.png
contact_unstarred.png
dialer-orange.png
dialer.png
history-orange.png
hold_off.png
hold_on.png
linphone-banner.png
linphone.icns
linphone.png
mic_active.png
mic_muted.png
notok.png
ok.png
speaker.png
startcall-green.png
startcall-small.png
status-green.png
status-offline.png
status-orange.png
status-red.png
stopcall-red.png
stopcall-small.png
)
install(FILES ${PIXMAPS}
DESTINATION ${PACKAGE_DATA_DIR}/pixmaps/linphone
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)

33
po/CMakeLists.txt Normal file
View file

@ -0,0 +1,33 @@
############################################################################
# CMakeLists.txt
# Copyright (C) 2014 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.
#
############################################################################
if(GETTEXT_FOUND)
string(REPLACE " " ";" LANGUAGES ${LINPHONE_ALL_LANGS})
foreach(language ${LANGUAGES})
GETTEXT_PROCESS_PO_FILES(${language} ALL PO_FILES ${language}.po)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${language}.gmo
DESTINATION ${PACKAGE_LOCALE_DIR}/${language}/LC_MESSAGES
RENAME linphone.mo
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endforeach()
endif()

View file

@ -40,3 +40,5 @@ coreapi/proxy.c
coreapi/callbacks.c
coreapi/linphonecall.c
coreapi/call_log.c
gtk/videowindow.c

View file

@ -48,3 +48,6 @@ mediastreamer2/src/videofilters/winvideo2.c
mediastreamer2/src/videofilters/x11video.c
mediastreamer2/src/voip/ice.c
build/vsx/LibLinphoneTester-wp8/LibLinphoneTester-wp8/Resources/AppResources.Designer.cs
build/wp8/LibLinphoneTester-wp8/Resources/AppResources.Designer.cs
mediastreamer2/build/wp8/mediastreamer2-tester-wp8/Resources/AppResources.Designer.cs
share/linphone.desktop.in

View file

@ -1,13 +1,12 @@
How to add a translation file
*****************************
To add a translation file in linphone project you should first :
- change the variable ALL_LINGUAS in configure.ac by adding the language (ex: fr)
- then add the file .po in the directory /po
- add the file .po in the directory /po
- run ./autogen.sh
Update the translation files
Update the translation files
***************************
To update all the translation files, in the directory /po run the following command
To update all the translation files, in the directory /po run the following command
$ make update-po

2033
po/ar.po Normal file

File diff suppressed because it is too large Load diff

View file

1481
po/cs.po

File diff suppressed because it is too large Load diff

1741
po/de.po

File diff suppressed because it is too large Load diff

1582
po/es.po

File diff suppressed because it is too large Load diff

705
po/fr.po

File diff suppressed because it is too large Load diff

842
po/he.po

File diff suppressed because it is too large Load diff

1145
po/hu.po

File diff suppressed because it is too large Load diff

1176
po/it.po

File diff suppressed because it is too large Load diff

1604
po/ja.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

1501
po/nl.po

File diff suppressed because it is too large Load diff

1200
po/pl.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

630
po/ru.po

File diff suppressed because it is too large Load diff

1061
po/sr.po

File diff suppressed because it is too large Load diff

1167
po/sv.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -20,13 +20,52 @@
#
############################################################################
install(FILES archived-rootca.pem
RENAME rootca.pem
DESTINATION share/linphone
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
if(APPLE)
find_program(OPENSSL_PROGRAM openssl)
execute_process(
COMMAND ${OPENSSL_PROGRAM} version -d
OUTPUT_VARIABLE OPENSSL_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX REPLACE "OPENSSLDIR: \"(.*)\"" "\\1" HTTPS_CA_DIR "${OPENSSL_VERSION}")
endif()
install(FILES ringback.wav
DESTINATION share/sounds/linphone
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/rootca.pem PROPERTIES GENERATED TRUE)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/rootca.pem
COMMAND ${CMAKE_COMMAND} -DHTTPS_CA_DIR=${HTTPS_CA_DIR} -DWORK_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/rootca.cmake)
add_custom_target(rootca ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/rootca.pem)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rootca.pem
DESTINATION ${PACKAGE_DATA_DIR}/linphone
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
set(SOUND_FILES
hello16000.wav
hello8000.wav
incoming_chat.wav
ringback.wav
)
install(FILES ${SOUND_FILES}
DESTINATION ${PACKAGE_SOUND_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
if(ENABLE_GTK_UI)
set(prefix "${CMAKE_INSTALL_PREFIX}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/audio-assistant.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/audio-assistant.desktop)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/linphone.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/linphone.desktop)
set(FREEDESKTOP_FILES
${CMAKE_CURRENT_BINARY_DIR}/audio-assistant.desktop
${CMAKE_CURRENT_BINARY_DIR}/linphone.desktop
)
install(FILES ${FREEDESKTOP_FILES}
DESTINATION ${PACKAGE_FREEDESKTOP_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
add_subdirectory(rings)

View file

@ -6,6 +6,6 @@ Comment[fr]=Assistant audio de Linphone.
Comment[ru]=Помощник аудио Linphone
Type=Application
Exec=linphone --run-audio-assistant
Icon=/usr/local/share/pixmaps/linphone/linphone.png
Icon=@prefix@/share/pixmaps/linphone/linphone.png
Terminal=false
Categories=Network;Telephony;

View file

@ -1,47 +1,25 @@
[Desktop Entry]
Name=Linphone
Comment=Linphone is a web-phone
Comment[fr]=Linphone est un web-phone.
Comment[de]=Linphone ist ein web-phone.
Comment[af]=Linphone is 'n webtelefoon
Comment[sq]=Linphone është një telefon interneti
Comment[ast]=Linphone ye un teléfonu web
Comment[bn]=Linphone ি
Comment[bs]=Linphone je mrežni telefon
Comment[pt_BR]=Linphone é um telefone web
Comment[bg]=Linphone е уеб телефон
Comment[ca@valencia]=El Linphone és un telèfon web
Comment[ca]=El Linphone és un telèfon web
Comment[zh_HK]=Linphone (web-phone)
Comment[zh_TW]=Linphone (web-phone)
Comment[zh_CN]=Linphone
Comment[crh]=Linphone bir web-telefonudur
Comment[nl]=Linphone is een webtelefoon
Comment[da]=Linphone er en nettelefon
Comment[cs]=Linphone webový telefon
Comment[fi]=Linphone on verkkopuhelin
Comment[gl]=Linphone é un teléfono-web
Comment[el]=Το Linphone είναι ένα διαδικτυακό τηλέφωνο
Comment[hu]=A Linphone egy webes telefon
Comment[is]=Linphone er vefsími
Comment[it]=Linphone è un telefono web
Comment[ja]=Linphone
Comment[ky]=Linphone - бул веб - телефон
Comment[ms]=Linphone adalah telefon-sesawang
Comment[oc]=Linphone es una aisina de telefonia IP
Comment[pl]=Rozbudowany telefon internetowy z funkcją wideorozmowy
Comment[nb]=Lintelefon er en nett-telefon
Comment[pt]=Linphone é um telefone da internet
Comment[ro]=Linphone este un telefon web
Comment[ru]=Linphone это веб-телефон
Comment[sl]=Linphone je spletni telefon
Comment[sv]=Webbtelefon
Comment[es]=Linphone es un teléfono web
Comment[vi]=Linphone là mt đin thoi web
Comment[uk]=Інтернет-телефон
Comment[tr]=Linphone bir web-telefonudur
Type=Application
Exec=linphone
Icon=@prefix@/share/pixmaps/linphone/linphone.png
Terminal=false
Categories=Network;Telephony;
# Translations
Name[de]=Linphone
Name[he]=Linphone
Name[ar]=لِنْفُونْ
Name[hu]=Linphone
Name[ru]=Linphone
Name[nb_NO]=Linphone
Name[it]=Linphone
Name[ja]=Linphone
Name[cs]=Linphone
Name[sr]=Линфон
Name[sv]=Linphone
Name[zh_CN]=Linphone
Name[fr]=Linphone
Name[zh_TW]=Linphone

View file

@ -20,7 +20,20 @@
#
############################################################################
install(FILES oldphone.wav toy-mono.wav
COMPONENT COMP_liblinphone
DESTINATION share/sounds/linphone/rings
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
set(RING_FILES
bigben.wav
oldphone-mono-30s.caf
oldphone-mono.wav
oldphone.wav
orig.wav
rock.wav
sweet.wav
synth.wav
tapping.wav
toy-mono.wav
)
install(FILES ${RING_FILES}
DESTINATION ${PACKAGE_RING_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)

40
share/rootca.cmake Normal file
View file

@ -0,0 +1,40 @@
############################################################################
# rootca.cmake
# Copyright (C) 2014 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.
#
############################################################################
if(HTTPS_CA_DIR)
set(ENV{HTTPS_CA_DIR} "${HTTPS_CA_DIR}")
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove "fresh-rootca.pem"
WORKING_DIRECTORY ${OUTPUT_DIR}
)
execute_process(
COMMAND "../scripts/mk-ca-bundle.pl" "${OUTPUT_DIR}/fresh-rootca.pem"
WORKING_DIRECTORY ${WORK_DIR}
)
if(EXISTS "${OUTPUT_DIR}/fresh-rootca.pem")
file(RENAME "${OUTPUT_DIR}/fresh-rootca.pem" "${OUTPUT_DIR}/rootca.pem")
else()
file(COPY "${WORK_DIR}/archived-rootca.pem" DESTINATION "${OUTPUT_DIR}")
file(RENAME "${OUTPUT_DIR}/archived-rootca.pem" "${OUTPUT_DIR}/rootca.pem")
endif()

46
tester/CMakeLists.txt Normal file
View file

@ -0,0 +1,46 @@
############################################################################
# CMakeLists.txt
# Copyright (C) 2014 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(SOURCE_FILES
accountmanager.c
call_tester.c
dtmf_tester.c
eventapi_tester.c
flexisip_tester.c
liblinphone_tester.c
log_collection_tester.c
message_tester.c
player_tester.c
presence_tester.c
quality_reporting_tester.c
register_tester.c
remote_provisioning_tester.c
setup_tester.c
stun_tester.c
tester.c
transport_tester.c
upnp_tester.c
)
add_executable(liblinphone_tester ${SOURCE_FILES})
target_include_directories(liblinphone_tester PUBLIC ${CUNIT_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester linphone ${CUNIT_LIBRARIES})

View file

@ -25,7 +25,8 @@ liblinphonetester_la_SOURCES = tester.c \
log_collection_tester.c \
transport_tester.c \
player_tester.c \
dtmf_tester.c
dtmf_tester.c \
accountmanager.c
liblinphonetester_la_LDFLAGS= -no-undefined
liblinphonetester_la_LIBADD= ../coreapi/liblinphone.la $(CUNIT_LIBS)
@ -44,7 +45,7 @@ endif
test: liblinphone_tester
./liblinphone_tester --config $(abs_srcdir)
./liblinphone_tester --config $(abs_srcdir) $(TEST_OPTIONS)
else !BUILD_CUNIT_TESTS

220
tester/accountmanager.c Normal file
View file

@ -0,0 +1,220 @@
/*
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 <http://www.gnu.org/licenses/>.
*/
#include "liblinphone_tester.h"
#include "private.h"
struct _Account{
LinphoneAddress *identity;
LinphoneAddress *modified_identity;
char *password;
int created;
int done;
int auth_requested;
};
typedef struct _Account Account;
Account *account_new(LinphoneAddress *identity, const char *unique_id){
char *modified_username;
Account *obj=ms_new0(Account,1);
/* we need to inhibit leak detector because the two LinphoneAddress will remain behond the scope of the test being run */
belle_sip_object_inhibit_leak_detector(TRUE);
obj->identity=linphone_address_clone(identity);
obj->password=sal_get_random_token(8);
obj->modified_identity=linphone_address_clone(identity);
modified_username=ms_strdup_printf("%s_%s",linphone_address_get_username(identity), unique_id);
linphone_address_set_username(obj->modified_identity, modified_username);
ms_free(modified_username);
belle_sip_object_inhibit_leak_detector(FALSE);
return obj;
};
void account_destroy(Account *obj){
linphone_address_unref(obj->identity);
linphone_address_unref(obj->modified_identity);
ms_free(obj->password);
ms_free(obj);
}
struct _AccountManager{
char *unique_id;
MSList *accounts;
};
typedef struct _AccountManager AccountManager;
static AccountManager *the_am=NULL;
AccountManager *account_manager_get(void){
if (the_am==NULL){
the_am=ms_new0(AccountManager,1);
the_am->unique_id=sal_get_random_token(6);
}
return the_am;
}
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);
ms_free(the_am);
}
the_am=NULL;
}
Account *account_manager_get_account(AccountManager *m, const LinphoneAddress *identity){
MSList *it;
for(it=m->accounts;it!=NULL;it=it->next){
Account *a=(Account*)it->data;
if (linphone_address_weak_equal(a->identity,identity)){
return a;
}
}
return NULL;
}
static void account_created_on_server_cb(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *info){
Account *account=(Account*)linphone_core_get_user_data(lc);
switch(state){
case LinphoneRegistrationOk:
account->created=1;
break;
case LinphoneRegistrationCleared:
account->done=1;
break;
default:
break;
}
}
static void account_created_auth_requested_cb(LinphoneCore *lc, const char *username, const char *realm, const char *domain){
Account *account=(Account*)linphone_core_get_user_data(lc);
account->auth_requested=1;
}
void account_create_on_server(Account *account, const LinphoneProxyConfig *refcfg){
LinphoneCoreVTable vtable={0};
LinphoneCore *lc;
LinphoneAddress *tmp_identity=linphone_address_clone(account->modified_identity);
LinphoneProxyConfig *cfg;
LinphoneAuthInfo *ai;
char *tmp;
LinphoneAddress *server_addr;
LCSipTransports tr;
vtable.registration_state_changed=account_created_on_server_cb;
vtable.auth_info_requested=account_created_auth_requested_cb;
lc=configure_lc_from(&vtable,liblinphone_tester_file_prefix,NULL,account);
tr.udp_port=LC_SIP_TRANSPORT_RANDOM;
tr.tcp_port=LC_SIP_TRANSPORT_RANDOM;
tr.tls_port=LC_SIP_TRANSPORT_RANDOM;
linphone_core_set_sip_transports(lc,&tr);
cfg=linphone_core_create_proxy_config(lc);
linphone_address_set_password(tmp_identity,account->password);
linphone_address_set_header(tmp_identity,"X-Create-Account","yes");
tmp=linphone_address_as_string(tmp_identity);
linphone_proxy_config_set_identity(cfg,tmp);
ms_free(tmp);
linphone_address_unref(tmp_identity);
server_addr=linphone_address_new(linphone_proxy_config_get_server_addr(refcfg));
linphone_address_set_transport(server_addr,LinphoneTransportTcp); /*use tcp for account creation*/
linphone_address_set_port(server_addr,0);
tmp=linphone_address_as_string(server_addr);
linphone_proxy_config_set_server_addr(cfg,tmp);
ms_free(tmp);
linphone_address_unref(server_addr);
linphone_proxy_config_set_expires(cfg,3600);
linphone_core_add_proxy_config(lc,cfg);
if (wait_for_until(lc,NULL,&account->auth_requested,1,10000)==FALSE){
ms_fatal("Account for %s could not be created on server.", linphone_proxy_config_get_identity(refcfg));
}
linphone_proxy_config_edit(cfg);
tmp=linphone_address_as_string(account->modified_identity);
linphone_proxy_config_set_identity(cfg,tmp); /*remove the X-Create-Account header*/
ms_free(tmp);
linphone_proxy_config_done(cfg);
ai=linphone_auth_info_new(linphone_address_get_username(account->modified_identity),
NULL,
account->password,NULL,NULL,linphone_address_get_domain(account->modified_identity));
linphone_core_add_auth_info(lc,ai);
linphone_auth_info_destroy(ai);
if (wait_for_until(lc,NULL,&account->created,1,3000)==FALSE){
ms_fatal("Account for %s is not working on server.", linphone_proxy_config_get_identity(refcfg));
}
linphone_core_remove_proxy_config(lc,cfg);
linphone_proxy_config_unref(cfg);
if (wait_for_until(lc,NULL,&account->done,1,3000)==FALSE){
ms_error("Account creation could not clean the registration context.");
}
linphone_core_destroy(lc);
}
LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyConfig *cfg){
LinphoneCore *lc=linphone_proxy_config_get_core(cfg);
const char *identity=linphone_proxy_config_get_identity(cfg);
LinphoneAddress *id_addr=linphone_address_new(identity);
Account *account=account_manager_get_account(m,id_addr);
LinphoneAuthInfo *ai;
char *tmp;
bool_t create_account=FALSE;
if (!account){
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);
}
tmp=linphone_address_as_string(account->modified_identity);
linphone_proxy_config_set_identity(cfg,tmp);
ms_free(tmp);
if (create_account){
account_create_on_server(account,cfg);
}
ai=linphone_auth_info_new(linphone_address_get_username(account->modified_identity),
NULL,
account->password,NULL,NULL,linphone_address_get_domain(account->modified_identity));
linphone_core_add_auth_info(lc,ai);
linphone_auth_info_destroy(ai);
linphone_address_unref(id_addr);
return account->modified_identity;
}
void linphone_core_manager_check_accounts(LinphoneCoreManager *m){
const MSList *it;
AccountManager *am=account_manager_get();
for(it=linphone_core_get_proxy_config_list(m->lc);it!=NULL;it=it->next){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig *)it->data;
LinphoneAddress *modified_identity=account_manager_check_account(am,cfg);
if (m->identity){
linphone_address_unref(m->identity);
}
m->identity=linphone_address_ref(modified_identity);
}
}

View file

@ -79,6 +79,16 @@ void call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState
CU_FAIL("unexpected event");break;
}
}
void call_stats_updated(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallStats *lstats) {
stats* counters = get_stats(lc);
if (lstats->updated == LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE) {
counters->number_of_rtcp_received++;
} else if (lstats->updated == LINPHONE_CALL_STATS_SENT_RTCP_UPDATE) {
counters->number_of_rtcp_sent++;
}
}
void linphone_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token) {
char* to=linphone_address_as_string(linphone_call_get_call_log(call)->to);
char* from=linphone_address_as_string(linphone_call_get_call_log(call)->from);
@ -196,9 +206,6 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr
CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(caller_mgr->lc,callee_mgr->identity,caller_params));
}
/*linphone_core_invite(caller_mgr->lc,"pauline");*/
did_received_call = wait_for(callee_mgr->lc
,caller_mgr->lc
,&callee_mgr->stat.number_of_LinphoneCallIncomingReceived
@ -361,9 +368,13 @@ static void direct_call_over_ipv6(){
if (liblinphone_tester_ipv6_available()){
LCSipTransports pauline_transports;
LinphoneAddress* pauline_dest = linphone_address_new("sip:[::1];transport=tcp");
char hellopath[256];
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new( "pauline_tcp_rc");
/*use playfile for callee to avoid locking on capture card*/
snprintf(hellopath,sizeof(hellopath), "%s/sounds/hello8000.wav", liblinphone_tester_file_prefix);
linphone_core_set_play_file(pauline->lc,hellopath);
linphone_core_use_files (pauline->lc,TRUE);
linphone_core_enable_ipv6(marie->lc,TRUE);
@ -374,7 +385,7 @@ static void direct_call_over_ipv6(){
CU_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 2, 2000));
CU_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk, 2, 2000));
#endif
linphone_core_get_sip_transports_used(pauline->lc,&pauline_transports);
linphone_address_set_port(pauline_dest,pauline_transports.tcp_port);
linphone_core_invite_address(marie->lc,pauline_dest);
@ -627,7 +638,7 @@ static void simple_call_compatibility_mode(void) {
CU_ASSERT_TRUE (wait_for(lc_marie,lc_marie,&stat_marie->number_of_LinphoneRegistrationOk,1));
linphone_core_invite(lc_marie,"pauline");
linphone_core_invite_address(lc_marie,pauline->identity);
CU_ASSERT_TRUE (wait_for(lc_pauline,lc_marie,&stat_pauline->number_of_LinphoneCallIncomingReceived,1));
CU_ASSERT_TRUE(linphone_core_inc_invite_pending(lc_pauline));
@ -660,7 +671,7 @@ static void cancelled_call(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCall* out_call = linphone_core_invite(pauline->lc,"marie");
LinphoneCall* out_call = linphone_core_invite_address(pauline->lc,marie->identity);
linphone_call_ref(out_call);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1));
@ -705,10 +716,10 @@ static void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mi
static void call_failed_because_of_codecs(void) {
int begin,leaked_objects;
belle_sip_object_enable_leak_detector(TRUE);
begin=belle_sip_object_get_object_count();
{
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
@ -716,7 +727,7 @@ static void call_failed_because_of_codecs(void) {
disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1);
disable_all_audio_codecs_except_one(pauline->lc,"pcma",-1);
out_call = linphone_core_invite(pauline->lc,"marie");
out_call = linphone_core_invite_address(pauline->lc,marie->identity);
linphone_call_ref(out_call);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1));
@ -787,7 +798,7 @@ static void cancelled_ringing_call(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCall* out_call = linphone_core_invite(pauline->lc,"marie");
LinphoneCall* out_call = linphone_core_invite_address(pauline->lc,marie->identity);
linphone_call_ref(out_call);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallIncomingReceived,1));
@ -809,7 +820,7 @@ static void early_declined_call(void) {
LinphoneCall* out_call;
linphone_core_set_max_calls(marie->lc,0);
out_call = linphone_core_invite(pauline->lc,"marie");
out_call = linphone_core_invite_address(pauline->lc,marie->identity);
linphone_call_ref(out_call);
/*wait until flexisip transfers the busy...*/
@ -929,7 +940,7 @@ static bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee
linphone_core_iterate(callee->lc);
}
ms_usleep(20000);
}while(!liblinphone_tester_clock_elapsed(&ts,5000));
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
}
/*make sure encryption mode are preserved*/
@ -966,7 +977,6 @@ static void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager
CU_ASSERT_TRUE(call(pauline,marie));
if (callee_with_ice && caller_with_ice) {
check_ice(pauline,marie,LinphoneIceStateHostConnection);
/*wait for the ICE reINVITE to complete*/
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
@ -1136,51 +1146,57 @@ static void call_paused_resumed(void) {
linphone_core_manager_destroy(pauline);
}
#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*/ \
CU_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &pauline->stat.number_of_rtcp_sent, rtcp_count_current+1, 10000)); \
stats = rtp_session_get_stats(call_pauline->audiostream->ms.sessions.rtp_session); \
loss_percentage = stats->cum_packet_loss * 100.f / (stats->packet_recv + stats->cum_packet_loss); \
CU_ASSERT_TRUE(.75 * params.loss_rate < loss_percentage); \
CU_ASSERT_TRUE(loss_percentage < 1.25 * params.loss_rate)
static void call_paused_resumed_with_loss(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCall* call_pauline;
const rtp_stats_t * stats;
float loss_percentage;
int rtcp_count_current;
OrtpNetworkSimulatorParams params={0};
params.enabled=TRUE;
params.loss_rate=25;
params.loss_rate=20;
CU_ASSERT_TRUE(call(pauline,marie));
call_pauline = linphone_core_get_current_call(pauline->lc);
rtp_session_enable_network_simulation(call_pauline->audiostream->ms.sessions.rtp_session,&params);
rtp_session_enable_network_simulation(call_pauline->videostream->ms.sessions.rtp_session,&params);
wait_for_until(pauline->lc, marie->lc, NULL, 5, 4000);
/*generate some traffic*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 6000);
CHECK_CURRENT_LOSS_RATE();
/*pause call*/
linphone_core_pause_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1));
CU_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);
wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000);
CHECK_CURRENT_LOSS_RATE();
/*resume*/
linphone_core_resume_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
/*same here: wait a while for a bit of a traffic, we need to receive a RTCP packet*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000);
wait_for_until(pauline->lc, marie->lc, NULL, 5, 6000);
/*since stats are NOT totally reset during pause, the stats->packet_recv is computed from
the start of call. This test ensures that the loss rate is consistent during the entire call.*/
stats = rtp_session_get_stats(call_pauline->sessions->rtp_session);
CU_ASSERT_TRUE(((stats->cum_packet_loss * 100.f / stats->packet_recv) / params.loss_rate) > .5f);
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
CHECK_CURRENT_LOSS_RATE();
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@ -1611,7 +1627,7 @@ static void video_call_with_ice_no_matching_audio_codecs(void) {
linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
linphone_core_set_stun_server(pauline->lc, "stun.linphone.org");
out_call = linphone_core_invite(marie->lc, "pauline");
out_call = linphone_core_invite_address(marie->lc, pauline->identity);
linphone_call_ref(out_call);
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1));
@ -1804,6 +1820,7 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
/*use playfile for callee to avoid locking on capture card*/
linphone_core_use_files (laure->lc,TRUE);
linphone_core_use_files (marie->lc,TRUE);
snprintf(hellopath,sizeof(hellopath), "%s/sounds/hello8000.wav", liblinphone_tester_file_prefix);
linphone_core_set_play_file(laure->lc,hellopath);
if (enable_caller_privacy)
@ -1828,7 +1845,8 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
LinphoneCall *call=(LinphoneCall *)iterator->data;
if (call != pauline_called_by_marie) {
/*fine, this is the call waiting*/
linphone_core_accept_call(pauline->lc,pauline_called_by_laure=call);
pauline_called_by_laure=call;
linphone_core_accept_call(pauline->lc,pauline_called_by_laure);
}
}
@ -2001,6 +2019,7 @@ static void call_with_file_player(void) {
char hellopath[256];
char *recordpath = create_filepath(liblinphone_tester_writable_dir_prefix, "record", "wav");
double similar;
const double threshold = 0.9;
/*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/
unlink(recordpath);
@ -2008,12 +2027,12 @@ static void call_with_file_player(void) {
snprintf(hellopath,sizeof(hellopath), "%s/sounds/hello8000.wav", liblinphone_tester_file_prefix);
/*caller uses files instead of soundcard in order to avoid mixing soundcard input with file played using call's player*/
linphone_core_use_files(pauline->lc,TRUE);
linphone_core_set_play_file(pauline->lc,NULL);
linphone_core_use_files(marie->lc,TRUE);
linphone_core_set_play_file(marie->lc,NULL);
/*callee is recording and plays file*/
linphone_core_use_files(pauline->lc,TRUE);
linphone_core_set_play_file(pauline->lc,hellopath);
linphone_core_set_play_file(pauline->lc,NULL);
linphone_core_set_record_file(pauline->lc,recordpath);
CU_ASSERT_TRUE(call(marie,pauline));
@ -2031,8 +2050,11 @@ static void call_with_file_player(void) {
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(ms_audio_diff(hellopath,recordpath,&similar,NULL,NULL)==0);
CU_ASSERT_TRUE(similar>0.9);
CU_ASSERT_TRUE(similar>threshold);
CU_ASSERT_TRUE(similar<=1.0);
if(similar > threshold && similar <=1.0) {
remove(recordpath);
}
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
ms_free(recordpath);
@ -2054,6 +2076,7 @@ static void call_with_mkv_file_player(void) {
char hellowav[256];
char *recordpath;
double similar;
const double threshold = 0.9;
if (!is_format_supported(marie->lc,"mkv")){
ms_warning("Test skipped, no mkv support.");
@ -2079,7 +2102,12 @@ static void call_with_mkv_file_player(void) {
player=linphone_call_get_player(linphone_core_get_current_call(marie->lc));
CU_ASSERT_PTR_NOT_NULL(player);
if (player){
CU_ASSERT_TRUE(linphone_player_open(player,hellomkv,on_eof,marie)==0);
int res = linphone_player_open(player,hellomkv,on_eof,marie);
if(!ms_filter_codec_supported("opus")) {
CU_ASSERT_EQUAL(res, -1);
goto end;
}
CU_ASSERT_EQUAL(res, 0);
CU_ASSERT_TRUE(linphone_player_start(player)==0);
CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_player_eof,1,12000));
linphone_player_close(player);
@ -2090,8 +2118,11 @@ static void call_with_mkv_file_player(void) {
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(ms_audio_diff(hellowav,recordpath,&similar,NULL,NULL)==0);
CU_ASSERT_TRUE(similar>0.6);
CU_ASSERT_TRUE(similar>threshold);
CU_ASSERT_TRUE(similar<=1.0);
if(similar>threshold && similar<=1.0) {
remove(recordpath);
}
ms_free(recordpath);
end:
@ -2789,7 +2820,7 @@ static void call_established_with_rejected_reinvite_with_error(void) {
static void call_rejected_because_wrong_credentials_with_params(const char* user_agent,bool_t enable_auth_req_cb) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneAuthInfo* good_auth_info=linphone_auth_info_clone((LinphoneAuthInfo*)(linphone_core_get_auth_info_list(marie->lc)->data));
LinphoneAuthInfo* good_auth_info=linphone_auth_info_clone(linphone_core_find_auth_info(marie->lc,NULL,linphone_address_get_username(marie->identity),NULL));
LinphoneAuthInfo* wrong_auth_info=linphone_auth_info_clone(good_auth_info);
bool_t result=FALSE;
linphone_auth_info_set_passwd(wrong_auth_info,"passecretdutout");
@ -2822,7 +2853,7 @@ static void call_rejected_because_wrong_credentials_with_params(const char* user
/*to make sure unregister will work*/
linphone_core_clear_all_auth_info(marie->lc);
linphone_core_add_auth_info(marie->lc,good_auth_info);
linphone_auth_info_destroy(good_auth_info);
linphone_core_manager_destroy(marie);
}
@ -3091,6 +3122,7 @@ static void record_call(const char *filename, bool_t enableVideo) {
end_call(marie, pauline);
CU_ASSERT_EQUAL(access(filepath, F_OK), 0);
}
remove(filepath);
ms_free(filepath);
}
linphone_core_manager_destroy(marie);

View file

@ -29,10 +29,12 @@ void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf) {
*dst = *dst ?
ms_strcat_printf(*dst, "%c", dtmf)
: ms_strdup_printf("%c", dtmf);
counters->dtmf_count++;
}
void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtmf_seq) {
char* expected = NULL;
int dtmf_count_prev;
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new( "pauline_rc");
@ -46,19 +48,21 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm
marie_call = linphone_core_get_current_call(marie->lc);
if (dtmf != '\0') {
dtmf_count_prev = pauline->stat.dtmf_count;
linphone_call_send_dtmf(marie_call, dtmf);
/*wait for the DTMF to be received from pauline*/
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000);
CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev+1, 10000));
expected = ms_strdup_printf("%c", dtmf);
}
if (dtmf_seq != NULL) {
int dtmf_delay_ms = lp_config_get_int(marie_call->core->config,"net","dtmf_delay_ms",200);
dtmf_count_prev = pauline->stat.dtmf_count;
linphone_call_send_dtmfs(marie_call, dtmf_seq);
/*wait for the DTMF sequence to be received from pauline*/
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000 + dtmf_delay_ms * strlen(dtmf_seq));
CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev + strlen(dtmf_seq), 10000 + dtmf_delay_ms * strlen(dtmf_seq)));
expected = (dtmf!='\0')?ms_strdup_printf("%c%s",dtmf,dtmf_seq):ms_strdup(dtmf_seq);
}

View file

@ -40,7 +40,7 @@ const char *liblinphone_tester_get_notify_content(void){
void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content){
LinphoneCoreManager *mgr;
CU_ASSERT_PTR_NOT_NULL_FATAL(content);
CU_ASSERT_TRUE(strcmp(notify_content,(const char*)linphone_content_get_data(content))==0);
CU_ASSERT_TRUE(strcmp(notify_content,(const char*)linphone_content_get_buffer(content))==0);
mgr=get_manager(lc);
mgr->stat.number_of_NotifyReceived++;
}
@ -54,8 +54,7 @@ void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, Li
content = linphone_core_create_content(lc);
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"somexml2");
linphone_content_set_data(content,belle_sip_strdup(notify_content));
linphone_content_set_size(content,strlen(notify_content));
linphone_content_set_buffer(content,notify_content,strlen(notify_content));
ms_message("Subscription state [%s] from [%s]",linphone_subscription_state_to_string(state),from);
ms_free(from);
@ -134,8 +133,7 @@ static void subscribe_test_declined(void) {
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"somexml");
linphone_content_set_data(content,belle_sip_strdup(subscribe_content));
linphone_content_set_size(content,strlen(subscribe_content));
linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content));
pauline->decline_subscribe=TRUE;
@ -182,8 +180,7 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"somexml");
linphone_content_set_data(content,belle_sip_strdup(subscribe_content));
linphone_content_set_size(content,strlen(subscribe_content));
linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content));
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,content);
@ -236,8 +233,7 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"somexml");
linphone_content_set_data(content,belle_sip_strdup(subscribe_content));
linphone_content_set_size(content,strlen(subscribe_content));
linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content));
lev=linphone_core_create_subscribe(marie->lc,pauline->identity,"dodo",expires);
linphone_event_add_custom_header(lev,"My-Header","pouet");
@ -315,8 +311,7 @@ static void publish_test_with_args(bool_t refresh, int expires){
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"somexml");
linphone_content_set_data(content,belle_sip_strdup(subscribe_content));
linphone_content_set_size(content,strlen(subscribe_content));
linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content));
lp_config_set_int(marie->lc->config,"sip","refresh_generic_publish",refresh);

View file

@ -18,7 +18,7 @@ auto-respawn=true
# List of white space separated host names pointing to this machine.
# This is to prevent loops while routing SIP messages.
# Default value: localhost
aliases=localhost sipopen.example.org sip.example.org auth.example.org auth1.example.org auth2.example.org client.example.org
aliases=localhost sipopen.example.org sip.example.org auth.example.org auth1.example.org auth2.example.org client.example.org sip2.linphone.org
# List of white space separated SIP uris where the proxy must listen.Wildcard
# (*) can be used to mean 'all local ip addresses'. If 'transport'
@ -205,6 +205,15 @@ hashed-passwords=false
# Default value: false
new-auth-on-407=false
# Enable a feature useful for automatic tests, allowing a client
# to create a temporary account in the password database in memory.
# This MUST not be used for production as it is a real security
# hole.
# Default value: false
enable-test-accounts-creation=true
##
## ...
##

Some files were not shown because too many files have changed in this diff Show more