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); }
int AccountSettingsModel::transportIndex() const { if (!_proxyConfig) { return -1; } const char *proxy = linphone_proxy_config_get_server_addr(_proxyConfig); LinphoneAddress *addr = linphone_core_create_address(LinphoneManager::getInstance()->getLc(), proxy); LinphoneTransportType transport = linphone_address_get_transport(addr); if (transport == LinphoneTransportUdp) { return 0; } else if (transport == LinphoneTransportTcp) { return 1; } else if (transport == LinphoneTransportTls) { return 2; } return -1; }
int AddressAPI::getTransport() const { CORE_MUTEX FBLOG_DEBUG("AddressAPI::getTransport", "this=" << this); return linphone_address_get_transport(mAddress); }