Commit cfe2a94f authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI
Browse files

Fix sips handling in interpret_url.

Added a unit test for it.
parent a8d304fd
...@@ -2279,8 +2279,8 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url) ...@@ -2279,8 +2279,8 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
enum_lookup_res_free(enumres); enum_lookup_res_free(enumres);
return uri; return uri;
} }
/* check if we have a "sip:" */ /* check if we have a "sip:" or a "sips:" */
if (strstr(url,"sip:")==NULL){ if ( (strstr(url,"sip:")==NULL) && (strstr(url,"sips:")==NULL) ){
/* this doesn't look like a true sip uri */ /* this doesn't look like a true sip uri */
if (strchr(url,'@')!=NULL){ if (strchr(url,'@')!=NULL){
/* seems like sip: is missing !*/ /* seems like sip: is missing !*/
......
...@@ -68,11 +68,35 @@ static void core_sip_transport_test(void) { ...@@ -68,11 +68,35 @@ static void core_sip_transport_test(void) {
linphone_core_destroy(lc); linphone_core_destroy(lc);
} }
static void linphone_interpret_url_test()
{
LinphoneCoreVTable v_table;
LinphoneCore* lc;
const char* sips_address = "sips:margaux@sip.linphone.org";
LinphoneAddress* address;
memset ( &v_table,0,sizeof ( v_table ) );
lc = linphone_core_new ( &v_table,NULL,NULL,NULL );
CU_ASSERT_PTR_NOT_NULL_FATAL ( lc );
address = linphone_core_interpret_url(lc, sips_address);
CU_ASSERT_PTR_NOT_NULL_FATAL(address);
CU_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips");
CU_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux");
CU_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org");
linphone_address_destroy(address);
linphone_core_destroy ( lc );
}
test_t setup_tests[] = { test_t setup_tests[] = {
{ "Linphone Address", linphone_address_test }, { "Linphone Address", linphone_address_test },
{ "Linphone core init/uninit", core_init_test }, { "Linphone core init/uninit", core_init_test },
{ "Linphone random transport port",core_sip_transport_test} { "Linphone random transport port",core_sip_transport_test},
{ "Linphone interpret url", linphone_interpret_url_test }
}; };
test_suite_t setup_test_suite = { test_suite_t setup_test_suite = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment