static void simple_auth_register_with_refresh() { LinphoneCoreManager* lcm = create_lcm_with_auth(1); stats* counters = &lcm->stat; char route[256]; sprintf(route,"sip:%s",test_route); register_with_refresh(lcm,TRUE,auth_domain,route); CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1); linphone_core_manager_destroy(lcm); }
static void register_with_refresh_with_send_error() { int retry=0; LinphoneCoreManager* lcm = create_lcm_with_auth(1); stats* counters = &lcm->stat; LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain); /*create authentication structure from identity*/ char route[256]; sprintf(route,"sip:%s",test_route); linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/ register_with_refresh_base(lcm->lc,TRUE,auth_domain,route); /*simultate a network error*/ sal_set_send_error(lcm->lc->sal, -1); while (counters->number_of_LinphoneRegistrationProgress<2 && retry++ <20) { linphone_core_iterate(lcm->lc); ms_usleep(100000); } CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0); CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2); CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0); linphone_core_manager_destroy(lcm); }
static LinphoneCoreManager* create_lcm() { return create_lcm_with_auth(0); }