static void proxy_transport_change(){ LinphoneCoreManager* lcm = create_lcm(); stats* counters = &lcm->stat; LinphoneProxyConfig* proxy_config; LinphoneAddress* addr; char* addr_as_string; LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/ linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/ register_with_refresh_base(lcm->lc,FALSE,auth_domain,NULL); linphone_core_get_default_proxy(lcm->lc,&proxy_config); reset_counters(counters); /*clear stats*/ linphone_proxy_config_edit(proxy_config); CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); addr = linphone_address_new(linphone_proxy_config_get_addr(proxy_config)); if (LinphoneTransportTcp == linphone_address_get_transport(addr)) { linphone_address_set_transport(addr,LinphoneTransportUdp); } else { linphone_address_set_transport(addr,LinphoneTransportTcp); } linphone_proxy_config_set_server_addr(proxy_config,addr_as_string=linphone_address_as_string(addr)); linphone_proxy_config_done(proxy_config); CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1)); /*as we change p[roxy server destination, we should'nt be notified about the clear*/ CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0); ms_free(addr_as_string); linphone_address_destroy(addr); linphone_core_manager_destroy(lcm); }
/*take care of min expires configuration from server*/ static void simple_register_with_refresh() { LinphoneCoreManager* lcm = create_lcm(); stats* counters = &lcm->stat; register_with_refresh(lcm,TRUE,NULL,NULL); CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0); linphone_core_manager_destroy(lcm); }
static void change_expires(){ LinphoneCoreManager* lcm = create_lcm(); stats* counters = &lcm->stat; LinphoneProxyConfig* proxy_config; register_with_refresh_base(lcm->lc,FALSE,NULL,NULL); linphone_core_get_default_proxy(lcm->lc,&proxy_config); linphone_proxy_config_edit(proxy_config); reset_counters(counters); /*clear stats*/ /*nothing is supposed to arrive until done*/ CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); linphone_proxy_config_set_expires(proxy_config,3); linphone_proxy_config_done(proxy_config); CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1)); /*wait 2s without receive refresh*/ CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2,2000)); /* now, it should be ok*/ CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2)); linphone_core_manager_destroy(lcm); }
static void simple_tls_register(){ char route[256]; LinphoneCoreManager* lcm; sprintf(route,"sip:%s;transport=tls",test_route); lcm = create_lcm(); register_with_refresh(lcm,FALSE,test_domain,route); linphone_core_manager_destroy(lcm); }
static void simple_tcp_register_compatibility_mode(){ char route[256]; LinphoneCoreManager* lcm; LCSipTransports transport = {0,5070,0,0}; sprintf(route,"sip:%s",test_route); lcm = create_lcm(); register_with_refresh_base_2(lcm->lc,FALSE,test_domain,route,FALSE,transport); linphone_core_manager_destroy(lcm); }
static void redirect(){ char route[256]; LinphoneCoreManager* lcm; LCSipTransports transport = {-1,0,0,0}; sprintf(route,"sip:%s:5064",test_route); lcm = create_lcm(); linphone_core_set_user_agent(lcm->lc,"redirect",NULL); register_with_refresh_base_2(lcm->lc,FALSE,test_domain,route,FALSE,transport); linphone_core_manager_destroy(lcm); }
static void simple_authenticated_register(){ stats* counters; LinphoneCoreManager* lcm = create_lcm(); 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*/ counters = &lcm->stat; register_with_refresh(lcm,FALSE,auth_domain,route); CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0); }
static void simple_unregister(){ LinphoneCoreManager* lcm = create_lcm(); stats* counters = &lcm->stat; LinphoneProxyConfig* proxy_config; register_with_refresh_base(lcm->lc,FALSE,NULL,NULL); linphone_core_get_default_proxy(lcm->lc,&proxy_config); linphone_proxy_config_edit(proxy_config); reset_counters(counters); /*clear stats*/ /*nothing is supposed to arrive until done*/ CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000)); linphone_proxy_config_enable_register(proxy_config,FALSE); linphone_proxy_config_done(proxy_config); CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1)); linphone_core_manager_destroy(lcm); }