static void proxy_transport_change_with_wrong_port_givin_up() { LinphoneCoreManager* lcm = create_lcm(); stats* counters = &lcm->stat; LinphoneProxyConfig* proxy_config; LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/ char route[256]; LCSipTransports transport= {LC_SIP_TRANSPORT_RANDOM,LC_SIP_TRANSPORT_RANDOM,LC_SIP_TRANSPORT_RANDOM,LC_SIP_TRANSPORT_RANDOM}; sprintf(route,"sip:%s",test_route); linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/ register_with_refresh_base_3(lcm->lc, FALSE, auth_domain, "sip2.linphone.org:5987", 0,transport,LinphoneRegistrationProgress); linphone_core_get_default_proxy(lcm->lc,&proxy_config); linphone_proxy_config_edit(proxy_config); CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); linphone_proxy_config_enableregister(proxy_config,FALSE); linphone_proxy_config_done(proxy_config); CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1)); CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,0); CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1); CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0); linphone_core_manager_destroy(lcm); }
LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config, int index) { const char *tmp; const char *identity; const char *proxy; LinphoneProxyConfig *cfg; char key[50]; sprintf(key,"proxy_%i",index); if (!lp_config_has_section(config,key)){ return NULL; } cfg=linphone_proxy_config_new(); identity=lp_config_get_string(config,key,"reg_identity",NULL); proxy=lp_config_get_string(config,key,"reg_proxy",NULL); linphone_proxy_config_set_identity(cfg,identity); linphone_proxy_config_set_server_addr(cfg,proxy); tmp=lp_config_get_string(config,key,"reg_route",NULL); if (tmp!=NULL) linphone_proxy_config_set_route(cfg,tmp); linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",600)); linphone_proxy_config_enableregister(cfg,lp_config_get_int(config,key,"reg_sendregister",0)); linphone_proxy_config_enable_publish(cfg,lp_config_get_int(config,key,"publish",0)); linphone_proxy_config_set_dial_escape_plus(cfg,lp_config_get_int(config,key,"dial_escape_plus",0)); linphone_proxy_config_set_dial_prefix(cfg,lp_config_get_string(config,key,"dial_prefix",NULL)); tmp=lp_config_get_string(config,key,"type",NULL); if (tmp!=NULL && strlen(tmp)>0) linphone_proxy_config_set_sip_setup(cfg,tmp); return cfg; }
static void io_recv_error_without_active_register(){ LinphoneCoreManager *mgr; LinphoneCore* lc; int register_ok; stats* counters ; int number_of_udp_proxy=0; MSList* proxys; mgr=configure_lcm(); lc=mgr->lc; counters = get_stats(lc); register_ok=counters->number_of_LinphoneRegistrationOk; number_of_udp_proxy=get_number_of_udp_proxy(lc); for (proxys=ms_list_copy(linphone_core_get_proxy_config_list(lc));proxys!=NULL;proxys=proxys->next) { LinphoneProxyConfig* proxy_cfg=(LinphoneProxyConfig*)proxys->data; linphone_proxy_config_edit(proxy_cfg); linphone_proxy_config_enableregister(proxy_cfg,FALSE); linphone_proxy_config_done(proxy_cfg); } ms_list_free(proxys); /*wait for unregistrations*/ CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationCleared,register_ok /*because 1 udp*/)); sal_set_recv_error(lc->sal, 0); /*nothing should happen because no active registration*/ CU_ASSERT_FALSE(wait_for_until(lc,lc,&counters->number_of_LinphoneRegistrationProgress,2*(register_ok-number_of_udp_proxy) /*because 1 udp*/,3000)); CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0) sal_set_recv_error(lc->sal, 1); /*reset*/ linphone_core_manager_destroy(mgr); }