mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Add missing tests.
This commit is contained in:
parent
6eb2a1d132
commit
7832def94b
9 changed files with 145 additions and 9 deletions
|
|
@ -7041,10 +7041,6 @@ void linphone_core_enable_conference_server (LinphoneCore *lc, bool_t enable) {
|
|||
lp_config_set_int(linphone_core_get_config(lc), "misc", "conference_server_enabled", enable);
|
||||
}
|
||||
|
||||
bool_t linphone_core_conference_server_enabled (const LinphoneCore *lc) {
|
||||
return lp_config_get_int(linphone_core_get_config(lc), "misc", "conference_server_enabled", FALSE) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
bool_t _linphone_core_is_conference_creation (const LinphoneCore *lc, const LinphoneAddress *addr) {
|
||||
const char *uri = linphone_core_get_conference_factory_uri(lc);
|
||||
if (!uri)
|
||||
|
|
@ -7063,6 +7059,10 @@ bool_t _linphone_core_is_conference_creation (const LinphoneCore *lc, const Linp
|
|||
return result;
|
||||
}
|
||||
|
||||
bool_t linphone_core_conference_server_enabled (const LinphoneCore *lc) {
|
||||
return lp_config_get_int(linphone_core_get_config(lc), "misc", "conference_server_enabled", FALSE) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
void linphone_core_set_tls_cert(LinphoneCore *lc, const char *tls_cert) {
|
||||
if (lc->tls_cert) {
|
||||
ms_free(lc->tls_cert);
|
||||
|
|
|
|||
|
|
@ -152,6 +152,16 @@ LINPHONE_PUBLIC void sal_call_set_sdp_handling(SalOp *h, SalOpSDPHandling handli
|
|||
LINPHONE_PUBLIC SalMediaDescription * sal_call_get_final_media_description(SalOp *h);
|
||||
|
||||
LINPHONE_PUBLIC belle_sip_resolver_context_t *sal_resolve_a(Sal *sal, const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data);
|
||||
|
||||
LINPHONE_PUBLIC Sal *sal_op_get_sal(SalOp *op);
|
||||
LINPHONE_PUBLIC SalOp *sal_create_refer_op(Sal *sal);
|
||||
LINPHONE_PUBLIC void sal_release_op(SalOp *op);
|
||||
LINPHONE_PUBLIC void sal_op_set_from(SalOp *sal_refer_op, const char* from);
|
||||
LINPHONE_PUBLIC void sal_op_set_to(SalOp *sal_refer_op, const char* to);
|
||||
LINPHONE_PUBLIC void sal_op_send_refer(SalOp *sal_refer_op, SalAddress* refer_to);
|
||||
LINPHONE_PUBLIC void sal_set_user_pointer(Sal *sal, void *user_pointer);
|
||||
LINPHONE_PUBLIC void *sal_get_user_pointer(Sal *sal);
|
||||
LINPHONE_PUBLIC void sal_set_call_refer_callback(Sal *sal, void (*OnReferCb)(SalOp *op, const SalAddress *referto));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -1020,4 +1020,45 @@ belle_sip_resolver_context_t *sal_resolve_a(Sal *sal, const char *name, int port
|
|||
return sal->resolve_a(name, port, family, cb, data);
|
||||
}
|
||||
|
||||
Sal *sal_op_get_sal(SalOp *op) {
|
||||
return op->get_sal();
|
||||
}
|
||||
|
||||
SalOp *sal_create_refer_op(Sal *sal) {
|
||||
return new SalReferOp(sal);
|
||||
}
|
||||
|
||||
void sal_release_op(SalOp *op) {
|
||||
op->release();
|
||||
}
|
||||
|
||||
void sal_op_set_from(SalOp *sal_refer_op, const char* from) {
|
||||
auto referOp = dynamic_cast<SalReferOp *>(sal_refer_op);
|
||||
referOp->set_from(from);
|
||||
}
|
||||
|
||||
void sal_op_set_to(SalOp *sal_refer_op, const char* to) {
|
||||
auto referOp = dynamic_cast<SalReferOp *>(sal_refer_op);
|
||||
referOp->set_to(to);
|
||||
}
|
||||
|
||||
void sal_op_send_refer(SalOp *sal_refer_op, SalAddress* refer_to) {
|
||||
auto referOp = dynamic_cast<SalReferOp *>(sal_refer_op);
|
||||
referOp->send_refer(refer_to);
|
||||
}
|
||||
|
||||
void sal_set_user_pointer(Sal *sal, void *user_pointer) {
|
||||
sal->set_user_pointer(user_pointer);
|
||||
}
|
||||
|
||||
void *sal_get_user_pointer(Sal *sal) {
|
||||
return sal->get_user_pointer();
|
||||
}
|
||||
|
||||
void sal_set_call_refer_callback(Sal *sal, void (*OnReferCb)(SalOp *op, const SalAddress *referto)) {
|
||||
struct Sal::Callbacks cbs = {NULL};
|
||||
cbs.refer_received = OnReferCb;
|
||||
sal->set_callbacks(&cbs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ set(RC_FILES
|
|||
rcfiles/account_creator_rc
|
||||
rcfiles/assistant_create.rc
|
||||
rcfiles/carddav_rc
|
||||
rcfiles/chloe_rc
|
||||
rcfiles/conference_focus_rc
|
||||
rcfiles/empty_rc
|
||||
rcfiles/friends_rc
|
||||
|
|
|
|||
|
|
@ -97,6 +97,20 @@ Account *account_manager_get_account(AccountManager *m, const LinphoneAddress *i
|
|||
return NULL;
|
||||
}
|
||||
|
||||
LinphoneAddress *account_manager_get_identity_with_modified_identity(const LinphoneAddress *modified_identity){
|
||||
AccountManager *m = account_manager_get();
|
||||
bctbx_list_t *it;
|
||||
|
||||
for(it=m->accounts;it!=NULL;it=it->next){
|
||||
Account *a=(Account*)it->data;
|
||||
if (linphone_address_weak_equal(a->modified_identity,modified_identity)){
|
||||
return a->identity;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void account_created_on_server_cb(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *info){
|
||||
Account *account=(Account*)linphone_core_get_user_data(lc);
|
||||
switch(state){
|
||||
|
|
|
|||
|
|
@ -1390,6 +1390,76 @@ void test_removing_old_tport(void) {
|
|||
bctbx_list_free(lcs);
|
||||
}
|
||||
|
||||
static const char* get_laure_rc(void) {
|
||||
if (liblinphone_tester_ipv6_available()) {
|
||||
return "laure_tcp_rc";
|
||||
} else {
|
||||
return "laure_rc_udp";
|
||||
}
|
||||
}
|
||||
|
||||
static void on_refer_received(SalOp *op, const SalAddress *refer_to) {
|
||||
Sal *sal = sal_op_get_sal(op);
|
||||
LinphoneCoreManager *receiver = (LinphoneCoreManager*)sal_get_user_pointer(sal);
|
||||
receiver->stat.number_of_LinphoneCallRefered++;
|
||||
sal_release_op(op);
|
||||
}
|
||||
|
||||
void resend_refer_other_devices(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
LinphoneCoreManager* laure = linphone_core_manager_new( get_laure_rc());
|
||||
LinphoneCoreManager* pauline2;
|
||||
bctbx_list_t* lcs = NULL;
|
||||
|
||||
lcs=bctbx_list_append(lcs,marie->lc);
|
||||
lcs=bctbx_list_append(lcs,pauline->lc);
|
||||
lcs=bctbx_list_append(lcs,laure->lc);
|
||||
|
||||
/* We set Pauline's Sal callback and pass the core manager to access stats */
|
||||
Sal *pauline_sal = linphone_core_get_sal(pauline->lc);
|
||||
sal_set_user_pointer(pauline_sal, (void*)pauline);
|
||||
sal_set_call_refer_callback(pauline_sal, on_refer_received);
|
||||
|
||||
|
||||
char *marie_address = linphone_address_as_string(marie->identity);
|
||||
char *pauline_address = linphone_address_as_string(pauline->identity);
|
||||
char *laure_address = linphone_address_as_string(laure->identity);
|
||||
|
||||
/* Then we create a refer from marie to pauline that refers to laure */
|
||||
SalOp *op = sal_create_refer_op(linphone_core_get_sal(marie->lc));
|
||||
sal_op_set_from(op, marie_address);
|
||||
sal_op_set_to(op, pauline_address);
|
||||
|
||||
SalAddress *address = sal_address_new(laure_address);
|
||||
sal_address_set_param(address, "text", NULL);
|
||||
sal_op_send_refer(op, address);
|
||||
|
||||
ms_free(marie_address);
|
||||
ms_free(pauline_address);
|
||||
ms_free(laure_address);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,5000));
|
||||
|
||||
/* We create another pauline and check if it has received a refer */
|
||||
pauline2 = linphone_core_manager_new( "pauline_rc");
|
||||
lcs=bctbx_list_append(lcs,pauline2->lc);
|
||||
|
||||
Sal *pauline2_sal = linphone_core_get_sal(pauline2->lc);
|
||||
sal_set_user_pointer(pauline2_sal, (void*)pauline2);
|
||||
sal_set_call_refer_callback(pauline2_sal, on_refer_received);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline2->stat.number_of_LinphoneCallRefered,1,5000));
|
||||
|
||||
sal_address_unref(address);
|
||||
sal_release_op(op);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(laure);
|
||||
linphone_core_manager_destroy(pauline2);
|
||||
bctbx_list_free(lcs);
|
||||
}
|
||||
|
||||
test_t flexisip_tests[] = {
|
||||
TEST_ONE_TAG("Subscribe forking", subscribe_forking, "LeaksMemory"),
|
||||
TEST_NO_TAG("Message forking", message_forking),
|
||||
|
|
@ -1427,7 +1497,8 @@ test_t flexisip_tests[] = {
|
|||
TEST_NO_TAG("TLS authentication - client rejected due to CN mismatch", tls_client_auth_bad_certificate_cn),
|
||||
TEST_NO_TAG("TLS authentication - client rejected due to unrecognized certificate chain", tls_client_auth_bad_certificate),
|
||||
TEST_NO_TAG("Transcoder", transcoder_tester),
|
||||
TEST_NO_TAG("Removing old tport on flexisip for the same client", test_removing_old_tport)
|
||||
TEST_NO_TAG("Removing old tport on flexisip for the same client", test_removing_old_tport),
|
||||
TEST_NO_TAG("Resend of REFER with other devices", resend_refer_other_devices)
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,15 @@ userid=laure
|
|||
passwd=secret
|
||||
realm="sip.example.org"
|
||||
|
||||
|
||||
[proxy_0]
|
||||
reg_proxy=sip.example.org;transport=tcp
|
||||
reg_route=sip.example.org;transport=tcp
|
||||
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
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ userid=marie
|
|||
passwd=secret
|
||||
realm=sip.example.org
|
||||
|
||||
|
||||
[proxy_0]
|
||||
reg_proxy=sip.example.org;transport=tcp
|
||||
reg_route=sip.example.org;transport=tcp;lr
|
||||
|
|
@ -29,6 +28,8 @@ url="Paupoche" <sip:pauline@sip.example.org>
|
|||
pol=accept
|
||||
subscribe=0
|
||||
|
||||
[misc]
|
||||
conference-factory-uri=sip:conference-factory@conf.example.org
|
||||
|
||||
[rtp]
|
||||
audio_rtp_port=18070-28000
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ userid=pauline
|
|||
passwd=secret
|
||||
realm=sip.example.org
|
||||
|
||||
|
||||
[proxy_0]
|
||||
realm=sip.example.org
|
||||
reg_proxy=sip2.linphone.org;transport=tls
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue