static void upload_collected_traces() { LinphoneCoreManager* marie = setup(TRUE); if (transport_supported(marie->lc, LinphoneTransportTls)) { int waiting = 100; LinphoneCoreVTable *v_table = linphone_core_v_table_new(); v_table->log_collection_upload_state_changed = logCollectionUploadStateChangedCb; linphone_core_add_listener(marie->lc, v_table); linphone_core_set_log_collection_max_file_size(5000); linphone_core_set_log_collection_upload_server_url(marie->lc,"https://www.linphone.org:444/lft.php"); // Generate some logs while (--waiting) ms_error("(test error)Waiting %d...", waiting); linphone_core_compress_log_collection(marie->lc); linphone_core_upload_log_collection(marie->lc); BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,1)); /*try 2 times*/ waiting=100; linphone_core_reset_log_collection(marie->lc); while (--waiting) ms_error("(test error)Waiting %d...", waiting); linphone_core_compress_log_collection(marie->lc); linphone_core_upload_log_collection(marie->lc); BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2)); } collect_cleanup(marie); }
static void text_message_with_credential_from_auth_cb(void) { char* to; LinphoneChatRoom* chat_room; LinphoneCoreVTable* vtable = linphone_core_v_table_new(); LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); text_message_with_credential_from_auth_cb_auth_info=linphone_auth_info_clone((LinphoneAuthInfo*)(linphone_core_get_auth_info_list(marie->lc)->data)); /*to force cb to be called*/ linphone_core_clear_all_auth_info(marie->lc); vtable->auth_info_requested=text_message_with_credential_from_auth_cb_auth_info_requested; linphone_core_add_listener(marie->lc, vtable); to = linphone_address_as_string(marie->identity); chat_room = linphone_core_create_chat_room(pauline->lc,to); ms_free(to); { int dummy=0; wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/ reset_counters(&marie->stat); reset_counters(&pauline->stat); } linphone_chat_room_send_message(chat_room,"Bla bla bla bla"); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1); CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); }
static LinphoneCoreManager* create_lcm_with_auth(unsigned int with_auth) { LinphoneCoreManager* lcm=linphone_core_manager_new(NULL); if (with_auth) { LinphoneCoreVTable* vtable = linphone_core_v_table_new(); vtable->auth_info_requested=auth_info_requested; linphone_core_add_listener(lcm->lc,vtable); } /*to allow testing with 127.0.0.1*/ linphone_core_set_network_reachable(lcm->lc,TRUE); return lcm; }
LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bool_t do_registration) { LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)ms_new0(LinphoneConferenceServer, 1); LinphoneCoreManager *lm = (LinphoneCoreManager *)conf_srv; conf_srv->vtable = linphone_core_v_table_new(); conf_srv->vtable->call_state_changed = linphone_conference_server_call_state_changed; conf_srv->vtable->refer_received = linphone_conference_server_refer_received; conf_srv->vtable->registration_state_changed = linphone_conference_server_registration_state_changed; conf_srv->vtable->user_data = conf_srv; conf_srv->reg_state = LinphoneRegistrationNone; linphone_core_manager_init(lm, rc_file); linphone_core_add_listener(lm->lc, conf_srv->vtable); linphone_core_manager_start(lm, do_registration); return conf_srv; }
static LinphoneCallParams * _configure_for_video(LinphoneCoreManager *manager, LinphoneCoreCallStateChangedCb cb) { LinphoneCallParams *params; LinphoneCoreVTable *vtable = linphone_core_v_table_new(); vtable->call_state_changed = cb; linphone_core_add_listener(manager->lc, vtable); linphone_core_set_video_device(manager->lc, "StaticImage: Static picture"); linphone_core_enable_video_capture(manager->lc, TRUE); linphone_core_enable_video_display(manager->lc, TRUE); params = linphone_core_create_default_call_parameters(manager->lc); linphone_call_params_enable_video(params, TRUE); if (linphone_core_find_payload_type(manager->lc,"VP8", 90000, -1)!=NULL){ disable_all_video_codecs_except_one(manager->lc, "VP8"); }else{ ms_warning("VP8 codec not available, will use MP4V-ES instead"); disable_all_video_codecs_except_one(manager->lc, "MP4V-ES"); } return params; }
static void authenticated_register_with_no_initial_credentials(){ LinphoneCoreManager *mgr; LinphoneCoreVTable* vtable = linphone_core_v_table_new(); stats* counters; char route[256]; sprintf(route,"sip:%s",test_route); mgr = linphone_core_manager_new(NULL); vtable->auth_info_requested=auth_info_requested; linphone_core_add_listener(mgr->lc,vtable); counters= get_stats(mgr->lc); counters->number_of_auth_info_requested=0; register_with_refresh(mgr,FALSE,auth_domain,route); CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1); linphone_core_manager_destroy(mgr); }