mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 20:48:07 +00:00
add SIPP based tests
This commit is contained in:
parent
9a792cbbf7
commit
a42c3ee85e
6 changed files with 127 additions and 3 deletions
|
|
@ -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])
|
||||
|
||||
|
|
@ -1057,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
|
||||
|
|
|
|||
|
|
@ -45,7 +45,15 @@ 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")
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
105
tester/complex_sip_call.c
Normal file
105
tester/complex_sip_call.c
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
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;
|
||||
|
||||
/*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);
|
||||
*/
|
||||
char* scen = bc_tester_res("sipp/sip_update_within_icoming_reinvite_with_no_sdp.xml");
|
||||
|
||||
FILE * sipp_out = sip_start(scen
|
||||
, linphone_address_get_username(mgr->identity)
|
||||
, mgr->identity);
|
||||
|
||||
if (sipp_out) {
|
||||
BC_ASSERT_TRUE(wait_for_until(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallIncomingReceived, 1,100000));
|
||||
linphone_core_accept_call(mgr->lc, linphone_core_get_current_call(mgr->lc));
|
||||
BC_ASSERT_TRUE(wait_for_until(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallStreamsRunning, 2,100000));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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",
|
||||
liblinphone_tester_setup,
|
||||
NULL,
|
||||
sizeof(tests) / sizeof(tests[0]),
|
||||
tests
|
||||
};
|
||||
|
||||
|
|
@ -52,6 +52,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);
|
||||
|
|
|
|||
|
|
@ -436,6 +436,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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue