diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index cca84fd23..ad7b151ab 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2346,29 +2346,42 @@ LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpCon return core; } -LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, struct _LpConfig *config, void *userdata) { +static LinphoneCore *_linphone_core_new_with_config_and_start ( + const LinphoneCoreVTable *vtable, + LinphoneConfig *config, + void *userdata, + bool_t automatically_start +) { LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get()); LinphoneCoreVTable *local_vtable = linphone_core_v_table_new(); LinphoneCore *core = NULL; if (vtable != NULL) *local_vtable = *vtable; _linphone_core_cbs_set_v_table(cbs, local_vtable, TRUE); - core = _linphone_core_new_with_config(cbs, config, userdata, NULL, TRUE); + core = _linphone_core_new_with_config(cbs, config, userdata, NULL, automatically_start); linphone_core_cbs_unref(cbs); return core; } -static LinphoneCore *_linphone_core_new(const LinphoneCoreVTable *vtable, - const char *config_path, const char *factory_config_path, void * userdata) { - LinphoneCore *lc; - LpConfig *config = lp_config_new_with_factory(config_path, factory_config_path); - lc=linphone_core_new_with_config(vtable, config, userdata); - lp_config_unref(config); +LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, struct _LpConfig *config, void *userdata) { + return _linphone_core_new_with_config_and_start(vtable, config, userdata, TRUE); +} + +LinphoneCore *_linphone_core_new ( + const LinphoneCoreVTable *vtable, + const char *config_path, + const char *factory_config_path, + void * userdata, + bool_t automatically_start +) { + LinphoneConfig *config = lp_config_new_with_factory(config_path, factory_config_path); + LinphoneCore *lc = _linphone_core_new_with_config_and_start(vtable, config, userdata, automatically_start); + linphone_config_unref(config); return lc; } LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config_path, void * userdata) { - return _linphone_core_new(vtable, config_path, factory_config_path, userdata); + return _linphone_core_new(vtable, config_path, factory_config_path, userdata, TRUE); } LinphoneCore *linphone_core_ref(LinphoneCore *lc) { diff --git a/coreapi/tester_utils.h b/coreapi/tester_utils.h index f6d836b5f..4fd79a951 100644 --- a/coreapi/tester_utils.h +++ b/coreapi/tester_utils.h @@ -45,6 +45,7 @@ typedef enum _LinphoneProxyConfigAddressComparisonResult{ extern "C" { #endif +LINPHONE_PUBLIC LinphoneCore *_linphone_core_new (const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config_path, void * userdata, bool_t automatically_start); LINPHONE_PUBLIC LinphoneVcardContext *linphone_core_get_vcard_context(const LinphoneCore *lc); LINPHONE_PUBLIC bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_get_local_ip(LinphoneCore *lc, int af, const char *dest, char *result); diff --git a/tester/tester.c b/tester/tester.c index 04e0456bb..f325acc93 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -155,13 +155,13 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c dnsuserhostspath = userhostsfile[0]=='/' ? ms_strdup(userhostsfile) : ms_strdup_printf("%s/%s", path, userhostsfile); - if( config != NULL ) { + if (config) { lp_config_set_string(config, "sound", "remote_ring", ringbackpath); lp_config_set_string(config, "sound", "local_ring" , ringpath); lp_config_set_string(config, "sip", "root_ca" , rootcapath); - lc = linphone_core_new_with_config(v_table, config, user_data); + lc = linphone_factory_create_core_with_config_3(linphone_factory_get(), config, NULL); } else { - lc = linphone_core_new(v_table,NULL,(filepath!=NULL&&filepath[0]!='\0') ? filepath : NULL, user_data); + lc = _linphone_core_new(v_table,NULL,(filepath!=NULL&&filepath[0]!='\0') ? filepath : NULL, user_data, FALSE); linphone_core_set_ring(lc, ringpath); linphone_core_set_ringback(lc, ringbackpath); @@ -391,6 +391,8 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, bool_t check_for_prox LinphoneProxyConfig* proxy; int proxy_count; + linphone_core_start(mgr->lc); + /*BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count, int, "%d");*/ if (check_for_proxies){ /**/ proxy_count=(int)bctbx_list_size(linphone_core_get_proxy_config_list(mgr->lc));