diff --git a/coreapi/bellesip_sal/sal_op_impl.c b/coreapi/bellesip_sal/sal_op_impl.c index b05517fad..a9c99b5cd 100644 --- a/coreapi/bellesip_sal/sal_op_impl.c +++ b/coreapi/bellesip_sal/sal_op_impl.c @@ -130,32 +130,36 @@ void sal_op_resend_request(SalOp* op, belle_sip_request_t* request) { static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* request,bool_t add_contact) { belle_sip_client_transaction_t* client_transaction; belle_sip_provider_t* prov=op->base.root->prov; - belle_sip_header_route_t* route_header; belle_sip_uri_t* outbound_proxy=NULL; belle_sip_header_contact_t* contact; - MSList* iterator; + if (!op->dialog || belle_sip_dialog_get_state(op->dialog) == BELLE_SIP_DIALOG_NULL) { /*don't put route header if dialog is in confirmed state*/ - for(iterator=(MSList*)sal_op_get_route_addresses(op);iterator!=NULL;iterator=iterator->next) { - if(!outbound_proxy) { - /*first toute is outbound proxy*/ - outbound_proxy=belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(iterator->data)); - } else { - /*next are Route headers*/ - route_header = belle_sip_header_route_create(BELLE_SIP_HEADER_ADDRESS(iterator->data)); - belle_sip_message_add_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_HEADER(route_header)); - } + const MSList *elem=sal_op_get_route_addresses(op); + belle_sip_uri_t *next_hop_uri; + const char *transport; + if (elem) { + outbound_proxy=belle_sip_header_address_get_uri((belle_sip_header_address_t*)elem->data); + next_hop_uri=outbound_proxy; + }else{ + next_hop_uri=belle_sip_request_get_uri(request); } - if (!sal_op_get_route_addresses(op) && belle_sip_list_size(belle_sip_provider_get_listening_points(op->base.root->prov))==1) { - /*compatibility mode*/ - belle_sip_listening_point_t* lp = (belle_sip_listening_point_t*)belle_sip_provider_get_listening_points(op->base.root->prov)->data; - belle_sip_uri_t* to_uri=belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(belle_sip_message_get_header_by_type(request,belle_sip_header_to_t))); - belle_sip_header_address_t* route=belle_sip_header_address_create(NULL,belle_sip_uri_create(NULL,belle_sip_uri_get_host(to_uri))); - belle_sip_uri_set_transport_param(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(route)),belle_sip_listening_point_get_transport(lp)); - route_header = belle_sip_header_route_create(route); - belle_sip_object_unref(route); - belle_sip_message_add_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_HEADER(route_header)); - ms_message("Only one lp & no route, forcing transport to lp transport [%s]",belle_sip_listening_point_get_transport(lp)); + transport=belle_sip_uri_get_transport_param(next_hop_uri); + if (transport==NULL){ + /*compatibility mode: by default it should be udp as not explicitely set and if no udp listening point is available, then use + * the first available transport*/ + if (belle_sip_provider_get_listening_point(prov,"UDP")==0){ + if (belle_sip_provider_get_listening_point(prov,"TCP")!=NULL){ + transport="tcp"; + }else if (belle_sip_provider_get_listening_point(prov,"TLS")!=NULL){ + transport="tls"; + } + } + if (transport){ + belle_sip_message("Transport is not specified, using %s because UDP is not available.",transport); + belle_sip_uri_set_transport_param(next_hop_uri,transport); + } + belle_sip_uri_fix(next_hop_uri); } } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 5e0412316..9d9e69059 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2585,10 +2585,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const sal_address_set_transport((SalAddress*)route,sal_transport_parse(linphone_proxy_config_guess_transport(chosen_proxy))); } } - - sal_op_add_route_address(call->op,route); - } if(linphone_core_add_call(lc,call)!= 0) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 76f40eb99..7104174cc 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -377,12 +377,13 @@ const char* linphone_proxy_config_guess_transport(const LinphoneProxyConfig *obj } static void linphone_proxy_config_register(LinphoneProxyConfig *obj){ if (obj->reg_sendregister){ - LinphoneAddress* proxy=linphone_address_new(obj->reg_proxy); - char* proxy_string; + LinphoneAddress* proxy=linphone_address_new(obj->reg_proxy); + char* proxy_string; #ifndef USE_BELLESIP char *contact; #else LinphoneAddress *contact; + if (linphone_proxy_config_guess_transport(obj) && !sal_address_get_transport((SalAddress*)proxy)) { sal_address_set_transport((SalAddress*)proxy,sal_transport_parse(linphone_proxy_config_guess_transport(obj))); } @@ -397,7 +398,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){ #ifndef USE_BELLESIP ms_free(contact); #else - linphone_address_destroy(contact); + linphone_address_destroy(contact); #endif } sal_op_set_user_pointer(obj->op,obj); diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index efe8f9a5e..4513fbf81 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -90,6 +90,8 @@ LinphoneCore* create_lc_with_auth(unsigned int with_auth) { } lc = linphone_core_new(&v_table,NULL,NULL,NULL); linphone_core_set_user_data(lc,&global_stat); + /* until we have good certificates on our test server... */ + linphone_core_verify_server_certificates(lc,FALSE); return lc; } @@ -109,6 +111,9 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c linphone_core_set_user_data(lc,&global_stat); counters = (stats*)linphone_core_get_user_data(lc); + /* until we have good certificates on our test server... */ + linphone_core_verify_server_certificates(lc,FALSE); + sprintf(ringpath, "%s/%s", path, "oldphone.wav"); sprintf(ringbackpath, "%s/%s", path, "ringback.wav"); linphone_core_set_ring(lc, ringpath); @@ -118,8 +123,8 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c CU_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count); while (counters->number_of_LinphoneRegistrationOknumber_of_LinphoneRegistrationOk,proxy_count); return lc; diff --git a/tester/setup_tester.c b/tester/setup_tester.c index 4fee989e9..f567ca2e2 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -29,6 +29,8 @@ static void core_init_test(void) { LinphoneCore* lc; memset (&v_table,0,sizeof(v_table)); lc = linphone_core_new(&v_table,NULL,NULL,NULL); + /* until we have good certificates on our test server... */ + linphone_core_verify_server_certificates(lc,FALSE); CU_ASSERT_PTR_NOT_NULL_FATAL(lc); linphone_core_destroy(lc); }