mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Fix sips handling in interpret_url.
Added a unit test for it.
This commit is contained in:
parent
a8d304fd8f
commit
cfe2a94f6c
2 changed files with 27 additions and 3 deletions
|
|
@ -2279,8 +2279,8 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
|
|||
enum_lookup_res_free(enumres);
|
||||
return uri;
|
||||
}
|
||||
/* check if we have a "sip:" */
|
||||
if (strstr(url,"sip:")==NULL){
|
||||
/* check if we have a "sip:" or a "sips:" */
|
||||
if ( (strstr(url,"sip:")==NULL) && (strstr(url,"sips:")==NULL) ){
|
||||
/* this doesn't look like a true sip uri */
|
||||
if (strchr(url,'@')!=NULL){
|
||||
/* seems like sip: is missing !*/
|
||||
|
|
|
|||
|
|
@ -68,11 +68,35 @@ static void core_sip_transport_test(void) {
|
|||
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[] = {
|
||||
{ "Linphone Address", linphone_address_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 = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue