mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-29 17:29:20 +00:00
Merge branch 'master' into dev_glade_friendlist
This commit is contained in:
commit
aa4794c8b7
54 changed files with 2464 additions and 1285 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -92,3 +92,4 @@ tester/ZIDCache*.xml
|
|||
tester/stereo-record.wav
|
||||
.dirstamp
|
||||
git-clang-format.diff
|
||||
*.log
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ option(ENABLE_VIDEO "Build with video support." YES)
|
|||
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
|
||||
option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO)
|
||||
option(ENABLE_NLS "Build with internationalisation support" YES)
|
||||
option(ENABLE_CALL_LOGS_STORAGE "Turn on compilation of call logs storage." YES)
|
||||
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
|
@ -140,6 +141,9 @@ if(ENABLE_NLS)
|
|||
find_package(Intl REQUIRED)
|
||||
include_directories(${INTL_INCLUDE_DIRS})
|
||||
endif()
|
||||
if(ENABLE_CALL_LOGS_STORAGE)
|
||||
find_package(Sqlite3 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
include(CheckIncludeFiles)
|
||||
|
|
@ -162,6 +166,7 @@ endif()
|
|||
if(SQLITE3_FOUND)
|
||||
include_directories(${SQLITE3_INCLUDE_DIRS})
|
||||
add_definitions("-DMSG_STORAGE_ENABLED")
|
||||
add_definitions("-DCALL_LOGS_STORAGE_ENABLED")
|
||||
endif()
|
||||
if(ENABLE_TUNNEL)
|
||||
include_directories(${TUNNEL_INCLUDE_DIRS})
|
||||
|
|
|
|||
44
configure.ac
44
configure.ac
|
|
@ -132,7 +132,7 @@ AC_CONFIG_COMMANDS([libtool-hacking],
|
|||
|
||||
dnl Add the languages which your application supports here.
|
||||
PKG_PROG_PKG_CONFIG
|
||||
ALL_LINGUAS=$(cd po && echo *.po | sed 's/\.po//g')
|
||||
ALL_LINGUAS=$(cd $srcdir/po && echo *.po | sed 's/\.po//g')
|
||||
AC_SUBST(ALL_LINGUAS)
|
||||
AC_DEFINE_UNQUOTED(LINPHONE_ALL_LANGS, "$ALL_LINGUAS", [All supported languages])
|
||||
|
||||
|
|
@ -894,7 +894,7 @@ if test x$enable_msg_storage != xfalse; then
|
|||
AC_CHECK_LIB(sqlite3, sqlite3_open, [SQLITE3_LIBS+=" -lsqlite3 "; found_sqlite=yes], [foo=bar])
|
||||
fi
|
||||
if test "$found_sqlite" = "yes"; then
|
||||
SQLITE3_CFLAGS+="-DMSG_STORAGE_ENABLED"
|
||||
SQLITE3_CFLAGS+=" -DMSG_STORAGE_ENABLED"
|
||||
if test "$build_macos" = "yes" -o "$ios_found" = "yes"; then
|
||||
SQLITE3_LIBS+=" -liconv"
|
||||
fi
|
||||
|
|
@ -912,6 +912,41 @@ fi
|
|||
|
||||
AM_CONDITIONAL(BUILD_MSG_STORAGE, test x$enable_msg_storage = xtrue)
|
||||
|
||||
AC_ARG_ENABLE(call-logs-storage,
|
||||
[AS_HELP_STRING([--enable-call-logs-storage=[yes/no]], [Turn on compilation of call logs storage (default=auto)])],
|
||||
[case "${enableval}" in
|
||||
yes) enable_call_logs_storage=true ;;
|
||||
no) enable_call_logs_storage=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-call-logs-storage) ;;
|
||||
esac],
|
||||
[enable_call_logs_storage=auto]
|
||||
)
|
||||
|
||||
if test x$enable_call_logs_storage != xfalse; then
|
||||
PKG_CHECK_MODULES(SQLITE3,[sqlite3 >= 3.6.0],[found_sqlite=yes],[found_sqlite=no])
|
||||
if test "$found_sqlite" = "no"; then
|
||||
dnl Check the lib presence in case the PKG-CONFIG version is not found
|
||||
AC_CHECK_LIB(sqlite3, sqlite3_open, [SQLITE3_LIBS+=" -lsqlite3 "; found_sqlite=yes], [foo=bar])
|
||||
fi
|
||||
if test "$found_sqlite" = "yes"; then
|
||||
SQLITE3_CFLAGS+=" -DCALL_LOGS_STORAGE_ENABLED"
|
||||
if test "$build_macos" = "yes" -o "$ios_found" = "yes"; then
|
||||
SQLITE3_LIBS+=" -liconv"
|
||||
fi
|
||||
enable_call_logs_storage=true
|
||||
else
|
||||
if test x$enable_call_logs_storage = xtrue; then
|
||||
AC_MSG_ERROR([sqlite3, required for call logs storage, not found])
|
||||
fi
|
||||
enable_call_logs_storage=false
|
||||
fi
|
||||
|
||||
AC_SUBST(SQLITE3_CFLAGS)
|
||||
AC_SUBST(SQLITE3_LIBS)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(BUILD_CALL_LOGS_STORAGE, test x$enable_call_logs_storage = xtrue)
|
||||
|
||||
PKG_CHECK_MODULES(BELLESIP, [belle-sip >= 1.4.0])
|
||||
|
||||
SIPSTACK_CFLAGS="$BELLESIP_CFLAGS"
|
||||
|
|
@ -1022,6 +1057,10 @@ else
|
|||
fi
|
||||
AM_CONDITIONAL(HAVE_DOXYGEN, test "$DOXYGEN" != "false")
|
||||
|
||||
AC_CHECK_PROG([SIPP],[sipp], [true], [false])
|
||||
if test "x$SIPP" != "xfalse" ; then
|
||||
AC_DEFINE(HAVE_SIPP,1,[defined when SIPP is available])
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
|
|
@ -1065,6 +1104,7 @@ printf "* %-30s %s\n" "Account assistant" $build_wizard
|
|||
printf "* %-30s %s\n" "Console interface" $console_ui
|
||||
printf "* %-30s %s\n" "Tools" $build_tools
|
||||
printf "* %-30s %s\n" "Message storage" $enable_msg_storage
|
||||
printf "* %-30s %s\n" "Call logs storage" $enable_call_logs_storage
|
||||
printf "* %-30s %s\n" "IM encryption" $lime
|
||||
printf "* %-30s %s\n" "uPnP support" $build_upnp
|
||||
printf "* %-30s %s\n" "LDAP support" $enable_ldap
|
||||
|
|
|
|||
|
|
@ -141,13 +141,16 @@ void linphone_auth_info_destroy(LinphoneAuthInfo *obj){
|
|||
void linphone_auth_info_write_config(LpConfig *config, LinphoneAuthInfo *obj, int pos)
|
||||
{
|
||||
char key[50];
|
||||
bool_t store_ha1_passwd = lp_config_get_int(config, "sip", "store_ha1_passwd", 1);
|
||||
|
||||
|
||||
sprintf(key,"auth_info_%i",pos);
|
||||
lp_config_clean_section(config,key);
|
||||
|
||||
if (obj==NULL || lp_config_get_int(config, "sip", "store_auth_info", 1) == 0){
|
||||
return;
|
||||
}
|
||||
if (!obj->ha1 && obj->realm && obj->passwd && (obj->username||obj->userid) && lp_config_get_int(config, "sip", "store_ha1_passwd", 1) == 1) {
|
||||
if (!obj->ha1 && obj->realm && obj->passwd && (obj->username||obj->userid) && store_ha1_passwd) {
|
||||
/*compute ha1 to avoid storing clear text password*/
|
||||
obj->ha1=ms_malloc(33);
|
||||
sal_auth_compute_ha1(obj->userid?obj->userid:obj->username,obj->realm,obj->passwd,obj->ha1);
|
||||
|
|
@ -160,8 +163,17 @@ void linphone_auth_info_write_config(LpConfig *config, LinphoneAuthInfo *obj, in
|
|||
}
|
||||
if (obj->ha1!=NULL){
|
||||
lp_config_set_string(config,key,"ha1",obj->ha1);
|
||||
} else if (obj->passwd!=NULL){ /*only write passwd if no ha1*/
|
||||
lp_config_set_string(config,key,"passwd",obj->passwd);
|
||||
}
|
||||
if (obj->passwd != NULL){
|
||||
if (store_ha1_passwd){
|
||||
if (obj->ha1){
|
||||
/*if we have our ha1 and store_ha1_passwd set to TRUE, then drop the clear text password for security*/
|
||||
linphone_auth_info_set_passwd(obj, NULL);
|
||||
}
|
||||
}else{
|
||||
/*we store clear text password only if store_ha1_passwd is FALSE*/
|
||||
lp_config_set_string(config,key,"passwd",obj->passwd);
|
||||
}
|
||||
}
|
||||
if (obj->realm!=NULL){
|
||||
lp_config_set_string(config,key,"realm",obj->realm);
|
||||
|
|
@ -218,7 +230,7 @@ static bool_t realm_match(const char *realm1, const char *realm2){
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *username, const char *realm, const char *domain){
|
||||
static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *username, const char *realm, const char *domain, bool_t ignore_realm){
|
||||
MSList *elem;
|
||||
const LinphoneAuthInfo *ret=NULL;
|
||||
|
||||
|
|
@ -238,9 +250,9 @@ static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *user
|
|||
}
|
||||
ret=pinfo;
|
||||
}
|
||||
} else if (domain && pinfo->domain && strcmp(domain,pinfo->domain)==0 && pinfo->ha1==NULL) {
|
||||
} else if (domain && pinfo->domain && strcmp(domain,pinfo->domain)==0 && (pinfo->ha1==NULL || ignore_realm)) {
|
||||
return pinfo;
|
||||
} else if (!domain && pinfo->ha1==NULL) {
|
||||
} else if (!domain && (pinfo->ha1==NULL || ignore_realm)) {
|
||||
return pinfo;
|
||||
}
|
||||
}
|
||||
|
|
@ -248,6 +260,24 @@ static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *user
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
const LinphoneAuthInfo *_linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username, const char *domain, bool_t ignore_realm){
|
||||
const LinphoneAuthInfo *ai=NULL;
|
||||
if (realm){
|
||||
ai=find_auth_info(lc,username,realm,NULL, FALSE);
|
||||
if (ai==NULL && domain){
|
||||
ai=find_auth_info(lc,username,realm,domain, FALSE);
|
||||
}
|
||||
}
|
||||
if (ai == NULL && domain != NULL) {
|
||||
ai=find_auth_info(lc,username,NULL,domain, ignore_realm);
|
||||
}
|
||||
if (ai==NULL){
|
||||
ai=find_auth_info(lc,username,NULL,NULL, ignore_realm);
|
||||
}
|
||||
/*if (ai) ms_message("linphone_core_find_auth_info(): returning auth info username=%s, realm=%s", ai->username, ai->realm);*/
|
||||
return ai;
|
||||
}
|
||||
/**
|
||||
* Find authentication info matching realm, username, domain criteria.
|
||||
* First of all, (realm,username) pair are searched. If multiple results (which should not happen because realm are supposed to be unique), then domain is added to the search.
|
||||
|
|
@ -258,21 +288,21 @@ static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *user
|
|||
* @return a #LinphoneAuthInfo
|
||||
**/
|
||||
const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username, const char *domain){
|
||||
const LinphoneAuthInfo *ai=NULL;
|
||||
if (realm){
|
||||
ai=find_auth_info(lc,username,realm,NULL);
|
||||
if (ai==NULL && domain){
|
||||
ai=find_auth_info(lc,username,realm,domain);
|
||||
return _linphone_core_find_auth_info(lc, realm, username, domain, TRUE);
|
||||
}
|
||||
|
||||
/*the auth info is expected to be in the core's list*/
|
||||
void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai){
|
||||
int i;
|
||||
MSList *elem = lc->auth_info;
|
||||
|
||||
if (!lc->sip_conf.save_auth_info) return;
|
||||
|
||||
for (i=0; elem != NULL; elem = elem->next, i++){
|
||||
if (ai == elem->data){
|
||||
linphone_auth_info_write_config(lc->config, ai, i);
|
||||
}
|
||||
}
|
||||
if (ai == NULL && domain != NULL) {
|
||||
ai=find_auth_info(lc,username,NULL,domain);
|
||||
}
|
||||
if (ai==NULL){
|
||||
ai=find_auth_info(lc,username,NULL,NULL);
|
||||
}
|
||||
/*if (ai) ms_message("linphone_core_find_auth_info(): returning auth info username=%s, realm=%s", ai->username, ai->realm);*/
|
||||
return ai;
|
||||
}
|
||||
|
||||
static void write_auth_infos(LinphoneCore *lc){
|
||||
|
|
@ -280,6 +310,7 @@ static void write_auth_infos(LinphoneCore *lc){
|
|||
int i;
|
||||
|
||||
if (!linphone_core_ready(lc)) return;
|
||||
if (!lc->sip_conf.save_auth_info) return;
|
||||
for(elem=lc->auth_info,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
|
||||
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)(elem->data);
|
||||
linphone_auth_info_write_config(lc->config,ai,i);
|
||||
|
|
@ -321,7 +352,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
|
|||
SalOp *op=(SalOp*)elem->data;
|
||||
LinphoneAuthInfo *ai;
|
||||
const SalAuthInfo *req_sai=sal_op_get_auth_requested(op);
|
||||
ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,req_sai->realm,req_sai->username,req_sai->domain);
|
||||
ai=(LinphoneAuthInfo*)_linphone_core_find_auth_info(lc,req_sai->realm,req_sai->username,req_sai->domain, FALSE);
|
||||
if (ai){
|
||||
SalAuthInfo sai;
|
||||
MSList* proxy;
|
||||
|
|
@ -353,7 +384,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
|
|||
info->domain ? info->domain : "");
|
||||
}
|
||||
ms_list_free(l);
|
||||
if(lc->sip_conf.save_auth_info) write_auth_infos(lc);
|
||||
write_auth_infos(lc);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -373,7 +404,7 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *in
|
|||
if (r){
|
||||
lc->auth_info=ms_list_remove(lc->auth_info,r);
|
||||
linphone_auth_info_destroy(r);
|
||||
if(lc->sip_conf.save_auth_info) write_auth_infos(lc);
|
||||
write_auth_infos(lc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -240,6 +240,14 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve
|
|||
return;
|
||||
}
|
||||
}else if (strcmp("INVITE",method)==0) {
|
||||
/*handle the case where we are receiving a request with to tag but it is not belonging to any dialog*/
|
||||
belle_sip_header_to_t *to = belle_sip_message_get_header_by_type(req, belle_sip_header_to_t);
|
||||
if (belle_sip_header_to_get_tag(to) != NULL){
|
||||
ms_warning("Receiving INVITE with to-tag but no know dialog here. Rejecting.");
|
||||
resp=belle_sip_response_create_from_request(req,481);
|
||||
belle_sip_provider_send_response(sal->prov,resp);
|
||||
return;
|
||||
}
|
||||
op=sal_op_new(sal);
|
||||
op->dir=SalOpDirIncoming;
|
||||
sal_op_call_fill_cbs(op);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <time.h>
|
||||
#include "private.h"
|
||||
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
#ifndef _WIN32
|
||||
#if !defined(ANDROID) && !defined(__QNXNTO__)
|
||||
# include <langinfo.h>
|
||||
# include <iconv.h>
|
||||
# include <string.h>
|
||||
#endif
|
||||
#else
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#define MAX_PATH_SIZE 1024
|
||||
#include "sqlite3.h"
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Internal functions *
|
||||
|
|
@ -260,7 +274,7 @@ void linphone_call_log_unref(LinphoneCallLog *cl) {
|
|||
* Constructor and destructor functions *
|
||||
******************************************************************************/
|
||||
|
||||
static void _linphone_call_log_destroy(LinphoneCallLog *cl){
|
||||
static void _linphone_call_log_destroy(LinphoneCallLog *cl) {
|
||||
if (cl->from!=NULL) linphone_address_destroy(cl->from);
|
||||
if (cl->to!=NULL) linphone_address_destroy(cl->to);
|
||||
if (cl->refkey!=NULL) ms_free(cl->refkey);
|
||||
|
|
@ -269,7 +283,7 @@ static void _linphone_call_log_destroy(LinphoneCallLog *cl){
|
|||
if (cl->reporting.reports[LINPHONE_CALL_STATS_VIDEO]!=NULL) linphone_reporting_destroy(cl->reporting.reports[LINPHONE_CALL_STATS_VIDEO]);
|
||||
}
|
||||
|
||||
LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress *to){
|
||||
LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress *to) {
|
||||
LinphoneCallLog *cl=belle_sip_object_new(LinphoneCallLog);
|
||||
cl->dir=dir;
|
||||
cl->start_date_time=time(NULL);
|
||||
|
|
@ -278,6 +292,7 @@ LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *fr
|
|||
cl->to=to;
|
||||
cl->status=LinphoneCallAborted; /*default status*/
|
||||
cl->quality=-1;
|
||||
cl->storage_id=0;
|
||||
|
||||
cl->reporting.reports[LINPHONE_CALL_STATS_AUDIO]=linphone_reporting_new();
|
||||
cl->reporting.reports[LINPHONE_CALL_STATS_VIDEO]=linphone_reporting_new();
|
||||
|
|
@ -298,3 +313,291 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallLog, belle_sip_object_t,
|
|||
NULL, // marshal
|
||||
FALSE
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* SQL storage related functions *
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
|
||||
static void linphone_create_table(sqlite3* db) {
|
||||
char* errmsg=NULL;
|
||||
int ret;
|
||||
ret=sqlite3_exec(db,"CREATE TABLE IF NOT EXISTS call_history ("
|
||||
"id INTEGER PRIMARY KEY AUTOINCREMENT,"
|
||||
"caller TEXT NOT NULL," // Can't name a field "from"...
|
||||
"callee TEXT NOT NULL,"
|
||||
"direction INTEGER,"
|
||||
"duration INTEGER,"
|
||||
"start_time TEXT NOT NULL,"
|
||||
"connected_time TEXT NOT NULL,"
|
||||
"status INTEGER,"
|
||||
"videoEnabled INTEGER,"
|
||||
"quality REAL"
|
||||
");",
|
||||
0,0,&errmsg);
|
||||
if(ret != SQLITE_OK) {
|
||||
ms_error("Error in creation: %s.\n", errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
static int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
|
||||
#if defined(ANDROID) || defined(__QNXNTO__)
|
||||
return sqlite3_open(db_file, db);
|
||||
#elif defined(_WIN32)
|
||||
int ret;
|
||||
wchar_t db_file_utf16[MAX_PATH_SIZE];
|
||||
ret = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, db_file, -1, db_file_utf16, MAX_PATH_SIZE);
|
||||
if(ret == 0) db_file_utf16[0] = '\0';
|
||||
return sqlite3_open16(db_file_utf16, db);
|
||||
#else
|
||||
char db_file_locale[MAX_PATH_SIZE] = {'\0'};
|
||||
char db_file_utf8[MAX_PATH_SIZE] = "";
|
||||
char *inbuf=db_file_locale, *outbuf=db_file_utf8;
|
||||
size_t inbyteleft = MAX_PATH_SIZE, outbyteleft = MAX_PATH_SIZE;
|
||||
iconv_t cb;
|
||||
|
||||
strncpy(db_file_locale, db_file, MAX_PATH_SIZE-1);
|
||||
cb = iconv_open("UTF-8", nl_langinfo(CODESET));
|
||||
if(cb != (iconv_t)-1) {
|
||||
int ret;
|
||||
ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
|
||||
if(ret == -1) db_file_utf8[0] = '\0';
|
||||
iconv_close(cb);
|
||||
}
|
||||
return sqlite3_open(db_file_utf8, db);
|
||||
#endif
|
||||
}
|
||||
|
||||
void linphone_core_call_log_storage_init(LinphoneCore *lc) {
|
||||
int ret;
|
||||
const char *errmsg;
|
||||
sqlite3 *db;
|
||||
|
||||
linphone_core_call_log_storage_close(lc);
|
||||
|
||||
ret=_linphone_sqlite3_open(lc->logs_db_file, &db);
|
||||
if(ret != SQLITE_OK) {
|
||||
errmsg = sqlite3_errmsg(db);
|
||||
ms_error("Error in the opening: %s.\n", errmsg);
|
||||
sqlite3_close(db);
|
||||
return;
|
||||
}
|
||||
|
||||
linphone_create_table(db);
|
||||
lc->logs_db = db;
|
||||
|
||||
// Load the existing call logs
|
||||
linphone_core_get_call_history(lc);
|
||||
}
|
||||
|
||||
void linphone_core_call_log_storage_close(LinphoneCore *lc) {
|
||||
if (lc->logs_db){
|
||||
sqlite3_close(lc->logs_db);
|
||||
lc->logs_db = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* DB layout:
|
||||
* | 0 | storage_id
|
||||
* | 1 | from
|
||||
* | 2 | to
|
||||
* | 3 | direction flag
|
||||
* | 4 | duration
|
||||
* | 5 | start date time (time_t)
|
||||
* | 6 | connected date time (time_t)
|
||||
* | 7 | status
|
||||
* | 8 | video enabled (1 or 0)
|
||||
* | 9 | quality
|
||||
*/
|
||||
static int create_call_log(void *data, int argc, char **argv, char **colName) {
|
||||
MSList **list = (MSList **)data;
|
||||
LinphoneAddress *from;
|
||||
LinphoneAddress *to;
|
||||
LinphoneCallDir dir;
|
||||
LinphoneCallLog *log;
|
||||
|
||||
unsigned int storage_id = atoi(argv[0]);
|
||||
from = linphone_address_new(argv[1]);
|
||||
to = linphone_address_new(argv[2]);
|
||||
dir = (LinphoneCallDir) atoi(argv[3]);
|
||||
log = linphone_call_log_new(dir, from, to);
|
||||
|
||||
log->storage_id = storage_id;
|
||||
log->duration = atoi(argv[4]);
|
||||
log->start_date_time = (time_t)atol(argv[5]);
|
||||
log->connected_date_time = (time_t)atol(argv[6]);
|
||||
log->status = (LinphoneCallStatus) atoi(argv[7]);
|
||||
log->video_enabled = atoi(argv[8]) == 1;
|
||||
log->quality = atof(argv[9]);
|
||||
|
||||
*list = ms_list_append(*list, log);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void linphone_sql_request_call_log(sqlite3 *db, const char *stmt, MSList **list) {
|
||||
char* errmsg = NULL;
|
||||
int ret;
|
||||
ret = sqlite3_exec(db, stmt, create_call_log, list, &errmsg);
|
||||
if (ret != SQLITE_OK) {
|
||||
ms_error("linphone_sql_request: statement %s -> error sqlite3_exec(): %s.", stmt, errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
int linphone_sql_request_generic(sqlite3* db, const char *stmt) {
|
||||
char* errmsg = NULL;
|
||||
int ret;
|
||||
ret = sqlite3_exec(db, stmt, NULL, NULL, &errmsg);
|
||||
if (ret != SQLITE_OK) {
|
||||
ms_error("linphone_sql_request: statement %s -> error sqlite3_exec(): %s.", stmt, errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
|
||||
if (lc && lc->logs_db){
|
||||
char *from, *to;
|
||||
char *buf;
|
||||
|
||||
from = linphone_address_as_string(log->from);
|
||||
to = linphone_address_as_string(log->to);
|
||||
buf = sqlite3_mprintf("INSERT INTO call_history VALUES(NULL,%Q,%Q,%i,%i,%lld,%lld,%i,%i,%f);",
|
||||
from,
|
||||
to,
|
||||
log->dir,
|
||||
log->duration,
|
||||
(int64_t)log->start_date_time,
|
||||
(int64_t)log->connected_date_time,
|
||||
log->status,
|
||||
log->video_enabled ? 1 : 0,
|
||||
log->quality
|
||||
);
|
||||
linphone_sql_request_generic(lc->logs_db, buf);
|
||||
sqlite3_free(buf);
|
||||
ms_free(from);
|
||||
ms_free(to);
|
||||
sqlite3_last_insert_rowid(lc->logs_db);
|
||||
}
|
||||
|
||||
if (lc) {
|
||||
lc->call_logs = ms_list_prepend(lc->call_logs, linphone_call_log_ref(log));
|
||||
}
|
||||
}
|
||||
|
||||
const MSList *linphone_core_get_call_history(LinphoneCore *lc) {
|
||||
char *buf;
|
||||
uint64_t begin,end;
|
||||
|
||||
if (!lc || lc->logs_db == NULL) return NULL;
|
||||
|
||||
lc->call_logs = ms_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
|
||||
|
||||
buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %i", lc->max_call_logs);
|
||||
|
||||
begin = ortp_get_cur_time_ms();
|
||||
linphone_sql_request_call_log(lc->logs_db, buf, &lc->call_logs);
|
||||
end = ortp_get_cur_time_ms();
|
||||
ms_message("%s(): completed in %i ms",__FUNCTION__, (int)(end-begin));
|
||||
sqlite3_free(buf);
|
||||
|
||||
return lc->call_logs;
|
||||
}
|
||||
|
||||
void linphone_core_delete_call_history(LinphoneCore *lc) {
|
||||
char *buf;
|
||||
|
||||
if (!lc || lc->logs_db == NULL) return ;
|
||||
|
||||
buf = sqlite3_mprintf("DELETE FROM call_history");
|
||||
linphone_sql_request_generic(lc->logs_db, buf);
|
||||
sqlite3_free(buf);
|
||||
}
|
||||
|
||||
void linphone_core_delete_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
|
||||
char *buf;
|
||||
|
||||
if (!lc || lc->logs_db == NULL) return ;
|
||||
|
||||
buf = sqlite3_mprintf("DELETE FROM call_history WHERE id = %i", log->storage_id);
|
||||
linphone_sql_request_generic(lc->logs_db, buf);
|
||||
sqlite3_free(buf);
|
||||
}
|
||||
|
||||
int linphone_core_get_call_history_size(LinphoneCore *lc) {
|
||||
int numrows = 0;
|
||||
char *buf;
|
||||
sqlite3_stmt *selectStatement;
|
||||
int returnValue;
|
||||
|
||||
if (!lc || lc->logs_db == NULL) return 0;
|
||||
|
||||
buf = sqlite3_mprintf("SELECT count(*) FROM call_history");
|
||||
returnValue = sqlite3_prepare_v2(lc->logs_db, buf, -1, &selectStatement, NULL);
|
||||
if (returnValue == SQLITE_OK){
|
||||
if(sqlite3_step(selectStatement) == SQLITE_ROW){
|
||||
numrows = sqlite3_column_int(selectStatement, 0);
|
||||
}
|
||||
}
|
||||
sqlite3_finalize(selectStatement);
|
||||
sqlite3_free(buf);
|
||||
|
||||
return numrows;
|
||||
}
|
||||
|
||||
MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
|
||||
char *buf;
|
||||
char *sipAddress;
|
||||
uint64_t begin,end;
|
||||
MSList *result = NULL;
|
||||
|
||||
if (!lc || lc->logs_db == NULL || addr == NULL) return NULL;
|
||||
|
||||
/*since we want to append query parameters depending on arguments given, we use malloc instead of sqlite3_mprintf*/
|
||||
sipAddress = linphone_address_as_string_uri_only(addr);
|
||||
buf = sqlite3_mprintf("SELECT * FROM call_history WHERE caller LIKE '%%%q%%' OR callee LIKE '%%%q%%' ORDER BY id DESC", sipAddress, sipAddress); // The '%%%q%%' takes care of the eventual presence of a display name
|
||||
|
||||
begin = ortp_get_cur_time_ms();
|
||||
linphone_sql_request_call_log(lc->logs_db, buf, &result);
|
||||
end = ortp_get_cur_time_ms();
|
||||
ms_message("%s(): completed in %i ms",__FUNCTION__, (int)(end-begin));
|
||||
sqlite3_free(buf);
|
||||
ms_free(sipAddress);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void linphone_core_call_log_storage_init(LinphoneCore *lc) {
|
||||
}
|
||||
|
||||
void linphone_core_call_log_storage_close(LinphoneCore *lc) {
|
||||
}
|
||||
|
||||
void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
|
||||
}
|
||||
|
||||
const MSList *linphone_core_get_call_history(LinphoneCore *lc) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void linphone_core_delete_call_history(LinphoneCore *lc) {
|
||||
}
|
||||
|
||||
void linphone_core_delete_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
|
||||
}
|
||||
|
||||
int linphone_core_get_call_history_size(LinphoneCore *lc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -968,7 +968,7 @@ static void auth_failure(SalOp *op, SalAuthInfo* info) {
|
|||
LinphoneAuthInfo *ai=NULL;
|
||||
|
||||
if( info != NULL ){
|
||||
ai = (LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
|
||||
ai = (LinphoneAuthInfo*)_linphone_core_find_auth_info(lc,info->realm,info->username,info->domain, TRUE);
|
||||
|
||||
if (ai){
|
||||
ms_message("%s/%s/%s authentication fails.",info->realm,info->username,info->domain);
|
||||
|
|
@ -1172,11 +1172,16 @@ static bool_t fill_auth_info_with_client_certificate(LinphoneCore *lc, SalAuthIn
|
|||
}
|
||||
|
||||
static bool_t fill_auth_info(LinphoneCore *lc, SalAuthInfo* sai) {
|
||||
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,sai->realm,sai->username,sai->domain);
|
||||
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)_linphone_core_find_auth_info(lc,sai->realm,sai->username,sai->domain, FALSE);
|
||||
if (ai) {
|
||||
sai->userid=ms_strdup(ai->userid?ai->userid:ai->username);
|
||||
sai->password=ai->passwd?ms_strdup(ai->passwd):NULL;
|
||||
sai->ha1=ai->ha1?ms_strdup(ai->ha1):NULL;
|
||||
if (sai->realm && !ai->realm){
|
||||
/*if realm was not known, then set it so that ha1 may eventually be calculated and clear text password dropped*/
|
||||
linphone_auth_info_set_realm(ai, sai->realm);
|
||||
linphone_core_write_auth_info(lc, ai);
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
|
|
@ -1252,18 +1257,7 @@ static void text_delivery_update(SalOp *op, SalTextDeliveryStatus status){
|
|||
}
|
||||
// check that the message does not belong to an already destroyed chat room - if so, do not invoke callbacks
|
||||
if (chat_msg->chat_room != NULL) {
|
||||
chat_msg->state=chatStatusSal2Linphone(status);
|
||||
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 %s",linphone_chat_message_state_to_string(chat_msg->state));
|
||||
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);
|
||||
}
|
||||
}
|
||||
linphone_chat_message_update_state(chat_msg, chatStatusSal2Linphone(status));
|
||||
}
|
||||
if (status != SalTextDeliveryInProgress) { /*only release op if not in progress*/
|
||||
linphone_chat_message_destroy(chat_msg);
|
||||
|
|
|
|||
1225
coreapi/chat.c
1225
coreapi/chat.c
File diff suppressed because it is too large
Load diff
|
|
@ -1336,7 +1336,15 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
|
|||
break;
|
||||
case LinphoneCallStreamsRunning:
|
||||
if (call->prevstate == LinphoneCallUpdating || call->prevstate == LinphoneCallUpdatedByRemote) {
|
||||
linphone_core_notify_display_status(lc,_("Call parameters were successfully modified."));
|
||||
LinphoneReason reason = linphone_call_get_reason(call);
|
||||
char *msg;
|
||||
if (reason != LinphoneReasonNone) {
|
||||
msg = ms_strdup(_("Call parameters were successfully modified."));
|
||||
} else {
|
||||
msg = ms_strdup_printf(_("Call parameters could not be modified: %s."), linphone_reason_to_string(reason));
|
||||
}
|
||||
linphone_core_notify_display_status(lc, msg);
|
||||
ms_free(msg);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -1360,7 +1368,6 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
|
|||
if (cstate==LinphoneCallReleased) {/*shall be performed after app notification*/
|
||||
linphone_call_set_released(call);
|
||||
}
|
||||
linphone_core_soundcard_hint_check(lc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2562,6 +2569,7 @@ static RtpSession * create_audio_rtp_io_session(LinphoneCall *call) {
|
|||
int ptnum = lp_config_get_int(lc->config, "sound", "rtp_ptnum", 0);
|
||||
const char *rtpmap = lp_config_get_string(lc->config, "sound", "rtp_map", "pcmu/8000/1");
|
||||
int symmetric = lp_config_get_int(lc->config, "sound", "rtp_symmetric", 0);
|
||||
int jittcomp = lp_config_get_int(lc->config, "sound", "rtp_jittcomp", 0); /* 0 means no jitter buffer*/
|
||||
RtpSession *rtp_session = NULL;
|
||||
pt = rtp_profile_get_payload_from_rtpmap(call->audio_profile, rtpmap);
|
||||
if (pt != NULL) {
|
||||
|
|
@ -2572,7 +2580,8 @@ static RtpSession * create_audio_rtp_io_session(LinphoneCall *call) {
|
|||
rtp_session_set_remote_addr_and_port(rtp_session, remote_ip, remote_port, -1);
|
||||
rtp_session_enable_rtcp(rtp_session, FALSE);
|
||||
rtp_session_set_payload_type(rtp_session, ptnum);
|
||||
rtp_session_set_jitter_compensation(rtp_session, linphone_core_get_audio_jittcomp(lc));
|
||||
rtp_session_set_jitter_compensation(rtp_session, jittcomp);
|
||||
rtp_session_enable_jitter_buffer(rtp_session, jittcomp>0);
|
||||
rtp_session_set_symmetric_rtp(rtp_session, (bool_t)symmetric);
|
||||
}
|
||||
return rtp_session;
|
||||
|
|
@ -2749,6 +2758,7 @@ static RtpSession * create_video_rtp_io_session(LinphoneCall *call) {
|
|||
int ptnum = lp_config_get_int(lc->config, "video", "rtp_ptnum", 0);
|
||||
const char *rtpmap = lp_config_get_string(lc->config, "video", "rtp_map", "vp8/90000/1");
|
||||
int symmetric = lp_config_get_int(lc->config, "video", "rtp_symmetric", 0);
|
||||
int jittcomp = lp_config_get_int(lc->config, "video", "rtp_jittcomp", 0); /* 0 means no jitter buffer*/
|
||||
RtpSession *rtp_session = NULL;
|
||||
pt = rtp_profile_get_payload_from_rtpmap(call->video_profile, rtpmap);
|
||||
if (pt != NULL) {
|
||||
|
|
@ -2760,6 +2770,8 @@ static RtpSession * create_video_rtp_io_session(LinphoneCall *call) {
|
|||
rtp_session_enable_rtcp(rtp_session, FALSE);
|
||||
rtp_session_set_payload_type(rtp_session, ptnum);
|
||||
rtp_session_set_symmetric_rtp(rtp_session, (bool_t)symmetric);
|
||||
rtp_session_set_jitter_compensation(rtp_session, jittcomp);
|
||||
rtp_session_enable_jitter_buffer(rtp_session, jittcomp>0);
|
||||
}
|
||||
return rtp_session;
|
||||
}
|
||||
|
|
@ -3221,6 +3233,8 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
|
|||
rtp_profile_destroy(call->rtp_io_video_profile);
|
||||
call->rtp_io_video_profile = NULL;
|
||||
}
|
||||
|
||||
linphone_core_soundcard_hint_check(call->core);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3954,6 +3968,9 @@ void linphone_call_log_completed(LinphoneCall *call){
|
|||
linphone_core_notify_display_status(lc,info);
|
||||
ms_free(info);
|
||||
}
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
linphone_core_store_call_log(lc, call->log);
|
||||
#else
|
||||
lc->call_logs=ms_list_prepend(lc->call_logs,linphone_call_log_ref(call->log));
|
||||
if (ms_list_size(lc->call_logs)>lc->max_call_logs){
|
||||
MSList *elem,*prevelem=NULL;
|
||||
|
|
@ -3965,8 +3982,9 @@ void linphone_call_log_completed(LinphoneCall *call){
|
|||
linphone_call_log_unref((LinphoneCallLog*)elem->data);
|
||||
lc->call_logs=ms_list_remove_link(lc->call_logs,elem);
|
||||
}
|
||||
linphone_core_notify_call_log_updated(lc,call->log);
|
||||
call_logs_write_to_config_file(lc);
|
||||
#endif
|
||||
linphone_core_notify_call_log_updated(lc,call->log);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4267,13 +4285,13 @@ void linphone_call_set_broken(LinphoneCall *call){
|
|||
|
||||
void linphone_call_repair_if_broken(LinphoneCall *call){
|
||||
LinphoneCallParams *params;
|
||||
|
||||
|
||||
if (!call->broken) return;
|
||||
|
||||
|
||||
/*First, make sure that the proxy from which we received this call, or to which we routed this call is registered*/
|
||||
if (!call->dest_proxy || linphone_proxy_config_get_state(call->dest_proxy) != LinphoneRegistrationOk) return;
|
||||
|
||||
|
||||
|
||||
|
||||
switch (call->state){
|
||||
case LinphoneCallStreamsRunning:
|
||||
case LinphoneCallPaused:
|
||||
|
|
|
|||
|
|
@ -1294,6 +1294,7 @@ static void ui_config_read(LinphoneCore *lc)
|
|||
linphone_core_add_friend(lc,lf);
|
||||
linphone_friend_unref(lf);
|
||||
}
|
||||
|
||||
call_logs_read_from_config_file(lc);
|
||||
}
|
||||
|
||||
|
|
@ -4930,15 +4931,42 @@ LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc)
|
|||
* Call log related functions *
|
||||
******************************************************************************/
|
||||
|
||||
const MSList * linphone_core_get_call_logs(LinphoneCore *lc){
|
||||
void linphone_core_set_call_logs_database_path(LinphoneCore *lc, const char *path) {
|
||||
if (lc->logs_db_file){
|
||||
ms_free(lc->logs_db_file);
|
||||
lc->logs_db_file = NULL;
|
||||
}
|
||||
if (path) {
|
||||
lc->logs_db_file = ms_strdup(path);
|
||||
linphone_core_call_log_storage_init(lc);
|
||||
|
||||
linphone_core_migrate_logs_from_rc_to_db(lc);
|
||||
}
|
||||
}
|
||||
|
||||
const MSList* linphone_core_get_call_logs(LinphoneCore *lc) {
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
if (lc->logs_db) {
|
||||
linphone_core_get_call_history(lc);
|
||||
}
|
||||
#endif
|
||||
return lc->call_logs;
|
||||
}
|
||||
|
||||
void linphone_core_clear_call_logs(LinphoneCore *lc){
|
||||
void linphone_core_clear_call_logs(LinphoneCore *lc) {
|
||||
bool_t call_logs_sqlite_db_found = FALSE;
|
||||
lc->missed_calls=0;
|
||||
ms_list_for_each(lc->call_logs,(void (*)(void*))linphone_call_log_unref);
|
||||
lc->call_logs=ms_list_free(lc->call_logs);
|
||||
call_logs_write_to_config_file(lc);
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
if (lc->logs_db) {
|
||||
call_logs_sqlite_db_found = TRUE;
|
||||
linphone_core_delete_call_history(lc);
|
||||
}
|
||||
#endif
|
||||
if (!call_logs_sqlite_db_found) {
|
||||
ms_list_for_each(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
|
||||
lc->call_logs = ms_list_free(lc->call_logs);
|
||||
call_logs_write_to_config_file(lc);
|
||||
}
|
||||
}
|
||||
|
||||
int linphone_core_get_missed_calls_count(LinphoneCore *lc) {
|
||||
|
|
@ -4949,13 +4977,85 @@ void linphone_core_reset_missed_calls_count(LinphoneCore *lc) {
|
|||
lc->missed_calls=0;
|
||||
}
|
||||
|
||||
void linphone_core_remove_call_log(LinphoneCore *lc, LinphoneCallLog *cl){
|
||||
lc->call_logs = ms_list_remove(lc->call_logs, cl);
|
||||
call_logs_write_to_config_file(lc);
|
||||
linphone_call_log_unref(cl);
|
||||
void linphone_core_remove_call_log(LinphoneCore *lc, LinphoneCallLog *cl) {
|
||||
bool_t call_logs_sqlite_db_found = FALSE;
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
if (lc->logs_db) {
|
||||
call_logs_sqlite_db_found = TRUE;
|
||||
linphone_core_delete_call_log(lc, cl);
|
||||
}
|
||||
#endif
|
||||
if (!call_logs_sqlite_db_found) {
|
||||
lc->call_logs = ms_list_remove(lc->call_logs, cl);
|
||||
call_logs_write_to_config_file(lc);
|
||||
linphone_call_log_unref(cl);
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
|
||||
MSList *logs_to_migrate = NULL;
|
||||
LpConfig *lpc = NULL;
|
||||
int original_logs_count, migrated_logs_count;
|
||||
int i;
|
||||
|
||||
#ifndef CALL_LOGS_STORAGE_ENABLED
|
||||
ms_warning("linphone has been compiled without sqlite, can't migrate call logs");
|
||||
return;
|
||||
#endif
|
||||
if (!lc) {
|
||||
return;
|
||||
}
|
||||
|
||||
lpc = linphone_core_get_config(lc);
|
||||
if (!lpc) {
|
||||
ms_warning("this core has been started without a rc file, nothing to migrate");
|
||||
return;
|
||||
}
|
||||
if (lp_config_get_int(lpc, "misc", "call_logs_migration_done", 0) == 1) {
|
||||
ms_warning("the call logs migration has already been done, skipping...");
|
||||
return;
|
||||
}
|
||||
|
||||
// This is because there must have been a call previously to linphone_core_call_log_storage_init
|
||||
lc->call_logs = ms_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
|
||||
|
||||
call_logs_read_from_config_file(lc);
|
||||
if (!lc->call_logs) {
|
||||
ms_warning("nothing to migrate, skipping...");
|
||||
return;
|
||||
}
|
||||
|
||||
logs_to_migrate = lc->call_logs;
|
||||
lc->call_logs = NULL;
|
||||
// We can't use ms_list_for_each because logs_to_migrate are listed in the wrong order (latest first), and we want to store the logs latest last
|
||||
for (i = ms_list_size(logs_to_migrate) - 1; i >= 0; i--) {
|
||||
LinphoneCallLog *log = (LinphoneCallLog *) ms_list_nth_data(logs_to_migrate, i);
|
||||
linphone_core_store_call_log(lc, log);
|
||||
}
|
||||
|
||||
original_logs_count = ms_list_size(logs_to_migrate);
|
||||
migrated_logs_count = ms_list_size(lc->call_logs);
|
||||
if (original_logs_count == migrated_logs_count) {
|
||||
int i = 0;
|
||||
ms_debug("call logs migration successful: %i logs migrated", ms_list_size(lc->call_logs));
|
||||
lp_config_set_int(lpc, "misc", "call_logs_migration_done", 1);
|
||||
|
||||
for (; i < original_logs_count; i++) {
|
||||
char logsection[32];
|
||||
snprintf(logsection, sizeof(logsection), "call_log_%i", i);
|
||||
lp_config_clean_section(lpc, logsection);
|
||||
}
|
||||
} else {
|
||||
ms_error("not as many logs saved in db has logs read from rc (%i in rc against %i in db)!", original_logs_count, migrated_logs_count);
|
||||
}
|
||||
|
||||
ms_list_free_with_data(logs_to_migrate, (void (*)(void*))linphone_call_log_unref);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Video related functions *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
static void toggle_video_preview(LinphoneCore *lc, bool_t val){
|
||||
|
|
@ -6171,6 +6271,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
|
|||
linphone_core_free_payload_types(lc);
|
||||
if (lc->supported_formats) ms_free(lc->supported_formats);
|
||||
linphone_core_message_storage_close(lc);
|
||||
linphone_core_call_log_storage_close(lc);
|
||||
ms_exit();
|
||||
linphone_core_set_state(lc,LinphoneGlobalOff,"Off");
|
||||
linphone_core_deactivate_log_serialization_if_needed();
|
||||
|
|
|
|||
|
|
@ -3170,6 +3170,14 @@ LINPHONE_PUBLIC void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *l
|
|||
**/
|
||||
LINPHONE_PUBLIC const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
|
||||
|
||||
/**
|
||||
* Get the list of call logs (past calls) that matches the given #LinphoneAddress.
|
||||
* At the contrary of linphone_core_get_call_logs, it is your responsability to unref the logs and free this list once you are done using it.
|
||||
* @param[in] lc LinphoneCore object
|
||||
* @return \mslist{LinphoneCallLog}
|
||||
**/
|
||||
LINPHONE_PUBLIC MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr);
|
||||
|
||||
/**
|
||||
* Erase the call log.
|
||||
* @param[in] lc LinphoneCore object
|
||||
|
|
@ -3198,6 +3206,22 @@ LINPHONE_PUBLIC void linphone_core_reset_missed_calls_count(LinphoneCore *lc);
|
|||
**/
|
||||
LINPHONE_PUBLIC void linphone_core_remove_call_log(LinphoneCore *lc, LinphoneCallLog *call_log);
|
||||
|
||||
/**
|
||||
* Sets the database filename where call logs will be stored.
|
||||
* If the file does not exist, it will be created.
|
||||
* @ingroup initializing
|
||||
* @param lc the linphone core
|
||||
* @param path filesystem path
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_core_set_call_logs_database_path(LinphoneCore *lc, const char *path);
|
||||
|
||||
/**
|
||||
* Migrates the call logs from the linphonerc to the database if not done yet
|
||||
* @ingroup initializing
|
||||
* @param lc the linphone core
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc);
|
||||
|
||||
/**
|
||||
* @}
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -1867,7 +1867,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getOrCreateChatRoom(JNI
|
|||
,jstring jto) {
|
||||
|
||||
const char* to = env->GetStringUTFChars(jto, NULL);
|
||||
LinphoneChatRoom* lResult = linphone_core_get_or_create_chat_room((LinphoneCore*)lc,to);
|
||||
LinphoneChatRoom* lResult = linphone_core_get_chat_room_from_uri((LinphoneCore*)lc,to);
|
||||
env->ReleaseStringUTFChars(jto, to);
|
||||
return (jlong)lResult;
|
||||
}
|
||||
|
|
@ -3086,11 +3086,6 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_markAsRead(JNIEnv*
|
|||
linphone_chat_room_mark_as_read((LinphoneChatRoom*)ptr);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_destroy(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
linphone_chat_room_destroy((LinphoneChatRoom*)ptr);
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createFileTransferMessage(JNIEnv* env, jobject thiz, jlong ptr, jstring jname, jstring jtype, jstring jsubtype, jint data_size) {
|
||||
LinphoneContentPrivate content = {0};
|
||||
|
|
@ -3279,7 +3274,7 @@ static void message_state_changed(LinphoneChatMessage* msg, LinphoneChatMessageS
|
|||
return;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) msg->cb_ud;
|
||||
jobject listener = (jobject) msg->message_state_changed_user_data;
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageStateChanged","(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneChatMessage$State;)V");
|
||||
jobject jmessage = getChatMessage(env, msg);
|
||||
|
|
@ -3303,7 +3298,7 @@ static void file_transfer_progress_indication(LinphoneChatMessage *msg, const Li
|
|||
return;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) msg->cb_ud;
|
||||
jobject listener = (jobject) msg->message_state_changed_user_data;
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageFileTransferProgressChanged", "(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;II)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
|
@ -3323,7 +3318,7 @@ static void file_transfer_recv(LinphoneChatMessage *msg, const LinphoneContent*
|
|||
return;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) msg->cb_ud;
|
||||
jobject listener = (jobject) msg->message_state_changed_user_data;
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageFileTransferReceived", "(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;Lorg/linphone/core/LinphoneBuffer;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
|
@ -3349,7 +3344,7 @@ static LinphoneBuffer* file_transfer_send(LinphoneChatMessage *msg, const Linph
|
|||
return buffer;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) msg->cb_ud;
|
||||
jobject listener = (jobject) msg->message_state_changed_user_data;
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageFileTransferSent","(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;IILorg/linphone/core/LinphoneBuffer;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
|
@ -3372,7 +3367,7 @@ extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setListener(JNIEn
|
|||
LinphoneChatMessage *message = (LinphoneChatMessage *)ptr;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
|
||||
message->cb_ud = listener;
|
||||
message->message_state_changed_user_data = listener;
|
||||
cbs = linphone_chat_message_get_callbacks(message);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, message_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
|
|
@ -3389,7 +3384,7 @@ extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_unref(JNIEnv* en
|
|||
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getChatRooms(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
MSList* chats = linphone_core_get_chat_rooms((LinphoneCore*)ptr);
|
||||
const MSList* chats = linphone_core_get_chat_rooms((LinphoneCore*)ptr);
|
||||
int chatsSize = ms_list_size(chats);
|
||||
jlongArray jChats = env->NewLongArray(chatsSize);
|
||||
jlong *jInternalArray = env->GetLongArrayElements(jChats, NULL);
|
||||
|
|
|
|||
|
|
@ -433,11 +433,6 @@ MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
|
|||
return linphone_chat_room_get_history_range(cr, 0, nb_message-1);
|
||||
}
|
||||
|
||||
|
||||
void linphone_close_storage(sqlite3* db){
|
||||
sqlite3_close(db);
|
||||
}
|
||||
|
||||
void linphone_create_table(sqlite3* db){
|
||||
char* errmsg=NULL;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ struct _LinphoneCallLog{
|
|||
char* call_id; /**unique id of a call*/
|
||||
struct _LinphoneQualityReporting reporting;
|
||||
bool_t video_enabled;
|
||||
unsigned int storage_id;
|
||||
};
|
||||
|
||||
BELLE_SIP_DECLARE_VPTR(LinphoneCallLog);
|
||||
|
|
@ -204,8 +205,8 @@ struct _LinphoneChatMessage {
|
|||
LinphoneChatMessageCbs *callbacks;
|
||||
LinphoneChatMessageDir dir;
|
||||
char* message;
|
||||
LinphoneChatMessageStateChangedCb cb;
|
||||
void* cb_ud;
|
||||
LinphoneChatMessageStateChangedCb message_state_changed_cb;
|
||||
void* message_state_changed_user_data;
|
||||
void* message_userdata;
|
||||
char* appdata;
|
||||
char* external_body_url;
|
||||
|
|
@ -336,6 +337,8 @@ SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params);
|
|||
SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params);
|
||||
|
||||
void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos);
|
||||
void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai);
|
||||
const LinphoneAuthInfo *_linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username, const char *domain, bool_t ignore_realm);
|
||||
|
||||
void linphone_core_update_proxy_register(LinphoneCore *lc);
|
||||
void linphone_core_refresh_subscribes(LinphoneCore *lc);
|
||||
|
|
@ -500,7 +503,7 @@ 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 );
|
||||
void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state);
|
||||
/**/
|
||||
|
||||
struct _LinphoneProxyConfig
|
||||
|
|
@ -847,6 +850,10 @@ struct _LinphoneCore
|
|||
#ifdef MSG_STORAGE_ENABLED
|
||||
sqlite3 *db;
|
||||
bool_t debug_storage;
|
||||
#endif
|
||||
char *logs_db_file;
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
sqlite3 *logs_db;
|
||||
#endif
|
||||
#ifdef BUILD_UPNP
|
||||
UpnpContext *upnp;
|
||||
|
|
@ -965,6 +972,13 @@ void _linphone_core_codec_config_write(LinphoneCore *lc);
|
|||
#endif
|
||||
void call_logs_read_from_config_file(LinphoneCore *lc);
|
||||
void call_logs_write_to_config_file(LinphoneCore *lc);
|
||||
void linphone_core_call_log_storage_init(LinphoneCore *lc);
|
||||
void linphone_core_call_log_storage_close(LinphoneCore *lc);
|
||||
void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log);
|
||||
const MSList *linphone_core_get_call_history(LinphoneCore *lc);
|
||||
void linphone_core_delete_call_history(LinphoneCore *lc);
|
||||
void linphone_core_delete_call_log(LinphoneCore *lc, LinphoneCallLog *log);
|
||||
int linphone_core_get_call_history_size(LinphoneCore *lc);
|
||||
|
||||
int linphone_core_get_edge_bw(LinphoneCore *lc);
|
||||
int linphone_core_get_edge_ptime(LinphoneCore *lc);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,34 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "linphone.h"
|
||||
|
||||
#define CONFIG_FILE ".linphone-call-history.db"
|
||||
|
||||
char *linphone_gtk_call_logs_storage_get_db_file(const char *filename){
|
||||
const int path_max=1024;
|
||||
char *db_file=NULL;
|
||||
|
||||
db_file=(char *)g_malloc(path_max*sizeof(char));
|
||||
if (filename==NULL) filename=CONFIG_FILE;
|
||||
/*try accessing a local file first if exists*/
|
||||
if (access(CONFIG_FILE,F_OK)==0){
|
||||
snprintf(db_file,path_max,"%s",filename);
|
||||
}else{
|
||||
#ifdef WIN32
|
||||
const char *appdata=getenv("APPDATA");
|
||||
if (appdata){
|
||||
snprintf(db_file,path_max,"%s\\%s",appdata,LINPHONE_CONFIG_DIR);
|
||||
CreateDirectory(db_file,NULL);
|
||||
snprintf(db_file,path_max,"%s\\%s\\%s",appdata,LINPHONE_CONFIG_DIR,filename);
|
||||
}
|
||||
#else
|
||||
const char *home=getenv("HOME");
|
||||
if (home==NULL) home=".";
|
||||
snprintf(db_file,path_max,"%s/%s",home,filename);
|
||||
#endif
|
||||
}
|
||||
return db_file;
|
||||
}
|
||||
|
||||
static void fill_renderers(GtkTreeView *v){
|
||||
GtkTreeViewColumn *c;
|
||||
GtkCellRenderer *r;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ LINPHONE_PUBLIC GtkWidget *linphone_gtk_get_widget(GtkWidget *window, const char
|
|||
LINPHONE_PUBLIC GtkWidget *linphone_gtk_create_widget(const char* widget_name);
|
||||
|
||||
char *linphone_gtk_message_storage_get_db_file(const char *filename);
|
||||
char *linphone_gtk_call_logs_storage_get_db_file(const char *filename);
|
||||
LINPHONE_PUBLIC void linphone_gtk_show_assistant(GtkWidget* parent);
|
||||
LINPHONE_PUBLIC void linphone_gtk_close_assistant(void);
|
||||
|
||||
|
|
|
|||
45
gtk/main.c
45
gtk/main.c
|
|
@ -259,7 +259,7 @@ gboolean linphone_gtk_get_audio_assistant_option(void){
|
|||
}
|
||||
|
||||
static void linphone_gtk_init_liblinphone(const char *config_file,
|
||||
const char *factory_config_file, const char *db_file) {
|
||||
const char *factory_config_file, const char *chat_messages_db_file, const char *call_logs_db_file) {
|
||||
LinphoneCoreVTable vtable={0};
|
||||
gchar *secrets_file=linphone_gtk_get_config_file(SECRETS_FILE);
|
||||
gchar *user_certificates_dir=linphone_gtk_get_config_file(CERTIFICATES_PATH);
|
||||
|
|
@ -309,7 +309,8 @@ static void linphone_gtk_init_liblinphone(const char *config_file,
|
|||
_linphone_gtk_enable_video(FALSE);
|
||||
linphone_gtk_set_ui_config_int("videoselfview",0);
|
||||
}
|
||||
if (db_file) linphone_core_set_chat_database_path(the_core,db_file);
|
||||
if (chat_messages_db_file) linphone_core_set_chat_database_path(the_core,chat_messages_db_file);
|
||||
if (call_logs_db_file) linphone_core_set_call_logs_database_path(the_core, call_logs_db_file);
|
||||
}
|
||||
|
||||
LinphoneCore *linphone_gtk_get_core(void){
|
||||
|
|
@ -1856,7 +1857,9 @@ static void linphone_gtk_init_main_window(){
|
|||
linphone_gtk_show_friends();
|
||||
linphone_core_reset_missed_calls_count(linphone_gtk_get_core());
|
||||
main_window=linphone_gtk_get_main_window();
|
||||
#ifndef CALL_LOGS_STORAGE_ENABLED
|
||||
linphone_gtk_call_log_update(main_window);
|
||||
#endif
|
||||
|
||||
linphone_gtk_update_call_buttons (NULL);
|
||||
g_object_set_data(G_OBJECT(main_window),"keypad",NULL);
|
||||
|
|
@ -2015,6 +2018,28 @@ static void sigint_handler(int signum){
|
|||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static void populate_xdg_data_dirs_envvar(void) {
|
||||
#ifndef WIN32
|
||||
int i;
|
||||
gchar *value;
|
||||
gchar **paths;
|
||||
|
||||
if(g_getenv("XDG_DATA_DIRS") == NULL) {
|
||||
value = g_strdup("/usr/share:/usr/local/share:/opt/local/share");
|
||||
} else {
|
||||
value = g_strdup(g_getenv("XDG_DATA_DIRS"));
|
||||
}
|
||||
paths = g_strsplit(value, ":", -1);
|
||||
for(i=0; paths[i] && strcmp(paths[i], PACKAGE_DATA_DIR) != 0; i++);
|
||||
if(paths[i] == NULL) {
|
||||
gchar *new_value = g_strdup_printf("%s:%s", value, PACKAGE_DATA_DIR);
|
||||
g_setenv("XDG_DATA_DIRS", new_value, TRUE);
|
||||
g_free(new_value);
|
||||
}
|
||||
g_strfreev(paths);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
char *config_file;
|
||||
const char *factory_config_file;
|
||||
|
|
@ -2024,7 +2049,7 @@ int main(int argc, char *argv[]){
|
|||
GdkPixbuf *pbuf;
|
||||
const char *app_name="Linphone";
|
||||
LpConfig *factory;
|
||||
char *db_file;
|
||||
char *chat_messages_db_file, *call_logs_db_file;
|
||||
GError *error=NULL;
|
||||
const char *tmp;
|
||||
|
||||
|
|
@ -2043,6 +2068,8 @@ int main(int argc, char *argv[]){
|
|||
/*for pulseaudio:*/
|
||||
g_setenv("PULSE_PROP_media.role", "phone", TRUE);
|
||||
#endif
|
||||
|
||||
populate_xdg_data_dirs_envvar();
|
||||
|
||||
lang=linphone_gtk_get_lang(config_file);
|
||||
if (lang == NULL || lang[0]=='\0'){
|
||||
|
|
@ -2162,9 +2189,15 @@ core_start:
|
|||
linphone_gtk_create_log_window();
|
||||
linphone_core_enable_logs_with_cb(linphone_gtk_log_handler);
|
||||
|
||||
db_file=linphone_gtk_message_storage_get_db_file(NULL);
|
||||
linphone_gtk_init_liblinphone(config_file, factory_config_file, db_file);
|
||||
g_free(db_file);
|
||||
chat_messages_db_file=linphone_gtk_message_storage_get_db_file(NULL);
|
||||
call_logs_db_file = linphone_gtk_call_logs_storage_get_db_file(NULL);
|
||||
linphone_gtk_init_liblinphone(config_file, factory_config_file, chat_messages_db_file, call_logs_db_file);
|
||||
g_free(chat_messages_db_file);
|
||||
g_free(call_logs_db_file);
|
||||
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
linphone_gtk_call_log_update(the_ui);
|
||||
#endif
|
||||
|
||||
/* do not lower timeouts under 30 ms because it exhibits a bug on gtk+/win32, with cpu running 20% all the time...*/
|
||||
gtk_timeout_add(30,(GtkFunction)linphone_gtk_iterate,(gpointer)linphone_gtk_get_core());
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ static LinphoneStatusIcon *_linphone_status_icon_new(const _LinphoneStatusIconDe
|
|||
}
|
||||
|
||||
static void _linphone_status_icon_free(LinphoneStatusIcon *obj) {
|
||||
if(obj->desc->uninit) obj->desc->uninit(obj->data);
|
||||
if(obj->desc->uninit) obj->desc->uninit(obj);
|
||||
if(obj->params) linphone_status_icon_params_unref(obj->params);
|
||||
g_free(obj);
|
||||
}
|
||||
|
|
@ -326,10 +326,10 @@ static void _linphone_status_icon_impl_gtk_init(LinphoneStatusIcon *si) {
|
|||
si->data = icon;
|
||||
}
|
||||
|
||||
// static void _linphone_status_icon_impl_gtk_uninit(LinphoneStatusIcon *si) {
|
||||
// GtkStatusIcon *icon = GTK_STATUS_ICON(si->data);
|
||||
// gtk_status_icon_set_visible(icon, FALSE);
|
||||
// }
|
||||
static void _linphone_status_icon_impl_gtk_uninit(LinphoneStatusIcon *si) {
|
||||
GtkStatusIcon *icon = GTK_STATUS_ICON(si->data);
|
||||
gtk_status_icon_set_visible(icon, FALSE);
|
||||
}
|
||||
|
||||
static void _linphone_status_icon_impl_gtk_start(LinphoneStatusIcon *si) {
|
||||
GtkStatusIcon *icon = GTK_STATUS_ICON(si->data);
|
||||
|
|
@ -381,7 +381,7 @@ static gboolean _linphone_status_icon_impl_is_supported(
|
|||
static const _LinphoneStatusIconDesc _linphone_status_icon_impl_gtk_desc = {
|
||||
"gtk_status_icon",
|
||||
_linphone_status_icon_impl_gtk_init,
|
||||
NULL,
|
||||
_linphone_status_icon_impl_gtk_uninit,
|
||||
_linphone_status_icon_impl_gtk_start,
|
||||
_linphone_status_icon_impl_enable_blinking,
|
||||
_linphone_status_icon_impl_is_supported
|
||||
|
|
|
|||
|
|
@ -76,11 +76,6 @@ public interface LinphoneChatRoom {
|
|||
*/
|
||||
LinphoneChatMessage[] getHistoryRange(int begin, int end);
|
||||
|
||||
/**
|
||||
* Destroys a LinphoneChatRoom.
|
||||
*/
|
||||
void destroy();
|
||||
|
||||
/**
|
||||
* Returns the amount of unread messages associated with the peer of this chatRoom.
|
||||
* @return the amount of unread messages
|
||||
|
|
|
|||
|
|
@ -91,10 +91,6 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
destroy(nativePtr);
|
||||
}
|
||||
|
||||
public int getUnreadMessagesCount() {
|
||||
synchronized(getCore()){
|
||||
return getUnreadMessagesCount(nativePtr);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 19d44b552f46272f43a57f3370badd1a66663f58
|
||||
Subproject commit 7924441a874ebc6a7cf0698988b9633e015b722e
|
||||
2
oRTP
2
oRTP
|
|
@ -1 +1 @@
|
|||
Subproject commit bb95930a77e8a1432e5c31dc170f05ecd15518e5
|
||||
Subproject commit 9477ed6ef1b3bffb6eb1e9e64787b2a3ccd9059e
|
||||
|
|
@ -45,37 +45,41 @@ set(SOURCE_FILES
|
|||
tunnel_tester.c
|
||||
upnp_tester.c
|
||||
video_tester.c
|
||||
)
|
||||
complex_sip_call.c
|
||||
)
|
||||
|
||||
find_program(SIPP_PROGRAM NAMES sipp sipp.exe)
|
||||
if(SIPP_PROGRAM)
|
||||
add_definitions(-DHAVE_SIPP=1)
|
||||
else()
|
||||
message(WARNING "Could not find sipp!")
|
||||
endif()
|
||||
|
||||
add_definitions(-DBC_CONFIG_FILE="config.h")
|
||||
|
||||
if(IOS)
|
||||
|
||||
add_library(linphonetester STATIC ${SOURCE_FILES})
|
||||
target_include_directories(linphonetester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
|
||||
target_link_libraries(linphonetester linphone ${CUNIT_LIBRARIES})
|
||||
install(TARGETS linphonetester
|
||||
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 "liblinphone_tester.h" "common/bc_tester_utils.h"
|
||||
DESTINATION include/linphone
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
|
||||
add_library(linphonetester STATIC ${SOURCE_FILES})
|
||||
target_include_directories(linphonetester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
|
||||
target_link_libraries(linphonetester linphone ${CUNIT_LIBRARIES})
|
||||
install(TARGETS linphonetester
|
||||
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 "liblinphone_tester.h" "common/bc_tester_utils.h"
|
||||
DESTINATION include/linphone
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
else()
|
||||
|
||||
add_executable(liblinphone_tester ${SOURCE_FILES})
|
||||
set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
|
||||
target_include_directories(liblinphone_tester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
|
||||
target_link_libraries(liblinphone_tester linphone ${CUNIT_LIBRARIES})
|
||||
if (GTK2_FOUND)
|
||||
target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
|
||||
target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
|
||||
target_link_libraries(liblinphone_tester linphone ${GTK2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_executable(liblinphone_tester ${SOURCE_FILES})
|
||||
set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
|
||||
target_include_directories(liblinphone_tester PUBLIC ${CUNIT_INCLUDE_DIRS} PRIVATE common)
|
||||
target_link_libraries(liblinphone_tester linphone ${CUNIT_LIBRARIES})
|
||||
if (GTK2_FOUND)
|
||||
target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
|
||||
target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
|
||||
target_link_libraries(liblinphone_tester linphone ${GTK2_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ liblinphonetester_la_SOURCES = \
|
|||
tester.c \
|
||||
upnp_tester.c \
|
||||
video_tester.c \
|
||||
common/bc_tester_utils.c
|
||||
common/bc_tester_utils.c \
|
||||
complex_sip_call.c
|
||||
|
||||
liblinphonetester_ladir = $(includedir)/linphone
|
||||
liblinphonetester_la_HEADERS = common/bc_tester_utils.h
|
||||
|
|
|
|||
|
|
@ -1274,14 +1274,13 @@ static void call_paused_by_both() {
|
|||
linphone_core_pause_call(marie->lc, call_marie);
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausing,1));
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPaused,1));
|
||||
|
||||
|
||||
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
|
||||
/*pauline must stay in paused state*/
|
||||
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallPaused, 1, int, "%i");
|
||||
check_media_direction(pauline, call_pauline, lcs, LinphoneMediaDirectionInactive, LinphoneMediaDirectionInvalid);
|
||||
check_media_direction(marie, call_marie, lcs, LinphoneMediaDirectionInactive, LinphoneMediaDirectionInvalid);
|
||||
|
||||
|
||||
|
||||
/*now pauline wants to resume*/
|
||||
linphone_core_resume_call(pauline->lc, call_pauline);
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallResuming,1));
|
||||
|
|
@ -1289,7 +1288,7 @@ static void call_paused_by_both() {
|
|||
/*Marie must stay in paused state*/
|
||||
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
|
||||
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallPaused, 1, int, "%i");
|
||||
|
||||
|
||||
/*now marie wants to resume also*/
|
||||
linphone_core_resume_call(marie->lc, call_marie);
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallResuming,1));
|
||||
|
|
@ -3161,6 +3160,7 @@ static void call_rejected_because_wrong_credentials_with_params(const char* user
|
|||
LinphoneAuthInfo* wrong_auth_info=linphone_auth_info_clone(good_auth_info);
|
||||
bool_t result=FALSE;
|
||||
linphone_auth_info_set_passwd(wrong_auth_info,"passecretdutout");
|
||||
linphone_auth_info_set_ha1(wrong_auth_info, NULL);
|
||||
linphone_core_clear_all_auth_info(marie->lc);
|
||||
|
||||
if (user_agent) {
|
||||
|
|
@ -3258,8 +3258,8 @@ static void multiple_early_media(void) {
|
|||
/*wait a bit that streams are established*/
|
||||
wait_for_list(lcs,&dummy,1,6000);
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_max_audio_down_bw(pauline),70,int,"%i");
|
||||
BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>70);
|
||||
BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>70);
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie1), 70, int, "%i");
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie2), 70, int, "%i");
|
||||
|
||||
linphone_core_accept_call(marie1->lc,linphone_core_get_current_call(marie1->lc));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000));
|
||||
|
|
@ -3270,8 +3270,8 @@ static void multiple_early_media(void) {
|
|||
|
||||
/*wait a bit that streams are established*/
|
||||
wait_for_list(lcs,&dummy,1,3000);
|
||||
BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>71);
|
||||
BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>71);
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(pauline), 71, int, "%i");
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie1), 71, int, "%i");
|
||||
|
||||
/*send an INFO in reverse side to check that dialogs are properly established*/
|
||||
info=linphone_core_create_info_message(marie1->lc);
|
||||
|
|
@ -3333,13 +3333,13 @@ void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList*
|
|||
BC_ASSERT_EQUAL(linphone_call_params_get_audio_direction(params), audio_dir, int, "%d");
|
||||
switch (audio_dir) {
|
||||
case LinphoneMediaDirectionInactive:
|
||||
BC_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth<5);
|
||||
BC_ASSERT_LOWER(linphone_call_get_audio_stats(call)->upload_bandwidth, 5, int, "%i");
|
||||
case LinphoneMediaDirectionSendOnly:
|
||||
BC_ASSERT_TRUE(linphone_call_get_video_stats(call)->download_bandwidth<5);
|
||||
BC_ASSERT_LOWER(linphone_call_get_video_stats(call)->download_bandwidth, 5, int, "%i");
|
||||
if (audio_dir == LinphoneMediaDirectionSendOnly) BC_ASSERT_TRUE(wait_for_list(lcs,mgr->stat.current_audio_upload_bandwidth,70,4000));
|
||||
break;
|
||||
case LinphoneMediaDirectionRecvOnly:
|
||||
BC_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth<5);
|
||||
BC_ASSERT_LOWER(linphone_call_get_audio_stats(call)->upload_bandwidth, 5, int, "%i");
|
||||
case LinphoneMediaDirectionSendRecv:
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,mgr->stat.current_audio_download_bandwidth,70,4000));
|
||||
if (audio_dir == LinphoneMediaDirectionSendRecv) BC_ASSERT_TRUE(wait_for_list(lcs,mgr->stat.current_audio_upload_bandwidth,70,4000));
|
||||
|
|
@ -4208,7 +4208,7 @@ static void video_call_with_re_invite_inactive_followed_by_re_invite_base(Linpho
|
|||
linphone_call_params_set_video_direction(params,LinphoneMediaDirectionSendRecv);
|
||||
linphone_core_update_call(marie->lc,linphone_core_get_current_call(marie->lc),params);
|
||||
linphone_call_params_destroy(params);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,3));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
|
||||
|
||||
|
|
@ -4319,12 +4319,12 @@ static void simple_stereo_call(const char *codec_name, int clock_rate, int bitra
|
|||
}else{
|
||||
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID)
|
||||
double similar;
|
||||
double min_threshold = .6f;
|
||||
double min_threshold = .75f; /*should be above 0.8 in best conditions*/
|
||||
double max_threshold = 1.f;
|
||||
if (!stereo){
|
||||
/*when opus doesn't transmit stereo, the cross correlation is around 0.54 : as expected, it is not as good as in full stereo mode*/
|
||||
/*when opus doesn't transmit stereo, the cross correlation is around 0.6 : as expected, it is not as good as in full stereo mode*/
|
||||
min_threshold = .4f;
|
||||
max_threshold = .6f;
|
||||
max_threshold = .68f;
|
||||
}
|
||||
BC_ASSERT_EQUAL(ms_audio_diff(stereo_file, recordpath,&similar,&audio_cmp_params,completion_cb,NULL), 0, int, "%d");
|
||||
BC_ASSERT_GREATER(similar, min_threshold, double, "%g");
|
||||
|
|
@ -4357,40 +4357,40 @@ static void simple_stereo_call_opus(void){
|
|||
}
|
||||
|
||||
static void call_with_complex_late_offering(void){
|
||||
LinphoneCallParams *params;
|
||||
LinphoneCallParams *params;
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
LinphoneCall* call_pauline;
|
||||
LinphoneCall* call_marie;
|
||||
LinphoneVideoPolicy vpol = {TRUE, TRUE};
|
||||
bool_t call_ok;
|
||||
|
||||
|
||||
linphone_core_enable_video(pauline->lc, TRUE, TRUE);
|
||||
linphone_core_enable_video(marie->lc, TRUE, TRUE);
|
||||
linphone_core_set_video_policy(pauline->lc, &vpol);
|
||||
linphone_core_set_video_policy(marie->lc, &vpol);
|
||||
linphone_core_set_video_device(pauline->lc,liblinphone_tester_mire_id);
|
||||
linphone_core_set_video_device(marie->lc,liblinphone_tester_mire_id);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE((call_ok=call(pauline,marie)));
|
||||
if (!call_ok) goto end;
|
||||
|
||||
|
||||
call_pauline = linphone_core_get_current_call(pauline->lc);
|
||||
call_marie = linphone_core_get_current_call(marie->lc);
|
||||
|
||||
|
||||
//Invite inactive Audio/video (Marie pause Pauline)
|
||||
ms_message("CONTEXT: Marie sends INVITE with SDP with all streams inactive");
|
||||
params=linphone_core_create_call_params(marie->lc,call_marie);
|
||||
linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionInactive);
|
||||
linphone_call_params_set_video_direction(params,LinphoneMediaDirectionInactive);
|
||||
|
||||
|
||||
linphone_core_update_call(marie->lc, call_marie ,params);
|
||||
linphone_call_params_destroy(params);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
|
||||
|
||||
|
||||
//Marie sends INVITE without SDP
|
||||
ms_message("CONTEXT: Marie sends INVITE without SDP for setting streams in send-only mode");
|
||||
linphone_core_enable_sdp_200_ack(marie->lc,TRUE);
|
||||
|
|
@ -4404,7 +4404,7 @@ static void call_with_complex_late_offering(void){
|
|||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,2));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,3));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,2));
|
||||
|
||||
|
||||
linphone_core_enable_sdp_200_ack(marie->lc,FALSE);
|
||||
|
||||
//Pauline pause Marie
|
||||
|
|
@ -4413,7 +4413,7 @@ static void call_with_complex_late_offering(void){
|
|||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPausing,1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPaused,1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1));
|
||||
|
||||
|
||||
//Pauline resume Marie
|
||||
ms_message("CONTEXT: Pauline resumes the call");
|
||||
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
|
||||
|
|
@ -4421,22 +4421,22 @@ static void call_with_complex_late_offering(void){
|
|||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,4));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallResuming,1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,3));
|
||||
|
||||
|
||||
wait_for_until(pauline->lc, marie->lc, NULL, 0, 2000);
|
||||
|
||||
|
||||
//Marie invite inactive Audio/Video
|
||||
ms_message("CONTEXT: Marie sends INVITE with SDP with all streams inactive");
|
||||
params=linphone_core_create_call_params(marie->lc,call_marie);
|
||||
linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionInactive);
|
||||
linphone_call_params_set_video_direction(params,LinphoneMediaDirectionInactive);
|
||||
|
||||
|
||||
linphone_core_update_call(marie->lc, call_marie,params);
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,3));
|
||||
linphone_call_params_destroy(params);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,4));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,5));
|
||||
|
||||
|
||||
//Marie sends INVITE without SDP
|
||||
ms_message("CONTEXT: Marie sends INVITE without SDP in the purpose of re-enabling streams in sendrecv mode");
|
||||
linphone_core_enable_sdp_200_ack(marie->lc,TRUE);
|
||||
|
|
@ -4449,17 +4449,15 @@ static void call_with_complex_late_offering(void){
|
|||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,5));
|
||||
|
||||
|
||||
linphone_core_enable_sdp_200_ack(marie->lc,FALSE);
|
||||
|
||||
|
||||
|
||||
end_call(marie,pauline);
|
||||
|
||||
|
||||
end:
|
||||
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
|
||||
}
|
||||
|
||||
static void simple_mono_call_opus(void){
|
||||
|
|
@ -4504,7 +4502,7 @@ static void call_with_rtp_io_mode(void) {
|
|||
bool_t call_ok;
|
||||
int attempts;
|
||||
double similar=1;
|
||||
const double threshold = 0.9;
|
||||
const double threshold = 0.85;
|
||||
|
||||
/*this test is actually attempted three times in case of failure, because the audio comparison at the end is very sensitive to
|
||||
* jitter buffer drifts, which sometimes happen if the machine is unable to run the test in good realtime conditions */
|
||||
|
|
@ -4628,26 +4626,26 @@ static int rtptm_on_send(RtpTransportModifier *rtptm, mblk_t *msg) {
|
|||
int i = 0;
|
||||
unsigned char *src;
|
||||
int size = 0;
|
||||
|
||||
|
||||
if (rtp->version == 0) {
|
||||
// This is probably a STUN packet, so don't count it (oRTP won't) and don't encrypt it either
|
||||
return msgdsize(msg);
|
||||
}
|
||||
|
||||
|
||||
// Mediastream can create a mblk_t with only the RTP header and setting the b_cont pointer to the actual RTP content buffer
|
||||
// In this scenario, the result of rtp_get_payload will be 0, and we won't be able to do our XOR encryption on the payload
|
||||
// The call to msgpullup will trigger a memcpy of the header and the payload in the same buffer in the msg mblk_t
|
||||
msgpullup(msg, -1);
|
||||
// Now that the mblk_t buffer directly contains the header and the payload, we can get the size of the payload and a pointer to it's start (we don't encrypt the RTP header)
|
||||
size = rtp_get_payload(msg, &src);
|
||||
|
||||
|
||||
// Just for fun, let's do a XOR encryption
|
||||
for (i = 0; i < size; i++) {
|
||||
src[i] ^= (unsigned char) XOR_KEY[i % strlen(XOR_KEY)];
|
||||
}
|
||||
|
||||
|
||||
data->packetSentCount += 1;
|
||||
|
||||
|
||||
/* /!\ DO NOT RETURN 0 or the packet will never leave /!\ */
|
||||
return msgdsize(msg);
|
||||
}
|
||||
|
|
@ -4660,23 +4658,23 @@ static int rtptm_on_receive(RtpTransportModifier *rtptm, mblk_t *msg) {
|
|||
int i = 0;
|
||||
unsigned char *src;
|
||||
int size = 0;
|
||||
|
||||
|
||||
if (rtp->version == 0) {
|
||||
// This is probably a STUN packet, so don't count it (oRTP won't) and don't decrypt it either
|
||||
return msgdsize(msg);
|
||||
}
|
||||
|
||||
|
||||
// On the receiving side, there is no need for a msgpullup, the mblk_t contains the header and the payload in the same buffer
|
||||
// We just ask for the size and a pointer to the payload buffer
|
||||
size = rtp_get_payload(msg, &src);
|
||||
|
||||
|
||||
// Since we did a XOR encryption on the send side, we have to do it again to decrypt the payload
|
||||
for (i = 0; i < size; i++) {
|
||||
src[i] ^= (unsigned char) XOR_KEY[i % strlen(XOR_KEY)];
|
||||
}
|
||||
|
||||
|
||||
data->packetReceivedCount += 1;
|
||||
|
||||
|
||||
/* /!\ DO NOT RETURN 0 or the packet will be dropped /!\ */
|
||||
return msgdsize(msg);
|
||||
}
|
||||
|
|
@ -4690,7 +4688,7 @@ static void rtptm_destroy(RtpTransportModifier *rtptm) {
|
|||
// This is the callback called when the state of the call change
|
||||
void static call_state_changed_4(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) {
|
||||
int i = 0;
|
||||
|
||||
|
||||
// To add a custom RTP transport modifier, we have to do it before the call is running, but after the RTP session is created.
|
||||
if (cstate == LinphoneCallIncomingReceived || cstate == LinphoneCallOutgoingProgress) {
|
||||
RtpTransport *rtpt = NULL;
|
||||
|
|
@ -4700,16 +4698,16 @@ void static call_state_changed_4(LinphoneCore *lc, LinphoneCall *call, LinphoneC
|
|||
rtptm->t_process_on_send = rtptm_on_send;
|
||||
rtptm->t_process_on_receive = rtptm_on_receive;
|
||||
rtptm->t_destroy = rtptm_destroy;
|
||||
|
||||
|
||||
// Here we iterate on each meta rtp transport available
|
||||
for (i = 0; i < linphone_call_get_stream_count(call); i++) {
|
||||
MSFormatType type;
|
||||
|
||||
|
||||
rtpt = linphone_call_get_meta_rtp_transport(call, i);
|
||||
|
||||
|
||||
// If we wanted, we also could get the RTCP meta transports like this:
|
||||
// rtcpt = linphone_call_get_meta_rtcp_transport(call, i);
|
||||
|
||||
|
||||
// If you want to know which stream meta RTP transport is the current one, you can use
|
||||
type = linphone_call_get_stream_type(call, i);
|
||||
// Currently there is only MSAudio and MSVideo types, but this could change later
|
||||
|
|
@ -4719,7 +4717,6 @@ void static call_state_changed_4(LinphoneCore *lc, LinphoneCall *call, LinphoneC
|
|||
} else if (type == MSVideo) {
|
||||
// Because the call of this test is audio only, we don't have to append our modifier to the meta RTP transport from the video stream
|
||||
}
|
||||
|
||||
}
|
||||
// We save the pointer to our RtpTransportModifier in the call user_data to be able to get to it later
|
||||
call->user_data = rtptm;
|
||||
|
|
@ -4744,8 +4741,8 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
|
|||
char *hellopath = bc_tester_res("sounds/ahbahouaismaisbon.wav"); // File to be played
|
||||
char *recordpath = create_filepath(bc_tester_get_writable_dir_prefix(), "record-call_with_file_player", "wav"); // File to record the received sound
|
||||
double similar = 1; // The factor of similarity between the played file and the one recorded
|
||||
const double threshold = 0.9; // Minimum similarity value to consider the record file equal to the one sent
|
||||
|
||||
const double threshold = 0.85; // Minimum similarity value to consider the record file equal to the one sent
|
||||
|
||||
// We create a new vtable to listen only to the call state changes, in order to plug our RTP Transport Modifier when the call will be established
|
||||
v_table = linphone_core_v_table_new();
|
||||
v_table->call_state_changed = call_state_changed_4;
|
||||
|
|
@ -4753,11 +4750,11 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
|
|||
v_table = linphone_core_v_table_new();
|
||||
v_table->call_state_changed = call_state_changed_4;
|
||||
linphone_core_add_listener(marie->lc,v_table);
|
||||
|
||||
|
||||
if (recordTest) { // When we do the record test, we need a file player to play the content of a sound file
|
||||
/*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/
|
||||
unlink(recordpath);
|
||||
|
||||
|
||||
linphone_core_use_files(pauline->lc,TRUE);
|
||||
linphone_core_set_play_file(pauline->lc,NULL);
|
||||
linphone_core_set_record_file(pauline->lc,NULL);
|
||||
|
|
@ -4772,16 +4769,16 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
|
|||
BC_ASSERT_TRUE((call_ok=call(pauline,marie)));
|
||||
|
||||
if (!call_ok) goto end;
|
||||
|
||||
|
||||
// Ref the call to keep the pointer valid even after the call is release
|
||||
call_pauline = linphone_call_ref(linphone_core_get_current_call(pauline->lc));
|
||||
call_marie = linphone_call_ref(linphone_core_get_current_call(marie->lc));
|
||||
|
||||
|
||||
// This is for the pause/resume test, we don't do it in the call record test to be able to check the recorded call matches the file played
|
||||
if (pauseResumeTest) {
|
||||
// This only wait for 3 seconds in order to generate traffic for the test
|
||||
wait_for_until(pauline->lc, marie->lc, NULL, 5, 3000);
|
||||
|
||||
|
||||
linphone_core_pause_call(pauline->lc,call_pauline);
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallPausing, 1));
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneCallPausedByRemote, 1));
|
||||
|
|
@ -4794,7 +4791,7 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
|
|||
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2));
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2));
|
||||
|
||||
|
||||
/*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);
|
||||
|
||||
|
|
@ -4817,10 +4814,10 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
|
|||
wait_for_until(pauline->lc, marie->lc, NULL, 0, 1000);
|
||||
|
||||
end_call(pauline, marie);
|
||||
|
||||
|
||||
// Now we compute a similarity factor between the original file and the one we recorded on the callee side
|
||||
BC_ASSERT_EQUAL(ms_audio_diff(hellopath, recordpath, &similar, &audio_cmp_params, NULL, NULL), 0, int, "%d");
|
||||
|
||||
|
||||
BC_ASSERT_GREATER(similar, threshold, double, "%g");
|
||||
BC_ASSERT_LOWER(similar, 1.0, double, "%g");
|
||||
if (similar >= threshold && similar <= 1.0) {
|
||||
|
|
@ -4830,17 +4827,17 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
|
|||
} else {
|
||||
// This only wait for 3 seconds in order to generate traffic for the test
|
||||
wait_for_until(pauline->lc, marie->lc, NULL, 5, 3000);
|
||||
|
||||
|
||||
// We termine the call and check the stats to see if the call is correctly ended on both sides
|
||||
end_call(pauline, marie);
|
||||
}
|
||||
|
||||
|
||||
// Now we can go fetch our custom structure and check the number of packets sent/received is the same on both sides
|
||||
rtptm_marie = (RtpTransportModifier *)call_marie->user_data;
|
||||
rtptm_pauline = (RtpTransportModifier *)call_pauline->user_data;
|
||||
data_marie = (RtpTransportModifierData *)rtptm_marie->data;
|
||||
data_pauline = (RtpTransportModifierData *)rtptm_pauline->data;
|
||||
|
||||
|
||||
BC_ASSERT_PTR_NOT_NULL(data_marie);
|
||||
BC_ASSERT_PTR_NOT_NULL(data_pauline);
|
||||
ms_message("Marie sent %i RTP packets and received %i (through our modifier)", (int)data_marie->packetSentCount, (int)data_marie->packetReceivedCount);
|
||||
|
|
@ -4849,7 +4846,7 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
|
|||
BC_ASSERT_TRUE(data_marie->packetSentCount - data_pauline->packetReceivedCount < 50);
|
||||
BC_ASSERT_TRUE(data_marie->packetReceivedCount == data_pauline->packetSentCount);
|
||||
// At this point, we know each packet that has been processed in the send callback of our RTP modifier also go through the recv callback of the remote.
|
||||
|
||||
|
||||
// Now we want to ensure that all sent RTP packets actually go through our RTP transport modifier and thus no packet leave without being processed (by any operation we might want to do on it)
|
||||
{
|
||||
const LinphoneCallStats *marie_stats = linphone_call_get_audio_stats(call_marie);
|
||||
|
|
@ -4874,7 +4871,7 @@ end:
|
|||
ms_free(data_marie);
|
||||
}
|
||||
ms_free(rtptm_marie);
|
||||
|
||||
|
||||
// Unref the previously ref calls
|
||||
if (call_marie) {
|
||||
linphone_call_unref(call_marie);
|
||||
|
|
@ -4882,11 +4879,11 @@ end:
|
|||
if (call_pauline) {
|
||||
linphone_call_unref(call_pauline);
|
||||
}
|
||||
|
||||
|
||||
// The test is finished, the linphone core are no longer needed, we can safely free them
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
|
||||
|
||||
ms_free(recordpath);
|
||||
ms_free(hellopath);
|
||||
}
|
||||
|
|
@ -4907,34 +4904,34 @@ static void _call_with_network_switch(bool_t use_ice){
|
|||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
bool_t call_ok;
|
||||
|
||||
|
||||
if (use_ice){
|
||||
linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
|
||||
linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
|
||||
}
|
||||
|
||||
|
||||
BC_ASSERT_TRUE((call_ok=call(pauline,marie)));
|
||||
if (!call_ok) goto end;
|
||||
|
||||
|
||||
wait_for_until(marie->lc, pauline->lc, NULL, 0, 2000);
|
||||
if (use_ice) BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection));
|
||||
|
||||
|
||||
/*marie looses the network and reconnects*/
|
||||
linphone_core_set_network_reachable(marie->lc, FALSE);
|
||||
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000);
|
||||
|
||||
|
||||
/*marie will reconnect and register*/
|
||||
linphone_core_set_network_reachable(marie->lc, TRUE);
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneRegistrationOk, 2));
|
||||
|
||||
|
||||
/*pauline shall receive a reINVITE to update the session*/
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2));
|
||||
|
||||
|
||||
liblinphone_tester_check_rtcp(pauline, marie);
|
||||
if (use_ice) BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection));
|
||||
|
||||
|
||||
/*pauline shall be able to end the call without problem now*/
|
||||
end_call(pauline, marie);
|
||||
end:
|
||||
|
|
@ -4952,6 +4949,121 @@ static void call_with_network_switch_and_ice(void){
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
|
||||
static void call_logs_if_no_db_set() {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* laure = linphone_core_manager_new("laure_call_logs_rc");
|
||||
BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 10);
|
||||
|
||||
BC_ASSERT_TRUE(call(marie, laure));
|
||||
wait_for_until(marie->lc, laure->lc, NULL, 5, 1000);
|
||||
end_call(marie, laure);
|
||||
|
||||
BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 11);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(laure);
|
||||
}
|
||||
|
||||
static void call_logs_migrate() {
|
||||
LinphoneCoreManager* laure = linphone_core_manager_new("laure_call_logs_rc");
|
||||
char *logs_db = create_filepath(bc_tester_get_writable_dir_prefix(), "call_logs", "db");
|
||||
int i = 0;
|
||||
int incoming_count = 0, outgoing_count = 0, missed_count = 0, aborted_count = 0, decline_count = 0, video_enabled_count = 0;
|
||||
|
||||
BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 10);
|
||||
|
||||
linphone_core_set_call_logs_database_path(laure->lc, logs_db);
|
||||
BC_ASSERT_TRUE(linphone_core_get_call_history_size(laure->lc) == 10);
|
||||
|
||||
for (; i < ms_list_size(laure->lc->call_logs); i++) {
|
||||
LinphoneCallLog *log = ms_list_nth_data(laure->lc->call_logs, i);
|
||||
LinphoneCallStatus state = linphone_call_log_get_status(log);
|
||||
LinphoneCallDir direction = linphone_call_log_get_dir(log);
|
||||
|
||||
if (state == LinphoneCallAborted) {
|
||||
aborted_count += 1;
|
||||
} else if (state == LinphoneCallMissed) {
|
||||
missed_count += 1;
|
||||
} else if (state == LinphoneCallDeclined) {
|
||||
decline_count += 1;
|
||||
}
|
||||
|
||||
if (direction == LinphoneCallOutgoing) {
|
||||
outgoing_count += 1;
|
||||
} else {
|
||||
incoming_count += 1;
|
||||
}
|
||||
|
||||
if (linphone_call_log_video_enabled(log)) {
|
||||
video_enabled_count += 1;
|
||||
}
|
||||
}
|
||||
BC_ASSERT_TRUE(incoming_count == 5);
|
||||
BC_ASSERT_TRUE(outgoing_count == 5);
|
||||
BC_ASSERT_TRUE(missed_count == 1);
|
||||
BC_ASSERT_TRUE(aborted_count == 3);
|
||||
BC_ASSERT_TRUE(decline_count == 2);
|
||||
BC_ASSERT_TRUE(video_enabled_count == 3);
|
||||
|
||||
laure->lc->call_logs = ms_list_free_with_data(laure->lc->call_logs, (void (*)(void*))linphone_call_log_unref);
|
||||
call_logs_read_from_config_file(laure->lc);
|
||||
BC_ASSERT_TRUE(ms_list_size(laure->lc->call_logs) == 0);
|
||||
|
||||
remove(logs_db);
|
||||
ms_free(logs_db);
|
||||
linphone_core_manager_destroy(laure);
|
||||
}
|
||||
|
||||
static void call_logs_sqlite_storage() {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
char *logs_db = create_filepath(bc_tester_get_writable_dir_prefix(), "call_logs", "db");
|
||||
MSList *logs = NULL;
|
||||
LinphoneAddress *laure = NULL;
|
||||
|
||||
linphone_core_set_call_logs_database_path(marie->lc, logs_db);
|
||||
BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 0);
|
||||
|
||||
BC_ASSERT_TRUE(call(marie, pauline));
|
||||
wait_for_until(marie->lc, pauline->lc, NULL, 5, 1000);
|
||||
end_call(marie, pauline);
|
||||
BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 1);
|
||||
|
||||
logs = linphone_core_get_call_history_for_address(marie->lc, linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc)));
|
||||
BC_ASSERT_TRUE(ms_list_size(logs) == 1);
|
||||
ms_list_free_with_data(logs, (void (*)(void*))linphone_call_log_unref);
|
||||
|
||||
laure = linphone_address_new("\"Laure\" <sip:laure@sip.example.org>");
|
||||
logs = linphone_core_get_call_history_for_address(marie->lc, laure);
|
||||
BC_ASSERT_TRUE(ms_list_size(logs) == 0);
|
||||
ms_free(laure);
|
||||
|
||||
logs = linphone_core_get_call_history_for_address(marie->lc, linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc)));
|
||||
BC_ASSERT_TRUE(ms_list_size(logs) == 1);
|
||||
linphone_core_delete_call_log(marie->lc, (LinphoneCallLog *)ms_list_nth_data(logs, 0));
|
||||
ms_list_free_with_data(logs, (void (*)(void*))linphone_call_log_unref);
|
||||
BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 0);
|
||||
|
||||
BC_ASSERT_TRUE(call(marie, pauline));
|
||||
wait_for_until(marie->lc, pauline->lc, NULL, 5, 1000);
|
||||
end_call(marie, pauline);
|
||||
BC_ASSERT_TRUE(call(marie, pauline));
|
||||
wait_for_until(marie->lc, pauline->lc, NULL, 5, 1000);
|
||||
end_call(marie, pauline);
|
||||
BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 2);
|
||||
|
||||
linphone_core_delete_call_history(marie->lc);
|
||||
BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 0);
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
remove(logs_db);
|
||||
ms_free(logs_db);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
test_t call_tests[] = {
|
||||
{ "Early declined call", early_declined_call },
|
||||
{ "Call declined", call_declined },
|
||||
|
|
@ -5082,6 +5194,11 @@ test_t call_tests[] = {
|
|||
{ "Call with RTP IO mode", call_with_rtp_io_mode },
|
||||
{ "Call with generic NACK RTCP feedback", call_with_generic_nack_rtcp_feedback },
|
||||
{ "Call with complex late offering", call_with_complex_late_offering },
|
||||
#ifdef CALL_LOGS_STORAGE_ENABLED
|
||||
{ "Call log working if no db set", call_logs_if_no_db_set },
|
||||
{ "Call log storage migration from rc to db", call_logs_migrate },
|
||||
{ "Call log storage in sqlite database", call_logs_sqlite_storage },
|
||||
#endif
|
||||
{ "Call with custom RTP Modifier", call_with_custom_rtp_modifier },
|
||||
{ "Call paused resumed with custom RTP Modifier", call_paused_resumed_with_custom_rtp_modifier },
|
||||
{ "Call record with custom RTP Modifier", call_record_with_custom_rtp_modifier },
|
||||
|
|
@ -5092,10 +5209,5 @@ test_t call_tests[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
test_suite_t call_test_suite = {
|
||||
"Single Call",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(call_tests) / sizeof(call_tests[0]),
|
||||
call_tests
|
||||
};
|
||||
test_suite_t call_test_suite = {"Single Call", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(call_tests) / sizeof(call_tests[0]), call_tests};
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
|
||||
static char *bc_tester_resource_dir_prefix = NULL;
|
||||
static char *bc_tester_writable_dir_prefix = NULL;
|
||||
|
||||
|
|
@ -82,7 +81,7 @@ void bc_tester_printf(int level, const char *fmt, ...) {
|
|||
int bc_tester_run_suite(test_suite_t *suite) {
|
||||
int i;
|
||||
|
||||
CU_pSuite pSuite = CU_add_suite(suite->name, suite->init_func, suite->cleanup_func);
|
||||
CU_pSuite pSuite = CU_add_suite(suite->name, suite->before_all, suite->after_all);
|
||||
|
||||
for (i = 0; i < suite->nb_tests; i++) {
|
||||
if (NULL == CU_add_test(pSuite, suite->tests[i].name, suite->tests[i].func)) {
|
||||
|
|
@ -102,7 +101,7 @@ int bc_tester_suite_index(const char *suite_name) {
|
|||
int i;
|
||||
|
||||
for (i = 0; i < nb_test_suites; i++) {
|
||||
if ((strcmp(suite_name, test_suite[i]->name) == 0) && (strlen(suite_name) == strlen(test_suite[i]->name))) {
|
||||
if (strcmp(suite_name, test_suite[i]->name) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
@ -165,25 +164,35 @@ static void suite_start_message_handler(const CU_pSuite pSuite) {
|
|||
suite_start_time = time(NULL);
|
||||
}
|
||||
static void suite_complete_message_handler(const CU_pSuite pSuite, const CU_pFailureRecord pFailure) {
|
||||
bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] ended in %lu sec\n", pSuite->pName, time(NULL) - suite_start_time);
|
||||
bc_tester_printf(bc_printf_verbosity_info, "Suite [%s] ended in %lu sec\n", pSuite->pName,
|
||||
time(NULL) - suite_start_time);
|
||||
}
|
||||
|
||||
static time_t test_start_time = 0;
|
||||
static void test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSuite) {
|
||||
int suite_index = bc_tester_suite_index(pSuite->pName);
|
||||
bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] Test [%s] started", pSuite->pName,pTest->pName);
|
||||
test_start_time = time(NULL);
|
||||
if (test_suite[suite_index]->before_each) {
|
||||
test_suite[suite_index]->before_each();
|
||||
}
|
||||
}
|
||||
|
||||
/*derivated from cunit*/
|
||||
static void test_complete_message_handler(const CU_pTest pTest,
|
||||
const CU_pSuite pSuite,
|
||||
const CU_pFailureRecord pFailureList) {
|
||||
static void test_complete_message_handler(const CU_pTest pTest, const CU_pSuite pSuite,
|
||||
const CU_pFailureRecord pFailureList) {
|
||||
int i;
|
||||
char result[2048];
|
||||
char buffer[2048];
|
||||
int suite_index = bc_tester_suite_index(pSuite->pName);
|
||||
char result[2048]={0};
|
||||
char buffer[2048]={0};
|
||||
CU_pFailureRecord pFailure = pFailureList;
|
||||
snprintf(result, sizeof(result), "Suite [%s] Test [%s] %s in %lu secs"
|
||||
, pSuite->pName, pTest->pName, pFailure?"failed":"passed",(unsigned long)(time(NULL) - test_start_time));
|
||||
|
||||
if (test_suite[suite_index]->after_each) {
|
||||
test_suite[suite_index]->after_each();
|
||||
}
|
||||
|
||||
snprintf(result, sizeof(result), "Suite [%s] Test [%s] %s in %lu secs", pSuite->pName, pTest->pName,
|
||||
pFailure ? "failed" : "passed", (unsigned long)(time(NULL) - test_start_time));
|
||||
if (pFailure) {
|
||||
for (i = 1 ; (NULL != pFailure) ; pFailure = pFailure->pNext, i++) {
|
||||
snprintf(buffer, sizeof(buffer), "\n %d. %s:%u - %s", i,
|
||||
|
|
@ -197,15 +206,20 @@ static void test_complete_message_handler(const CU_pTest pTest,
|
|||
#ifdef __linux
|
||||
/* use mallinfo() to monitor allocated space. It is linux specific but other methods don't work:
|
||||
* setrlimit() RLIMIT_DATA doesn't count memory allocated via mmap() (which is used internally by malloc)
|
||||
* setrlimit() RLIMIT_AS works but also counts virtual memory allocated by thread stacks, which is very big and hardly controllable.
|
||||
* setrlimit() RLIMIT_AS works but also counts virtual memory allocated by thread stacks, which is very big and
|
||||
* hardly controllable.
|
||||
* setrlimit() RLIMIT_RSS does nothing interesting on linux.
|
||||
* getrusage() of RSS is unreliable: memory blocks can be leaked without being read or written, which would not appear in RSS.
|
||||
* getrusage() of RSS is unreliable: memory blocks can be leaked without being read or written, which would not
|
||||
* appear in RSS.
|
||||
* mallinfo() itself is the less worse solution. Allocated bytes are returned as 'int' so limited to 2GB
|
||||
*/
|
||||
if (max_vm_kb){
|
||||
if (max_vm_kb) {
|
||||
struct mallinfo minfo = mallinfo();
|
||||
if (minfo.uordblks > max_vm_kb * 1024){
|
||||
bc_tester_printf(bc_printf_verbosity_error, "The program exceeded the maximum ammount of memory allocatable (%i bytes), aborting now.\n", minfo.uordblks);
|
||||
if (minfo.uordblks > max_vm_kb * 1024) {
|
||||
bc_tester_printf(
|
||||
bc_printf_verbosity_error,
|
||||
"The program exceeded the maximum amount of memory allocatable (%i bytes), aborting now.\n",
|
||||
minfo.uordblks);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -281,30 +295,31 @@ int bc_tester_run_tests(const char *suite_name, const char *test_name) {
|
|||
}
|
||||
}
|
||||
#ifdef __linux
|
||||
bc_tester_printf(bc_printf_verbosity_info, "Still %i kilobytes allocated when all tests are finished.", mallinfo().uordblks/1024);
|
||||
bc_tester_printf(bc_printf_verbosity_info, "Still %i kilobytes allocated when all tests are finished.",
|
||||
mallinfo().uordblks / 1024);
|
||||
#endif
|
||||
|
||||
|
||||
return CU_get_number_of_tests_failed()!=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void bc_tester_helper(const char *name, const char* additionnal_helper) {
|
||||
bc_tester_printf(bc_printf_verbosity_info,"%s --help\n"
|
||||
"\t\t\t--list-suites\n"
|
||||
"\t\t\t--list-tests <suite>\n"
|
||||
"\t\t\t--suite <suite name>\n"
|
||||
"\t\t\t--test <test name>\n"
|
||||
bc_tester_printf(bc_printf_verbosity_info,
|
||||
"%s --help\n"
|
||||
"\t\t\t--list-suites\n"
|
||||
"\t\t\t--list-tests <suite>\n"
|
||||
"\t\t\t--suite <suite name>\n"
|
||||
"\t\t\t--test <test name>\n"
|
||||
#ifdef HAVE_CU_CURSES
|
||||
"\t\t\t--curses\n"
|
||||
"\t\t\t--curses\n"
|
||||
#endif
|
||||
"\t\t\t--xml\n"
|
||||
"\t\t\t--xml-file <xml file name>\n"
|
||||
"\t\t\t--max-alloc <size in ko> (maximum ammount of memory obtained via malloc allocator)\n"
|
||||
"And additionally:\n"
|
||||
"%s"
|
||||
, name
|
||||
, additionnal_helper);
|
||||
"\t\t\t--xml\n"
|
||||
"\t\t\t--xml-file <xml file name>\n"
|
||||
"\t\t\t--max-alloc <size in ko> (maximum ammount of memory obtained via malloc allocator)\n"
|
||||
"And additionally:\n"
|
||||
"%s",
|
||||
name, additionnal_helper);
|
||||
}
|
||||
|
||||
void bc_tester_init(void (*ftester_printf)(int level, const char *fmt, va_list args), int iverbosity_info, int iverbosity_error) {
|
||||
|
|
@ -329,19 +344,19 @@ void bc_tester_init(void (*ftester_printf)(int level, const char *fmt, va_list a
|
|||
bc_printf_verbosity_info = iverbosity_info;
|
||||
}
|
||||
|
||||
void bc_tester_set_max_vm(long max_vm_kb){
|
||||
void bc_tester_set_max_vm(long max_vm_kb) {
|
||||
#ifdef __linux
|
||||
max_vm_kb = max_vm_kb;
|
||||
bc_tester_printf(bc_printf_verbosity_info, "Maximum virtual memory space set to %li kilo bytes", max_vm_kb);
|
||||
#else
|
||||
bc_tester_printf(bc_printf_verbosity_error,"Maximum virtual memory space setting is only implemented on Linux.");
|
||||
bc_tester_printf(bc_printf_verbosity_error, "Maximum virtual memory space setting is only implemented on Linux.");
|
||||
#endif
|
||||
}
|
||||
|
||||
int bc_tester_parse_args(int argc, char **argv, int argid)
|
||||
{
|
||||
int i = argid;
|
||||
|
||||
|
||||
if (strcmp(argv[i],"--help")==0){
|
||||
return -1;
|
||||
} else if (strcmp(argv[i],"--test")==0){
|
||||
|
|
@ -364,7 +379,7 @@ int bc_tester_parse_args(int argc, char **argv, int argid)
|
|||
xml_enabled = 1;
|
||||
} else if (strcmp(argv[i], "--xml") == 0){
|
||||
xml_enabled = 1;
|
||||
} else if (strcmp(argv[i], "--max-alloc") == 0){
|
||||
} else if (strcmp(argv[i], "--max-alloc") == 0) {
|
||||
CHECK_ARG("--max-alloc", ++i, argc);
|
||||
max_vm_kb = atol(argv[i]);
|
||||
} else {
|
||||
|
|
@ -383,10 +398,10 @@ int bc_tester_parse_args(int argc, char **argv, int argid)
|
|||
|
||||
int bc_tester_start(void) {
|
||||
int ret;
|
||||
|
||||
|
||||
if (max_vm_kb)
|
||||
bc_tester_set_max_vm(max_vm_kb);
|
||||
|
||||
|
||||
if( xml_enabled ){
|
||||
size_t size = strlen(xml_file) + strlen(".tmp") + 1;
|
||||
char * xml_tmp_file = malloc(sizeof(char) * size);
|
||||
|
|
|
|||
|
|
@ -35,9 +35,11 @@ extern int bc_printf_verbosity_info;
|
|||
extern int bc_printf_verbosity_error;
|
||||
|
||||
typedef void (*test_function_t)(void);
|
||||
typedef int (*init_function_t)(void);
|
||||
typedef int (*cleanup_function_t)(void);
|
||||
typedef int (*test_suite_function_t)(const char *name);
|
||||
/** Function used in all suites - it is invoked before all and each tests and also after each and all tests
|
||||
* @return 0 means success, otherwise it's an error
|
||||
**/
|
||||
typedef int (*pre_post_function_t)(void);
|
||||
// typedef int (*test_suite_function_t)(const char *name);
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
|
|
@ -45,11 +47,14 @@ typedef struct {
|
|||
} test_t;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
init_function_t init_func;
|
||||
cleanup_function_t cleanup_func;
|
||||
int nb_tests;
|
||||
test_t *tests;
|
||||
const char *name; /*suite name*/
|
||||
pre_post_function_t
|
||||
before_all; /*function invoked before running the suite. If not returning 0, suite is not launched. */
|
||||
pre_post_function_t after_all; /*function invoked at the end of the suite, even if some tests failed. */
|
||||
test_function_t before_each; /*function invoked before each test within this suite. */
|
||||
test_function_t after_each; /*function invoked after each test within this suite, even if it failed. */
|
||||
int nb_tests; /* number of tests */
|
||||
test_t *tests; /* tests within this suite */
|
||||
} test_suite_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
104
tester/complex_sip_call.c
Normal file
104
tester/complex_sip_call.c
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
liblinphone_tester - liblinphone test suite
|
||||
Copyright (C) 2015 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 "linphonecore.h"
|
||||
#include "liblinphone_tester.h"
|
||||
#include "lpconfig.h"
|
||||
#include "private.h"
|
||||
|
||||
|
||||
static FILE *sip_start(const char *senario, const char* dest_username, LinphoneAddress* dest_addres) {
|
||||
char *dest;
|
||||
char *command;
|
||||
FILE *file;
|
||||
|
||||
if (linphone_address_get_port(dest_addres)>0)
|
||||
dest = ms_strdup_printf("%s:%i",linphone_address_get_domain(dest_addres),linphone_address_get_port(dest_addres));
|
||||
else
|
||||
dest = ms_strdup_printf("%s",linphone_address_get_domain(dest_addres));
|
||||
|
||||
command = ms_strdup_printf("sipp -sf %s -s %s %s -trace_err -trace_msg -m 1 -d 1000 ",senario,dest_username,dest);
|
||||
|
||||
ms_message("Starting sipp commad [%s]",command);
|
||||
file = popen(command, "r");
|
||||
ms_free(command);
|
||||
ms_free(dest);
|
||||
return file;
|
||||
}
|
||||
/*static void dest_server_server_resolved(void *data, const char *name, struct addrinfo *ai_list) {
|
||||
*(struct addrinfo **)data =ai_list;
|
||||
}*/
|
||||
static void sip_update_within_icoming_reinvite_with_no_sdp(void) {
|
||||
LinphoneCoreManager *mgr;
|
||||
/* LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(mgr->lc);
|
||||
LinphoneAddress *dest = linphone_address_new(linphone_proxy_config_get_route(proxy) ?linphone_proxy_config_get_route(proxy):linphone_proxy_config_get_server_addr(proxy));
|
||||
struct addrinfo *addrinfo = NULL;
|
||||
char ipstring [INET6_ADDRSTRLEN];
|
||||
int err;
|
||||
int port = linphone_address_get_port(dest);*/
|
||||
char *identity_char;
|
||||
char *scen;
|
||||
FILE * sipp_out;
|
||||
|
||||
/*currently we use direct connection because sipp do not properly set ACK request uri*/
|
||||
mgr= linphone_core_manager_new2( "empty_rc", FALSE);
|
||||
mgr->identity= linphone_core_get_primary_contact_parsed(mgr->lc);
|
||||
linphone_address_set_username(mgr->identity,"marie");
|
||||
identity_char=linphone_address_as_string(mgr->identity);
|
||||
linphone_core_set_primary_contact(mgr->lc,identity_char);
|
||||
linphone_core_iterate(mgr->lc);
|
||||
/*
|
||||
sal_resolve_a( mgr->lc->sal
|
||||
,linphone_address_get_domain(dest)
|
||||
,linphone_address_get_port(dest)
|
||||
,AF_INET
|
||||
,(SalResolverCallback)dest_server_server_resolved
|
||||
,&addrinfo);
|
||||
linphone_address_destroy(dest);
|
||||
dest=linphone_address_new(NULL);
|
||||
|
||||
wait_for(mgr->lc, mgr->lc, (int*)&addrinfo, 1);
|
||||
err=getnameinfo((struct sockaddr
|
||||
*)addrinfo->ai_addr,addrinfo->ai_addrlen,ipstring,INET6_ADDRSTRLEN,NULL,0,NI_NUMERICHOST);
|
||||
linphone_address_set_domain(dest, ipstring);
|
||||
if (port > 0)
|
||||
linphone_address_set_port(dest, port);
|
||||
*/
|
||||
scen = bc_tester_res("sipp/sip_update_within_icoming_reinvite_with_no_sdp.xml");
|
||||
|
||||
sipp_out = sip_start(scen
|
||||
, linphone_address_get_username(mgr->identity)
|
||||
, mgr->identity);
|
||||
|
||||
if (sipp_out) {
|
||||
BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallIncomingReceived, 1));
|
||||
linphone_core_accept_call(mgr->lc, linphone_core_get_current_call(mgr->lc));
|
||||
BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallStreamsRunning, 2));
|
||||
BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallEnd, 1));
|
||||
pclose(sipp_out);
|
||||
}
|
||||
linphone_core_manager_destroy(mgr);
|
||||
}
|
||||
|
||||
static test_t tests[] = {
|
||||
{ "SIP UPDATE within incoming reinvite witjout sdp", sip_update_within_icoming_reinvite_with_no_sdp},
|
||||
};
|
||||
|
||||
test_suite_t complex_sip_call_test_suite = {"Complex SIP Call", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(tests) / sizeof(tests[0]), tests};
|
||||
|
|
@ -171,10 +171,5 @@ test_t dtmf_tests[] = {
|
|||
{ "Send DTMF using RFC2833 using Opus",send_dtmf_rfc2833_opus},
|
||||
};
|
||||
|
||||
test_suite_t dtmf_test_suite = {
|
||||
"DTMF",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(dtmf_tests) / sizeof(dtmf_tests[0]),
|
||||
dtmf_tests
|
||||
};
|
||||
test_suite_t dtmf_test_suite = {"DTMF", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(dtmf_tests) / sizeof(dtmf_tests[0]), dtmf_tests};
|
||||
|
|
|
|||
|
|
@ -367,11 +367,5 @@ test_t event_tests[] = {
|
|||
{ "Publish without automatic refresh",publish_no_auto_test }
|
||||
};
|
||||
|
||||
test_suite_t event_test_suite = {
|
||||
"Event",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(event_tests) / sizeof(event_tests[0]),
|
||||
event_tests
|
||||
};
|
||||
|
||||
test_suite_t event_test_suite = {"Event", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(event_tests) / sizeof(event_tests[0]), event_tests};
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ aliases=localhost sip2.linphone.org sipopen.example.org sip.example.org auth.exa
|
|||
|
||||
#note: the ip addresses are explicitely specified here because the machine has several interfaces. In a simple case, using '*' instead of the explicit ip address is sufficient,
|
||||
#and there is no need to specify the ipv6 transport addresses.
|
||||
transports=sip:94.23.19.176:5060 sips:94.23.19.176:5061;tls-certificates-dir=/etc/flexisip/tls/certificates/cn sips:94.23.19.176:5062;tls-certificates-dir=/etc/flexisip/tls/certificates/altname sips:94.23.19.176:5063;require-peer-certificate=1 sip:94.23.19.176:5064 sip:[2001:41d0:2:14b0::1]:5060 sips:[2001:41d0:2:14b0::1]:5061;tls-certificates-dir=/etc/flexisip/tls/certificates/cn sips:[2001:41d0:2:14b0::1]:5062;tls-certificates-dir=/etc/flexisip/tls/certificates/altname sips:[2001:41d0:2:14b0::1]:5063;require-peer-certificate=1 sip:[2001:41d0:2:14b0::1]:5064
|
||||
transports=sip:MacBook-Pro-de-jehan.local:5060 sips:MacBook-Pro-de-jehan.local:5061;tls-certificates-dir=/etc/flexisip/tls/certificates/cn sips:MacBook-Pro-de-jehan.local:5062;tls-certificates-dir=/etc/flexisip/tls/certificates/altname sips:MacBook-Pro-de-jehan.local:5063;require-peer-certificate=1 sip:MacBook-Pro-de-jehan.local:5064 sip:[2001:41d0:2:14b0::1]:5060 sips:[2001:41d0:2:14b0::1]:5061;tls-certificates-dir=/etc/flexisip/tls/certificates/cn sips:[2001:41d0:2:14b0::1]:5062;tls-certificates-dir=/etc/flexisip/tls/certificates/altname sips:[2001:41d0:2:14b0::1]:5063;require-peer-certificate=1 sip:[2001:41d0:2:14b0::1]:5064
|
||||
|
||||
|
||||
# An absolute path of a directory where TLS server certificate and
|
||||
|
|
|
|||
|
|
@ -511,9 +511,6 @@ static void early_media_call_forking(void) {
|
|||
MSList *lcs=NULL;
|
||||
LinphoneCallParams *params=linphone_core_create_default_call_parameters(pauline->lc);
|
||||
LinphoneVideoPolicy pol;
|
||||
LinphoneCall *marie1_call;
|
||||
LinphoneCall *marie2_call;
|
||||
LinphoneCall *pauline_call;
|
||||
int dummy=0;
|
||||
|
||||
pol.automatically_accept=1;
|
||||
|
|
@ -548,18 +545,14 @@ static void early_media_call_forking(void) {
|
|||
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,3000));
|
||||
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1, int, "%d");
|
||||
|
||||
pauline_call=linphone_core_get_current_call(pauline->lc);
|
||||
marie1_call=linphone_core_get_current_call(marie->lc);
|
||||
marie2_call=linphone_core_get_current_call(marie2->lc);
|
||||
|
||||
/*wait a bit that streams are established*/
|
||||
wait_for_list(lcs,&dummy,1,6000);
|
||||
BC_ASSERT_GREATER(linphone_call_get_audio_stats(pauline_call)->download_bandwidth, 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_call_get_audio_stats(pauline_call)->download_bandwidth, 99, int, "%d");
|
||||
BC_ASSERT_GREATER(linphone_call_get_audio_stats(marie1_call)->download_bandwidth, 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_call_get_audio_stats(marie1_call)->download_bandwidth, 99, int, "%d");
|
||||
BC_ASSERT_GREATER(linphone_call_get_audio_stats(marie2_call)->download_bandwidth, 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_call_get_audio_stats(marie2_call)->download_bandwidth, 99, int, "%d");
|
||||
wait_for_list(lcs,&dummy,1,5000);
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(pauline), 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_core_manager_get_mean_audio_down_bw(pauline), 99, int, "%d");
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie), 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_core_manager_get_mean_audio_down_bw(marie), 99, int, "%d");
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie2), 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_core_manager_get_mean_audio_down_bw(marie2), 99, int, "%d");
|
||||
|
||||
linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,3000));
|
||||
|
|
@ -570,14 +563,12 @@ static void early_media_call_forking(void) {
|
|||
|
||||
/*wait a bit that streams are established*/
|
||||
wait_for_list(lcs,&dummy,1,3000);
|
||||
BC_ASSERT_GREATER(linphone_call_get_audio_stats(pauline_call)->download_bandwidth, 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_call_get_audio_stats(pauline_call)->download_bandwidth, 99, int, "%d");
|
||||
BC_ASSERT_GREATER(linphone_call_get_audio_stats(marie1_call)->download_bandwidth, 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_call_get_audio_stats(marie1_call)->download_bandwidth, 99, int, "%d");
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(pauline), 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_core_manager_get_mean_audio_down_bw(pauline), 99, int, "%d");
|
||||
BC_ASSERT_GREATER(linphone_core_manager_get_mean_audio_down_bw(marie), 60, int, "%d");
|
||||
BC_ASSERT_LOWER(linphone_core_manager_get_mean_audio_down_bw(marie), 99, int, "%d");
|
||||
|
||||
linphone_core_terminate_all_calls(pauline->lc);
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,5000));
|
||||
end_call(pauline, marie);
|
||||
|
||||
ms_list_free(lcs);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
|
|
@ -772,7 +763,7 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
|
|||
linphone_chat_message_cbs_set_file_transfer_send(cbs, tester_file_transfer_send);
|
||||
linphone_chat_room_send_chat_message(chat_room,message);
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageExtBodyReceived,1));
|
||||
fclose(file_to_send);
|
||||
|
||||
if (marie->stat.last_received_chat_message ) {
|
||||
cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
|
|
@ -781,10 +772,10 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
|
|||
}
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageFileTransferDone,1));
|
||||
|
||||
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
|
||||
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,2, int, "%d");
|
||||
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d");
|
||||
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1, int, "%d");
|
||||
BC_ASSERT_TRUE(compare_files(send_filepath, receive_filepath));
|
||||
compare_files(send_filepath, receive_filepath);
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_core_manager_destroy(marie);
|
||||
|
|
@ -926,13 +917,5 @@ test_t flexisip_tests[] = {
|
|||
{ "DoS module trigger by sending a lot of chat messages", dos_module_trigger }
|
||||
};
|
||||
|
||||
|
||||
test_suite_t flexisip_test_suite = {
|
||||
"Flexisip",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(flexisip_tests) / sizeof(flexisip_tests[0]),
|
||||
flexisip_tests
|
||||
};
|
||||
|
||||
|
||||
test_suite_t flexisip_test_suite = {"Flexisip", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(flexisip_tests) / sizeof(flexisip_tests[0]), flexisip_tests};
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ int main (int argc, char *argv[])
|
|||
|
||||
liblinphone_tester_init(NULL);
|
||||
|
||||
#ifndef WIN32 /*this hack doesn't work for argv[0]="c:\blablab\"*/
|
||||
// this allows to launch tester from outside of tester directory
|
||||
if (strstr(argv[0], ".libs")) {
|
||||
int prefix_length = strstr(argv[0], ".libs") - argv[0] + 1;
|
||||
|
|
@ -205,6 +206,7 @@ int main (int argc, char *argv[])
|
|||
bc_tester_set_writable_dir_prefix(prefix);
|
||||
ms_free(prefix);
|
||||
}
|
||||
#endif
|
||||
|
||||
for(i = 1; i < argc; ++i) {
|
||||
if (strcmp(argv[i], "--verbose") == 0) {
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ extern test_suite_t video_test_suite;
|
|||
extern test_suite_t multicast_call_test_suite;
|
||||
extern test_suite_t multi_call_test_suite;
|
||||
extern test_suite_t proxy_config_test_suite;
|
||||
#if HAVE_SIPP
|
||||
extern test_suite_t complex_sip_call_test_suite;
|
||||
#endif
|
||||
extern int manager_count;
|
||||
|
||||
extern int liblinphone_tester_ipv6_available(void);
|
||||
|
|
@ -318,7 +321,7 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video
|
|||
void call_base(LinphoneMediaEncryption mode, bool_t enable_video,bool_t enable_relay,LinphoneFirewallPolicy policy,bool_t enable_tunnel);
|
||||
bool_t call_with_caller_params(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr, const LinphoneCallParams *params);
|
||||
bool_t pause_call_1(LinphoneCoreManager* mgr_1,LinphoneCall* call_1,LinphoneCoreManager* mgr_2,LinphoneCall* call_2);
|
||||
bool_t compare_files(const char *path1, const char *path2);
|
||||
void compare_files(const char *path1, const char *path2);
|
||||
void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList* lcs,LinphoneMediaDirection audio_dir, LinphoneMediaDirection video_dir);
|
||||
|
||||
extern const MSAudioDiffParams audio_cmp_params;
|
||||
|
|
@ -332,7 +335,7 @@ int linphone_core_manager_get_mean_audio_up_bw(const LinphoneCoreManager *mgr);
|
|||
|
||||
void video_call_base_2(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled);
|
||||
|
||||
int liblinphone_tester_setup();
|
||||
void liblinphone_tester_before_each();
|
||||
void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args));
|
||||
void liblinphone_tester_uninit(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -324,11 +324,6 @@ test_t log_collection_tests[] = {
|
|||
{ "Upload collected traces", upload_collected_traces}
|
||||
};
|
||||
|
||||
test_suite_t log_collection_test_suite = {
|
||||
"LogCollection",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(log_collection_tests) / sizeof(log_collection_tests[0]),
|
||||
log_collection_tests
|
||||
};
|
||||
|
||||
test_suite_t log_collection_test_suite = {"LogCollection", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(log_collection_tests) / sizeof(log_collection_tests[0]),
|
||||
log_collection_tests};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -553,10 +553,5 @@ test_t multi_call_tests[] = {
|
|||
{ "Incoming call accepted when outgoing call in outgoing ringing early media",incoming_call_accepted_when_outgoing_call_in_outgoing_ringing_early_media},
|
||||
};
|
||||
|
||||
test_suite_t multi_call_test_suite = {
|
||||
"Multi call",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(multi_call_tests) / sizeof(multi_call_tests[0]),
|
||||
multi_call_tests
|
||||
};
|
||||
test_suite_t multi_call_test_suite = {"Multi call", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(multi_call_tests) / sizeof(multi_call_tests[0]), multi_call_tests};
|
||||
|
|
|
|||
|
|
@ -269,10 +269,6 @@ test_t multicast_call_tests[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
test_suite_t multicast_call_test_suite = {
|
||||
"Multicast Call",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(multicast_call_tests) / sizeof(multicast_call_tests[0]),
|
||||
multicast_call_tests
|
||||
};
|
||||
test_suite_t multicast_call_test_suite = {"Multicast Call", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(multicast_call_tests) / sizeof(multicast_call_tests[0]),
|
||||
multicast_call_tests};
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ static void compatible_avpf_features(void) {
|
|||
|
||||
BC_ASSERT_TRUE((call_ok=call(marie, pauline)));
|
||||
if (!call_ok) goto end;
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
|
||||
check_avpf_features(marie->lc, lpt->avpf.features);
|
||||
|
|
@ -417,10 +417,5 @@ static test_t offeranswer_tests[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
test_suite_t offeranswer_test_suite = {
|
||||
"Offer-answer",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(offeranswer_tests) / sizeof(offeranswer_tests[0]),
|
||||
offeranswer_tests
|
||||
};
|
||||
test_suite_t offeranswer_test_suite = {"Offer-answer", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(offeranswer_tests) / sizeof(offeranswer_tests[0]), offeranswer_tests};
|
||||
|
|
|
|||
|
|
@ -82,10 +82,5 @@ test_t player_tests[] = {
|
|||
{ "Local MKV file" , playing_test }
|
||||
};
|
||||
|
||||
test_suite_t player_test_suite = {
|
||||
"Player",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(player_tests) / sizeof(test_t),
|
||||
player_tests
|
||||
};
|
||||
test_suite_t player_test_suite = {"Player", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(player_tests) / sizeof(test_t), player_tests};
|
||||
|
|
|
|||
|
|
@ -482,11 +482,5 @@ test_t presence_tests[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
test_suite_t presence_test_suite = {
|
||||
"Presence",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(presence_tests) / sizeof(presence_tests[0]),
|
||||
presence_tests
|
||||
};
|
||||
|
||||
test_suite_t presence_test_suite = {"Presence", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(presence_tests) / sizeof(presence_tests[0]), presence_tests};
|
||||
|
|
|
|||
|
|
@ -108,10 +108,5 @@ test_t proxy_config_tests[] = {
|
|||
{ "SIP URI normalization", sip_uri_normalization },
|
||||
};
|
||||
|
||||
test_suite_t proxy_config_test_suite = {
|
||||
"Proxy config",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(proxy_config_tests) / sizeof(proxy_config_tests[0]),
|
||||
proxy_config_tests
|
||||
};
|
||||
test_suite_t proxy_config_test_suite = {"Proxy config", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(proxy_config_tests) / sizeof(proxy_config_tests[0]), proxy_config_tests};
|
||||
|
|
|
|||
|
|
@ -383,10 +383,6 @@ test_t quality_reporting_tests[] = {
|
|||
{ "Sent using custom route", quality_reporting_sent_using_custom_route},
|
||||
};
|
||||
|
||||
test_suite_t quality_reporting_test_suite = {
|
||||
"QualityReporting",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(quality_reporting_tests) / sizeof(quality_reporting_tests[0]),
|
||||
quality_reporting_tests
|
||||
};
|
||||
test_suite_t quality_reporting_test_suite = {"QualityReporting", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(quality_reporting_tests) / sizeof(quality_reporting_tests[0]),
|
||||
quality_reporting_tests};
|
||||
|
|
|
|||
155
tester/rcfiles/laure_call_logs_rc
Normal file
155
tester/rcfiles/laure_call_logs_rc
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
[sip]
|
||||
sip_port=5092
|
||||
sip_tcp_port=5092
|
||||
sip_tls_port=5093
|
||||
default_proxy=0
|
||||
ping_with_options=0
|
||||
register_only_when_network_is_up=0
|
||||
|
||||
[auth_info_0]
|
||||
username=laure
|
||||
userid=laure
|
||||
passwd=secret
|
||||
realm="sip.example.org"
|
||||
|
||||
|
||||
[proxy_0]
|
||||
reg_proxy=sip.example.org
|
||||
reg_identity=sip:laure@sip.example.org
|
||||
reg_expires=3600
|
||||
reg_sendregister=1
|
||||
publish=0
|
||||
dial_escape_plus=0
|
||||
|
||||
|
||||
[rtp]
|
||||
audio_rtp_port=9010-9390
|
||||
video_rtp_port=9410-9910
|
||||
|
||||
[video]
|
||||
display=0
|
||||
capture=0
|
||||
show_local=0
|
||||
size=qcif
|
||||
enabled=0
|
||||
self_view=0
|
||||
automatically_initiate=0
|
||||
automatically_accept=0
|
||||
device=StaticImage: Static picture
|
||||
|
||||
[sound]
|
||||
echocancellation=0 #to not overload cpu in case of VG
|
||||
|
||||
[net]
|
||||
dns_srv_enabled=0 #no srv needed in general
|
||||
stun_server=stun.linphone.org
|
||||
|
||||
[call_log_0]
|
||||
dir=0
|
||||
status=0
|
||||
from=sip:pauline@sip.linphone.org
|
||||
to=sip:laure@sip.linphone.org
|
||||
start_date_time=1441738272
|
||||
duration=3
|
||||
quality=5.000000
|
||||
video_enabled=0
|
||||
call_id=o6mx-QSdKJ
|
||||
|
||||
[call_log_1]
|
||||
dir=0
|
||||
status=1
|
||||
from=sip:pauline@sip.linphone.org
|
||||
to=sip:laure@sip.linphone.org
|
||||
start_date_time=1441738266
|
||||
duration=0
|
||||
quality=-1.000000
|
||||
video_enabled=0
|
||||
call_id=wnXDtOhURa
|
||||
|
||||
[call_log_2]
|
||||
dir=1
|
||||
status=2
|
||||
from=sip:laure@sip.linphone.org
|
||||
to=sip:pauline@sip.linphone.org
|
||||
start_date_time=1441738258
|
||||
duration=0
|
||||
quality=-1.000000
|
||||
video_enabled=0
|
||||
call_id=81ZldO6dlk
|
||||
|
||||
[call_log_3]
|
||||
dir=1
|
||||
status=1
|
||||
from=sip:laure@sip.linphone.org
|
||||
to=sip:pauline@sip.linphone.org
|
||||
start_date_time=1441738250
|
||||
duration=0
|
||||
quality=-1.000000
|
||||
video_enabled=0
|
||||
call_id=3yq7TlwS8Q
|
||||
|
||||
[call_log_4]
|
||||
dir=1
|
||||
status=0
|
||||
from=sip:laure@sip.linphone.org
|
||||
to=sip:pauline@sip.linphone.org
|
||||
start_date_time=1441738243
|
||||
duration=0
|
||||
quality=-1.000000
|
||||
video_enabled=1
|
||||
call_id=EmoqEyeLbZ
|
||||
|
||||
[call_log_5]
|
||||
dir=0
|
||||
status=1
|
||||
from=sip:pauline@sip.linphone.org
|
||||
to=sip:laure@sip.linphone.org
|
||||
start_date_time=1441738234
|
||||
duration=0
|
||||
quality=-1.000000
|
||||
video_enabled=0
|
||||
call_id=xl29jqHZ2N
|
||||
|
||||
[call_log_6]
|
||||
dir=1
|
||||
status=0
|
||||
from=sip:laure@sip.linphone.org
|
||||
to=sip:pauline@sip.linphone.org
|
||||
start_date_time=1441738215
|
||||
duration=6
|
||||
quality=4.898808
|
||||
video_enabled=1
|
||||
call_id=2JNrT43eji
|
||||
|
||||
[call_log_7]
|
||||
dir=0
|
||||
status=0
|
||||
from=sip:pauline@sip.linphone.org
|
||||
to=sip:laure@sip.linphone.org
|
||||
start_date_time=1441738200
|
||||
duration=5
|
||||
quality=4.715808
|
||||
video_enabled=1
|
||||
call_id=joyRwGhk-2
|
||||
|
||||
[call_log_8]
|
||||
dir=1
|
||||
status=3
|
||||
from=sip:laure@sip.linphone.org
|
||||
to=sip:pauline@sip.linphone.org
|
||||
start_date_time=1441738122
|
||||
duration=0
|
||||
quality=-1.000000
|
||||
video_enabled=0
|
||||
call_id=az01erTY2U
|
||||
|
||||
[call_log_9]
|
||||
dir=0
|
||||
status=3
|
||||
from=sip:pauline@sip.linphone.org
|
||||
to=sip:laure@sip.linphone.org
|
||||
start_date_time=1441738031
|
||||
duration=0
|
||||
quality=-1.000000
|
||||
video_enabled=0
|
||||
call_id=jk39dfZP0L
|
||||
|
|
@ -358,8 +358,8 @@ static void authenticated_register_with_no_initial_credentials(){
|
|||
static void authenticated_register_with_late_credentials(){
|
||||
LinphoneCoreManager *lcm;
|
||||
stats* counters;
|
||||
LCSipTransports transport = {5070,5070,0,5071};
|
||||
char route[256];
|
||||
LCSipTransports transport = {5070,5070,0,5071};
|
||||
|
||||
sprintf(route,"sip:%s",test_route);
|
||||
|
||||
|
|
@ -371,6 +371,46 @@ static void authenticated_register_with_late_credentials(){
|
|||
linphone_core_manager_destroy(lcm);
|
||||
}
|
||||
|
||||
static void authenticated_register_with_provided_credentials(){
|
||||
LinphoneCoreManager *lcm;
|
||||
stats* counters;
|
||||
LinphoneProxyConfig *cfg;
|
||||
char route[256];
|
||||
LinphoneAddress *from;
|
||||
char *addr;
|
||||
LinphoneAuthInfo *ai;
|
||||
|
||||
sprintf(route,"sip:%s",test_route);
|
||||
|
||||
lcm = linphone_core_manager_new(NULL);
|
||||
|
||||
counters = get_stats(lcm->lc);
|
||||
cfg = linphone_core_create_proxy_config(lcm->lc);
|
||||
from = create_linphone_address(auth_domain);
|
||||
|
||||
linphone_proxy_config_set_identity(cfg, addr=linphone_address_as_string(from));
|
||||
ms_free(addr);
|
||||
|
||||
linphone_proxy_config_enable_register(cfg,TRUE);
|
||||
linphone_proxy_config_set_expires(cfg,1);
|
||||
linphone_proxy_config_set_route(cfg, test_route);
|
||||
linphone_proxy_config_set_server_addr(cfg,test_route);
|
||||
linphone_address_destroy(from);
|
||||
|
||||
ai = linphone_auth_info_new(test_username, NULL, test_password, NULL, NULL, NULL);
|
||||
linphone_core_add_auth_info(lcm->lc, ai);
|
||||
|
||||
linphone_core_add_proxy_config(lcm->lc, cfg);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
|
||||
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
|
||||
|
||||
BC_ASSERT_PTR_NULL(lp_config_get_string(lcm->lc->config, "auth_info_0", "passwd", NULL));
|
||||
BC_ASSERT_PTR_NOT_NULL(lp_config_get_string(lcm->lc->config, "auth_info_0", "ha1", NULL));
|
||||
|
||||
linphone_core_manager_destroy(lcm);
|
||||
}
|
||||
|
||||
static void authenticated_register_with_wrong_late_credentials(){
|
||||
LinphoneCoreManager *lcm;
|
||||
stats* counters;
|
||||
|
|
@ -877,6 +917,7 @@ test_t register_tests[] = {
|
|||
{ "Digest auth with wrong credentials without 403", authenticated_register_with_wrong_credentials_without_403},
|
||||
{ "Authenticated register with wrong late credentials", authenticated_register_with_wrong_late_credentials},
|
||||
{ "Authenticated register with late credentials", authenticated_register_with_late_credentials },
|
||||
{ "Authenticated register with provided credentials", authenticated_register_with_provided_credentials },
|
||||
{ "Register with refresh", simple_register_with_refresh },
|
||||
{ "Authenticated register with refresh", simple_auth_register_with_refresh },
|
||||
{ "Register with refresh and send error", register_with_refresh_with_send_error },
|
||||
|
|
@ -894,11 +935,5 @@ test_t register_tests[] = {
|
|||
{ "Simple redirect", redirect}
|
||||
};
|
||||
|
||||
test_suite_t register_test_suite = {
|
||||
"Register",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(register_tests) / sizeof(register_tests[0]),
|
||||
register_tests
|
||||
};
|
||||
|
||||
test_suite_t register_test_suite = {"Register", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(register_tests) / sizeof(register_tests[0]), register_tests};
|
||||
|
|
|
|||
|
|
@ -134,10 +134,6 @@ test_t remote_provisioning_tests[] = {
|
|||
{ "Remote provisioning invalid URI", remote_provisioning_invalid_uri }
|
||||
};
|
||||
|
||||
test_suite_t remote_provisioning_test_suite = {
|
||||
"RemoteProvisioning",
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(remote_provisioning_tests) / sizeof(remote_provisioning_tests[0]),
|
||||
remote_provisioning_tests
|
||||
};
|
||||
test_suite_t remote_provisioning_test_suite = {"RemoteProvisioning", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(remote_provisioning_tests) / sizeof(remote_provisioning_tests[0]),
|
||||
remote_provisioning_tests};
|
||||
|
|
|
|||
|
|
@ -306,11 +306,5 @@ test_t setup_tests[] = {
|
|||
{ "Codec usability", codec_usability_test }
|
||||
};
|
||||
|
||||
test_suite_t setup_test_suite = {
|
||||
"Setup",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(setup_tests) / sizeof(setup_tests[0]),
|
||||
setup_tests
|
||||
};
|
||||
|
||||
test_suite_t setup_test_suite = {"Setup", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(setup_tests) / sizeof(setup_tests[0]), setup_tests};
|
||||
|
|
|
|||
175
tester/sipp/sip_update_within_icoming_reinvite_with_no_sdp.xml
Normal file
175
tester/sipp/sip_update_within_icoming_reinvite_with_no_sdp.xml
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- Sipp default 'uac' scenario. -->
|
||||
<!-- -->
|
||||
|
||||
<scenario name="Basic Sipstone UAC">
|
||||
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
INVITE sip:[service]@sip.example.org SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@sip.example.org>;tag=[pid]SIPpTag00[call_number]
|
||||
To: sut <sip:[service]@sip.example.org>
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 INVITE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||
s=-
|
||||
c=IN IP[media_ip_type] [media_ip]
|
||||
t=0 0
|
||||
m=audio [media_port] RTP/AVP 0
|
||||
a=rtpmap:0 PCMU/8000
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="100"
|
||||
optional="true">
|
||||
</recv>
|
||||
|
||||
<recv response="180" optional="true">
|
||||
</recv>
|
||||
|
||||
<recv response="200" rrs="true" rtd="true">
|
||||
</recv>
|
||||
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@sip.example.org>;tag=[pid]SIPpTag00[call_number]
|
||||
To: sut <sip:[service]@sip.example.org>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 ACK
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
INVITE sip:[service]@sip.example.org SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@sip.example.org>;tag=[pid]SIPpTag00[call_number]
|
||||
To: sut <sip:[service]@sip.example.org>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 2 INVITE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
<recv response="100"
|
||||
optional="true">
|
||||
</recv>
|
||||
|
||||
|
||||
<recv response="200" rtd="true">
|
||||
</recv>
|
||||
|
||||
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
UPDATE sip:[service]@sip.example.org SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@sip.example.org>;tag=[pid]SIPpTag00[call_number]
|
||||
To: sut <sip:[service]@sip.example.org>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 3 UPDATE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
<recv response="200" optionnal="true" rtd="true">
|
||||
</recv>
|
||||
<send >
|
||||
<![CDATA[
|
||||
ACK sip:[service]@sip.example.org SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@sip.example.org>;tag=[pid]SIPpTag00[call_number]
|
||||
To: sut <sip:[service]@sip.example.org>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 2 ACK
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
|
||||
s=-
|
||||
c=IN IP[media_ip_type] [media_ip]
|
||||
t=0 0
|
||||
m=audio [media_port] RTP/AVP 0
|
||||
a=rtpmap:0 PCMU/8000
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<pause/>
|
||||
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
BYE sip:[service]@sip.example.org SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@sip.example.org>;tag=[pid]SIPpTag00[call_number]
|
||||
To: sut <sip:[service]@sip.example.org>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 4 BYE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="200" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
|
||||
Binary file not shown.
|
|
@ -110,10 +110,5 @@ test_t stun_tests[] = {
|
|||
{ "STUN encode buffer protection", linphone_stun_test_encode },
|
||||
};
|
||||
|
||||
test_suite_t stun_test_suite = {
|
||||
"Stun",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(stun_tests) / sizeof(stun_tests[0]),
|
||||
stun_tests
|
||||
};
|
||||
test_suite_t stun_test_suite = {"Stun", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(stun_tests) / sizeof(stun_tests[0]), stun_tests};
|
||||
|
|
|
|||
|
|
@ -115,7 +115,9 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
|
|||
|
||||
if (file){
|
||||
filepath = ms_strdup_printf("%s/%s", path, file);
|
||||
BC_ASSERT_EQUAL_FATAL(ortp_file_exist(filepath),0,int, "%d");
|
||||
if (ortp_file_exist(filepath) != 0) {
|
||||
ms_fatal("Could not find file %s in path %s, did you configured resources directory correctly?", file, path);
|
||||
}
|
||||
config = lp_config_new_with_factory(NULL,filepath);
|
||||
}
|
||||
|
||||
|
|
@ -438,6 +440,9 @@ void liblinphone_tester_add_suites() {
|
|||
#endif
|
||||
bc_tester_add_suite(&multicast_call_test_suite);
|
||||
bc_tester_add_suite(&proxy_config_test_suite);
|
||||
#if HAVE_SIPP
|
||||
bc_tester_add_suite(&complex_sip_call_test_suite);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int linphone_core_manager_get_max_audio_bw_base(const int array[],int array_size) {
|
||||
|
|
@ -474,12 +479,10 @@ int linphone_core_manager_get_mean_audio_up_bw(const LinphoneCoreManager *mgr) {
|
|||
, sizeof(mgr->stat.audio_upload_bandwidth)/sizeof(int));
|
||||
}
|
||||
|
||||
int liblinphone_tester_setup() {
|
||||
void liblinphone_tester_before_each() {
|
||||
if (manager_count != 0) {
|
||||
// crash in some linphone core have not been destroyed because if we continue
|
||||
// it will crash in CUnit AND we should NEVER keep a manager alive
|
||||
ms_fatal("%d linphone core manager still alive!", manager_count);
|
||||
return 1;
|
||||
ms_fatal("%d linphone core managers are still alive!", manager_count);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -262,10 +262,5 @@ test_t tunnel_tests[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
test_suite_t tunnel_test_suite = {
|
||||
"Tunnel",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(tunnel_tests) / sizeof(tunnel_tests[0]),
|
||||
tunnel_tests
|
||||
};
|
||||
test_suite_t tunnel_test_suite = {"Tunnel", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(tunnel_tests) / sizeof(tunnel_tests[0]), tunnel_tests};
|
||||
|
|
|
|||
|
|
@ -59,10 +59,5 @@ test_t upnp_tests[] = {
|
|||
{ "Check ip address", upnp_check_ipaddress },
|
||||
};
|
||||
|
||||
test_suite_t upnp_test_suite = {
|
||||
"Upnp",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(upnp_tests) / sizeof(upnp_tests[0]),
|
||||
upnp_tests
|
||||
};
|
||||
test_suite_t upnp_test_suite = {"Upnp", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(upnp_tests) / sizeof(upnp_tests[0]), upnp_tests};
|
||||
|
|
|
|||
|
|
@ -430,13 +430,13 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void
|
|||
|
||||
linphone_core_invite_address_with_params(pauline->lc, marie1->identity, pauline_params);
|
||||
linphone_call_params_destroy(pauline_params);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingReceived, 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingReceived, 1, 3000));
|
||||
|
||||
|
||||
marie1_call = linphone_core_get_current_call(marie1->lc);
|
||||
marie2_call = linphone_core_get_current_call(marie2->lc);
|
||||
|
||||
|
||||
if (marie1_call){
|
||||
linphone_call_set_next_video_frame_decoded_callback(marie1_call, linphone_call_iframe_decoded_cb, marie1->lc);
|
||||
}
|
||||
|
|
@ -449,7 +449,6 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void
|
|||
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1, 3000));
|
||||
|
||||
pauline_call = linphone_core_get_current_call(pauline->lc);
|
||||
|
||||
|
||||
BC_ASSERT_PTR_NOT_NULL(pauline_call);
|
||||
BC_ASSERT_PTR_NOT_NULL(marie1_call);
|
||||
|
|
@ -457,7 +456,7 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void
|
|||
|
||||
if (pauline_call && marie1_call && marie2_call) {
|
||||
linphone_call_set_next_video_frame_decoded_callback(pauline_call, linphone_call_iframe_decoded_cb, pauline->lc);
|
||||
|
||||
|
||||
/* wait a bit that streams are established */
|
||||
wait_for_list(lcs, &dummy, 1, 3000);
|
||||
BC_ASSERT_EQUAL(linphone_call_get_audio_stats(pauline_call)->download_bandwidth, 0, float, "%f");
|
||||
|
|
@ -553,12 +552,7 @@ test_t video_tests[] = {
|
|||
|
||||
};
|
||||
|
||||
test_suite_t video_test_suite = {
|
||||
"Video",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(video_tests) / sizeof(video_tests[0]),
|
||||
video_tests
|
||||
};
|
||||
test_suite_t video_test_suite = {"Video", NULL, NULL, liblinphone_tester_before_each, NULL,
|
||||
sizeof(video_tests) / sizeof(video_tests[0]), video_tests};
|
||||
|
||||
#endif /* VIDEO_ENABLED */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue