static void linphone_interpret_url_test(void) { LinphoneCoreVTable v_table; LinphoneCore* lc; const char* sips_address = "sips:[email protected]"; LinphoneAddress* address; LinphoneProxyConfig *proxy_config; char *tmp; memset ( &v_table,0,sizeof ( v_table ) ); lc = linphone_core_new ( &v_table,NULL,NULL,NULL ); BC_ASSERT_PTR_NOT_NULL_FATAL ( lc ); proxy_config =linphone_core_create_proxy_config(lc); linphone_proxy_config_set_identity(proxy_config, "sip:[email protected]"); linphone_proxy_config_enable_register(proxy_config, FALSE); linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org"); linphone_core_add_proxy_config(lc, proxy_config); linphone_core_set_default_proxy_config(lc,proxy_config); linphone_proxy_config_unref(proxy_config); address = linphone_core_interpret_url(lc, sips_address); BC_ASSERT_PTR_NOT_NULL_FATAL(address); BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips"); BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux"); BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org"); linphone_address_destroy(address); address = linphone_core_interpret_url(lc,"23"); BC_ASSERT_PTR_NOT_NULL(address); BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "23"); BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); linphone_address_destroy(address); address = linphone_core_interpret_url(lc,"#24"); BC_ASSERT_PTR_NOT_NULL(address); BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24"); BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); tmp = linphone_address_as_string(address); BC_ASSERT_TRUE(strcmp (tmp,"sip:%[email protected]") == 0); linphone_address_destroy(address); address = linphone_core_interpret_url(lc,tmp); BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24"); BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); linphone_address_destroy(address); ms_free(tmp); linphone_core_destroy (lc); }
static void linphone_interpret_url_test() { LinphoneCoreVTable v_table; LinphoneCore* lc; const char* sips_address = "sips:[email protected]"; LinphoneAddress* address; memset ( &v_table,0,sizeof ( v_table ) ); lc = linphone_core_new ( &v_table,NULL,NULL,NULL ); BC_ASSERT_PTR_NOT_NULL_FATAL ( lc ); address = linphone_core_interpret_url(lc, sips_address); BC_ASSERT_PTR_NOT_NULL_FATAL(address); BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips"); BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux"); BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org"); linphone_address_destroy(address); linphone_core_destroy ( lc ); }
StringPtr AddressAPI::getScheme() const { CORE_MUTEX FBLOG_DEBUG("AddressAPI::getScheme", "this=" << this); return CHARPTR_TO_STRING(linphone_address_get_scheme(mAddress)); }